bitcore-wallet-service/bit-wallet/bit-broadcast

33 lines
824 B
Plaintext
Raw Normal View History

2015-02-15 13:52:48 -08:00
#!/usr/bin/env node
var _ = require('lodash');
var program = require('commander');
var Client = require('../lib/client');
var utils = require('./cli-utils');
2015-02-15 13:52:48 -08:00
program
.version('0.0.1')
.option('-c,--config [file]', 'Wallet config filename')
2015-02-17 15:31:03 -08:00
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v,--verbose', 'be verbose')
.usage('[options] <txpid>')
.parse(process.argv);
2015-02-15 13:52:48 -08:00
var args = program.args;
if (!args[0])
program.help();
var txpid = args[0];
var client = utils.getClient(program);
2015-02-15 13:52:48 -08:00
client.getTxProposals({}, function(err, txps) {
utils.die(err);
2015-02-15 13:52:48 -08:00
var txp = utils.findOneTxProposal(txps, txpid);
client.broadcastTxProposal(txp, function(err, txid) {
utils.die(err);
2015-02-15 14:12:45 -08:00
console.log('Transaction Broadcasted: TXID: ' + x.txid);
});
});