diff --git a/index.html b/index.html index fb498ba3a..cb440eeab 100644 --- a/index.html +++ b/index.html @@ -18,8 +18,10 @@
Wallet ID: {{$root.wallet.id}}
-

{{totalBalance}}

-

0

+

+ Balance: {{totalBalance || 0}}
+ Available to Spend:{{availableBalance || 0}} +

diff --git a/js/controllers/addresses.js b/js/controllers/addresses.js index c92c7ea76..af3a7ee01 100644 --- a/js/controllers/addresses.js +++ b/js/controllers/addresses.js @@ -10,8 +10,7 @@ angular.module('copay.addresses').controller('AddressesController', var _updateBalance = function () { controllerUtils.setSocketHandlers(); - - w.getBalance(function (balance, balanceByAddr, isMain) { + w.getBalance(true, function (balance, balanceByAddr, isMain) { if (balanceByAddr && Object.keys(balanceByAddr).length) { $rootScope.balanceByAddr = balanceByAddr; $scope.isMain = isMain; diff --git a/js/models/core/Wallet.js b/js/models/core/Wallet.js index d86e3adf1..707e7f3db 100644 --- a/js/models/core/Wallet.js +++ b/js/models/core/Wallet.js @@ -410,7 +410,7 @@ Wallet.prototype.addressIsOwn = function(addrStr) { return ret; }; -Wallet.prototype.getBalance = function(cb) { +Wallet.prototype.getBalance = function(safe, cb) { var balance = 0; var balanceByAddr = {}; var isMain = {}; @@ -424,7 +424,8 @@ Wallet.prototype.getBalance = function(cb) { balanceByAddr[a]=0; isMain[a]=1; }); - this.getUnspent(function(utxos) { + var f = safe ? this.getSafeUnspent.bind(this):this.getUnspent.bind(this); + f(function(utxos) { for(var i=0;i