From 85cf86d108c564e4965dcdd4f651b78d7c2f7284 Mon Sep 17 00:00:00 2001 From: Kadir Sekha Date: Thu, 25 Jan 2018 17:59:45 -0400 Subject: [PATCH] show fiat balance when sweeping private key --- src/js/controllers/paperWallet.js | 14 +++++++++++--- www/views/paperWallet.html | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/js/controllers/paperWallet.js b/src/js/controllers/paperWallet.js index 2344f6e5a..9f5b8ab67 100644 --- a/src/js/controllers/paperWallet.js +++ b/src/js/controllers/paperWallet.js @@ -1,5 +1,5 @@ angular.module('copayApp.controllers').controller('paperWalletController', - function($scope, $timeout, $log, $ionicModal, $ionicHistory, feeService, popupService, gettextCatalog, platformInfo, configService, profileService, $state, lodash, bitcore, bitcoreCash, ongoingProcess, txFormatService, $stateParams, walletService) { + function($scope, $timeout, $log, $ionicModal, $ionicHistory, feeService, popupService, gettextCatalog, platformInfo, configService, profileService, $state, lodash, bitcore, bitcoreCash, ongoingProcess, txFormatService, $stateParams, walletService, rateService) { var _ = lodash; @@ -71,10 +71,15 @@ angular.module('copayApp.controllers').controller('paperWalletController', $scope.btcBalance = btcBalance; $scope.bchBalance = bchBalance; - if ($scope.btcWallet) + if ($scope.btcWallet) { $scope.btcBalanceText = txFormatService.formatAmountStr($scope.btcWallet.coin, btcBalance); - if ($scope.bchWallet) + $scope.btcFiatBalance = rateService.toFiat(btcBalance, $scope.fiatCode, 'btc').toFixed(2); + } + + if ($scope.bchWallet) { $scope.bchBalanceText = txFormatService.formatAmountStr($scope.bchWallet.coin, bchBalance); + $scope.bchFiatBalance = rateService.toFiat(bchBalance, $scope.fiatCode, 'bch').toFixed(2); + } $scope.readyToShow = true; } @@ -170,6 +175,9 @@ angular.module('copayApp.controllers').controller('paperWalletController', $scope.singleBchWallet = $scope.bchWallets.length == 1; $scope.noMatchingBtcWallet = $scope.btcWallets.length == 0; $scope.noMatchingBchWallet = $scope.bchWallets.length == 0; + + var config = configService.getSync().wallet.settings; + $scope.fiatCode = config.alternativeIsoCode || 'USD'; }); $scope.$on("$ionicView.enter", function(event, data) { diff --git a/www/views/paperWallet.html b/www/views/paperWallet.html index 117870165..a8d3d2ee4 100644 --- a/www/views/paperWallet.html +++ b/www/views/paperWallet.html @@ -11,6 +11,9 @@

Bitcoin Cash found:

{{bchBalanceText}} +
+ {{bchFiatBalance}} {{fiatCode}} +
@@ -57,6 +60,9 @@

Bitcoin found:

{{btcBalanceText}} +
+ {{btcFiatBalance}} {{fiatCode}} +