-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Unexpected behavior if staticCall returns an empty array #4036
Labels
bug
Verified to be an issue.
fixed/complete
This Bug is fixed or Enhancement is complete and published.
v6
Issues regarding v6
Comments
Another way to reproduce this is just simply use the Result: import { Result } from 'ethers';
const emptyArray = new Result();
const mappedEmptyArray = emptyArray.map((index) => index.toString());
console.log('pre map length:', emptyArray.length); // 0
console.log('post map length:', mappedEmptyArray.length); // 1
console.log('pre map:', emptyArray); // []
console.log('post map:', mappedEmptyArray); // [0] Output:
|
Confirmed as a bug. Fixed locally and I'll get a fix published shortly. |
ricmoo
added a commit
that referenced
this issue
May 18, 2023
Fixed in v6.4.0. Let me know if you have any more issues. Thanks! :) |
Woodpile37
pushed a commit
to Woodpile37/ethers.js
that referenced
this issue
Jan 14, 2024
Woodpile37
pushed a commit
to Woodpile37/ethers.js
that referenced
this issue
Jan 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Verified to be an issue.
fixed/complete
This Bug is fixed or Enhancement is complete and published.
v6
Issues regarding v6
Ethers Version
6.3.0
Search Terms
abi, empty array, decoder
Describe the Problem
If a staticCall returns an empty array (let's call it
arr
). Thearr.map(...).length
will have the length of 1, which is not correct.I think it has something to do with the
Result
class here.Code Snippet
Contract ABI
['function rewardIndexesStored() external view returns (uint256[] memory indexes)']
Errors
No response
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer)
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: