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

Parameters decoding error for nested components #5714

Closed
1 task done
nazarhussain opened this issue Dec 28, 2022 · 0 comments
Closed
1 task done

Parameters decoding error for nested components #5714

nazarhussain opened this issue Dec 28, 2022 · 0 comments
Assignees
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@nazarhussain
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Raise following error.

AbiError: Parameter decoding error: Cannot read properties of undefined (reading '0')

Expected Behavior

There should not be any error.

Steps to Reproduce

While using following data to decode the receipt logs.

{
  "inputs": [{"indexed":true,"internalType":"address","name":"addr","type":"address"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"addr","type":"address"},{"components":[{"internalType":"string","name":"email","type":"string"},{"internalType":"string","name":"phone","type":"string"}],"internalType":"struct ABIV2UserDirectory.Contact","name":"contact","type":"tuple"}],"indexed":false,"internalType":"struct ABIV2UserDirectory.User","name":"user","type":"tuple"}],
  "data": "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000060000000000000000000000000cb00cde33a7a0fba30c63745534f1f7ae607076b00000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000c5269636b2053616e6368657a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000157269636b2e63313337406369746164656c2e636663000000000000000000000000000000000000000000000000000000000000000000000000000000000000112b31202835353529203331342d31353933000000000000000000000000000000",
  "topics": [
    "0x000000000000000000000000cb00cde33a7a0fba30c63745534f1f7ae607076b"
  ]
}

It throws following error,

TypeError: Cannot read properties of undefined (reading '0')
    at formatDecodedObject (node_modules/web3-eth-abi/dist/api/parameters_api.js:20:55)
    at formatDecodedObject (node_modules/web3-eth-abi/dist/api/parameters_api.js:20:22)
    at formatDecodedObject (node_modules/web3-eth-abi/dist/api/parameters_api.js:20:22)
    at decodeParametersWith (node_modules/web3-eth-abi/dist/api/parameters_api.js:79:40)
    at decodeLog (node_modules/web3-eth-abi/dist/api/logs_api.js:20:53)

Web3.js Version

4.0.1-alpha.2

Environment

  • Operating System: Mac
  • Browser: Brave
  • Node.js Version: v18.12.1
  • NPM Version: 8.19.2

Anything Else?

This error was found while migrating the truffle project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

1 participant