Merge pull request #986 from yemel/feature/ui-locked-balance
Change available balance to locked
This commit is contained in:
commit
09286ec37d
4 changed files with 16 additions and 8 deletions
|
|
@ -212,6 +212,10 @@ angular.module('copayApp.services')
|
||||||
$rootScope.totalBalanceBTC = (balanceSat / COIN);
|
$rootScope.totalBalanceBTC = (balanceSat / COIN);
|
||||||
$rootScope.availableBalance = safeBalanceSat * satToUnit;
|
$rootScope.availableBalance = safeBalanceSat * satToUnit;
|
||||||
$rootScope.availableBalanceBTC = (safeBalanceSat / COIN);
|
$rootScope.availableBalanceBTC = (safeBalanceSat / COIN);
|
||||||
|
|
||||||
|
$rootScope.lockedBalance = (balanceSat - safeBalanceSat) * satToUnit;
|
||||||
|
$rootScope.lockedBalanceBTC = (balanceSat - safeBalanceSat) / COIN;
|
||||||
|
|
||||||
var balanceByAddr = {};
|
var balanceByAddr = {};
|
||||||
for (var ii in balanceByAddrSat) {
|
for (var ii in balanceByAddrSat) {
|
||||||
balanceByAddr[ii] = balanceByAddrSat[ii] * satToUnit;
|
balanceByAddr[ii] = balanceByAddrSat[ii] * satToUnit;
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,12 @@ describe("Unit: controllerUtils", function() {
|
||||||
controllerUtils.updateBalance(function() {
|
controllerUtils.updateBalance(function() {
|
||||||
expect($rootScope.totalBalanceBTC).to.be.equal(1.00000001);
|
expect($rootScope.totalBalanceBTC).to.be.equal(1.00000001);
|
||||||
expect($rootScope.availableBalanceBTC).to.be.equal(0.90000002);
|
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.totalBalance).to.be.equal(1000000.01);
|
||||||
expect($rootScope.availableBalance).to.be.equal(900000.02);
|
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).not.to.equal(null);
|
||||||
expect($rootScope.addrInfos[0].address).to.equal(Waddr);
|
expect($rootScope.addrInfos[0].address).to.equal(Waddr);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,16 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
Available
|
Locked
|
||||||
<span ng-if="$root.updatingBalance">
|
<span ng-if="$root.updatingBalance">
|
||||||
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
||||||
</span>
|
</span>
|
||||||
<span ng-show="!$root.updatingBalance"
|
<span ng-show="!$root.updatingBalance"
|
||||||
data-options="disable_for_touch:true"
|
data-options="disable_for_touch:true"
|
||||||
tooltip="{{availableBalanceBTC || 0 |noFractionNumber:8}} BTC"
|
tooltip="{{lockedBalanceBTC || 0 |noFractionNumber:8}} BTC"
|
||||||
tooltip-trigger="mouseenter"
|
tooltip-trigger="mouseenter"
|
||||||
tooltip-placement="bottom">{{availableBalance || 0|noFractionNumber}} {{$root.unitName}}
|
tooltip-placement="bottom">{{lockedBalance || 0|noFractionNumber}} {{$root.unitName}}
|
||||||
</span>
|
</span> <i class="fi-info medium" tooltip="Balance locked in pending transaction proposals" tooltip-placement="bottom"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="line-sidebar-b"></div>
|
<div class="line-sidebar-b"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,16 @@
|
||||||
|noFractionNumber}} {{$root.unitName}}
|
|noFractionNumber}} {{$root.unitName}}
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
Available
|
Locked
|
||||||
<span ng-if="$root.updatingBalance">
|
<span ng-if="$root.updatingBalance">
|
||||||
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
<i class="fi-bitcoin-circle icon-rotate spinner"></i>
|
||||||
</span>
|
</span>
|
||||||
<span ng-show="!$root.updatingBalance"
|
<span ng-show="!$root.updatingBalance"
|
||||||
data-options="disable_for_touch:true"
|
data-options="disable_for_touch:true"
|
||||||
tooltip="{{availableBalanceBTC || 0 |noFractionNumber:8}} BTC"
|
tooltip="{{lockedBalanceBTC || 0 |noFractionNumber:8}} BTC"
|
||||||
tooltip-trigger="mouseenter"
|
tooltip-trigger="mouseenter"
|
||||||
tooltip-placement="bottom">{{availableBalance || 0|noFractionNumber}} {{$root.unitName}}
|
tooltip-placement="bottom">{{lockedBalance || 0|noFractionNumber}} {{$root.unitName}}
|
||||||
</span>
|
</span> <i class="fi-info medium" tooltip="Balance locked in pending transaction proposals" tooltip-placement="bottom"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="line-sidebar"></div>
|
<div class="line-sidebar"></div>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue