web3-react icon indicating copy to clipboard operation
web3-react copied to clipboard

Fails first call, when calling a contract, walletconnect

Open glitch-txs opened this issue 3 years ago • 3 comments
trafficstars

Hi! I'm testing the beta version of web3-react for walletconnect.

I found an issue, when I connect my wallet for the first time and I call a smart contract (like the name of a token or any other function) the call fails and gives an error, but if I refresh the website and reconnect (just by clicking 'connect' it's connected again and doesn't require the QR code scan) and I do the call again it works fine. This only happens the first time I connect a metamask wallet using the QR code. After refreshing the website the issue goes away.

I created a small version repo for web3-react specifically for wallet connect to do some tests. https://github.com/Bright-Glitch/web3-react-walletconnect-protocol

glitch-txs avatar Aug 09 '22 08:08 glitch-txs

This is related to wrong RPC inside the provider. Although the ChainId is correct but RPC is wrong. So RPC is not updated when we connect for the first time.

asimashfaq avatar Sep 20 '22 11:09 asimashfaq

any update here? I faced the same problem

Sotatek-HiepNguyen2 avatar Nov 24 '22 02:11 Sotatek-HiepNguyen2

please check this url if it matches rpc by chainId , if not then update it again const { library } = useWeb3React(); library?.provider?.http?.connection.url this is example

image

kelvin0x avatar Jan 25 '23 20:01 kelvin0x