Add more information output to the send funds helper

This commit is contained in:
bumi 2019-04-01 11:52:56 +02:00
parent 9512ba4334
commit 61fa26da7a

View File

@ -5,9 +5,22 @@ module.exports = async function(callback) {
let amount = await promptly.prompt('Amount: ', {default: '1'}); let amount = await promptly.prompt('Amount: ', {default: '1'});
amount = parseInt(amount); amount = parseInt(amount);
console.log(`sending ${amount} ETH from ${web3.eth.accounts[0]} to ${recipient}`); let fromAccount = web3.eth.accounts[0];
let fromBalance = await web3.eth.getBalance(fromAccount);
let recipientBalance = await web3.eth.getBalance(recipient);
web3.eth.sendTransaction({to: recipient, value: web3.toWei(amount), from: web3.eth.accounts[0]}, console.log); console.log('--------------');
console.log(`sender account balance ${fromAccount}: ${fromBalance}`);
console.log(`recipient account balance ${recipient}: ${recipientBalance}`);
console.log(`\nsending ${amount} ETH from ${web3.eth.accounts[0]} to ${recipient}`);
let transaction = await web3.eth.sendTransaction({to: recipient, value: web3.toWei(amount), from: web3.eth.accounts[0]});
console.log(`transaction id: ${transaction}`);
recipientBalance = await web3.eth.getBalance(recipient);
console.log(`\nnew recipient account balance ${recipient}: ${recipientBalance}`);
callback(); callback();
} }