bitcore-wallet-service/bit-wallet/bit-send

34 lines
853 B
Plaintext
Raw Normal View History

2015-02-13 07:45:05 -08:00
#!/usr/bin/env node
var program = require('commander');
2015-02-13 10:49:47 -08:00
var ClientLib = require('../lib/clientlib.js');
2015-02-13 07:45:05 -08:00
var common = require('./common');
program
.version('0.0.1')
2015-02-13 11:57:28 -08:00
.option('-c, --config [file]', 'Wallet config filename')
.option('-v, --verbose', 'be verbose')
2015-02-13 07:45:05 -08:00
.usage('[options] <address> <amount> <message>')
.parse(process.argv);
var args = program.args;
if (!args[0] || !args[1] || !args[2])
program.help();
var address = args[0];
var amount = args[1];
var message = args[2];
2015-02-13 11:07:47 -08:00
var cli = new ClientLib({
filename: program.config
2015-02-13 07:45:05 -08:00
});
2015-02-13 08:35:20 -08:00
cli.send({toAddress: address, amount: amount, message:message}, function(err, x) {
2015-02-13 07:45:05 -08:00
common.die(err);
2015-02-13 08:35:20 -08:00
console.log(' * Tx created: ID %s [%s] RequiredSignatures:',
2015-02-13 11:07:47 -08:00
x.id, x.status, x.requiredSignatures);
2015-02-13 08:35:20 -08:00
if (program.verbose)
2015-02-13 11:07:47 -08:00
console.log('* Raw Server Response:\n', x); //TODO
});