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

WalletConnectConnector cannot automatically switch the rpc when the first time connecting other supported chainId

Open RodeRickIsWatching opened this issue 3 years ago • 5 comments
trafficstars

I've set the default ChainId in 137, and Set the chainId in my wallet is 421611, after activating the WalletConnectConnector, it seems strange. Seeing the pic. image

I think the rpc should also changed like the chainId does, but it doesnt But it do can auto switch the rpc with its related chainId after refreshing the page.

Does anyone meet the same problem?

And my settings is here, version "@web3-react/walletconnect-connector": "^7.0.2-alpha.0", image

RodeRickIsWatching avatar Jul 05 '22 21:07 RodeRickIsWatching

I'm also facing the very same issue. I'm providing the goerli test network as rpc, but it's getting Ethereum mainnet the first time. After a refresh, it gets the correct one. Any solution?

bigbluespace avatar Aug 12 '22 09:08 bigbluespace

We are facing the same issue. A "workaround" is to call activate, deactivate, and activate again. But the UX requires multiple scans of QR code on the wallet connect device. The connector has the correct chain id in sync with phone but the rpc url for the http provider is never updated away from its original default chain id url.

mdcoon avatar Sep 08 '22 13:09 mdcoon

So, have the official developers of the library solved this bug, or do you have a solution? I look forward to sharing

supermars01 avatar Sep 09 '22 02:09 supermars01

Just provide a chainId in WalletConnectConnector constructor object.

Should be like this, works for me: Screenshot 2022-10-03 at 19 49 20

7JUMPER7 avatar Oct 03 '22 16:10 7JUMPER7

Just provide a chainId in WalletConnectConnector constructor object.

Should be like this, works for me: Screenshot 2022-10-03 at 19 49 20

This breaks something else. If you have two chains it won't work

export const walletconnect = new WalletConnectConnector({
    rpc: {
    1: RPC_URLS[1],
    56: RPC_URLS[56] 
    },
    chainId: 1,
    qrcode: true
})

And don't try chainId: [1,56] or whatever, it won't work. It will still default to ethereum for some reasons. I'm tired of this issue from @web3-react and it has been going on forever with no intention to being fixed

iulianivg avatar Dec 17 '22 23:12 iulianivg