Displays error when transaction amount too low. Reinstated warning colour for transactions with high fees.
This commit is contained in:
parent
f758668395
commit
6626663a31
2 changed files with 18 additions and 6 deletions
|
|
@ -4,7 +4,7 @@ angular
|
||||||
.module('copayApp.controllers')
|
.module('copayApp.controllers')
|
||||||
.controller('reviewController', reviewController);
|
.controller('reviewController', reviewController);
|
||||||
|
|
||||||
function reviewController($log, $scope, $ionicLoading, $ionicModal, $timeout, addressbookService, bitcoinCashJsService, bitcore, bitcoreCash, configService, feeService, gettextCatalog, lodash, ongoingProcess, platformInfo, profileService, walletService, txFormatService) {
|
function reviewController(addressbookService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, configService, feeService, gettextCatalog, $ionicLoading, $ionicModal, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, $timeout, txFormatService, walletService) {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.destination = {
|
vm.destination = {
|
||||||
|
|
@ -21,6 +21,7 @@ function reviewController($log, $scope, $ionicLoading, $ionicModal, $timeout, ad
|
||||||
vm.feeCrypto = '';
|
vm.feeCrypto = '';
|
||||||
vm.feeFiat = '';
|
vm.feeFiat = '';
|
||||||
vm.fiatCurrency = '';
|
vm.fiatCurrency = '';
|
||||||
|
vm.feeIsHigh = false;
|
||||||
vm.feeLessThanACent = false;
|
vm.feeLessThanACent = false;
|
||||||
vm.origin = {
|
vm.origin = {
|
||||||
balanceAmount: '',
|
balanceAmount: '',
|
||||||
|
|
@ -52,6 +53,7 @@ function reviewController($log, $scope, $ionicLoading, $ionicModal, $timeout, ad
|
||||||
var satoshis = null;
|
var satoshis = null;
|
||||||
var toAddress = '';
|
var toAddress = '';
|
||||||
var tx = {};
|
var tx = {};
|
||||||
|
var unitFromSat = 0;
|
||||||
|
|
||||||
var FEE_TOO_HIGH_LIMIT_PERCENTAGE = 15;
|
var FEE_TOO_HIGH_LIMIT_PERCENTAGE = 15;
|
||||||
|
|
||||||
|
|
@ -89,7 +91,8 @@ function reviewController($log, $scope, $ionicLoading, $ionicModal, $timeout, ad
|
||||||
} else {
|
} else {
|
||||||
config = configCache;
|
config = configCache;
|
||||||
priceDisplayIsFiat = config.wallet.settings.priceDisplay === 'fiat';
|
priceDisplayIsFiat = config.wallet.settings.priceDisplay === 'fiat';
|
||||||
vm.origin.currencyColor = originWallet.coin === 'btc' ? config.bitcoinWalletColor : config.bitcoinCashWalletColor;
|
vm.origin.currencyColor = originWallet.coin === 'btc' ? config.bitcoinWalletColor : config.bitcoinCashWalletColor;
|
||||||
|
unitFromSat = 1 / config.wallet.settings.unitToSatoshi;
|
||||||
}
|
}
|
||||||
updateSendAmounts();
|
updateSendAmounts();
|
||||||
getOriginWalletBalance(originWallet);
|
getOriginWalletBalance(originWallet);
|
||||||
|
|
@ -431,6 +434,14 @@ function reviewController($log, $scope, $ionicLoading, $ionicModal, $timeout, ad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setSendError(msg) {
|
||||||
|
$scope.sendStatus = '';
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
});
|
||||||
|
popupService.showAlert(gettextCatalog.getString('Error at confirm'), bwcError.msg(msg));
|
||||||
|
};
|
||||||
|
|
||||||
function setupTx(tx) {
|
function setupTx(tx) {
|
||||||
if (tx.coin === 'bch') {
|
if (tx.coin === 'bch') {
|
||||||
tx.displayAddress = bitcoinCashJsService.readAddress(tx.toAddress).cashaddr;
|
tx.displayAddress = bitcoinCashJsService.readAddress(tx.toAddress).cashaddr;
|
||||||
|
|
@ -593,7 +604,8 @@ function reviewController($log, $scope, $ionicLoading, $ionicModal, $timeout, ad
|
||||||
var perString = per.toFixed(2);
|
var perString = per.toFixed(2);
|
||||||
txp.feeRatePerStr = (perString == '0.00' ? '< ' : '') + perString + '%';
|
txp.feeRatePerStr = (perString == '0.00' ? '< ' : '') + perString + '%';
|
||||||
txp.feeToHigh = per > FEE_TOO_HIGH_LIMIT_PERCENTAGE;
|
txp.feeToHigh = per > FEE_TOO_HIGH_LIMIT_PERCENTAGE;
|
||||||
vm.feeCrypto = txp.fee;
|
vm.feeCrypto = (unitFromSat * txp.fee).toFixed(8);
|
||||||
|
vm.feeIsHigh = txp.feeToHigh;
|
||||||
console.log("crypto", vm.feeCrypto);
|
console.log("crypto", vm.feeCrypto);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,10 @@
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<div class="fee-summary">
|
<div class="fee-summary">
|
||||||
<div class="fee-fiat positive" ng-if="vm.feeLessThanACent">Fee: Less than 1 cent</div>
|
<div class="fee-fiat" ng-class="vm.feeIsHigh ? 'negative' : 'positive'" ng-if="vm.feeLessThanACent">Fee: Less than 1 cent</div>
|
||||||
<div class="fee-fiat positive" ng-if="!vm.feeLessThanACent">Fee: <amount value="fee.value" currency="fee.currency"></amount></div>
|
<div class="fee-fiat" ng-class="vm.feeIsHigh ? 'negative' : 'positive'" ng-if="!vm.feeLessThanACent">Fee: {{vm.feeFiat}} {{vm.feeCurrency}}</div>
|
||||||
<div class="fee-crypto" ng-if="vm.feeCrypto">
|
<div class="fee-crypto" ng-if="vm.feeCrypto">
|
||||||
<amount value="vm.feeCrypto" currency="fee.currency"></amount>
|
{{vm.feeCrypto}} {{vm.origin.currency}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue