Merge pull request #3795 from cmgustavo/feat/send-confirmation-popup
Send confirmation popup
This commit is contained in:
commit
bcde97727e
14 changed files with 237 additions and 84 deletions
|
|
@ -24,18 +24,24 @@ angular.module('copayApp.services').factory('txFormatService', function(profileS
|
|||
root.processTx = function(tx) {
|
||||
if (!tx) return;
|
||||
|
||||
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;
|
||||
// New transaction output format
|
||||
if (tx.outputs) {
|
||||
|
||||
var outputsNr = tx.outputs.length;
|
||||
|
||||
if (tx.action != 'received') {
|
||||
if (outputsNr > 1) {
|
||||
tx.recipientCount = outputsNr;
|
||||
tx.hasMultiplesOutputs = true;
|
||||
}
|
||||
tx.amount = lodash.reduce(tx.outputs, function(total, o) {
|
||||
o.amountStr = formatAmountStr(o.amount);
|
||||
o.alternativeAmountStr = formatAlternativeStr(o.amount);
|
||||
return total + o.amount;
|
||||
}, 0);
|
||||
}
|
||||
tx.amount = lodash.reduce(tx.outputs, function(total, o) {
|
||||
o.amountStr = formatAmountStr(o.amount);
|
||||
o.alternativeAmountStr = formatAlternativeStr(o.amount);
|
||||
return total + o.amount;
|
||||
}, 0);
|
||||
}
|
||||
tx.toAddress = tx.outputs[0].toAddress;
|
||||
}
|
||||
|
||||
tx.amountStr = formatAmountStr(tx.amount);
|
||||
tx.alternativeAmountStr = formatAlternativeStr(tx.amount);
|
||||
|
|
|
|||
|
|
@ -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('txService', function($rootScope, profileService, gettextCatalog, lodash, trezor, ledger, configService, bwsError, $log, feeService) {
|
||||
var root = {};
|
||||
|
||||
var reportSigningStatus = function(opts) {
|
||||
|
|
@ -85,8 +85,45 @@ 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);
|
||||
opts.feePerKb = feePerKb;
|
||||
opts.excludeUnconfirmedUtxos = currentSpendUnconfirmed ? false : true;
|
||||
fc.createTxProposal(opts, function(err, txp) {
|
||||
if (err) return cb(err);
|
||||
else return cb(null, txp);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
root.publishTx = function(txp, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
fc.publishTxProposal({txp: txp}, function(err, txp) {
|
||||
if (err) return cb(err);
|
||||
else return cb(null, txp);
|
||||
});
|
||||
};
|
||||
|
||||
var _signWithLedger = function(txp, cb) {
|
||||
Loading…
Add table
Add a link
Reference in a new issue