Close Position

Remove all liquidity and close a position permanently.

Quick Start

const tx = await sdk.Position.closePositionTransactionPayload({
  pool_id: '0x...',
  pos_id: '0x...',
  coinTypeA: '0x2::sui::SUI',
  coinTypeB: '0x...::usdc::USDC',
  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

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.

Close with Slippage Protection

Complete Example

Close vs Remove Liquidity

Action
Effect
Position NFT

Remove Liquidity

Withdraws tokens

Remains (empty)

Close Position

Withdraws all + burns NFT

Destroyed

Error Handling

Important Notes

  • Closing automatically collects all fees and rewards

  • Position NFT is burned and cannot be recovered

  • All liquidity must be removed (SDK handles this)

  • Cannot close position with active orders

Last updated