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 <address> <amount in ether>
This commit is contained in:
bumi 2018-04-02 16:53:25 +02:00
parent d9ece98ffa
commit 8301514c64

11
scripts/send-funds.js Normal file
View File

@ -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);
}