-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(balance-info): add query param to convert free balance to human (#…
…914) * update the balance key in IAccountsBalanceInfo to also be a string * accept a query param for converting the balance * add private convertBalance * add tests for convertBalance * change convert to denominate * switch all over to denomination * inline comments * handle zero values, and cleanup code * handle all balance values * add IBalanceLock type * add denominateLocks * update docs * add error handling for a chain with no decimal * correct the docs * cleanup code * cover edgecase where decimal is 0 * set api to historicApi * fix decimal selection * detail dec value in applyDenominationBalance
- Loading branch information
Showing
6 changed files
with
224 additions
and
30 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
import { Vec } from '@polkadot/types'; | ||
import { Balance, BalanceLock, Index } from '@polkadot/types/interfaces'; | ||
import { | ||
Balance, | ||
BalanceLock, | ||
Index, | ||
LockIdentifier, | ||
Reasons, | ||
} from '@polkadot/types/interfaces'; | ||
|
||
import { IAt } from '.'; | ||
|
||
export interface IAccountBalanceInfo { | ||
at: IAt; | ||
tokenSymbol: string; | ||
nonce: Index; | ||
free: Balance; | ||
reserved: Balance; | ||
miscFrozen: Balance; | ||
feeFrozen: Balance; | ||
locks: Vec<BalanceLock>; | ||
free: Balance | string; | ||
reserved: Balance | string; | ||
miscFrozen: Balance | string; | ||
feeFrozen: Balance | string; | ||
locks: Vec<BalanceLock> | IBalanceLock[]; | ||
} | ||
|
||
export interface IBalanceLock { | ||
id: LockIdentifier; | ||
amount: string; | ||
reasons: Reasons; | ||
} |