|
|
@ -2490,6 +2490,7 @@ WalletService.prototype._normalizeTxHistory = function(txs) { |
|
|
|
* @param {Object} opts |
|
|
|
* @param {Number} opts.skip (defaults to 0) |
|
|
|
* @param {Number} opts.limit |
|
|
|
* @param {Number} opts.includeExtendedInfo[=false] - Include all inputs/outputs for every tx. |
|
|
|
* @returns {TxProposal[]} Transaction proposals, first newer |
|
|
|
*/ |
|
|
|
WalletService.prototype.getTxHistory = function(opts, cb) { |
|
|
@ -2558,12 +2559,13 @@ WalletService.prototype.getTxHistory = function(opts, cb) { |
|
|
|
amount = 0; |
|
|
|
} |
|
|
|
|
|
|
|
function outputMap(o) { |
|
|
|
function formatOutput(o) { |
|
|
|
return { |
|
|
|
amount: o.amount, |
|
|
|
address: o.address |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var newTx = { |
|
|
|
txid: tx.txid, |
|
|
|
action: action, |
|
|
@ -2571,12 +2573,28 @@ WalletService.prototype.getTxHistory = function(opts, cb) { |
|
|
|
fees: tx.fees, |
|
|
|
time: tx.time, |
|
|
|
addressTo: addressTo, |
|
|
|
outputs: _.map(_.filter(outputs, { |
|
|
|
isChange: false |
|
|
|
}), outputMap), |
|
|
|
confirmations: tx.confirmations, |
|
|
|
}; |
|
|
|
|
|
|
|
if (opts.includeExtendedInfo) { |
|
|
|
newTx.inputs = _.map(inputs, function(input) { |
|
|
|
return _.pick(input, 'address', 'amount', 'isMine'); |
|
|
|
}); |
|
|
|
newTx.outputs = _.map(outputs, function(output) { |
|
|
|
return _.pick(output, 'address', 'amount', 'isMine'); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
outputs = _.filter(outputs, { |
|
|
|
isChange: false |
|
|
|
}); |
|
|
|
if (action == 'received') { |
|
|
|
outputs = _.filter(outputs, { |
|
|
|
isMine: true |
|
|
|
}); |
|
|
|
} |
|
|
|
newTx.outputs = _.map(outputs, formatOutput); |
|
|
|
} |
|
|
|
|
|
|
|
var proposal = indexedProposals[tx.txid]; |
|
|
|
if (proposal) { |
|
|
|
newTx.proposalId = proposal.id; |
|
|
|