interbtc-api

@interlay/interbtc-api / Exports / EscrowAPI

Interface: EscrowAPI

Implemented by

Table of contents

Methods

Methods

createLock

createLock(amount, unlockHeight): ExtrinsicData

Parameters

Name Type Description
amount MonetaryAmount<Currency> Governance token amount to lock (e.g. KINT or INTR)
unlockHeight number Block number to lock until

Returns

ExtrinsicData

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

Defined in

src/parachain/escrow.ts:37


getMaxPeriod

getMaxPeriod(): Promise<BN>

Returns

Promise<BN>

The maximum time for locks.

Defined in

src/parachain/escrow.ts:62


getRewardEstimate

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.

Parameters

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.

Returns

Promise<{ amount: MonetaryAmount<Currency> ; apy: Big }>

The estimated total reward amount and annualized reward percentage (APY).

Defined in

src/parachain/escrow.ts:97


getRewards

getRewards(accountId): Promise<MonetaryAmount<Currency>>

Parameters

Name Type Description
accountId AccountId User account ID

Returns

Promise<MonetaryAmount<Currency>>

The rewards that can be withdrawn by the account

Remarks

Implements https://spec.interlay.io/spec/reward.html#computereward

Defined in

src/parachain/escrow.ts:84


getSpan

getSpan(): Promise<BN>

Returns

Promise<BN>

All future times are rounded by this.

Defined in

src/parachain/escrow.ts:58


getStakedBalance

getStakedBalance(accountId): Promise<StakedBalance>

Parameters

Name Type Description
accountId AccountId ID of the user whose stake to fetch

Returns

Promise<StakedBalance>

The staked amount and end block

Defined in

src/parachain/escrow.ts:42


getTotalStakedBalance

getTotalStakedBalance(): Promise<MonetaryAmount<Currency>>

Returns

Promise<MonetaryAmount<Currency>>

The total amount of locked governance tokens

Remarks

Defined in

src/parachain/escrow.ts:49


increaseAmount

increaseAmount(amount): ExtrinsicData

Parameters

Name Type Description
amount MonetaryAmount<Currency> Governance token amount to lock (e.g. KINT or INTR)

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Defined in

src/parachain/escrow.ts:72


increaseUnlockHeight

increaseUnlockHeight(unlockHeight): ExtrinsicData

Parameters

Name Type Description
unlockHeight number The unlock height to increase by.

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Defined in

src/parachain/escrow.ts:78


totalVotingSupply

totalVotingSupply(blockNumber?): Promise<MonetaryAmount<Currency>>

Parameters

Name Type Description
blockNumber? number The number of block to query state at

Returns

Promise<MonetaryAmount<Currency>>

The voting balance

Remarks

Defined in

src/parachain/escrow.ts:30


votingBalance

votingBalance(accountId, blockNumber?): Promise<MonetaryAmount<Currency>>

Parameters

Name Type Description
accountId AccountId Account whose voting balance to fetch
blockNumber? number The number of block to query state at

Returns

Promise<MonetaryAmount<Currency>>

The voting balance

Remarks

Logic is duplicated from Escrow pallet in the parachain

Defined in

src/parachain/escrow.ts:21


withdraw

withdraw(): ExtrinsicData

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Remarks

Withdraws all locked governance currency

Defined in

src/parachain/escrow.ts:54


withdrawRewards

withdrawRewards(): ExtrinsicData

Returns

ExtrinsicData

A submittable extrinsic and an event that is emitted when extrinsic is submitted.

Remarks

Withdraws stake-to-vote rewards

Defined in

src/parachain/escrow.ts:67