Last active
December 20, 2017 02:22
-
-
Save devonwesley/2c257819c318d0cb083368ba671f11b1 to your computer and use it in GitHub Desktop.
This snippet of code is for the blog series that i am writing.
This file contains 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
function getAccounts() { | |
const ethAccount = web3.eth.accounts[0] | |
return document | |
.getElementById('account-addresses') | |
.innerHTML = `<div> | |
Account: ${ethAccount} | |
<br /> | |
Balance: ${balanceInEth(ethAccount)} | |
</div> | |
` | |
} | |
function balanceInEth(address) { | |
return web3.fromWei(web3.eth.getBalance(address).toString(), 'ether') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment