humanwhoexplores / smart-contracts

this repo contains my workbook for practicing smart contracts
0 stars 0 forks source link

How to find Balance of a Account #13

Closed humanwhoexplores closed 3 years ago

humanwhoexplores commented 3 years ago

`beforeEach(async () => { // beforeEach runs before running each test // Get a list of all accounts accounts = await web3.eth.getAccounts();

inbox = await new web3.eth.Contract(JSON.parse(interface))
    .deploy({data : bytecode, arguments: ['Inbox contract']})
    .send({from: accounts[0], gas: '1000000'})

let balance = await web3.eth.getBalance(accounts[0]);
console.log("The balance is ", balance);   

});`

accounts[0] is the address of account

humanwhoexplores commented 3 years ago

The current balance for the given address in wei.