Uniswap / web3-react

A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
https://web3-react-mu.vercel.app/
GNU General Public License v3.0
5.52k stars 1.52k forks source link

Fails first call, when calling a contract, walletconnect #645

Open glitch-txs opened 2 years ago

glitch-txs commented 2 years ago

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

asimashfaq commented 1 year ago

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.

Sotatek-HiepNguyen2 commented 1 year ago

any update here? I faced the same problem

kelvin0x commented 1 year ago

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