From dedbd9f54385e18645a9ed8e42e3b9ffce341127 Mon Sep 17 00:00:00 2001 From: poma Date: Thu, 18 Jul 2019 00:59:04 +0300 Subject: [PATCH] minor cli update --- cli.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli.js b/cli.js index be4bd69..8a37b0d 100755 --- a/cli.js +++ b/cli.js @@ -34,7 +34,7 @@ async function deposit() { async function getBalance(receiver) { const balance = await web3.eth.getBalance(receiver) - console.log('balance is ', web3.utils.fromWei(balance)) + console.log('Balance is ', web3.utils.fromWei(balance)) } async function withdraw(note, receiver) { @@ -116,6 +116,9 @@ function printHelp(code = 0) { Withdraw a note to 'receiver' account $ ./cli.js withdraw + + Check address balance + $ ./cli.js balance
Example: $ ./cli.js deposit @@ -151,7 +154,8 @@ if (inBrowser) { case 'balance': if (args.length === 2 && /^0x[0-9a-fA-F]{40}$/.test(args[1])) { init().then(() => getBalance(args[1])).then(() => process.exit(0)).catch(err => {console.log(err); process.exit(1)}) - } + } else + printHelp(1) break case 'withdraw': if (args.length === 3 && /^0x[0-9a-fA-F]{128}$/.test(args[1]) && /^0x[0-9a-fA-F]{40}$/.test(args[2])) {