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

30 lines
653 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-21 06:59:33 -08:00
program = utils.configureCommander(program);
2015-02-15 13:52:48 -08:00
program
.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);
});
});