bitcore-wallet-service/bit-wallet/bit-rm

39 lines
790 B
Plaintext
Raw Normal View History

2015-02-14 07:54:00 -08:00
#!/usr/bin/env node
var _ = require('lodash');
var program = require('commander');
2015-02-15 07:46:38 -08:00
var Client = require('../lib/client');
2015-02-14 07:54:00 -08:00
var common = require('./common');
program
.version('0.0.1')
.option('-c,--config [file]', 'Wallet config filename')
.option('-v,--verbose', 'be verbose')
.usage('[options] <txpid>')
.parse(process.argv);
var args = program.args;
if (!args[0])
program.help();
var txpid = args[0];
2015-02-15 07:46:38 -08:00
var cli = new Client({
2015-02-14 07:54:00 -08:00
filename: program.config
});
2015-02-15 08:03:48 -08:00
cli.getTxProposals({}, function(err, txps) {
2015-02-14 07:54:00 -08:00
common.die(err);
if (program.verbose)
2015-02-15 08:03:48 -08:00
console.log('* Raw Server Response:\n', txps); //TODO
2015-02-14 07:54:00 -08:00
2015-02-15 08:03:48 -08:00
var txp = common.findOneTxProposal(txps, txpid);
2015-02-14 07:54:00 -08:00
2015-02-15 08:03:48 -08:00
cli.removeTxProposal(txp, function(err) {
2015-02-14 07:54:00 -08:00
common.die(err);
2015-02-15 08:03:48 -08:00
console.log('Transaction removed.');
2015-02-14 07:54:00 -08:00
});
});