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.
42 lines
1.2 KiB
42 lines
1.2 KiB
#!/usr/bin/env node
|
|
|
|
var _ = require('lodash');
|
|
var program = require('commander');
|
|
var utils = require('./cli-utils');
|
|
|
|
program
|
|
.version('0.0.1')
|
|
.option('-c, --config [file]', 'Wallet config filename')
|
|
.option('-h, --host [host]', 'Bitcore Wallet Service URL (eg: http://localhost:3001/copay/api')
|
|
.option('-v, --verbose', 'be verbose')
|
|
.parse(process.argv);
|
|
|
|
var args = program.args;
|
|
var client = utils.getClient(program);
|
|
|
|
client.getStatus(function(err, res) {
|
|
utils.die(err);
|
|
|
|
var x = res.wallet;
|
|
console.log('* Wallet %s [%s]: %d-%d %s ', x.name, x.network, x.m, x.n, x.status);
|
|
|
|
var x = res.balance;
|
|
console.log('* Balance %d (Locked: %d)', x.totalAmount, x.lockedAmount);
|
|
|
|
if (!_.isEmpty(res.pendingTxps)) {
|
|
console.log("* TX Proposals:")
|
|
_.each(res.pendingTxps, function(x) {
|
|
console.log("\t%s [%s by %s] %dSAT => %s", utils.shortID(x.id), x.message, x.creatorName, x.amount, x.toAddress);
|
|
|
|
if (!_.isEmpty(x.actions)) {
|
|
console.log('\t\t * Actions');
|
|
console.log('\t\t', _.map(x.actions, function(a) {
|
|
return a.copayerName + ': ' + a.type + ''
|
|
}).join('. '));
|
|
}
|
|
|
|
if (program.verbose)
|
|
console.log('* Raw Server Response:\n', res); //TODO
|
|
});
|
|
}
|
|
});
|
|
|