yours-org/yours-wallet

emit when switching network

Closed this issue ยท 2 comments

Hi team,

Would it be possible to support emitting signals when switching the network in the wallet?

It would be great if a front-end app could be notified when the wallet network is changed. ๐Ÿ˜„

It looks like this was originally fixed but would need to be re-introduced after v4.0.0 release as it only supports emitting switchAccount and signedOut events

@gitzhou After looking into this, in v4.0+ this doesn't apply as the notion of switching networks no longer exists. Instead, you can listen for the switchAccount event and then call getNetwork() or look at the address format to determine if the address is mainnet or testnet.

https://app.gitbook.com/o/k6HnSOibnJKs9gyXDEwI/s/8h5PbVdOLZTSAZHevtG0/the-basics/events