web3modal icon indicating copy to clipboard operation
web3modal copied to clipboard

chainChanged event not detected with WalletConnect

Open RiccardoBiosas opened this issue 4 years ago • 7 comments

When using metamask through the web3Modal walletconnect provider, if I change the network on metamask after successfully connecting to the dapp the client does not appear to detect the chainChanged event.

// Subscribe to chainId change
provider.on("chainChanged", (chainId: number) => {
  console.log(chainId);
});

RiccardoBiosas avatar May 19 '21 18:05 RiccardoBiosas

How to solve this problem?

acrens avatar Aug 25 '21 08:08 acrens

I have tried networkChanged event too, but it only works when I change my wallet address and always gives undefined value. If anyone know any solution can you please help.

HasnainAsif avatar Dec 27 '21 09:12 HasnainAsif

connector.on("session_update", () => {}); doesn't work also

Deokti avatar Dec 28 '21 14:12 Deokti

Looks like it's a MetaMask's problem. https://github.com/MetaMask/metamask-mobile/issues/2927

In Test WalletConnect Wallet it works https://test.walletconnect.org/

Deokti avatar Dec 28 '21 14:12 Deokti

Same issue over here.

moahammadalt avatar Jan 26 '22 14:01 moahammadalt

Do you use ethers or web3js?

The web3js seems to have the events, but not ethers

mburger81 avatar Feb 04 '22 21:02 mburger81

We are using web3js

HasnainAsif avatar Feb 05 '22 10:02 HasnainAsif

With stable version 2.0.0 of Web3Modal now released, we are officially dropping support for version 1.x Due to this this issue/pr was marked for closing. It is highly recommended to upgrade as 2.x will be receiving further updates that will enable functionality for some of our newer sdks like auth and push as well as support for WalletConnect v2 (See this post about WalletConnect v1 being deprecated https://medium.com/walletconnect/walletconnect-v1-0-sunset-notice-and-migration-schedule-8af9d3720d2e)

If you need to continue using Web3Modal 1.x and require this feature/fix implemented, we suggest adding it via forking V1 branch.

xzilja avatar Jan 21 '23 14:01 xzilja