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

Document examples for encoding/decoding CompactBytesArray #279

Open
1 of 5 tasks
CJ42 opened this issue Feb 27, 2023 · 3 comments
Open
1 of 5 tasks

Document examples for encoding/decoding CompactBytesArray #279

CJ42 opened this issue Feb 27, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@CJ42
Copy link
Collaborator

CJ42 commented Feb 27, 2023

I'm submitting a...

  • bug report
  • feature request
  • question about the decisions made in the repository
  • question about how to use this project
  • documentation request

Summary

There is no documentation on erc725.js about the fact that the library can encode/decode CompactBytesArray.

There should be some examples in the documentation where we show how CompactBytesArray are encoded/decoded, especially the ouput if it's a normal valueType (an array of valueTypes), or a tuple (a 2D array of valueTypes).

Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)

The only place where we can find some infos are the tests files at the moment:

-> https://github.com/ERC725Alliance/erc725.js/blob/develop/src/lib/encoder.test.ts#L153-L157
-> https://github.com/ERC725Alliance/erc725.js/blob/develop/src/lib/utils.test.ts#L140

@CJ42 CJ42 added the documentation Improvements or additions to documentation label Feb 27, 2023
@Hugoo
Copy link
Contributor

Hugoo commented Mar 25, 2024

Could be nice to make an example of:

@CJ42
Copy link
Collaborator Author

CJ42 commented Jul 17, 2024

Could be nice to make an example of:

Test should be:

{
        schema: {
          name: 'LSP18RoyaltiesRecipients',
          key: '0xc0569ca6c9180acc2c3590f36330a36ae19015a19f4e85c28a7631e3317e6b9d',
          keyType: 'Singleton',
          valueType: '(bytes4,address,uint32)[CompactBytesArray]',
          valueContent: '(Bytes4,Address,Number)',
        },
        decodedValue: [
          [
            '0x3e89ad98', // LSP0 interface ID
            '0xCA41e4ea94c8fA99889c8EA2c8948768cBaf4bc0', // recipient address (checksummed)
            15000, // royalty percentage in points (100 % = 100_000). Here 15_000 for 15 % = 0x00003a98 as bytes4 hex
          ],
          [
            '0xffffffff', // any standard interface ID
            '0xF70Ce3b58f275A4c28d06C98615760dDe774DE57',
            10000, // 10_000 (for 10 %) = 0x00002710 as bytes4 hex
          ],
          [
            '0xffffffff', // any standard interface ID
            '0xd3236aa1B8A4dDe5eA375fd1F2Fb5c354e686c9f',
            8000, // 8_000 (for 8 %) = 0x00001f40 as bytes4 hex
          ],
        ],
        encodedValue:
          '0x001c3e89ad98ca41e4ea94c8fa99889c8ea2c8948768cbaf4bc000003a98001cfffffffff70ce3b58f275a4c28d06c98615760dde774de5700002710001cffffffffd3236aa1b8a4dde5ea375fd1f2fb5c354e686c9f00001f40',
      },

@CJ42
Copy link
Collaborator Author

CJ42 commented Nov 6, 2024

This issue can be closed once we have an example with LSP18Royalties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants