Remove Liquidity

Withdraw tokens from a liquidity position in Ferra pools.

Quick Start

const tx = await sdk.Position.removeLiquidityTransactionPayload({
  pool_id: '0x...',
  pos_id: '0x...',
  coinTypeA: '0x2::sui::SUI',
  coinTypeB: '0x...::usdc::USDC',
  delta_liquidity: '500000',
  min_amount_a: '490000000',
  min_amount_b: '490000'
  collect_fee: true
  rewarder_coin_types: [],
})

Parameters

Parameter
Type
Description

pool_id

string

The object id about which pool you want to operation.

pos_id

string

Position object ID

coinTypeA

string

First token type

coinTypeB

string

Second token type

delta_liquidity

string

Liquidity amount to remove

min_amount_a

string

Minimum token A to receive

min_amount_b

string

Minimum token B to receive

collect_fee

boolean

Indicates whether to collect fees during the removal.

rewarder_coin_types

string[]

Coin types associated with rewarder contracts.

Calculate Token Amounts

Complete Example

Error Handling

Important Notes

  • SDK automatically collects fees before removing liquidity

  • Tokens are sent directly to sender address

  • Cannot remove more liquidity than position contains

  • Position NFT remains after removing all liqui

Last updated