add proposal info

This commit is contained in:
Ivan Socolsky 2015-02-23 17:15:38 -03:00
parent 63ac70b50f
commit c42205c1de
2 changed files with 4 additions and 1 deletions

View File

@ -25,6 +25,7 @@ client.getTxHistory({}, function (err, txs) {
var time = moment(tx.time * 1000).fromNow(); var time = moment(tx.time * 1000).fromNow();
var amount = Utils.renderAmount(tx.amount); var amount = Utils.renderAmount(tx.amount);
var confirmations = tx.confirmations || 0; var confirmations = tx.confirmations || 0;
var proposal = tx.proposalId ? '["' + tx.message + '" by ' + tx.creatorName + '] ' : '';
switch (tx.action) { switch (tx.action) {
case 'received': case 'received':
direction = '<='; direction = '<=';
@ -37,6 +38,6 @@ client.getTxHistory({}, function (err, txs) {
break; break;
} }
console.log("\t%s: %s %s %s (%s confirmations)", time, direction, tx.action, amount, confirmations); console.log("\t%s: %s %s %s %s(%s confirmations)", time, direction, tx.action, amount, proposal, confirmations);
}); });
}); });

View File

@ -951,6 +951,8 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
var proposal = indexedProposals[tx.txid]; var proposal = indexedProposals[tx.txid];
if (proposal) { if (proposal) {
tx.proposalId = proposal.id;
tx.creatorName = proposal.creatorName;
tx.message = proposal.message; tx.message = proposal.message;
tx.actions = _.map(proposal.actions, function(action) { tx.actions = _.map(proposal.actions, function(action) {
return _.pick(action, ['createdOn', 'type', 'copayerId', 'copayerName', 'comment']); return _.pick(action, ['createdOn', 'type', 'copayerId', 'copayerName', 'comment']);