From 7f14ffd0566a61c701df8086d53639396ac7c530 Mon Sep 17 00:00:00 2001 From: CJ42 Date: Mon, 31 Jul 2023 16:36:54 +0100 Subject: [PATCH 1/2] docs: show examples in details toggle for readability --- docs/classes/ERC725.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/classes/ERC725.md b/docs/classes/ERC725.md index 06ca8d4d..d679fbc0 100644 --- a/docs/classes/ERC725.md +++ b/docs/classes/ERC725.md @@ -322,6 +322,9 @@ After the `data` is encoded, the object is ready to be stored in smart contracts #### Examples +
+ Encode a JSONURL with JSON and uploaded URL + ```javascript title="Encode a JSONURL with JSON and uploaded URL" myErc725.encodeData([ { @@ -389,6 +392,11 @@ myErc725.encodeData([ */ ``` +
+ +
+ Encode a JSONURL with hash function, hash and uploaded URL + ```javascript title="Encode a JSONURL with hash function, hash and uploaded URL" myErc725.encodeData([ { @@ -408,6 +416,11 @@ myErc725.encodeData([ */ ``` +
+ +
+ Encode dynamic keys + ```javascript title="Encode dynamic keys" const schemas = [ { @@ -464,6 +477,11 @@ myErc725.encodeData( */ ``` +
+ +
+ Encode multiple keys at once + ```javascript title="Encode multiple keys at once" myErc725.encodeData([ { @@ -506,6 +524,8 @@ myErc725.encodeData([ */ ``` +
+ --- ## encodeKeyName From 93a0addbb2e090ec606c719674df951f2441f11b Mon Sep 17 00:00:00 2001 From: CJ42 Date: Mon, 31 Jul 2023 16:47:48 +0100 Subject: [PATCH 2/2] docs: improve subheadings to display on sidebar --- docs/classes/ERC725.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/classes/ERC725.md b/docs/classes/ERC725.md index d679fbc0..ac065183 100644 --- a/docs/classes/ERC725.md +++ b/docs/classes/ERC725.md @@ -53,7 +53,7 @@ An array of extra [LSP-2 ERC725YJSONSchema] objects that can be used to find the ::: -#### Single-Key Example +### Single-Key Example ```javascript title="Decoding an object with one key" myErc725.decodeData([ @@ -95,7 +95,7 @@ myErc725.decodeData({ */ ``` -#### Multi-Key Example +### Multi-Key Example ```javascript title="Decoding an object with multiple keys" myErc725.decodeData([ @@ -146,7 +146,7 @@ myErc725.decodeData([ */ ``` -#### Dynamic-Key Example +### Dynamic-Key Example ```javascript title="Decoding an object with dynamic key and a custom schema" const schemas = [ @@ -799,7 +799,7 @@ The name(s) (or the encoded name(s) as schema key) of the element(s) in the smar ::: -#### All-Keys Example +### All-Keys Example ```javascript title="Receiving all keys from the schema" await myErc725.fetchData(); @@ -840,7 +840,7 @@ await myErc725.fetchData(); */ ``` -#### Single-Key Example +### Single-Key Example ```javascript title="Receiving one key from the schema" await myErc725.fetchData('LSP3Profile'); @@ -863,7 +863,7 @@ await myErc725.fetchData(['LSP1UniversalReceiverDelegate']); */ ``` -#### Multi-Keys / Dynamic-Keys Example +### Multi-Keys / Dynamic-Keys Example ```javascript title="Receiving multiple keys from the schema" await myErc725.fetchData(['LSP3Profile', 'LSP1UniversalReceiverDelegate']); @@ -948,7 +948,7 @@ The name(s) (or the encoded name(s) as schema key) of the element(s) in the smar ::: -#### All-Keys Example +### All-Keys Example ```javascript title="Receiving all keys from the schema" await myErc725.getData(); @@ -993,7 +993,7 @@ await myErc725.getData(); */ ``` -#### Single-Key Example +### Single-Key Example ```javascript title="Receiving one key from the schema" await myErc725.getData('LSP3Profile'); @@ -1034,7 +1034,7 @@ await myErc725.getData('LSP1UniversalReceiverDelegate'); */ ``` -#### Multi-Key Example +### Multi-Key Example ```javascript title="Receiving multiple keys from the schema" await myErc725.getData(['LSP3Profile', 'LSP1UniversalReceiverDelegate']); @@ -1058,7 +1058,7 @@ await myErc725.getData(['LSP3Profile', 'LSP1UniversalReceiverDelegate']); */ ``` -#### Dynamic-Key Example +### Dynamic-Key Example ```javascript title="Receiving dynamic keys from the schema" await myErc725.getData({ @@ -1190,7 +1190,7 @@ An array of extra [LSP-2 ERC725YJSONSchema] objects that can be used to find the | `result` | Record string | If the parameter `keys` is a string[ ] and the schema was found. | | `result` | null | If the schema was not found. | -#### Example using a predefined LSP3 schema +### Example using a predefined LSP3 schema ```javascript title="Parsing the hashed key from the LSP3 schema" myErc725.getSchema( @@ -1229,7 +1229,7 @@ myErc725.getSchema([ */ ``` -#### Example using a custom schema +### Example using a custom schema ```javascript title="Parsing the hashed key from a custom schema" myErc725.getSchema(