From 7d9f7d9303cb30ea88c408f92b73805f26321732 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Thu, 31 Aug 2017 10:08:26 -0300 Subject: [PATCH] Fix units. Ref formatAmount --- src/js/controllers/addresses.js | 2 +- src/js/services/walletService.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/js/controllers/addresses.js b/src/js/controllers/addresses.js index 0b9de5aa1..c83279f84 100644 --- a/src/js/controllers/addresses.js +++ b/src/js/controllers/addresses.js @@ -50,7 +50,7 @@ angular.module('copayApp.controllers').controller('addressesController', functio $scope.latestWithBalance = lodash.slice(withBalance, 0, BALANCE_ADDRESS_LIMIT); lodash.each(withBalance, function(a) { - a.balanceStr = txFormatService.formatAmount(a.amount); + a.balanceStr = txFormatService.formatAmountStr($scope.wallet.coin, a.amount); }); $scope.viewAll = { diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index d292ecf2b..1e7eb6dc8 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -215,11 +215,11 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim cache.satToUnit = 1 / cache.unitToSatoshi; //STR - cache.totalBalanceStr = txFormatService.formatAmount(cache.totalBalanceSat) + ' ' + (wallet.coin).toUpperCase(); - cache.lockedBalanceStr = txFormatService.formatAmount(cache.lockedBalanceSat) + ' ' + (wallet.coin).toUpperCase(); - cache.availableBalanceStr = txFormatService.formatAmount(cache.availableBalanceSat) + ' ' + (wallet.coin).toUpperCase(); - cache.spendableBalanceStr = txFormatService.formatAmount(cache.spendableAmount) + ' ' + (wallet.coin).toUpperCase(); - cache.pendingBalanceStr = txFormatService.formatAmount(cache.pendingAmount) + ' ' + (wallet.coin).toUpperCase(); + cache.totalBalanceStr = txFormatService.formatAmountStr(wallet.coin, cache.totalBalanceSat); + cache.lockedBalanceStr = txFormatService.formatAmountStr(wallet.coin, cache.lockedBalanceSat); + cache.availableBalanceStr = txFormatService.formatAmountStr(wallet.coin, cache.availableBalanceSat); + cache.spendableBalanceStr = txFormatService.formatAmountStr(wallet.coin, cache.spendableAmount); + cache.pendingBalanceStr = txFormatService.formatAmountStr(wallet.coin, cache.pendingAmount); cache.alternativeName = config.settings.alternativeName; cache.alternativeIsoCode = config.settings.alternativeIsoCode; @@ -416,10 +416,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim if (cacheCoin == 'bits') { - $log.debug('Fixing Tx Cache Unit to: ' + 'btc') + $log.debug('Fixing Tx Cache Unit to: ' + wallet.coin) lodash.each(txs, function(tx) { - tx.amountStr = txFormatService.formatAmountStr('BTC', tx.amount); - tx.feeStr = txFormatService.formatAmountStr('BTC', tx.fees); + tx.amountStr = txFormatService.formatAmountStr(wallet.coin, tx.amount); + tx.feeStr = txFormatService.formatAmountStr(wallet.coin, tx.fees); }); } };