Skip to content

Commit

Permalink
chore: add deprecation notice on load
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugoo committed Dec 14, 2023
1 parent b3a273a commit f7149bb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}).`,
`The schema with keyName: ${schema.name} is skipped because its key hash does not match its key name (expected: ${encodedKeyName}, got: ${schema.key}).`,
);
}

Expand Down

0 comments on commit f7149bb

Please sign in to comment.