Created
April 7, 2020 11:48
-
-
Save alexroan/9e514cb142a40ba03f91141610c343d1 to your computer and use it in GitHub Desktop.
accountsChanged.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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