Skip to content

Instantly share code, notes, and snippets.

@ylv-io
Last active January 14, 2019 12:09
Show Gist options
  • Save ylv-io/99bacf49200a3cf8ec0d21419cfe2dd8 to your computer and use it in GitHub Desktop.
Save ylv-io/99bacf49200a3cf8ec0d21419cfe2dd8 to your computer and use it in GitHub Desktop.
// web3 has to be injected/present
if (web3js) {
if (web3js.eth.accounts.length) {
// if not locked, get account
const account = web3js.eth.accounts[0];
// updates UI, state, pull data
} else {
// locked. update UI. Ask user to unlock.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment