diff --git a/cli.js b/cli.js index 2ac2a21..af54652 100755 --- a/cli.js +++ b/cli.js @@ -42,16 +42,19 @@ function toHex(number, length = 32) { /** Display ETH account balance */ async function printETHBalance({ address, name }) { - console.log(`${name} balance is`, web3.utils.fromWei(await web3.eth.getBalance(address)),`${netSymbol}`) + const checkBalance = await web3.eth.getBalance(address) + console.log(`${name} balance is`, web3.utils.fromWei(checkBalance),`${netSymbol}`) } /** Display ERC20 account balance */ async function printERC20Balance({ address, name, tokenAddress }) { const erc20ContractJson = require('./build/contracts/ERC20Mock.json') erc20 = tokenAddress ? new web3.eth.Contract(erc20ContractJson.abi, tokenAddress) : erc20 - balance = await erc20.methods.balanceOf(address).call() - decimals = await erc20.methods.decimals().call() - console.log(`${name}`,(await erc20.methods.name().call()),`Token Balance is`,toDecimals(balance, decimals, (balance.length + decimals)).toString().replace(/\B(?