From 8301514c6442d64ed2e59bbe86dc113eb513c3e9 Mon Sep 17 00:00:00 2001 From: bumi Date: Mon, 2 Apr 2018 16:53:25 +0200 Subject: [PATCH] Add script to send funds from the main account Helpful in development mode using ganache to fund another account usage: truffle exec scripts/send-funds.js
--- scripts/send-funds.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 scripts/send-funds.js diff --git a/scripts/send-funds.js b/scripts/send-funds.js new file mode 100644 index 0000000..e32287a --- /dev/null +++ b/scripts/send-funds.js @@ -0,0 +1,11 @@ + +module.exports = function(cb) { + let recipient = process.argv[4]; + if (!recipient) { + console.log('Please provide a recipient address'); + process.exit(); + } + let amount = parseInt(process.argv[5]) || 1; + console.log(recipient); + web3.eth.sendTransaction({to: recipient, value: web3.toWei(amount), from: web3.eth.accounts[0]}, console.log); +}