add support for fee customization

Signed-off-by: Matias Alejo Garcia <ematiu@gmail.com>
This commit is contained in:
Matias Alejo Garcia 2015-06-19 17:22:12 -03:00
commit 67ba30a20e
8 changed files with 74 additions and 2 deletions

View file

@ -443,7 +443,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.availableBalanceBTC = strip(self.availableBalanceBTC / COIN);
// KB to send max
self.feePerKbSat = config.feePerKbSat || 10000;
self.feePerKbSat = config.feeValue || 10000;
if (balance.totalKbToSendMax) {
var feeToSendMaxSat = balance.totalKbToSendMax * self.feePerKbSat;

View file

@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, lodash, configService, profileService) {
var config = configService.getSync();
this.unitName = config.wallet.settings.unitName;
this.feeName = config.wallet.settings.feeName || 'Priority';
this.bwsurl = config.bws.url;
this.selectedAlternative = {
name: config.wallet.settings.alternativeName,

View file

@ -0,0 +1,35 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesFeeController',
function($rootScope, $scope, configService, go) {
var config = configService.getSync();
this.feeName = config.wallet.settings.feeName || 'Priority';
this.feeOpts = [{
name: 'Priority',
value: 100,
}, {
name: 'Normal',
value: 50,
}, {
name: 'Economy',
value: 10,
}];
this.save = function(newFee) {
var opts = {
wallet: {
settings: {
feeName: newFee.name,
feeValue: newFee.value * 100,
}
}
};
this.feeName = newFee.name;
configService.set(opts, function(err) {
if (err) console.log(err);
$scope.$emit('Local/UnitSettingUpdated');
});
};
});

View file

@ -608,6 +608,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
amount: amount,
message: comment,
payProUrl: paypro ? paypro.url : null,
feePerKb: config.feeValue || 10000,
}, function(err, txp) {
if (err) {
self.setOngoingProcess();