assign addressTo and labelTo on outgoing txs only
This commit is contained in:
parent
7a349d7419
commit
9fdf06c28c
1 changed files with 13 additions and 6 deletions
|
|
@ -1323,7 +1323,10 @@ Wallet.prototype.getPendingTxProposals = function() {
|
||||||
});
|
});
|
||||||
txp.outs = [];
|
txp.outs = [];
|
||||||
_.each(addresses, function(value, address) {
|
_.each(addresses, function(value, address) {
|
||||||
txp.outs.push({address: address, value: value * satToUnit});
|
txp.outs.push({
|
||||||
|
address: address,
|
||||||
|
value: value * satToUnit
|
||||||
|
});
|
||||||
});
|
});
|
||||||
// extra fields
|
// extra fields
|
||||||
txp.fee = txp.builder.feeSat * satToUnit;
|
txp.fee = txp.builder.feeSat * satToUnit;
|
||||||
|
|
@ -2931,12 +2934,16 @@ Wallet.prototype.getTransactionHistory = function(opts, cb) {
|
||||||
tx.action = amount > 0 ? 'sent' : 'received';
|
tx.action = amount > 0 ? 'sent' : 'received';
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstOut = _.findWhere(items, {
|
if (tx.action == 'sent' || tx.action == 'moved') {
|
||||||
type: 'out'
|
var firstOut = _.findWhere(items, {
|
||||||
});
|
type: 'out'
|
||||||
|
});
|
||||||
|
if (firstOut) {
|
||||||
|
tx.labelTo = firstOut.label;
|
||||||
|
tx.addressTo = firstOut.address;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
tx.labelTo = firstOut ? firstOut.label : undefined;
|
|
||||||
tx.addressTo = firstOut ? firstOut.address : undefined;
|
|
||||||
tx.amountSat = Math.abs(amount);
|
tx.amountSat = Math.abs(amount);
|
||||||
tx.amount = tx.amountSat * satToUnit;
|
tx.amount = tx.amountSat * satToUnit;
|
||||||
tx.minedTs = !_.isNaN(tx.time) ? tx.time * 1000 : undefined;
|
tx.minedTs = !_.isNaN(tx.time) ? tx.time * 1000 : undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue