From 26c9988025e5b37e89c837b1dec8abb9e3c3ebf3 Mon Sep 17 00:00:00 2001 From: CJ42 Date: Wed, 13 Dec 2023 18:34:24 +0000 Subject: [PATCH] refactor: change valueContent to `VerifiableURI` --- examples/src/decodeData.js | 2 +- src/lib/decodeData.test.ts | 4 ++-- src/lib/encoder.ts | 2 +- src/lib/getDataFromExternalSources.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/src/decodeData.js b/examples/src/decodeData.js index 49933a74..fe7db8b8 100644 --- a/examples/src/decodeData.js +++ b/examples/src/decodeData.js @@ -99,7 +99,7 @@ const decodedDataManyKeys = myERC725.decodeData([ ] */ console.log('/*--------------------------------------------/*'); -console.log('/* decodeData - one key (VerifiableURL) /*'); +console.log('/* decodeData - one key (VerifiableURI) /*'); console.log('/*--------------------------------------------/*'); console.log(decodedDataOneKey); console.log('/*--------------------------------------------/*'); diff --git a/src/lib/decodeData.test.ts b/src/lib/decodeData.test.ts index 3c004811..a21feeea 100644 --- a/src/lib/decodeData.test.ts +++ b/src/lib/decodeData.test.ts @@ -47,7 +47,7 @@ describe('decodeData', () => { key: '0x', keyType: 'MappingWithGrouping', valueType: 'bytes', - valueContent: 'VerifiableURL', + valueContent: 'VerifiableURI', }, { name: 'MyDynamicKey:
', @@ -61,7 +61,7 @@ describe('decodeData', () => { key: '0x', keyType: 'Mapping', valueType: 'bytes', - valueContent: 'VerifiableURL', + valueContent: 'VerifiableURI', }, ]; diff --git a/src/lib/encoder.ts b/src/lib/encoder.ts index 277ae2b4..3607e90d 100644 --- a/src/lib/encoder.ts +++ b/src/lib/encoder.ts @@ -684,7 +684,7 @@ export const valueContentEncodingMap = ( } // https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-2-ERC725YJSONSchema.md#jsonurl case 'JSONURL': - case 'VerifiableURL': { + case 'VerifiableURI': { return { type: 'custom', encode: (dataToEncode: URLDataToEncode) => { diff --git a/src/lib/getDataFromExternalSources.ts b/src/lib/getDataFromExternalSources.ts index 4aac840c..dd0a96ec 100644 --- a/src/lib/getDataFromExternalSources.ts +++ b/src/lib/getDataFromExternalSources.ts @@ -44,14 +44,14 @@ export const getDataFromExternalSources = ( } if ( - !['jsonurl', 'asseturl', 'verifiableurl'].includes( + !['jsonurl', 'asseturl', 'verifiableuri'].includes( schemaElement.valueContent.toLowerCase(), ) ) { return dataEntry; } - // At this stage, value should be of type jsonurl, verifiableurl 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.`,