add vestingPerBlock and vestingEndBlock in DeriveBalancesAll when doing calcBalances (#2563)

* add vesting perBlock and vestingEndBlock in DeriveBalancesAll when doing calcBalances

* perBlock renamed to vestingPerBlock
This commit is contained in:
Nikhil Ranjan
2020-09-01 13:09:29 +02:00
committed by GitHub
parent bf4a8e28a3
commit f43bc32573
2 changed files with 5 additions and 0 deletions
+3
View File
@@ -50,6 +50,7 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
const isVesting = isStarted && !vestingLocked.isZero();
const vestedClaimable = api.registry.createType('Balance', isVesting ? vestingLocked.sub(vestingTotal.sub(vestedBalance)) : 0);
const availableBalance = api.registry.createType('Balance', allLocked ? 0 : bnMax(new BN(0), freeBalance.sub(lockedBalance)));
const vestingEndBlock = api.registry.createType('BlockNumber', isVesting ? vestingTotal.div(perBlock).add(startingBlock) : 0);
return {
accountId,
@@ -64,7 +65,9 @@ function calcBalances (api: ApiInterfaceRx, [{ accountId, accountNonce, freeBala
reservedBalance,
vestedBalance,
vestedClaimable,
vestingEndBlock,
vestingLocked,
vestingPerBlock: perBlock,
vestingTotal,
votingBalance
};
+2
View File
@@ -33,7 +33,9 @@ export interface DeriveBalancesAll extends DeriveBalancesAccount {
votingBalance: Balance;
vestedBalance: Balance;
vestedClaimable: Balance;
vestingEndBlock: BlockNumber;
vestingLocked: Balance;
vestingPerBlock: Balance;
vestingTotal: Balance;
}