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

40 lines
888 B
JavaScript
Executable File

#!/usr/bin/env node
var _ = require('lodash');
var program = require('commander');
var Client = require('../lib/client');
var common = require('./common');
program
.version('0.0.1')
.option('-c,--config [file]', 'Wallet config filename')
.option('-v,--verbose', 'be verbose')
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.usage('[options] <txpid>')
.parse(process.argv);
var args = program.args;
if (!args[0])
program.help();
var txpid = args[0];
var cli = new Client({
filename: program.config
});
cli.getTxProposals({}, function(err, txps) {
common.die(err);
if (program.verbose)
console.log('* Raw Server Response:\n', txps); //TODO
var txp = common.findOneTxProposal(txps, txpid);
cli.removeTxProposal(txp, function(err) {
common.die(err);
console.log('Transaction removed.');
});
});