@interlay/interbtc-api / Exports / AMMAPI
▸ addLiquidity(amounts, pool, maxSlippage, deadline, recipient): Promise<ExtrinsicData>
Adds liquidity to liquidity pool
| 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. |
Promise<ExtrinsicData>
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ claimFarmingRewards(claimableRewards): ExtrinsicData
Claim all pending farming rewards.
| Name | Type | Description |
|---|---|---|
claimableRewards |
Map<LpCurrency, MonetaryAmount<CurrencyExt>[]> |
Map of LpToken -> Array of reward monetary amounts -> supposed to be output of getClaimableFarmingRewards |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.
▸ getClaimableFarmingRewards(accountId, accountLiquidity, pools): Promise<Map<LpCurrency, MonetaryAmount<CurrencyExt>[]>>
Get claimable farming reward amounts for all farmed liquidity provided by account.
| 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. |
Promise<Map<LpCurrency, MonetaryAmount<CurrencyExt>[]>>
Map of LpCurrency -> Array of reward monetary amounts.
▸ getLiquidityPools(): Promise<LiquidityPool[]>
Get all liquidity pools.
Promise<LiquidityPool[]>
All liquidity pools.
▸ getLiquidityProvidedByAccount(accountId): Promise<MonetaryAmount<LpCurrency>[]>
Get liquidity provided by account.
| Name | Type | Description |
|---|---|---|
accountId |
AccountId |
Account to get provided liquidity information about. |
Promise<MonetaryAmount<LpCurrency>[]>
Array of LP token amounts that represent account’s positions in respective liquidity pools.
▸ getLpTokens(): Promise<LpCurrency[]>
Get all LP tokens.
Promise<LpCurrency[]>
Array of all standard and stable LP tokens.
▸ getOptimalTrade(inputAmount, outputCurrency, pools): null | Trade
Get optimal trade for provided trade type and amount.
| Name | Type | Description |
|---|---|---|
inputAmount |
MonetaryAmount<CurrencyExt> |
Amount to be exchanged. |
outputCurrency |
CurrencyExt |
Currency to purchase. |
pools |
LiquidityPool[] |
Array of all liquidity pools. |
null | Trade
Optimal trade information or null if the trade is not possible.
▸ removeLiquidity(amount, pool, maxSlippage, deadline, recipient): Promise<ExtrinsicData>
Removes liquidity from pool.
| 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. |
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.
▸ swap(trade, minimumAmountOut, recipient, deadline): ExtrinsicData
Swap assets.
| 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. |
A submittable extrinsic and an event that is emitted when extrinsic is submitted.