add balance warning
This commit is contained in:
parent
b83c0590dc
commit
44cd3cd495
3 changed files with 72 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService) {
|
||||
angular.module('copayApp.controllers').controller('addressesController', function($scope, $log, $stateParams, $state, $timeout, $ionicHistory, $ionicScrollDelegate, configService, popupService, gettextCatalog, ongoingProcess, lodash, profileService, walletService, bwcError, platformInfo, appConfigService, txFormatService, feeService) {
|
||||
var UNUSED_ADDRESS_LIMIT = 5;
|
||||
var BALANCE_ADDRESS_LIMIT = 5;
|
||||
var config = configService.getSync().wallet.settings;
|
||||
|
|
@ -55,7 +55,7 @@ angular.module('copayApp.controllers').controller('addressesController', functio
|
|||
$scope.latestWithBalance = lodash.slice(withBalance, 0, BALANCE_ADDRESS_LIMIT);
|
||||
|
||||
lodash.each(withBalance, function(a) {
|
||||
a.balanceStr = (a.amount * satToUnit).toFixed(unitDecimals) + ' ' + unitName;
|
||||
a.balanceStr = txFormatService.formatAmount(a.amount);
|
||||
});
|
||||
|
||||
$scope.viewAll = {
|
||||
|
|
@ -72,6 +72,31 @@ angular.module('copayApp.controllers').controller('addressesController', functio
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
feeService.getFeeLevels(function(err, levels){
|
||||
walletService.getLowUtxos($scope.wallet, levels, function(err, resp) {
|
||||
if (err) return;
|
||||
|
||||
if (resp.allUtxos && resp.allUtxos.length) {
|
||||
|
||||
|
||||
var allSum = lodash.sum(resp.allUtxos || 0, 'satoshis');
|
||||
var per = (resp.minFee / allSum) * 100;
|
||||
|
||||
$scope.lowWarning = resp.warning;
|
||||
$scope.lowUtxosNb = resp.lowUtxos.length;
|
||||
$scope.allUtxosNb = resp.allUtxos.length;
|
||||
$scope.lowUtxosSum = txFormatService.formatAmountStr(lodash.sum(resp.lowUtxos || 0, 'satoshis'));
|
||||
$scope.allUtxosSum = txFormatService.formatAmountStr(allSum);
|
||||
$scope.minFee = txFormatService.formatAmountStr(resp.minFee || 0);
|
||||
$scope.minFeePer = per.toFixed(2) + '%';
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function processPaths(list) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue