Complete flow of confirmation popup before send a tx

This commit is contained in:
Gustavo Maximiliano Cortez 2016-01-27 16:41:12 -03:00
commit df834c50c3
12 changed files with 203 additions and 98 deletions

View file

@ -30,6 +30,7 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS
tx.hasMultiplesOutputs = true;
tx.recipientCount = outputs;
}
tx.toAddress = tx.outputs[0].toAddress;
tx.amount = lodash.reduce(tx.outputs, function(total, o) {
o.amountStr = formatAmountStr(o.amount);
o.alternativeAmountStr = formatAlternativeStr(o.amount);

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('txSignService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log) {
angular.module('copayApp.services').factory('txSignService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log, feeService) {
var root = {};
var reportSigningStatus = function(opts) {
@ -85,8 +85,43 @@ angular.module('copayApp.services').factory('txSignService', function($rootScope
};
return cb();
});
});
};
root.createTx = function(opts, cb) {
var fc = profileService.focusedClient;
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
var currentSpendUnconfirmed = configWallet.spendUnconfirmed;
var currentFeeLevel = walletSettings.feeLevel || 'normal';
var getFee = function(cb) {
if (opts.lockedCurrentFeePerKb) {
cb(null, opts.lockedCurrentFeePerKb);
} else {
feeService.getCurrentFeeValue(currentFeeLevel, cb);
}
};
getFee(function(err, feePerKb) {
if (err) $log.debug(err);
fc.createTxProposal(opts, function(err, txp) {
if (err) return cb(err);
else return cb(null, txp);
});
});
};
root.publishTx = function(txId, cb) {
var fc = profileService.focusedClient;
fc.publishTxProposal(txId, function(err) {
if (err) return cb(err);
else return cb();
});
};
var _signWithLedger = function(txp, cb) {