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

Consistent encoding/decoding of the parameters #4555

Closed
1 of 2 tasks
nazarhussain opened this issue Nov 18, 2021 · 1 comment · Fixed by #4844
Closed
1 of 2 tasks

Consistent encoding/decoding of the parameters #4555

nazarhussain opened this issue Nov 18, 2021 · 1 comment · Fixed by #4844
Assignees
Labels

Comments

@nazarhussain
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Feature Request

Currently the web3-eth-abi package have to functions encodeParameters and decodeParameters. Both of these works fine but don't have a consistent output.

  1. We can't use the output of one function to pass to other
  2. Decoding result in different format of data used to encode

Use Cases

The following code snippet should work fine.

const abi = ['uint256', 'string'];
const inputParams = ['2345675643', 'Hello!%'];

const encodedOutput = encodeParameters(abi, inputParams);
const decodedParams = decodeParameters(abi, encodedOutput);

assert(inputParams === decodedParams);

Implementation Ideas

The reason behind the difference is the implementation of the output format. Which is not based on array index rather object index. Same behaviour exists in 1.x and 4.x

Feature Examples/References

No response

Are you willing to implement this feature?

  • Yes
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Jan 18, 2022
@mconnelly8 mconnelly8 added 4.x 4.0 related and removed Stale Has not received enough activity labels Jan 25, 2022
@luu-alex luu-alex linked a pull request Mar 21, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants