diff --git a/src/index.test.ts b/src/index.test.ts index a872ac31..25e2c9ca 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -939,10 +939,6 @@ describe('Running @erc725/erc725.js tests...', () => { }); }); - describe('Testing `decodeData`', () => { - // ... - }); - describe('Testing utility encoding & decoding functions', () => { const allGraphData = generateAllData(mockSchema) as any; /* **************************************** */ diff --git a/src/lib/encoder.test.ts b/src/lib/encoder.test.ts index 55334fdb..4f8d02b5 100644 --- a/src/lib/encoder.test.ts +++ b/src/lib/encoder.test.ts @@ -321,7 +321,7 @@ describe('encoder', () => { ]; leftPaddedTestCases.forEach((testCase) => { - it(`encodes + left pad \`input\` = ${testCase.input} as ${testCase.valueType} padded on the right with \`00\`s`, async () => { + it(`encodes + left pad number \`input\` = ${testCase.input} as ${testCase.valueType} padded on the left with \`00\`s`, async () => { const encodedValue = encodeValueType( testCase.valueType, testCase.input, diff --git a/src/lib/encoder.ts b/src/lib/encoder.ts index bed0761d..56f71c4e 100644 --- a/src/lib/encoder.ts +++ b/src/lib/encoder.ts @@ -219,7 +219,9 @@ const encodeToBytesN = ( // if we receive a plain string (e.g: "hey!"), convert it to utf8-hex data valueToEncode = toHex(value); } else if (typeof value === 'number') { - // if we receive a number as input, convert it to hex, left padded + // if we receive a number as input, convert it to hex, + // despite `bytesN` pads on the right, we pad number on the left side here + // to symmetrically encode / decode valueToEncode = padLeft(numberToHex(value), numberOfBytesInType * 2); } else { valueToEncode = value;