Skip to content

Commit

Permalink
refactor: cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Apr 25, 2024
1 parent 3e6213a commit 5af2f58
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/* **************************************** */
Expand Down
2 changes: 1 addition & 1 deletion src/lib/encoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/lib/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5af2f58

Please sign in to comment.