Browse Source

include proposal type, exclude decorations, in txhistory results

activeAddress
Gregg Zigler 10 years ago
parent
commit
730a3269c9
  1. 4
      lib/server.js
  2. 3
      test/integration/server.js

4
lib/server.js

@ -1532,6 +1532,7 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
amount = 0; amount = 0;
} }
function outputMap(o) { return { amount: o.amount, address: o.address } };
var newTx = { var newTx = {
txid: tx.txid, txid: tx.txid,
action: action, action: action,
@ -1539,13 +1540,14 @@ WalletService.prototype.getTxHistory = function(opts, cb) {
fees: tx.fees, fees: tx.fees,
time: tx.time, time: tx.time,
addressTo: addressTo, addressTo: addressTo,
outputs: _.filter(outputs, { isChange: false }), outputs: _.map(_.filter(outputs, { isChange: false }), outputMap),
confirmations: tx.confirmations, confirmations: tx.confirmations,
}; };
var proposal = indexedProposals[tx.txid]; var proposal = indexedProposals[tx.txid];
if (proposal) { if (proposal) {
newTx.proposalId = proposal.id; newTx.proposalId = proposal.id;
newTx.proposalType = proposal.type;
newTx.creatorName = proposal.creatorName; newTx.creatorName = proposal.creatorName;
newTx.message = proposal.message; newTx.message = proposal.message;
newTx.actions = _.map(proposal.actions, function(action) { newTx.actions = _.map(proposal.actions, function(action) {

3
test/integration/server.js

@ -3657,9 +3657,12 @@ describe('Wallet service', function() {
tx.actions.length.should.equal(1); tx.actions.length.should.equal(1);
tx.actions[0].type.should.equal('accept'); tx.actions[0].type.should.equal('accept');
tx.actions[0].copayerName.should.equal('copayer 1'); tx.actions[0].copayerName.should.equal('copayer 1');
tx.proposalType.should.equal(Model.TxProposal.Types.MULTIPLEOUTPUTS);
tx.outputs[0].address.should.equal(external); tx.outputs[0].address.should.equal(external);
tx.outputs[0].amount.should.equal(helpers.toSatoshi(50)); tx.outputs[0].amount.should.equal(helpers.toSatoshi(50));
should.not.exist(tx.outputs[0].message); should.not.exist(tx.outputs[0].message);
should.not.exist(tx.outputs[0]['isMine']);
should.not.exist(tx.outputs[0]['isChange']);
tx.outputs[1].address.should.equal(external); tx.outputs[1].address.should.equal(external);
tx.outputs[1].amount.should.equal(helpers.toSatoshi(30)); tx.outputs[1].amount.should.equal(helpers.toSatoshi(30));
should.exist(tx.outputs[1].message); should.exist(tx.outputs[1].message);

Loading…
Cancel
Save