@interlay/interbtc-api / Exports / DefaultEscrowAPI
• new DefaultEscrowAPI(api, governanceCurrency, systemApi): DefaultEscrowAPI
| Name | Type |
|---|---|
api |
ApiPromise |
governanceCurrency |
Currency |
systemApi |
SystemAPI |
• Private api: ApiPromise
• Private governanceCurrency: Currency
• Private systemApi: SystemAPI
▸ createLock(amount, unlockHeight): ExtrinsicData
| Name | Type | Description |
|---|---|---|
amount |
MonetaryAmount<Currency> |
Governance token amount to lock (e.g. KINT or INTR) |
unlockHeight |
number |
Block number to lock until |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
Remarks
The amount can’t be less than the max period (getMaxPeriod getter) to prevent rounding errors
▸ getEscrowStake(accountId): Promise<Big>
| Name | Type |
|---|---|
accountId |
AccountId |
Promise<Big>
▸ getEscrowTotalStake(): Promise<Big>
Promise<Big>
▸ getMaxPeriod(): Promise<BN>
Promise<BN>
The maximum time for locks.
▸ getRewardEstimate(accountId, amountToLock?, newLockEndHeight?): Promise<{ amount: MonetaryAmount<Currency> ; apy: Big }>
Estimate the annualized rewards for an account’s staked amounts while applying an optional amount to increase the locked stake by, and an optional lock time extension.
| Name | Type | Description |
|---|---|---|
accountId |
AccountId |
User account ID |
amountToLock? |
MonetaryAmount<Currency> |
(optional) New amount to add to the current stake. Zero, null, or undefined are interpreted as no changes to the current stake for the estimation. |
newLockEndHeight? |
number |
(optional) At which block number the stake lock should end. Zero, null, or undefined are interpreted as no lock extension used for the estimate. |
Promise<{ amount: MonetaryAmount<Currency> ; apy: Big }>
The estimated total reward amount and annualized reward percentage (APY).
▸ getRewardPerBlock(): Promise<MonetaryAmount<Currency>>
Promise<MonetaryAmount<Currency>>
▸ getRewardPerToken(): Promise<Big>
Promise<Big>
▸ getRewardTally(accountId): Promise<Big>
| Name | Type |
|---|---|
accountId |
AccountId |
Promise<Big>
▸ getRewards(accountId): Promise<MonetaryAmount<Currency>>
| Name | Type | Description |
|---|---|---|
accountId |
AccountId |
User account ID |
Promise<MonetaryAmount<Currency>>
The rewards that can be withdrawn by the account
Remarks
Implements https://spec.interlay.io/spec/reward.html#computereward
▸ getSpan(): Promise<BN>
Promise<BN>
All future times are rounded by this.
▸ getStakedBalance(accountId): Promise<StakedBalance>
| Name | Type | Description |
|---|---|---|
accountId |
AccountId |
ID of the user whose stake to fetch |
Promise<StakedBalance>
The staked amount and end block
▸ getTotalStakedBalance(): Promise<MonetaryAmount<Currency>>
Promise<MonetaryAmount<Currency>>
The total amount of locked governance tokens
Remarks
EscrowAPI.getTotalStakedBalance
▸ increaseAmount(amount): ExtrinsicData
| Name | Type | Description |
|---|---|---|
amount |
MonetaryAmount<Currency> |
Governance token amount to lock (e.g. KINT or INTR) |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ increaseUnlockHeight(unlockHeight): ExtrinsicData
| Name | Type | Description |
|---|---|---|
unlockHeight |
number |
The unlock height to increase by. |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
EscrowAPI.increaseUnlockHeight
▸ totalVotingSupply(blockNumber?): Promise<MonetaryAmount<Currency>>
| Name | Type | Description |
|---|---|---|
blockNumber? |
number |
The number of block to query state at |
Promise<MonetaryAmount<Currency>>
The voting balance
Remarks
interbtc-index).▸ votingBalance(accountId, blockNumber?): Promise<MonetaryAmount<Currency>>
| Name | Type | Description |
|---|---|---|
accountId |
AccountId |
Account whose voting balance to fetch |
blockNumber? |
number |
The number of block to query state at |
Promise<MonetaryAmount<Currency>>
The voting balance
Remarks
Logic is duplicated from Escrow pallet in the parachain
▸ withdraw(): ExtrinsicData
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
Remarks
Withdraws all locked governance currency
▸ withdrawRewards(): ExtrinsicData
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
Remarks
Withdraws stake-to-vote rewards