Skip to content

Return variable named 'values' not available on the result object #1491

Answered by ricmoo
vanjan asked this question in Q&A
Discussion options

You must be logged in to vote

The result is an Array (with extra keys), and Result objects don’t overwrite properties defined on them (including on the prototype; this would break operations on them). So if a name collides with part of the Array prototype, those keys are dropped and must be accessed positionally.

If you adjust your signature you pass in though, you can resolve this, for example: ABI = [ "function getValues() pure returns (uint8[3] _values, uint8[3] dates)" ].

It looks like you are using Hardhat, (getContractFactory is something they inject; not part of ethers), so I’m not sure how to override the ABI but you could also re-instantiate the contract object via contract = new Contract(contract.address, ab…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ricmoo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1490 on April 21, 2021 13:09.