Advanced send options
This commit is contained in:
parent
77abe774ac
commit
779db5a06c
6 changed files with 73 additions and 33 deletions
|
|
@ -84,6 +84,10 @@
|
|||
<span class="text-capitalize">{{index.feeOpts[index.currentFeeLevel]|translate}}</span>
|
||||
</span>
|
||||
</li>
|
||||
<li class="line-b p20">
|
||||
<span translate>Spend Unconfirmed Transaction</span>
|
||||
<switch id="spend-unconfirmed" name="spendUnconfirmed" ng-model="spendUnconfirmed" class="green right"></switch>
|
||||
</li>
|
||||
<li class="line-b p20" ng-click="$root.go('preferencesBwsUrl')">
|
||||
<span>Bitcore Wallet Service</span>
|
||||
<span class="text-gray db">
|
||||
|
|
|
|||
|
|
@ -418,6 +418,33 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-init="home.hideAdvSend=true">
|
||||
<a class="button outline light-gray expand tiny" ng-click="home.hideAdvSend=!home.hideAdvSend">
|
||||
<i class="fi-widget m3r"></i>
|
||||
<span translate ng-hide="!home.hideAdvSend">Show Advanced options</span>
|
||||
<span translate ng-hide="home.hideAdvSend">Hide Advanced options</span>
|
||||
<i ng-if="home.hideAdvSend" class="icon-arrow-down4"></i>
|
||||
<i ng-if="!home.hideAdvSend" class="icon-arrow-up4"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="m20b" ng-hide="home.hideAdvSend">
|
||||
<h4 class="title m0" translate>Fee policy for this transaction</h4>
|
||||
<ul class="no-bullet m0 size-14">
|
||||
<li ng-repeat="fee in (index.network == 'livenet' ? index.feeLevels.livenet : index.feeLevels.testnet)"
|
||||
ng-click="home.currentSendFeeLevel = fee.level" class="line-b p20">
|
||||
{{index.feeOpts[fee.level]|translate}}
|
||||
<i class="fi-check size-16 right"
|
||||
ng-show="(home.currentSendFeeLevel || index.currentFeeLevel) == fee.level"></i>
|
||||
</li>
|
||||
</ul>
|
||||
<h4 class="title m0" translate>Spend unconfirmed transaction</h4>
|
||||
<div class="p20 line-b">
|
||||
<span class="size-14" translate>Use unconfirmed in this transaction</span>
|
||||
<switch id="spend-unconfirmed" name="currentSpendUnconfirmed" ng-model="currentSpendUnconfirmed" class="green right"></switch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row" ng-show="!home.onGoingProcess">
|
||||
<div class="large-6 medium-6 small-6 columns" ng-show="!home.blockUx && (home._paypro || home.lockAddress || home.lockAmount)">
|
||||
<a ng-click="home.resetForm(sendForm)" class="button expand outline dark-gray round" translate>Cancel</a>
|
||||
|
|
|
|||
|
|
@ -279,6 +279,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
$log.debug('Wallet Status:', walletStatus);
|
||||
self.setPendingTxps(walletStatus.pendingTxps);
|
||||
self.setFees();
|
||||
self.setSpendUnconfirmed();
|
||||
|
||||
// Status Shortcuts
|
||||
self.walletName = walletStatus.wallet.name;
|
||||
|
|
@ -306,6 +307,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
};
|
||||
|
||||
self.setSpendUnconfirmed = function() {
|
||||
self.spendUnconfirmed = configService.getSync().wallet.spendUnconfirmed;
|
||||
};
|
||||
|
||||
self.setCurrentFeeLevel = function(level) {
|
||||
self.currentFeeLevel = level || configService.getSync().wallet.settings.feeLevel || 'priority';
|
||||
};
|
||||
|
|
@ -855,6 +860,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/SpendUnconfirmedUpdated', function(event) {
|
||||
self.setSpendUnconfirmed();
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/FeeLevelUpdated', function(event, level) {
|
||||
self.setCurrentFeeLevel(level);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,10 +9,25 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
name: config.wallet.settings.alternativeName,
|
||||
isoCode: config.wallet.settings.alternativeIsoCode
|
||||
};
|
||||
$scope.spendUnconfirmed = config.wallet.spendUnconfirmed;
|
||||
var fc = profileService.focusedClient;
|
||||
if (fc)
|
||||
$scope.encrypt = fc.hasPrivKeyEncrypted();
|
||||
|
||||
var unwatchSpendUnconfirmed = $scope.$watch('spendUnconfirmed', function(newVal, oldVal) {
|
||||
if (newVal == oldVal) return;
|
||||
var opts = {
|
||||
wallet: {
|
||||
spendUnconfirmed: newVal
|
||||
}
|
||||
};
|
||||
$rootScope.$emit('Local/SpendUnconfirmedUpdated');
|
||||
|
||||
configService.set(opts, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
});
|
||||
|
||||
var unwatch = $scope.$watch('encrypt', function(val) {
|
||||
var fc = profileService.focusedClient;
|
||||
if (!fc) return;
|
||||
|
|
@ -49,5 +64,6 @@ angular.module('copayApp.controllers').controller('preferencesController',
|
|||
|
||||
$scope.$on('$destroy', function() {
|
||||
unwatch();
|
||||
unwatchSpendUnconfirmed();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
var self = this;
|
||||
$rootScope.hideMenuBar = false;
|
||||
$rootScope.wpInputFocused = false;
|
||||
$scope.currentSpendUnconfirmed = configService.getSync().wallet.spendUnconfirmed;
|
||||
|
||||
// INIT
|
||||
var config = configService.getSync().wallet.settings;
|
||||
|
|
@ -538,6 +539,15 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
// Send
|
||||
|
||||
var unwatchSpendUnconfirmed = $scope.$watch('currentSpendUnconfirmed', function(newVal, oldVal) {
|
||||
if (newVal == oldVal) return;
|
||||
$scope.currentSpendUnconfirmed = newVal;
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
unwatchSpendUnconfirmed();
|
||||
});
|
||||
|
||||
this.canShowAlternative = function() {
|
||||
return $scope.showAlternative;
|
||||
};
|
||||
|
|
@ -736,7 +746,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
address = form.address.$modelValue;
|
||||
amount = parseInt((form.amount.$modelValue * unitToSat).toFixed(0));
|
||||
|
||||
feeService.getCurrentFeeValue(function(err, feePerKb) {
|
||||
feeService.getCurrentFeeValue(self.currentSendFeeLevel, function(err, feePerKb) {
|
||||
if (err) $log.debug(err);
|
||||
fc.sendTxProposal({
|
||||
toAddress: address,
|
||||
|
|
@ -744,6 +754,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
message: comment,
|
||||
payProUrl: paypro ? paypro.url : null,
|
||||
feePerKb: feePerKb,
|
||||
excludeUnconfirmedUtxos: $scope.currentSpendUnconfirmed ? false : true
|
||||
}, function(err, txp) {
|
||||
if (err) {
|
||||
self.setOngoingProcess();
|
||||
|
|
@ -848,6 +859,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
|
||||
this.lockAddress = false;
|
||||
this.lockAmount = false;
|
||||
this.currentSendFeeLevel = null;
|
||||
this.hideAdvSend = true;
|
||||
$scope.currentSpendUnconfirmed = configService.getSync().wallet.spendUnconfirmed;
|
||||
|
||||
this._amount = this._address = null;
|
||||
|
||||
|
|
@ -985,36 +999,6 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}
|
||||
};
|
||||
|
||||
// Advanced SEND: set temporary fee policy for each transaction
|
||||
this.openAdvancedSendModal = function(feeLevels, currentFeeLevel) {
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
||||
$scope.feeLevels = feeLevels;
|
||||
$scope.currentFeeLevel = currentFeeLevel
|
||||
$scope.network = fc.credentials.network;
|
||||
$scope.color = fc.backgroundColor;
|
||||
$scope.save = function(level) {
|
||||
$scope.currentFeeLevel = level;
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
};
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'views/modals/advancedSend.html',
|
||||
windowClass: 'full animated slideInUp',
|
||||
controller: ModalInstanceCtrl
|
||||
});
|
||||
|
||||
modalInstance.result.finally(function() {
|
||||
var m = angular.element(document.getElementsByClassName('reveal-modal'));
|
||||
m.addClass('slideOutDown');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// History
|
||||
|
||||
function strip(number) {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ angular.module('copayApp.services').factory('feeService', function($log, profile
|
|||
economy: gettextCatalog.getString('Economy')
|
||||
};
|
||||
|
||||
root.getCurrentFeeValue = function(cb) {
|
||||
root.getCurrentFeeValue = function(currentSendFeeLevel, cb) {
|
||||
var fc = profileService.focusedClient;
|
||||
var config = configService.getSync().wallet.settings;
|
||||
var feeLevel = config.feeLevel || 'normal';
|
||||
var feeLevel = currentSendFeeLevel || config.feeLevel || 'normal';
|
||||
// static fee
|
||||
var fee = 10000;
|
||||
fc.getFeeLevels(fc.credentials.network, function(err, levels) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue