Merge pull request #1791 from matiu/bug/use-all-funds

Fix #1789 - use all funds button
This commit is contained in:
Esteban Ordano 2014-11-12 22:17:50 -03:00
commit 4726570b7a
8 changed files with 43 additions and 72 deletions

View file

@ -268,12 +268,18 @@ angular.module('copayApp.services')
r.totalBalance = balanceSat * satToUnit;
r.totalBalanceBTC = (balanceSat / COIN);
r.availableBalance = safeBalanceSat * satToUnit;
r.safeUnspentCount = safeUnspentCount;
r.availableBalanceBTC = (safeBalanceSat / COIN);
r.safeUnspentCount = safeUnspentCount;
r.lockedBalance = (balanceSat - safeBalanceSat) * satToUnit;
r.lockedBalanceBTC = (balanceSat - safeBalanceSat) / COIN;
if (r.safeUnspentCount){
var estimatedFee = copay.Wallet.estimatedFee(r.safeUnspentCount);
r.topAmount = (((r.availableBalance * w.settings.unitToSatoshi).toFixed(0) - estimatedFee) / w.settings.unitToSatoshi);
}
var balanceByAddr = {};
for (var ii in balanceByAddrSat) {
balanceByAddr[ii] = balanceByAddrSat[ii] * satToUnit;
@ -281,6 +287,8 @@ angular.module('copayApp.services')
r.balanceByAddr = balanceByAddr;
root.updateAddressList();
if (rateService.isAvailable()) {
r.totalBalanceAlternative = rateService.toFiat(balanceSat, w.settings.alternativeIsoCode);
r.alternativeIsoCode = w.settings.alternativeIsoCode;
@ -303,6 +311,7 @@ angular.module('copayApp.services')
};
root.updateBalance = function(w, cb, refreshAll) {
w = w || $rootScope.wallet;
if (!w) return root.onErrorDigest();
if (!w.isReady()) return;