torusresearch/torus-embed

Events for wallet disconnect

Closed this issue · 4 comments

I'd like a way to listen for disconnect events. If someone leaves a tab open over night the wallet can disconnect, but the app doesn't have a way to hear the disconnect and respond.

Describe the solution you'd like
I think the normal metamask way is to listen to 'accountsChanged' on the provider (btw, typescript types don't have 'on' defined). It seems like accountsChanged only fires on connect with the current wallet.

Describe alternatives you've considered
It looks like somewhere in the code it is firing a 'disconnect' but that isn't happening at logout at least.

Same problem: #421

ptrf commented

Bump!

This issue is resolved, It now emits accountsChanged on logout. Thanks,