added comment from proposal if available

This commit is contained in:
Ivan Socolsky 2014-10-23 12:05:10 -03:00 committed by Matias Alejo Garcia
commit d44b56d564
2 changed files with 54 additions and 0 deletions

View file

@ -2917,6 +2917,7 @@ Wallet.prototype.getTransactionHistory = function(cb) {
var self = this;
var addresses = self.getAddressesInfo();
var proposals = self.getTxProposals();
var satToUnit = 1 / self.settings.unitToSatoshi;
function extractInsOuts(tx) {
@ -2997,6 +2998,12 @@ Wallet.prototype.getTransactionHistory = function(cb) {
var firstOut = _.findWhere(items, {
type: 'out'
});
var proposal = _.findWhere(proposals, {
ntxid: tx.txid
});
tx.comment = proposal ? proposal.comment : undefined;
tx.labelTo = firstOut ? firstOut.label : undefined;
tx.amountSat = Math.abs(amount);
tx.amount = tx.amountSat * satToUnit;