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

Upgrade from 0.2.8 to 0.3.12 leads to incorrect multicall return results #434

Closed
1 task done
t0rbik opened this issue Apr 30, 2023 · 1 comment · Fixed by #436
Closed
1 task done

Upgrade from 0.2.8 to 0.3.12 leads to incorrect multicall return results #434

t0rbik opened this issue Apr 30, 2023 · 1 comment · Fixed by #436

Comments

@t0rbik
Copy link

t0rbik commented Apr 30, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.2.8 and 0.3.12

Current Behavior

I expect this piece of code to work accordingly to types defined.
As it stands first call in multicall should return type [bigint, bigint]. Unfortunately, after upgrading to 0.3.12 in order to fix incorrect peer deps in wagmi@next, this piece of code throws an error. Bumping back to 0.2.8 fixes it.

const [[lockedAmount, lockedEnd], lockValue, voted] =
            await viemClient.multicall({
              allowFailure: false,
              multicallAddress: CONTRACTS.MULTICALL_ADDRESS,
              contracts: [
                {
                  ...vestingContract,
                  functionName: "locked",
                  args: [tokenIndex],
                },
                {
                  ...vestingContract,
                  functionName: "balanceOfNFT",
                  args: [tokenIndex],
                },
                {
                  ...vestingContract,
                  functionName: "voted",
                  args: [tokenIndex],
                },
              ],
            });

Here's the error message:

TypeError: Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.

Expected Behavior

I expect the piece of code mentioned above return proper multicall results.

Steps To Reproduce

I reckon you can reproduce by making a multicall in which one of calls returns an array of fixed number of elements

Link to Minimal Reproducible Example (StackBlitz, CodeSandbox, GitHub repo etc.)

No response

Anything else?

I think it's related to #398

Types are displayed correctly
Screenshot 2023-04-30 at 4 30 12 pm

I can do a minimal example, but in the nearest future

Copy link
Contributor

github-actions bot commented Jun 3, 2024

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant