wagmi icon indicating copy to clipboard operation
wagmi copied to clipboard

bug: lots of requests on arbitrum

Open chillichelli opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Package Version

0.5.12

Current Behavior

If your wallet is connected to arbitrum and you connect on the app using the InjectedConnector, I see a lot of network requests being fired by useContractReads whereas if im connected to Ethereum but pass chainId: 42161, theres only a couple.

Expected Behavior

I would expect the same amount of requests being fired

Steps To Reproduce

On the sandbox press connect and use the console network inspector to see the requests being fired.

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

https://codesandbox.io/s/quizzical-goldwasser-6lwu14?file=/src/App.js

Anything else?

No response

chillichelli avatar Sep 17 '22 15:09 chillichelli

More minimal example here:

https://codesandbox.io/s/nervous-ben-i3fhfn?file=/src/App.js

You have to connect wallet and make sure you're on Arbitrum.

A single balanceOf call proxied via useContractReads results in 16 requests,

1 eth_blockNumber and 15 duplicate eth_calls. I'd expect in this case to only see a maximum of 2 requests?

This gets out of hand quickly when you have large multicall requests, or multiple useContractReads on a single page.

matthewlilley avatar Sep 18 '22 14:09 matthewlilley

Fixed in 0.6.7.

jxom avatar Oct 19 '22 02:10 jxom

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 wagmi version. If you have any other comments you can create a new discussion.

github-actions[bot] avatar Jan 16 '24 00:01 github-actions[bot]