forked from bitpay/bitcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallet-status
executable file
·36 lines (27 loc) · 1.07 KB
/
wallet-status
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env node
var _ = require('lodash');
var program = require('commander');
var utils = require('./cli-utils');
program = utils.configureCommander(program);
program
.option('-v, --verbose', 'Show wallet raw data')
.parse(process.argv);
var args = program.args;
utils.getClient(program, { mustExist: true }, function (client) {
client.getStatus({}, function(err, res) {
utils.die(err);
var x = res.wallet;
console.log('* Wallet %s [%s]: %d-of-%d %s Coin:%s ', x.name, x.network, x.m, x.n, x.status, x.coin);
if (x.status != 'complete') {
console.log(' Missing copayers:', x.n - x.copayers.length);
console.log(' Wallet secret:', x.secret);
}
console.log('* Copayers:', _.map(x.copayers,'name').join(', '));
if (program.verbose) {
console.log('* Wallet Raw Data:', x);
}
var x = res.balance;
console.log('* Balance %s (Locked: %s)', utils.renderAmount(x.totalAmount, client.credentials.coin), utils.renderAmount(x.lockedAmount, client.credentials.coin));
utils.renderTxProposals(res.pendingTxps);
});
});