Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to decode array length only as number using decodeData #430

Merged
merged 1 commit into from
May 6, 2024

Conversation

CJ42
Copy link
Collaborator

@CJ42 CJ42 commented May 3, 2024

What kind of change does this PR introduce (bug fix, feature, docs update, ...)?

⭐ Feature

What is the current behaviour (you can also link to an open issue here)?

When using decodeData with key type Array, only arrays [ ... ] can be returned.

What is the new behaviour (if this is a feature change)?

Allow to use decodeData with key type Array that allows to pass a a 16 bytes long value, that will be decoded as a number.

const decodedData = ERC725.decodeData(
      {
        keyName: 'LSP12IssuedAssets[]',
        value: '0x00000000000000000000000000000003',
      },
      [
        {
          name: 'LSP12IssuedAssets[]',
          key: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
          keyType: 'Array',
          valueContent: 'Address',
          valueType: 'address',
        },
      ],
    );

will output:

// decodedData {
//  key: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
//  name: 'LSP12IssuedAssets[]',
//  value: 3
// }

Other information:

@CJ42 CJ42 force-pushed the feat/decode-array-length branch from f9dda43 to fbacfeb Compare May 3, 2024 18:43
@CJ42 CJ42 merged commit e341b06 into develop May 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants