Merge pull request #3900 from cmgustavo/ref/set-fee-level

Decrease in call to feelevels
This commit is contained in:
Matias Alejo Garcia 2016-02-23 09:44:35 -03:00
commit 1c8049c956
12 changed files with 87 additions and 98 deletions

View file

@ -10,10 +10,13 @@ angular.module('copayApp.services').factory('feeService', function($log, profile
economy: gettextCatalog.getString('Economy')
};
root.getCurrentFeeValue = function(currentSendFeeLevel, cb) {
root.getCurrentFeeLevel = function() {
return configService.getSync().wallet.settings.feeLevel || 'normal';
};
root.getCurrentFeeValue = function(cb) {
var fc = profileService.focusedClient;
var config = configService.getSync().wallet.settings;
var feeLevel = currentSendFeeLevel || config.feeLevel || 'normal';
var feeLevel = root.getCurrentFeeLevel();
// static fee
var fee = 10000;
fc.getFeeLevels(fc.credentials.network, function(err, levels) {
@ -30,8 +33,7 @@ angular.module('copayApp.services').factory('feeService', function($log, profile
root.getFeeLevels = function(cb) {
var fc = profileService.focusedClient;
var config = configService.getSync().wallet.settings;
var unitName = config.unitName;
var unitName = configService.getSync().wallet.settings.unitName;
fc.getFeeLevels('livenet', function(errLivenet, levelsLivenet) {
fc.getFeeLevels('testnet', function(errTestnet, levelsTestnet) {

View file

@ -92,18 +92,13 @@ angular.module('copayApp.services').factory('txService', function($rootScope, pr
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 currentSpendUnconfirmed = configService.getSync().wallet.spendUnconfirmed;
var getFee = function(cb) {
if (opts.lockedCurrentFeePerKb) {
cb(null, opts.lockedCurrentFeePerKb);
} else {
feeService.getCurrentFeeValue(currentFeeLevel, cb);
feeService.getCurrentFeeValue(cb);
}
};