|
|
@ -1420,13 +1420,18 @@ WalletService.prototype.getTxHistory = function(opts, cb) { |
|
|
|
var now = Math.floor(Date.now() / 1000); |
|
|
|
|
|
|
|
return _.map(txs, function(tx) { |
|
|
|
|
|
|
|
var amountIn, amountOut, amountOutChange; |
|
|
|
var amount, action, addressTo; |
|
|
|
|
|
|
|
if (tx.outputs.length || tx.inputs.length) { |
|
|
|
|
|
|
|
var inputs = classify(tx.inputs); |
|
|
|
var outputs = classify(tx.outputs); |
|
|
|
|
|
|
|
var amountIn = sum(inputs, true); |
|
|
|
var amountOut = sum(outputs, true, false); |
|
|
|
var amountOutChange = sum(outputs, true, true); |
|
|
|
var amount, action, addressTo; |
|
|
|
amountIn = sum(inputs, true); |
|
|
|
amountOut = sum(outputs, true, false); |
|
|
|
amountOutChange = sum(outputs, true, true); |
|
|
|
if (amountIn == (amountOut + amountOutChange + (amountIn > 0 ? tx.fees : 0))) { |
|
|
|
amount = amountOut; |
|
|
|
action = 'moved'; |
|
|
@ -1442,6 +1447,10 @@ WalletService.prototype.getTxHistory = function(opts, cb) { |
|
|
|
}); |
|
|
|
addressTo = firstExternalOutput ? firstExternalOutput.address : 'N/A'; |
|
|
|
}; |
|
|
|
} else { |
|
|
|
action = 'invalid'; |
|
|
|
amount = 0; |
|
|
|
} |
|
|
|
|
|
|
|
var newTx = { |
|
|
|
txid: tx.txid, |
|
|
|