Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function onInit() {
- await window.ethereum.enable();
- web3.eth.getAccounts(function (error, accounts) {
- console.log(accounts[0], 'current account on init');
- });
- // Acccounts now exposed
- window.ethereum.on('accountsChanged', function () {
- web3.eth.getAccounts(function (error, accounts) {
- console.log(accounts[0], 'current account after account change');
- });
- });
- }
- onInit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement