window.ethereum.on('accountsChanged', function (accounts) {
// Time to reload your interface with accounts[0]!
})
window.ethereum.on('networkChanged', function (networkId) {
// Time to reload your interface with the new networkId
})
var account = web3.eth.accounts[0];
var accountInterval = setInterval(function() {
if (web3.eth.accounts[0] !== account) {
account = web3.eth.accounts[0];
updateInterface();
}
}, 100);
window.ethereum.on('accountsChanged', function (accounts) {
// Time to reload your interface with accounts[0]!
})