Skip to content

Instantly share code, notes, and snippets.

@alexroan
Created April 7, 2020 11:48
Show Gist options
  • Save alexroan/9e514cb142a40ba03f91141610c343d1 to your computer and use it in GitHub Desktop.
Save alexroan/9e514cb142a40ba03f91141610c343d1 to your computer and use it in GitHub Desktop.
accountsChanged.js
async function getAccount() {
const accounts = await ethereum.enable();
const account = accounts[0];
// do something with new account here
}
ethereum.on('accountsChanged', function (accounts) {
getAccount();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment