|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
var _ = require('lodash');
|
|
|
|
var program = require('commander');
|
|
|
|
|
|
|
|
var ClientLib = require('../lib/clientlib.js');
|
|
|
|
var common = require('./common');
|
|
|
|
|
|
|
|
program
|
|
|
|
.version('0.0.1')
|
|
|
|
.option('-c, --config [file]', 'Wallet config filename')
|
|
|
|
.option('-v, --verbose', 'be verbose')
|
|
|
|
.parse(process.argv);
|
|
|
|
|
|
|
|
var args = program.args;
|
|
|
|
var cli = new ClientLib({
|
|
|
|
filename: program.config
|
|
|
|
});
|
|
|
|
|
|
|
|
cli.status(function(err, res) {
|
|
|
|
common.die(err);
|
|
|
|
|
|
|
|
var x = res.wallet;
|
|
|
|
console.log('* Wallet %s [%s]: %d-%d %s ', x.name, x.isTestnet ? 'testnet' : 'livenet', 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] %d => %s", common.shortID(x.id),x.amount, x.toAddress);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (program.verbose)
|
|
|
|
console.log('* Raw Server Response:\n', res); //TODO
|
|
|
|
});
|