0

I'm not sure if this question makes sense or if I'm looking at things correctly but it's coming from my understanding that ethersjs is an abstraction on top of MetaMask (and other providers)...

I've been able to get events from ethereum.on('chainChanged') and ethereum.on('accountsChanged') but I'm wondering if there is a way to do this through the ethersjs events or interface.

1
0

I don't see any official document for that in https://docs.ethers.io/

The way I do is to listen to chainChanged event directly from external Web3provider.

ethers.providers.Web3Provider(window.ethereum).provider.on('chainChanged')

ethers.providers.Web3Provider(window.ethereum).provider.on('accountsChanged')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.