diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 7bae6bdce..ea670355b 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -212,6 +212,10 @@ angular.module('copayApp.services') $rootScope.totalBalanceBTC = (balanceSat / COIN); $rootScope.availableBalance = safeBalanceSat * satToUnit; $rootScope.availableBalanceBTC = (safeBalanceSat / COIN); + + $rootScope.lockedBalance = (balanceSat - safeBalanceSat) * satToUnit; + $rootScope.lockedBalanceBTC = (balanceSat - safeBalanceSat) / COIN; + var balanceByAddr = {}; for (var ii in balanceByAddrSat) { balanceByAddr[ii] = balanceByAddrSat[ii] * satToUnit; diff --git a/test/unit/services/servicesSpec.js b/test/unit/services/servicesSpec.js index 0358d1b74..aa7f7e2c8 100644 --- a/test/unit/services/servicesSpec.js +++ b/test/unit/services/servicesSpec.js @@ -93,8 +93,12 @@ describe("Unit: controllerUtils", function() { controllerUtils.updateBalance(function() { expect($rootScope.totalBalanceBTC).to.be.equal(1.00000001); expect($rootScope.availableBalanceBTC).to.be.equal(0.90000002); + expect($rootScope.lockedBalanceBTC).to.be.equal(0.09999999); + expect($rootScope.totalBalance).to.be.equal(1000000.01); expect($rootScope.availableBalance).to.be.equal(900000.02); + expect($rootScope.lockedBalance).to.be.equal(99999.99); + expect($rootScope.addrInfos).not.to.equal(null); expect($rootScope.addrInfos[0].address).to.equal(Waddr); }); diff --git a/views/includes/sidebar-mobile.html b/views/includes/sidebar-mobile.html index 5b634fe1a..506fcc54a 100644 --- a/views/includes/sidebar-mobile.html +++ b/views/includes/sidebar-mobile.html @@ -24,16 +24,16 @@
- Available + Locked {{availableBalance || 0|noFractionNumber}} {{$root.unitName}} - + tooltip-placement="bottom">{{lockedBalance || 0|noFractionNumber}} {{$root.unitName}} +  
diff --git a/views/includes/sidebar.html b/views/includes/sidebar.html index d57e4075a..3d33607d8 100644 --- a/views/includes/sidebar.html +++ b/views/includes/sidebar.html @@ -32,16 +32,16 @@ |noFractionNumber}} {{$root.unitName}}
- Available + Locked   {{availableBalance || 0|noFractionNumber}} {{$root.unitName}} - + tooltip-placement="bottom">{{lockedBalance || 0|noFractionNumber}} {{$root.unitName}} +