|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
var _ = require('lodash');
|
|
|
|
var fs = require('fs');
|
|
|
|
var moment = require('moment');
|
|
|
|
var program = require('commander');
|
fix bit cmds: address, addresses, balance, broadcast, confirm, history, reject, rm, send, sign, status & txproposals
10 years ago
|
|
|
var utils = require('./cli-utils');
|
|
|
|
program = utils.configureCommander(program);
|
|
|
|
|
|
|
|
program
|
|
|
|
.parse(process.argv);
|
|
|
|
|
|
|
|
var args = program.args;
|
|
|
|
|
fix bit cmds: address, addresses, balance, broadcast, confirm, history, reject, rm, send, sign, status & txproposals
10 years ago
|
|
|
utils.getClient(program, function (client) {
|
|
|
|
client.getTxHistory({}, function (err, txs) {
|
|
|
|
if (_.isEmpty(txs))
|
|
|
|
return;
|
|
|
|
|
|
|
|
console.log("* TX History:")
|
|
|
|
|
|
|
|
_.each(txs, function(tx) {
|
|
|
|
var time = moment(tx.time * 1000).fromNow();
|
|
|
|
var amount = utils.renderAmount(tx.amount);
|
|
|
|
var confirmations = tx.confirmations || 0;
|
|
|
|
var proposal = tx.proposalId ? '["' + tx.message + '" by ' + tx.creatorName + '] ' : '';
|
|
|
|
switch (tx.action) {
|
|
|
|
case 'received':
|
|
|
|
direction = '<=';
|
|
|
|
break;
|
|
|
|
case 'moved':
|
|
|
|
direction = '==';
|
|
|
|
break;
|
|
|
|
case 'sent':
|
|
|
|
direction = '=>';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("\t%s: %s %s %s %s(%s confirmations)", time, direction, tx.action, amount, proposal, confirmations);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|