retrieving label from address book
This commit is contained in:
parent
6e2ade54bc
commit
b6f5b342f2
3 changed files with 54 additions and 11 deletions
|
|
@ -82,16 +82,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
}
|
||||
|
||||
$scope.showAddressBook = function() {
|
||||
var flag;
|
||||
if (w) {
|
||||
for (var k in w.addressBook) {
|
||||
if (w.addressBook[k]) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
return w && _.keys(w.addressBook).length > 0;
|
||||
};
|
||||
|
||||
if ($rootScope.pendingPayment) {
|
||||
|
|
|
|||
|
|
@ -2943,11 +2943,13 @@ Wallet.prototype.getTransactionHistory = function(cb) {
|
|||
addressStr: itemAddr,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'out',
|
||||
address: addr ? addr : itemAddr,
|
||||
isMine: !_.isUndefined(addr),
|
||||
isChange: addr ? !!addr.isChange : false,
|
||||
label: self.addressBook[itemAddr] ? self.addressBook[itemAddr].label : undefined,
|
||||
amountSat: parseInt((item.value * bitcore.util.COIN).toFixed(0)),
|
||||
}
|
||||
});
|
||||
|
|
@ -2986,13 +2988,16 @@ Wallet.prototype.getTransactionHistory = function(cb) {
|
|||
var amount;
|
||||
if (amountIn == (amountOut + amountOutChange + (amountIn > 0 ? fees : 0))) {
|
||||
tx.action = 'moved';
|
||||
// TODO: subtract amount from change addresses
|
||||
amount = amountOut;
|
||||
} else {
|
||||
amount = amountIn - amountOut - amountOutChange - (amountIn > 0 ? fees : 0);
|
||||
tx.action = amount > 0 ? 'sent' : 'received';
|
||||
}
|
||||
|
||||
var firstOut = _.findWhere(items, {
|
||||
type: 'out'
|
||||
});
|
||||
tx.labelTo = firstOut ? firstOut.label : undefined;
|
||||
tx.amountSat = Math.abs(amount);
|
||||
tx.amount = tx.amountSat * satToUnit;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue