Open kubarenatioN opened 3 weeks ago
Moreover, similar issue have already happened to another dev. He asked about it here, but get no response - https://github.com/ethers-io/ethers.js/issues/2842#issuecomment-1126837212
Also, I found this issue - https://github.com/ethers-io/ethers.js/issues/1396
There we have some explanation on usage of .on('network', () => {})
, but still, my original question is about that it doesn't work as intended, or I'm missing some details...
Waiting for some help. By the way, thanks for your great work!
Having this issue too with version 6.13.4
Ethers Version
6.13.4
Search Terms
network event listening
Describe the Problem
Well, I'm just subscribing to provider network change event (using
.on('network')
) and nothing is emitting when I change network in my Metamask wallet interface. When subscribing viawindow.ethereum.on('chainChanged', () => {})
and switching network, the callback is executed.I'm using hardhat localhost network and Sepolia test network with deployed contract, but as I see, the issue is in provider itself.
Please, help me to understand the issue and resolve it.
Repo with source code (App.tsx,
initWeb3
function) - https://github.com/kubarenatioN/dElection/commit/e1efb2c8c4e6bda8e4df2099e7ede2cb8385aca2#diff-e56cb91573ddb6a97ecd071925fe26504bb5a65f921dc64c63e534162950e1ebR53Code Snippet
Contract ABI
No response
Errors
No response
Environment
Browser (Chrome, Safari, etc)
Environment (Other)
Metamask Wallet