interbtc-api

@interlay/interbtc-api / Exports / AMMAPI

Interface: AMMAPI

Implemented by

Table of contents

Methods

Methods

addLiquidity

addLiquidity(amounts, pool, maxSlippage, deadline, recipient): Promise<ExtrinsicData>

Adds liquidity to liquidity pool

Parameters

Name Type Description
amounts PooledCurrencies Array of monetary amounts of pooled currencies sorted in the same order as in the pool.
pool LiquidityPool Type of liquidity pool.
maxSlippage number Maximum allowed slippage.
deadline number Deadline block number.
recipient AddressOrPair Recipient of the liquidity pool token.

Returns

Promise<ExtrinsicData>

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

Defined in

src/parachain/amm.ts:134


claimFarmingRewards

claimFarmingRewards(claimableRewards): ExtrinsicData

Claim all pending farming rewards.

Parameters

Name Type Description
claimableRewards Map<LpCurrency, MonetaryAmount<CurrencyExt>[]> Map of LpToken -> Array of reward monetary amounts -> supposed to be output of getClaimableFarmingRewards

Returns

ExtrinsicData

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

Defined in

src/parachain/amm.ts:168


getClaimableFarmingRewards

getClaimableFarmingRewards(accountId, accountLiquidity, pools): Promise<Map<LpCurrency, MonetaryAmount<CurrencyExt>[]>>

Get claimable farming reward amounts for all farmed liquidity provided by account.

Parameters

Name Type Description
accountId AccountId Account id for which to get claimable rewards.
accountLiquidity MonetaryAmount<LpCurrency>[] Amount of liquidity the account has provided.
pools LiquidityPool[] All liquidity pools.

Returns

Promise<Map<LpCurrency, MonetaryAmount<CurrencyExt>[]>>

Map of LpCurrency -> Array of reward monetary amounts.

Defined in

src/parachain/amm.ts:101


getLiquidityPools

getLiquidityPools(): Promise<LiquidityPool[]>

Get all liquidity pools.

Returns

Promise<LiquidityPool[]>

All liquidity pools.

Defined in

src/parachain/amm.ts:91


getLiquidityProvidedByAccount

getLiquidityProvidedByAccount(accountId): Promise<MonetaryAmount<LpCurrency>[]>

Get liquidity provided by account.

Parameters

Name Type Description
accountId AccountId Account to get provided liquidity information about.

Returns

Promise<MonetaryAmount<LpCurrency>[]>

Array of LP token amounts that represent account’s positions in respective liquidity pools.

Defined in

src/parachain/amm.ts:84


getLpTokens

getLpTokens(): Promise<LpCurrency[]>

Get all LP tokens.

Returns

Promise<LpCurrency[]>

Array of all standard and stable LP tokens.

Defined in

src/parachain/amm.ts:61


getOptimalTrade

getOptimalTrade(inputAmount, outputCurrency, pools): null | Trade

Get optimal trade for provided trade type and amount.

Parameters

Name Type Description
inputAmount MonetaryAmount<CurrencyExt> Amount to be exchanged.
outputCurrency CurrencyExt Currency to purchase.
pools LiquidityPool[] Array of all liquidity pools.

Returns

null | Trade

Optimal trade information or null if the trade is not possible.

Defined in

src/parachain/amm.ts:71


removeLiquidity

removeLiquidity(amount, pool, maxSlippage, deadline, recipient): Promise<ExtrinsicData>

Removes liquidity from pool.

Parameters

Name Type Description
amount MonetaryAmount<LpCurrency> Amount of LP token to be removed
pool LiquidityPool Liquidity pool to remove from.
maxSlippage number Maximum allowed slippage.
deadline number Deadline block number.
recipient AddressOrPair Recipient of the pooled currencies.

Returns

Promise<ExtrinsicData>

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

Note

Removes amount of liquidity in LP token, breaks it down and transfers to account.

Defined in

src/parachain/amm.ts:153


swap

swap(trade, minimumAmountOut, recipient, deadline): ExtrinsicData

Swap assets.

Parameters

Name Type Description
trade Trade Trade object containing information about the trade.
minimumAmountOut MonetaryAmount<CurrencyExt> Minimum output amount to be received.
recipient AddressOrPair Recipient address.
deadline string | number Deadline block for the swap transaction.

Returns

ExtrinsicData

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

Defined in

src/parachain/amm.ts:116