You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.5 KiB

10 years ago
#!/usr/bin/env node
10 years ago
var _ = require('lodash');
10 years ago
var program = require('commander');
var utils = require('./cli-utils');
10 years ago
program
.version('0.0.1')
.option('-c, --config [file]', 'Wallet config filename')
10 years ago
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
.option('-v, --verbose', 'be verbose')
10 years ago
.parse(process.argv);
var args = program.args;
var client = utils.getClient(program);
10 years ago
client.getStatus(function(err, res) {
utils.die(err);
10 years ago
10 years ago
var x = res.wallet;
console.log('* Wallet %s [%s]: %d-%d %s ', x.name, x.network, x.m, x.n, x.status);
10 years ago
if (x.status != 'complete')
console.log(' Missing copayers:', x.n - x.copayers.length);
console.log('* Copayers:', _.pluck(x.copayers,'name').join(', '));
10 years ago
var x = res.balance;
10 years ago
console.log('* Balance %dSAT (Locked: %dSAT)', x.totalAmount, x.lockedAmount);
10 years ago
10 years ago
if (!_.isEmpty(res.pendingTxps)) {
10 years ago
console.log("* TX Proposals:")
10 years ago
_.each(res.pendingTxps, function(x) {
10 years ago
missingSignatures = x.requiredSignatures - _.filter(_.values(x.actions), function (a) { return a.type == 'accept'; }).length;
console.log("\t%s [\"%s\" by %s] %dSAT => %s", utils.shortID(x.id), x.message, x.creatorName, x.amount, x.toAddress);
10 years ago
if (!_.isEmpty(x.actions)) {
10 years ago
console.log('\t\tActions: ', _.map(x.actions, function(a) {
return a.copayerName + ' ' + (a.type == 'accept' ? '✓' : '✗') + (a.comment ? ' (' + a.comment + ')' : '');
10 years ago
}).join('. '));
}
10 years ago
console.log('\t\tMissing signatures: ' + missingSignatures);
10 years ago
});
}
10 years ago
});