Fix txp and tx with multiple and single outputs

This commit is contained in:
Gustavo Maximiliano Cortez 2015-12-20 19:02:38 -03:00
parent c7bc2a16ba
commit d125a14483
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
2 changed files with 7 additions and 3 deletions

View File

@ -501,6 +501,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
message: 'test multi-output',
fee: 1000,
createdOn: new Date() / 1000,
type: 'multiple_output',
outputs: []
};
function addOutput(n) {

View File

@ -24,9 +24,12 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS
root.processTx = function(tx) {
if (!tx) return;
if (lodash.isArray(tx.outputs) && tx.outputs.length > 0 && tx.action != 'received') {
tx.hasMultiplesOutputs = true;
tx.recipientCount = tx.outputs.length;
var outputs = lodash.isArray(tx.outputs) ? tx.outputs.length : 0;
if (outputs && tx.action != 'received') {
if ((tx.type && tx.type == 'multiple_output') || (tx.proposalType && tx.proposalType == 'multiple_output')) {
tx.hasMultiplesOutputs = true;
tx.recipientCount = outputs;
}
tx.amount = lodash.reduce(tx.outputs, function(total, o) {
o.amountStr = formatAmountStr(o.amount);
o.alternativeAmountStr = formatAlternativeStr(o.amount);