From 2e22522b1514078651c4184c5e3dda44de1e900e Mon Sep 17 00:00:00 2001 From: Hugo Masclet Date: Thu, 14 Dec 2023 13:23:12 +0100 Subject: [PATCH] docs: update README and examples and docs for VerifiableURI --- README.md | 2 +- docs/classes/ERC725.md | 31 +++++++++++++++---------------- docs/getting-started.md | 2 +- examples/src/decodeData.js | 27 --------------------------- 4 files changed, 17 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index c2e46c10..790dd393 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ const schema = [ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', keyType: 'Singleton', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', valueType: 'bytes', }, { diff --git a/docs/classes/ERC725.md b/docs/classes/ERC725.md index 8bce7c8e..a5ecd2ae 100644 --- a/docs/classes/ERC725.md +++ b/docs/classes/ERC725.md @@ -238,7 +238,7 @@ const schemas = [ key: '0x...', keyType: 'Singleton', valueType: 'bytes', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', }, ]; @@ -251,7 +251,7 @@ myErc725.decodeData( 'true', ], value: - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361696670733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361696670733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', }, ], schemas, @@ -469,9 +469,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 + Encode a VerifiableURI with JSON and uploaded URL -```javascript title="Encode a JSONURL with JSON and uploaded URL" +```javascript title="Encode a VerifiableURI with JSON and uploaded URL" myErc725.encodeData([ { keyName: 'LSP3Profile', @@ -541,9 +541,9 @@ myErc725.encodeData([
- Encode a JSONURL with hash function, hash and uploaded URL + Encode a VerifiableURI with hash function, hash and uploaded URL -```javascript title="Encode a JSONURL with hash function, hash and uploaded URL" +```javascript title="Encode a VerifiableURI with hash function, hash and uploaded URL" myErc725.encodeData([ { keyName: 'LSP3Profile', @@ -1005,7 +1005,7 @@ myErc725.decodeMappingKey( myErc725.fetchData([keys]); ``` -The `fetchData` function fetches smart contract data and can additionally return [`JSONURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl) or [`ASSETURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#asseturl) data from IPFS, HTTP, or HTTPS endpoints. +The `fetchData` function fetches smart contract data and can additionally return [`VerifiableURI`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md#verifiableuri) data from IPFS, HTTP, or HTTPS endpoints. :::info @@ -1032,9 +1032,9 @@ The name(s) (or the encoded name(s) as schema key) of the element(s) in the smar #### Returns -| Name | Type | Description | -| :--- | :------------------------------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| data | `Promise` or
`Promise` | An array with same objects as for [`decodeData()`](./ERC725#decodedata) function but with the value being remplaced by the actual file for `JSONURL` and `ASSETURL` valueContent. If there is a hash mismatch, the value will be `null`. | +| Name | Type | Description | +| :--- | :------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| data | `Promise` or
`Promise` | An array with same objects as for [`decodeData()`](./ERC725#decodedata) function but with the value being remplaced by the actual file for `VerifiableURI` valueContent. If there is a hash mismatch, the value will be `null`. | :::info @@ -1162,8 +1162,7 @@ When omitting the `keys` parameter, it will give back every key (as per `ERC725J :::caution -- Data returned by this function does not contain external data of [`JSONURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl) - or [`ASSETURL`](https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#asseturl) schema elements. +- Data returned by this function does not contain external data of [`VerifiableURI`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md#verifiableuri) schema elements. - If you would like to receive everything in one go, you can use [`fetchData`](ERC725.md#fetchdata). ::: @@ -1455,7 +1454,7 @@ myErc725.getSchema( name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', keyType: 'Singleton', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', valueType: 'bytes' } */ @@ -1469,7 +1468,7 @@ myErc725.getSchema([ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', keyType: 'Singleton', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', valueType: 'bytes' }, '0x3a47ab5bd3a594c3a8995f8fa58d087600000000000000000000000000000001': { @@ -1493,7 +1492,7 @@ myErc725.getSchema( name: 'ParameterSchema', key: '0x777f55baf2e0c9f73d3bb456dfb8dbf6e609bf557969e3184c17ff925b3c402c', keyType: 'Singleton', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', valueType: 'bytes', }, ], @@ -1503,7 +1502,7 @@ myErc725.getSchema( name: 'ParameterSchema', key: '0x777f55baf2e0c9f73d3bb456dfb8dbf6e609bf557969e3184c17ff925b3c402c', keyType: 'Singleton', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', valueType: 'bytes', } */ diff --git a/docs/getting-started.md b/docs/getting-started.md index 1cb54779..896338bd 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -45,7 +45,7 @@ const schemas = [ key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', keyType: 'Singleton', valueType: 'bytes', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', }, { name: 'LSP1UniversalReceiverDelegate', diff --git a/examples/src/decodeData.js b/examples/src/decodeData.js index fe7db8b8..06ec1800 100644 --- a/examples/src/decodeData.js +++ b/examples/src/decodeData.js @@ -27,29 +27,6 @@ const decodedDataOneKey = myERC725.decodeData([ ] */ -const decodedDataOneKeyOld = myERC725.decodeData([ - { - keyName: 'LSP3Profile', - value: - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', - }, -]); -/** -[ - { - name: 'LSP3Profile', - key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', - value: { - verification: { - method: 'keccak256(utf8)', - data: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', - }, - url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx' - } - } -] -*/ - const decodedDataManyKeys = myERC725.decodeData([ { keyName: 'LSP3Profile', @@ -103,10 +80,6 @@ console.log('/* decodeData - one key (VerifiableURI) /*'); console.log('/*--------------------------------------------/*'); console.log(decodedDataOneKey); console.log('/*--------------------------------------------/*'); -console.log('/* decodeData - one key (JSONURL) /*'); -console.log('/*--------------------------------------------/*'); -console.log(decodedDataOneKeyOld); -console.log('/*--------------------------------------------/*'); console.log('/* decodeData - many keys /*'); console.log('/*--------------------------------------------/*'); console.log(decodedDataManyKeys);