-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Contract call with tuple is missing param names #5613
Contract call with tuple is missing param names #5613
Conversation
Your Render PR Server URL is https://atweb3js-docs-pr-5613.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-cdopmdpgp3jou2cjj8lg. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works sort of, I was hoping you would solve this: https://github.com/web3/web3.js/blob/4.x/packages/web3-eth-abi/src/types.ts#L193 😜
I've tried to figure it out but seems typescript not supporting dynamic names for the tuples right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its causing many tests to fail in https://github.com/web3/web3.js/actions/runs/3490219406/jobs/5841458348#step:4:176 all these tests should be passing before merging PR.
Even though types should be fixed to support that, it makes more sense to use output param name instead of array index in those tests as it's much more type safer. It might make sense to introduce type only tests for web3-eth-abi package: https://medium.com/front-end-weekly/testing-typescript-types-1595c641d7c7^^ |
I've fixed the types. Now they work in both ways by index and by name. Also, type tests were added. @mpetrunic |
@jdevcs @mconnelly8 Would it make sense to open an issue to create a guide for users explaining how to extract result types from abi (as they will probably need to do something with the result)? Like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add CHANGELOG.md
entries (for root, web3-eth-abi
, and web3-eth-contract
)
Changelogs were added |
* Update CHANGELOG version headers * Contract call with tuple is missing param names (#5613) * call special output type * fix * fix: enable outputs to have param names (#5624) * hot fix * add type if only one param * overloaded inputs types * fix resolver tests * add type tests * simplify types * revert registry unit test * test firefox * revert firefox test * update changelogs Co-authored-by: Marin Petrunić <[email protected]> * Fix `isHex` and `isHexStrict` for some edge cases and enrich their tests (#5655) * Change `isHex` to return true for negative numbers (for example `-123`) * Change both `isHex` and `isHexStrict` to return `false` for `-0x` * Change `isHex` to return `false` for empty strings ''. * Remove erroneous set provider code for Contract constructor (#5669) * Remove erroneous set provider code for Contract constructor. Add Contract constructor provider set test * Update CHANGELOGs * Debugging failing integration tests * Apply suggestions from code review * Use getSystemTestProvider instead of hardcoded string * Refactor ternaries in Contract constructor to if statements * Correct CHANGELOG entries * Remove unneeded checks in if statements * Test with injected external providers (#5652) * fix: sending tx with injected provider (#5651) Co-authored-by: Marin Petrunic <[email protected]> * adding a test for using `ganache` provider * enable the jsonrpc `id` to optionally be incremented starting from a number (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46) * test with `in3` as a provider & skip `in3` test if it takes too long * increase integration test timeout at web3 package * add a test for using `hardhat` provider * improve how legacy providers, such as hardhat, is used * implement `isPromise` that works in the browsers * refactor external providers tests * update CHANGELOG.md * Use Error ABI to parse errors when sending a transaction (#5662) * use Error ABI when sending a transaction * update CHANGELOG.md for #5587 * Remove merge conflict marker Co-authored-by: Oleksii Kosynskyi <[email protected]> Co-authored-by: Marin Petrunić <[email protected]> Co-authored-by: Muhammad Altabba <[email protected]> Co-authored-by: jdevcs <[email protected]>
* Version bump and build for v4.0.1-alpha.2 * Release/4.0.1 alpha.2 changelog update 3 (#5689) * Update CHANGELOG version headers * Update CHANGELOGs * Revert package version bump for web3-packagetemplate * Release/4.0.1 alpha.2 merge conflicts (#5692) * Update CHANGELOG version headers * Contract call with tuple is missing param names (#5613) * call special output type * fix * fix: enable outputs to have param names (#5624) * hot fix * add type if only one param * overloaded inputs types * fix resolver tests * add type tests * simplify types * revert registry unit test * test firefox * revert firefox test * update changelogs Co-authored-by: Marin Petrunić <[email protected]> * Fix `isHex` and `isHexStrict` for some edge cases and enrich their tests (#5655) * Change `isHex` to return true for negative numbers (for example `-123`) * Change both `isHex` and `isHexStrict` to return `false` for `-0x` * Change `isHex` to return `false` for empty strings ''. * Remove erroneous set provider code for Contract constructor (#5669) * Remove erroneous set provider code for Contract constructor. Add Contract constructor provider set test * Update CHANGELOGs * Debugging failing integration tests * Apply suggestions from code review * Use getSystemTestProvider instead of hardcoded string * Refactor ternaries in Contract constructor to if statements * Correct CHANGELOG entries * Remove unneeded checks in if statements * Test with injected external providers (#5652) * fix: sending tx with injected provider (#5651) Co-authored-by: Marin Petrunic <[email protected]> * adding a test for using `ganache` provider * enable the jsonrpc `id` to optionally be incremented starting from a number (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46) * test with `in3` as a provider & skip `in3` test if it takes too long * increase integration test timeout at web3 package * add a test for using `hardhat` provider * improve how legacy providers, such as hardhat, is used * implement `isPromise` that works in the browsers * refactor external providers tests * update CHANGELOG.md * Use Error ABI to parse errors when sending a transaction (#5662) * use Error ABI when sending a transaction * update CHANGELOG.md for #5587 * Remove merge conflict marker Co-authored-by: Oleksii Kosynskyi <[email protected]> Co-authored-by: Marin Petrunić <[email protected]> Co-authored-by: Muhammad Altabba <[email protected]> Co-authored-by: jdevcs <[email protected]> * Release patch/4.0.1 alpha.2/solve merge conflicts (#5697) * Update CHANGELOG version headers * Remove merge conflict markers * Remove double CHANGELOG entry Co-authored-by: Oleksii Kosynskyi <[email protected]> Co-authored-by: Marin Petrunić <[email protected]> Co-authored-by: Muhammad Altabba <[email protected]> Co-authored-by: jdevcs <[email protected]>
Description
#5504
Checklist for 4.x:
yarn
successfullyyarn lint
successfullyyarn build:web
successfullyyarn test:unit
successfullyyarn test:integration
successfullycompile:contracts
successfullyCHANGELOG.md
file in the packages I have edited.