Scenario…
- User has connected two accounts to our DAPP via MetaMask.
- User disconnects the currently active account.
- User still has their other connected account but it isn’t active in MetaMask.
In our DAPP we’re listening for changes like this.
useEffect(() => { if (!window.ethereum) return; const onAccountsChange = (connectedAddresses) => { props.setActiveAddress(connectedAddresses[0]); }; window.ethereum.on('accountsChanged', onAccountsChange); return () => { window.ethereum.off('accountsChanged', onAccountsChange); }; }, []);
This works great for switching accounts, but in the scenario above, it will setActiveAddress
to the other connected account even though it isn’t actually active in MetaMask.
In our DAPP we’d like to tell the user "Please open MetaMask and activate " to remove a small layer of possible confusion.
Is this possible?