Turbos
  • 📖About Turbos
    • Getting Started
    • About Turbos Finance
    • Why Sui Network
  • 📽️Products
    • Concentrated Liquidity AMM
      • Fee Tier for Token Pairs
      • Oracle
    • Automated Rebalance Vault
      • Step-by-Step Guide
      • Referral Program
    • TurboStar
    • TurbosBoost
  • 💡Protocol Concepts
    • About Concentrated Liquidity
    • Fee Tiers
    • Glossary
  • 🪙Tokenomics
    • TURBOS
    • Token Utility
    • Emission Distribution
  • ⚙️Others
    • Roadmap
    • Audits
    • Brand kit
    • Risks
    • Token Address
  • Developer Docs
    • Dev Overview
    • via SDK
      • Get Started
      • Initialize SDK
      • Clmm
        • getConfig
        • getFeesConfig
        • getPools
        • getPool
        • createPool
        • createAndAddLiquidity
        • increaseLiquidity
        • decreaseLiquidity
        • removeLiquidityAndBurn
        • preSwap
        • swap
        • collect Fees
        • collect Rewards
        • Fee
        • Liquidity and coin amounts calculation
        • APR calculation
      • Vault
        • createAndDepositVault
        • depositVault
        • withdrawVault
        • withdrawAllVault
        • collectClmmRewardDirectReturnVault
        • closeVault
        • computeTokenWithdrawVaultSwapResult
        • getVaultBalanceAmount
        • getMyVaults
  • Turbos Fun
    • Base
    • Create Pool
    • Calculate Token Amount
    • Buy
    • Sell
  • 📱Socials
    • Official website
    • Twitter
    • Discord
    • Medium
    • Zealy
  • Tutorials
    • Supported Wallets
      • SafePal Wallet
    • Move tutorial
    • Sui tutorial
Powered by GitBook
On this page
  • Signature
  • Params
  • Examples
  1. Developer Docs
  2. via SDK
  3. Clmm

removeLiquidityAndBurn

Remove a specific liquidity that includes follow steps:

  1. decrease liquidity

  2. collect fees

  3. collect rewards

  4. final burn

Signature

removeLiquidity(options: RemoveLiquidityOptions): Promise<Transaction>

Params

interface RemoveLiquidityOptions extends DecreaseLiquidityOptions {
  collectAmountA: string | number;
  collectAmountB: string | number;
  rewardAmounts: (string | number)[];
}

DecreaseLiquidityOptions can be found at page decreaseLiquidity

Examples

const turbosSdk = new TurbosSdk(Network.testnet, {
  url: 'https://fullnode.testnet.sui.io',
});
const signer = turbosSdk.account.getKeypairFromMnemonics("your mnemonic");
const poolId = '0xb32fb8ec0b447a833066496bd7251d3a2ee57a0a97c54bf4cc945a986235582a';
const pool = await turbosSdk.pool.getPool(poolId);
const positionId =
  '0x3b457840790091866473be5fd0365f988d220b593d3af09040daea1dc7bcdf60';
const position = await turbosSdk.nft.getPositionFields(positionId);
const txb = await turbosSdk.pool.removeLiquidity({
  pool: poolId,
  decreaseLiquidity: position.liquidity,
  nft: positionId,
  amountA: position.tokens_owed_a,
  amountB: position.tokens_owed_b,
  slippage: 3,
  address: signer.toSuiAddress(),
  collectAmountA: MAX_UINT_64.toString(), // The maximum value of u64 can be passed in, so the contract will automatically handle extracting all fees.
  collectAmountB: MAX_UINT_64.toString(),
  rewardAmounts: pool.reward_infos.map(() => MAX_UINT_64.toString()),
  deadline: Date.now() + 60 * 60 * 1000,
});
txb.setSender(signer.toSuiAddress());
const result = await turbosSdk.provider.signAndExecuteTransaction({
  transaction: txb,
  signer,
});
console.log(result);

collectAmountA,collectAmountB,rewardAmounts

Pass in the desired number to extract, along with the maximum u64 value, letting the contract automatically handle the extraction process.

PreviousdecreaseLiquidityNextpreSwap

Last updated 1 day ago