diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d380e1..1e7fc7a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,122 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [0.21.3](https://github.com/ERC725Alliance/erc725.js/compare/v0.21.2...v0.21.3) (2023-11-29) + + +### Features + +* add `encode/decodeValueType` as public callable methods ([#325](https://github.com/ERC725Alliance/erc725.js/issues/325)) ([a6fe7c8](https://github.com/ERC725Alliance/erc725.js/commit/a6fe7c8470688f573426b59fc2023a08da0cbd36)) +* add more schemas available to parse via `getSchema` ([#351](https://github.com/ERC725Alliance/erc725.js/issues/351)) ([b882379](https://github.com/ERC725Alliance/erc725.js/commit/b8823796c5f99d89d56954c894dfb6964adc552a)) +* add support for multi types in mappings ([#357](https://github.com/ERC725Alliance/erc725.js/issues/357)) ([ba92903](https://github.com/ERC725Alliance/erc725.js/commit/ba9290326efad0aab3855ad3f0ed2722180980ed)) +* add support to encode / decode any `uint8` to `uint256` types ([#355](https://github.com/ERC725Alliance/erc725.js/issues/355)) ([417a4e8](https://github.com/ERC725Alliance/erc725.js/commit/417a4e8ff2c74f3f9e35d0018a4973c97c6ac997)) +* allow to encode LSP2 Array length only ([#326](https://github.com/ERC725Alliance/erc725.js/issues/326)) ([3a6be55](https://github.com/ERC725Alliance/erc725.js/commit/3a6be551d889904b7d95e2630ab637f2a31feb50)) + + +### Bug Fixes + +* update lsp6 schema ([75c4044](https://github.com/ERC725Alliance/erc725.js/commit/75c40444e407d93076cc1e49ad706cc0055f383b)) + +## [0.21.2](https://github.com/ERC725Alliance/erc725.js/compare/v0.21.1...v0.21.2) (2023-11-07) + + +### Bug Fixes + +* Add for unknown verification method to allow for null verification data in LSP2 ([f205818](https://github.com/ERC725Alliance/erc725.js/commit/f205818af348471bde8f88af2008497b8c13e258)) +* Add more fixes per PR comments ([e7302e4](https://github.com/ERC725Alliance/erc725.js/commit/e7302e4504408e2f4f6304badd2024bfe05fcf47)) +* Change to verification object ([ddd2ab2](https://github.com/ERC725Alliance/erc725.js/commit/ddd2ab23d1c5181745827f338d9abaea48c772f7)) +* More renames _FUNCTIONS to _METHODS ([1a96be1](https://github.com/ERC725Alliance/erc725.js/commit/1a96be1dd15942d2a844bc26b9ab73e053e3b766)) +* Move @types/jest and jest ([852918c](https://github.com/ERC725Alliance/erc725.js/commit/852918c72228b3839ba60730dadef66837008f5a)) + +## [0.21.1](https://github.com/ERC725Alliance/erc725.js/compare/v0.21.0...v0.21.1) (2023-11-06) + + +### Bug Fixes + +* incorrect hex for `LSP8MetadataTokenURI` ([0500a75](https://github.com/ERC725Alliance/erc725.js/commit/0500a752e3117c5c7e9df8cfed22cb5d6fee20c5)) + +## [0.21.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.20.1...v0.21.0) (2023-11-02) + + +### ⚠ BREAKING CHANGES + +* update lsp3/lsp4 verificationData + +### Features + +* new gas parameter ([82e3833](https://github.com/ERC725Alliance/erc725.js/commit/82e383345a712619b5c6a1030b124d2625115fc1)) + + +### Code Refactoring + +* update lsp3/lsp4 verificationData ([9640d9f](https://github.com/ERC725Alliance/erc725.js/commit/9640d9fbf88c7cf694b9e82cc3a711350334b097)) + +## [0.20.1](https://github.com/ERC725Alliance/erc725.js/compare/v0.20.0...v0.20.1) (2023-10-30) + + +### Bug Fixes + +* incorrect permission value for `EXECUTE_RELAY_CALL` ([55b8f5e](https://github.com/ERC725Alliance/erc725.js/commit/55b8f5e64c29c5a85d872f605667c88c1546f6b3)) + +## [0.20.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.19.0...v0.20.0) (2023-10-18) + + +### Features + +* add permission `EXECUTE_RELAY_CALL` ([6db8835](https://github.com/ERC725Alliance/erc725.js/commit/6db8835ccd9d1082d9e8184bb2f14972760bea69)) + +## [0.19.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.18.0...v0.19.0) (2023-10-05) + + +### ⚠ BREAKING CHANGES + +* change LSP3 to SupportedStandards:LSP3Profile ([#307](https://github.com/ERC725Alliance/erc725.js/issues/307)) +* new encoding for static value types (not arrays `[]`) ([#288](https://github.com/ERC725Alliance/erc725.js/issues/288)) +* change `ArrayLength` value from `uint256` to `uint128` ([#287](https://github.com/ERC725Alliance/erc725.js/issues/287)) + +### Features + +* add checkPermissions function ([17d2258](https://github.com/ERC725Alliance/erc725.js/commit/17d225843c236951ef1515a0ff91095b5ef27cd3)) +* add schemas for LSP8 + LSP17 ([#311](https://github.com/ERC725Alliance/erc725.js/issues/311)) ([1e8dbf7](https://github.com/ERC725Alliance/erc725.js/commit/1e8dbf765c6c5e250539b402e9bd5a395966a8c2)) + + +### Bug Fixes + +* decode any uint256 as number not string ([#289](https://github.com/ERC725Alliance/erc725.js/issues/289)) ([37203f1](https://github.com/ERC725Alliance/erc725.js/commit/37203f14d313a0caff75724dc74175c741c1b540)) +* dependencies & example ([#302](https://github.com/ERC725Alliance/erc725.js/issues/302)) ([9979e89](https://github.com/ERC725Alliance/erc725.js/commit/9979e89e438cd9f7cc586d7dc271de969f13b125)) +* incorrect value in schema for array length in `...Map` ([#310](https://github.com/ERC725Alliance/erc725.js/issues/310)) ([0d28b13](https://github.com/ERC725Alliance/erc725.js/commit/0d28b1317dc085078090a8babacf4db517d91a87)) +* Remove hardcoded require ([5279278](https://github.com/ERC725Alliance/erc725.js/commit/527927812b1a05b13f8dc6b14aecaa6d24e98d61)) +* variable naming ([44b4785](https://github.com/ERC725Alliance/erc725.js/commit/44b47851ed63b817edc21c63655d67bac13a7e7f)) + + +### Code Refactoring + +* change `ArrayLength` value from `uint256` to `uint128` ([#287](https://github.com/ERC725Alliance/erc725.js/issues/287)) ([c95ee8a](https://github.com/ERC725Alliance/erc725.js/commit/c95ee8a53bf25bcf47777054af27cae1fbad8b2f)) +* change LSP3 to SupportedStandards:LSP3Profile ([#307](https://github.com/ERC725Alliance/erc725.js/issues/307)) ([73f3481](https://github.com/ERC725Alliance/erc725.js/commit/73f34818fe152c3ab5299177adc0eddfed6886c5)) +* new encoding for static value types (not arrays `[]`) ([#288](https://github.com/ERC725Alliance/erc725.js/issues/288)) ([f0b04da](https://github.com/ERC725Alliance/erc725.js/commit/f0b04daa57a281c537a8f28594439573188f0dce)) + +## [0.18.0](https://github.com/ERC725Alliance/erc725.js/compare/v0.17.2...v0.18.0) (2023-08-03) + +### ⚠ BREAKING CHANGES + +- new encoding for static value types (not arrays `[]`) (#288) +- change `ArrayLength` value from `uint256` to `uint128` (#287) + +### Features + +- add checkPermissions function ([17d2258](https://github.com/ERC725Alliance/erc725.js/commit/17d225843c236951ef1515a0ff91095b5ef27cd3)) +- Add new feature "Decode Mapping Key" ([8c1f1fc](https://github.com/ERC725Alliance/erc725.js/commit/8c1f1fcfb15fa43d1d3934b0b15f09d47902bb41)) + +### Bug Fixes + +- decode any uint256 as number not string ([#289](https://github.com/ERC725Alliance/erc725.js/issues/289)) ([37203f1](https://github.com/ERC725Alliance/erc725.js/commit/37203f14d313a0caff75724dc74175c741c1b540)) +- variable naming ([44b4785](https://github.com/ERC725Alliance/erc725.js/commit/44b47851ed63b817edc21c63655d67bac13a7e7f)) + +### improvement + +- change `ArrayLength` value from `uint256` to `uint128` ([#287](https://github.com/ERC725Alliance/erc725.js/issues/287)) ([c95ee8a](https://github.com/ERC725Alliance/erc725.js/commit/c95ee8a53bf25bcf47777054af27cae1fbad8b2f)) +- new encoding for static value types (not arrays `[]`) ([#288](https://github.com/ERC725Alliance/erc725.js/issues/288)) ([f0b04da](https://github.com/ERC725Alliance/erc725.js/commit/f0b04daa57a281c537a8f28594439573188f0dce)) + ### [0.17.2](https://github.com/ERC725Alliance/erc725.js/compare/v0.17.1...v0.17.2) (2023-03-14) - removed ERC725JSONSchemaKeyType duplicate value ([060ee6c](https://github.com/ERC725Alliance/erc725.js/commit/060ee6ce23bda328f727140419de7590f48fc394)) @@ -103,7 +219,6 @@ Minor update to update the LSP-2 schemas. ### improvement -- change fetchData output to non object ([1d4d570](https://github.com/ERC725Alliance/erc725.js/commit/1d4d57077a7766b3490477efb20f194fc4e00da4)) - fetchData as same output as decodeData ([59c3a87](https://github.com/ERC725Alliance/erc725.js/commit/59c3a879fefb2b9bfe46b9bea91ff6bd2a528df1)) - getData as same output as decodeData ([0f3b149](https://github.com/ERC725Alliance/erc725.js/commit/0f3b149f2280e6025a05e8e9ed306facfa63601a)) - use array for decodeData ([261d100](https://github.com/ERC725Alliance/erc725.js/commit/261d1007f4ff63abd9d794f4e64e5b408ce7c1a3)) 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 58bacaf4..06ec1800 100644 --- a/examples/src/decodeData.js +++ b/examples/src/decodeData.js @@ -8,7 +8,7 @@ const decodedDataOneKey = myERC725.decodeData([ { keyName: 'LSP3Profile', value: - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', }, ]); /** @@ -31,7 +31,7 @@ const decodedDataManyKeys = myERC725.decodeData([ { keyName: 'LSP3Profile', value: - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', }, { keyName: 'LSP3IssuedAssets[]', @@ -76,7 +76,7 @@ const decodedDataManyKeys = myERC725.decodeData([ ] */ console.log('/*--------------------------------------------/*'); -console.log('/* decodeData - one key /*'); +console.log('/* decodeData - one key (VerifiableURI) /*'); console.log('/*--------------------------------------------/*'); console.log(decodedDataOneKey); console.log('/*--------------------------------------------/*'); diff --git a/examples/src/encodeData.js b/examples/src/encodeData.js index 16984f41..138b8aa1 100644 --- a/examples/src/encodeData.js +++ b/examples/src/encodeData.js @@ -38,7 +38,7 @@ const encodedDataOneKeyV2 = myERC725.encodeData({ '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5' ], values: [ - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178' + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178' ] } */ @@ -76,7 +76,7 @@ const encodedDataManyKeys = myERC725.encodeData([ '0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47' ], values: [ - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', '0x0000000000000000000000000000000000000000000000000000000000000002', '0xd94353d9b005b3c0a9da169b768a31c57844e490', '0xdaea594e385fc724449e3118b2db7e86dfba1826', diff --git a/package.json b/package.json index 8191bd2d..f42d3c0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@erc725/erc725.js", - "version": "0.17.2", + "version": "0.21.3", "description": "Library to interact with ERC725 smart contracts", "main": "build/main/src/index.js", "typings": "build/main/src/index.d.ts", diff --git a/schemas/LSP3ProfileMetadata.json b/schemas/LSP3ProfileMetadata.json index 1d048987..ffa86676 100644 --- a/schemas/LSP3ProfileMetadata.json +++ b/schemas/LSP3ProfileMetadata.json @@ -11,7 +11,7 @@ "key": "0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5", "keyType": "Singleton", "valueType": "bytes", - "valueContent": "JSONURL" + "valueContent": "VerifiableURI" }, { "name": "LSP12IssuedAssets[]", diff --git a/schemas/LSP4DigitalAsset.json b/schemas/LSP4DigitalAsset.json index c57410b2..fbe6336f 100644 --- a/schemas/LSP4DigitalAsset.json +++ b/schemas/LSP4DigitalAsset.json @@ -25,7 +25,7 @@ "key": "0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e", "keyType": "Singleton", "valueType": "bytes", - "valueContent": "JSONURL" + "valueContent": "VerifiableURI" }, { "name": "LSP4Creators[]", diff --git a/src/index.ts b/src/index.ts index 454951d3..e7924b75 100644 --- a/src/index.ts +++ b/src/index.ts @@ -138,14 +138,23 @@ export class ERC725 { // eslint-disable-next-line class-methods-use-this private validateSchemas(schemas: ERC725JSONSchema[]) { return schemas.filter((schema) => { + if ( + schema.valueContent === 'AssetURL' || + schema.valueContent === 'JSONURL' + ) { + console.warn( + `[Deprecation notice] The schema with keyName: ${schema.name} uses deprecated valueContent: ${schema.valueContent}. It has been replaced by VerifiableURI. Decoding is backward compatible but value will be encoded as VerifiableURI.`, + ); + } + try { const encodedKeyName = encodeKeyName(schema.name); const isKeyValid = schema.key === encodedKeyName; if (!isKeyValid) { - console.log( - `The schema with keyName: ${schema.key} is skipped because its key hash does not match its key name (expected: ${encodedKeyName}, got: ${schema.key}).`, + console.warn( + `The schema with keyName: ${schema.name} is skipped because its key hash does not match its key name (expected: ${encodedKeyName}, got: ${schema.key}).`, ); } diff --git a/src/lib/decodeData.test.ts b/src/lib/decodeData.test.ts index 490fb5e7..22ea7ea2 100644 --- a/src/lib/decodeData.test.ts +++ b/src/lib/decodeData.test.ts @@ -38,16 +38,30 @@ describe('decodeData', () => { { name: 'MyKeyName::', key: '0x', - keyType: 'Singleton', + keyType: 'MappingWithGrouping', + valueType: 'bytes', + valueContent: 'JSONURL', // Deprecated - We keep it for backward compatibility between v0.21.3 and v0.22.0 + }, + { + name: 'MyKeyName2::', + key: '0x', + keyType: 'MappingWithGrouping', valueType: 'bytes', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', }, { name: 'MyDynamicKey:
', key: '0x', - keyType: 'Singleton', + keyType: 'Mapping', + valueType: 'bytes', + valueContent: 'JSONURL', // Deprecated - We keep it for backward compatibility between v0.21.3 and v0.22.0 + }, + { + name: 'MyDynamicKey2:
', + key: '0x', + keyType: 'Mapping', valueType: 'bytes', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', }, ]; @@ -69,6 +83,56 @@ describe('decodeData', () => { expect(decodedData.map(({ name }) => name)).to.eql(['KeyOne', 'KeyTwo']); }); + it('is backward compatible with JSONURL and AssetURL and decodes these encoding correctly', () => { + const decodedData = decodeData( + [ + { + keyName: 'JSONURLCase', + value: + '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361696670733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + }, + { + keyName: 'AssetURLCase', + value: + '0x8019f9b1d47cf10786205bb08ce508e91c424d413d0f6c48e24dbfde2920d16a9561a723697066733a2f2f516d57346e554e7933767476723344785a48754c66534c6e687a4b4d6532576d67735573454750504668385a7470', + }, + ], + [ + { + name: 'JSONURLCase', + key: '0x9136feeb09af67b63993b586ce46a43bd3456990d3fdb39d07beab9dee8d5910', + keyType: 'Singleton', + valueType: 'bytes', + valueContent: 'JSONURL', // Deprecated - We keep it for backward compatibility between v0.21.3 and v0.22.0 + }, + { + name: 'AssetURLCase', + key: '0xbda5878fa57d8da097bf7cfd78c28e75f2c2c7b028e4e056d16d7e4b83f98081', + keyType: 'Singleton', + valueType: 'bytes', + valueContent: 'AssetURL', // Deprecated - We keep it for backward compatibility between v0.21.3 and v0.22.0 + }, + ], + ); + + expect(decodedData.map(({ value }) => value)).to.eql([ + { + verification: { + method: 'keccak256(utf8)', // 0x6f357c6a + data: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + }, + url: 'ifps://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', + }, + { + verification: { + method: 'keccak256(bytes)', // 0x8019f9b1 + data: '0xd47cf10786205bb08ce508e91c424d413d0f6c48e24dbfde2920d16a9561a723', + }, + url: 'ipfs://QmW4nUNy3vtvr3DxZHuLfSLnhzKMe2WmgsUsEGPPFh8Ztp', + }, + ]); + }); + it('parses non array input correctly', () => { const decodedData = decodeData( { @@ -146,19 +210,19 @@ describe('decodeData', () => { const decodedData = decodeData( [ { - keyName: 'MyKeyName::', + keyName: 'MyKeyName2::', dynamicKeyParts: [ '0xaaaabbbbccccddddeeeeffff111122223333444455556666777788889999aaaa', 'true', ], value: - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', }, { - keyName: 'MyDynamicKey:
', + keyName: 'MyDynamicKey2:
', dynamicKeyParts: '0xcafecafecafecafecafecafecafecafecafecafe', value: - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', }, { keyName: 'KeyTwo', @@ -169,8 +233,8 @@ describe('decodeData', () => { ); expect(decodedData.map(({ name }) => name)).to.eql([ - 'MyKeyName:aaaabbbbccccddddeeeeffff111122223333444455556666777788889999aaaa:true', - 'MyDynamicKey:cafecafecafecafecafecafecafecafecafecafe', + 'MyKeyName2:aaaabbbbccccddddeeeeffff111122223333444455556666777788889999aaaa:true', + 'MyDynamicKey2:cafecafecafecafecafecafecafecafecafecafe', 'KeyTwo', ]); }); diff --git a/src/lib/encoder.test.ts b/src/lib/encoder.test.ts index 4389821e..d2b5cd5b 100644 --- a/src/lib/encoder.test.ts +++ b/src/lib/encoder.test.ts @@ -16,7 +16,14 @@ import { expect, assert } from 'chai'; -import { keccak256, utf8ToHex, stripHexPrefix, toBN, toHex } from 'web3-utils'; +import { + keccak256, + utf8ToHex, + stripHexPrefix, + toBN, + toHex, + padLeft, +} from 'web3-utils'; import { valueContentEncodingMap, encodeValueType, @@ -28,7 +35,7 @@ import { SUPPORTED_VERIFICATION_METHOD_HASHES, SUPPORTED_VERIFICATION_METHOD_STRINGS, } from '../constants/constants'; -import { JSONURLDataToEncode, URLDataWithHash } from '../types'; +import { URLDataToEncode, URLDataWithHash } from '../types'; describe('encoder', () => { describe('valueType', () => { @@ -889,6 +896,9 @@ describe('encoder', () => { decodedValue: 'http://test.com', encodedValue: '0x687474703a2f2f746573742e636f6d', }, + // AssetURL is deprecated since: + // https://github.com/lukso-network/LIPs/pull/263 + // We keep it in our tests for backward compatibility testing for v0.22.0 release { valueContent: 'AssetURL', decodedValue: { @@ -898,8 +908,21 @@ describe('encoder', () => { }, url: 'http://test.com/asset.glb', }, + // Starting from v0.22.0, we force AssetURL encode to VerifiableURI as AssetURL is deprecated + encodedValue: + '0x00006f357c6a0020027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d16168687474703a2f2f746573742e636f6d2f61737365742e676c62', + }, + { + valueContent: 'VerifiableURI', + decodedValue: { + verification: { + method: SUPPORTED_VERIFICATION_METHOD_STRINGS.KECCAK256_UTF8, + data: '0x027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d16168', + }, + url: 'http://test.com/asset.glb', + }, encodedValue: - '0x6f357c6a027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d16168687474703a2f2f746573742e636f6d2f61737365742e676c62', + '0x00006f357c6a0020027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d16168687474703a2f2f746573742e636f6d2f61737365742e676c62', }, { valueContent: 'BitArray', @@ -940,7 +963,7 @@ describe('encoder', () => { }); it('encodes/decodes: JSONURL', () => { - const dataToEncode: JSONURLDataToEncode = { + const dataToEncode: URLDataToEncode = { url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', json: { myProperty: 'is a string', @@ -957,9 +980,13 @@ describe('encoder', () => { const jsonVerificationData = keccak256( JSON.stringify(dataToEncode.json), ).substring(2); + + // Starting from v0.22.0, we force JSONURL encode to VerifiableURI as JSONURL is deprecated assert.deepStrictEqual( encodedValue, - verificationMethod + jsonVerificationData + hexUrl, + `0x0000${stripHexPrefix(verificationMethod)}${stripHexPrefix( + padLeft(jsonVerificationData.length / 2, 4), + )}${jsonVerificationData}${hexUrl}`, ); const expectedDecodedValue: URLDataWithHash = { diff --git a/src/lib/encoder.ts b/src/lib/encoder.ts index 6696cef9..3838fda3 100644 --- a/src/lib/encoder.ts +++ b/src/lib/encoder.ts @@ -44,7 +44,7 @@ import { toBN, } from 'web3-utils'; -import { JSONURLDataToEncode, URLDataWithHash, Verification } from '../types'; +import { URLDataToEncode, URLDataWithHash, Verification } from '../types'; import { AssetURLEncode } from '../types/encodeData'; import { @@ -74,20 +74,61 @@ const encodeDataSourceWithHash = ( const verificationMethod = getVerificationMethod( verification?.method || UNKNOWN_VERIFICATION_METHOD, ); - return ( - (verificationMethod - ? keccak256(verificationMethod.name).slice(0, 10) - : padLeft(0, 8)) + - stripHexPrefix(verification ? verification.data : padLeft(0, 64)) + - stripHexPrefix(utf8ToHex(dataSource)) - ); + return [ + '0x0000', + stripHexPrefix( + verificationMethod + ? padLeft(keccak256(verificationMethod.name).slice(0, 10), 8) + : '00000000', + ), + stripHexPrefix( + verification?.data + ? padLeft(verification.data.slice(2).length / 2, 4) + : '0000', + ), + stripHexPrefix( + verification?.data ? stripHexPrefix(verification?.data) : '', + ), + stripHexPrefix(utf8ToHex(dataSource)), + ].join(''); }; const decodeDataSourceWithHash = (value: string): URLDataWithHash => { - const verificationMethodSig = value.slice(0, 10); - const verificationMethod = getVerificationMethod(verificationMethodSig); + if (value.slice(0, 6) === '0x0000') { + /* + 0 1 2 3 4 5 6 7 8 + 12345678901234567890123456789012345678901234567890123456789012345678901234567890 + 0x0000 code + 6f357c6a hash fn [6] + 0020 data len [14] + 820464ddfac1be...[18 + data len] + [18 + data len]...696670733a2f2...[...rest] + */ + const verificationMethodSignature = `0x${value.slice(6, 14)}`; + // NOTE: verificationMethodSignature can be 0x00000000 if no verification method is used + // this means that an invalid verification method should still return all data + // and not be an error. It's up to the method calling this to figure out + // whether an unknown verification method is an error or not. + const verificationMethod = getVerificationMethod( + verificationMethodSignature, + ); + const encodedLength = `0x${value.slice(14, 18)}`; // Rest of data string after function hash + const dataLength = hexToNumber(encodedLength, false) as number; + const dataHash = `0x${value.slice(18, 18 + dataLength * 2)}`; // Get jsonHash 32 bytes + const dataSource = hexToUtf8('0x' + value.slice(18 + dataLength * 2)); // Get remainder as URI + + return { + verification: { + method: verificationMethod?.name || UNKNOWN_VERIFICATION_METHOD, + data: dataHash, + }, + url: dataSource, + }; + } - const encodedData = value.replace('0x', '').slice(8); // Rest of data string after function hash + const verificationMethodSignature = value.slice(0, 10); + const verificationMethod = getVerificationMethod(verificationMethodSignature); + const encodedData = value.slice(10); // Rest of data string after function hash const dataHash = '0x' + encodedData.slice(0, 64); // Get jsonHash 32 bytes const dataSource = hexToUtf8('0x' + encodedData.slice(64)); // Get remainder as URI @@ -639,19 +680,13 @@ export const valueContentEncodingMap = ( decode: (value: string) => hexToUtf8(value), }; } - case 'AssetURL': { - return { - type: 'custom', - encode: (value: AssetURLEncode) => - encodeDataSourceWithHash(value.verification, value.url), - decode: (value: string) => decodeDataSourceWithHash(value), - }; - } - // https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl - case 'JSONURL': { + // https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md#verifiableuri + case 'AssetURL': // Deprecated since v0.22.0 + case 'JSONURL': // Deprecated since v0.22.0 + case 'VerifiableURI': { return { type: 'custom', - encode: (dataToEncode: JSONURLDataToEncode) => { + encode: (dataToEncode: URLDataToEncode) => { const { verification: { data, method } = {}, json, @@ -823,7 +858,7 @@ export function decodeValueType( export function encodeValueContent( valueContent: string, - value: string | number | AssetURLEncode | JSONURLDataToEncode | boolean, + value: string | number | AssetURLEncode | URLDataToEncode | boolean, ): string | false { if (valueContent.slice(0, 2) === '0x') { return valueContent === value ? value : false; diff --git a/src/lib/getDataFromExternalSources.ts b/src/lib/getDataFromExternalSources.ts index ead0cace..dd0a96ec 100644 --- a/src/lib/getDataFromExternalSources.ts +++ b/src/lib/getDataFromExternalSources.ts @@ -44,14 +44,14 @@ export const getDataFromExternalSources = ( } if ( - !['jsonurl', 'asseturl'].includes( + !['jsonurl', 'asseturl', 'verifiableuri'].includes( schemaElement.valueContent.toLowerCase(), ) ) { return dataEntry; } - // At this stage, value should be of type jsonurl or asseturl + // At this stage, value should be of type jsonurl, verifiableuri or asseturl if (typeof dataEntry.value === 'string') { console.error( `Value of key: ${dataEntry.name} (${dataEntry.value}) is string but valueContent is: ${schemaElement.valueContent}. Expected type should be object with url key.`, diff --git a/src/lib/schemaParser.test.ts b/src/lib/schemaParser.test.ts index 287c12dc..0c6482d7 100644 --- a/src/lib/schemaParser.test.ts +++ b/src/lib/schemaParser.test.ts @@ -28,7 +28,7 @@ describe('schemaParser getSchema', () => { name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', keyType: 'Singleton', - valueContent: 'JSONURL', + valueContent: 'VerifiableURI', valueType: 'bytes', }); }); diff --git a/src/lib/utils.test.ts b/src/lib/utils.test.ts index e583a000..89b6056b 100644 --- a/src/lib/utils.test.ts +++ b/src/lib/utils.test.ts @@ -78,7 +78,7 @@ describe('utils', () => { name: 'TestObjArray[]', key: '0x9985edaf12cbacf5ac7d6ed54f0445cc0ea56075aee9b9942e4ab3bf4239f950', keyType: 'Array', - valueContent: 'JSONURL', + valueContent: 'JSONURL', // Deprecated - we keep it for backward compatibility valueType: 'bytes', }, decodedValue: [ @@ -105,12 +105,12 @@ describe('utils', () => { { key: '0x9985edaf12cbacf5ac7d6ed54f0445cc00000000000000000000000000000000', value: - '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', }, { key: '0x9985edaf12cbacf5ac7d6ed54f0445cc00000000000000000000000000000001', value: - '0x6f357c6a81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', + '0x00006f357c6a002081bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', }, ], }, @@ -317,7 +317,7 @@ describe('utils', () => { url: 'http://day.night/asset.glb', }, encodedValue: - '0x6f357c6a81dadadadadadadadadadadadadadadf00a4bdfa8fcaf3791d25f69b497abf88687474703a2f2f6461792e6e696768742f61737365742e676c62', + '0x00006f357c6a002081dadadadadadadadadadadadadadadf00a4bdfa8fcaf3791d25f69b497abf88687474703a2f2f6461792e6e696768742f61737365742e676c62', }, { valueContent: 'JSONURL', @@ -330,7 +330,7 @@ describe('utils', () => { url: 'ipfs://QmbErKh3Fjsxxxxxxxxxxxxxxxxxxxxxxxxxxv9AJJvZbd', }, encodedValue: - '0x6f357c6a81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', + '0x00006f357c6a002081bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', }, { @@ -643,7 +643,7 @@ describe('utils', () => { '0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47', ], values: [ - '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', + '0x00006f357c6a0020820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361697066733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', '0x00000000000000000000000000000002', '0xd94353d9b005b3c0a9da169b768a31c57844e490', '0xdaea594e385fc724449e3118b2db7e86dfba1826', diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 7024068f..d3230b13 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -22,6 +22,7 @@ import { checkAddressChecksum, isAddress, + leftPad, numberToHex, padLeft, stripHexPrefix, @@ -29,7 +30,7 @@ import { import { arrToBufArr } from 'ethereumjs-util'; import { - JSONURLDataToEncode, + URLDataToEncode, EncodeDataReturn, URLDataWithHash, Verification, @@ -77,8 +78,8 @@ export function encodeKeyValue( | string[] | number | number[] - | JSONURLDataToEncode - | JSONURLDataToEncode[] + | URLDataToEncode + | URLDataToEncode[] | boolean, name?: string, ): string | false { @@ -176,7 +177,7 @@ export function guessKeyTypeFromKeyName( export const encodeTupleKeyValue = ( valueContent: string, // i.e. (bytes4,Number,bytes16) valueType: string, // i.e. (bytes4,bytes8,bytes16) - decodedValues: Array, + decodedValues: Array, ) => { // We assume data has already been validated at this stage @@ -239,8 +240,8 @@ export function encodeKey( | number | (string | number)[] | string[][] - | JSONURLDataToEncode - | JSONURLDataToEncode[] + | URLDataToEncode + | URLDataToEncode[] | boolean, ) { // NOTE: This will not guarantee order of array as on chain. Assumes developer must set correct order @@ -340,8 +341,8 @@ export function encodeKey( | string[] | number | number[] - | JSONURLDataToEncode - | JSONURLDataToEncode[], + | URLDataToEncode + | URLDataToEncode[], schema.name, ); default: @@ -479,7 +480,7 @@ export function getVerificationMethod(nameOrSig: string) { ({ name, sig }) => name === nameOrSig || sig === nameOrSig, ); - if (!verificationMethod) { + if (!verificationMethod && nameOrSig !== '0x00000000') { throw new Error( `Chosen verification method '${nameOrSig}' is not supported. Supported verification methods: ${SUPPORTED_VERIFICATION_METHODS_LIST}`, ); @@ -492,7 +493,7 @@ export function hashData( data: string | Uint8Array | Record, nameOrSig: SUPPORTED_VERIFICATION_METHODS | string, ): string { - return getVerificationMethod(nameOrSig).method(data); + return getVerificationMethod(nameOrSig)?.method(data) || leftPad(0, 64); } /** diff --git a/src/types/encodeData/JSONURL.ts b/src/types/encodeData/JSONURL.ts index 4948cdc9..440e6f72 100644 --- a/src/types/encodeData/JSONURL.ts +++ b/src/types/encodeData/JSONURL.ts @@ -25,12 +25,12 @@ export interface URLDataWithJson extends URLData { json: Record; } -export type JSONURLDataToEncode = URLDataWithHash | URLDataWithJson; +export type URLDataToEncode = URLDataWithHash | URLDataWithJson; export type EncodeDataType = | string | string[] - | JSONURLDataToEncode + | URLDataToEncode | boolean | number; diff --git a/test/mockSchema.ts b/test/mockSchema.ts index 2784a728..ffd8829f 100644 --- a/test/mockSchema.ts +++ b/test/mockSchema.ts @@ -39,13 +39,13 @@ export const mockSchema: (ERC725JSONSchema & { // Testing data returnRawData: abiCoder.encodeParameter( 'bytes', - '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', ), returnRawDataArray: abiCoder.encodeParameter('bytes[]', [ - '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', ]), returnGraphData: - '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', expectedResult: { verification: { method: 'keccak256(utf8)', @@ -65,13 +65,13 @@ export const mockSchema: (ERC725JSONSchema & { // Testing data returnRawData: abiCoder.encodeParameter( 'bytes', - '0x6f357c6aa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020a7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', ), returnRawDataArray: abiCoder.encodeParameter('bytes[]', [ - '0x6f357c6aa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020a7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', ]), returnGraphData: - '0x6f357c6aa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020a7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', expectedResult: { verification: { method: 'keccak256(utf8)', @@ -263,26 +263,26 @@ export const mockSchema: (ERC725JSONSchema & { abiCoder.encodeParameter('bytes', leftPad(2, 32)), // array length abiCoder.encodeParameter( 'bytes', - '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', ), abiCoder.encodeParameter( 'bytes', - '0x6f357c6a81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', + '0x00006f357c6a002081bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', ), ], returnRawDataArray: [ abiCoder.encodeParameter('bytes[]', [leftPad(2, 32)]), abiCoder.encodeParameter('bytes[]', [ - '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a0020733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', ]), abiCoder.encodeParameter('bytes[]', [ - '0x6f357c6a81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', + '0x00006f357c6a002081bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', ]), ], returnGraphData: [ leftPad(2, 32), // array length - '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', - '0x6f357c6a81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', + '0x00006f357c6a0020733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', + '0x00006f357c6a002081bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88697066733a2f2f516d6245724b6833466a7378787878787878787878787878787878787878787878787878787639414a4a765a6264', ], expectedResult: [ // This JSON from JSONURL above...