createWrapperWithdrawLiquidityInstruction
Withdraws liquidity from a CLMM market and converts the proceeds to base assets in a single atomic operation. This instruction removes the LP position, sells the PT component for SY on the market, and then redeems all SY for the underlying base asset. The caller receives base tokens directly.Usage
Accounts
| Name | Type | Signer | Writable | Description |
|---|---|---|---|---|
withdrawer | PublicKey | Yes | Yes | Wallet withdrawing liquidity |
market | PublicKey | No | Yes | The CLMM market account |
ticks | PublicKey | No | Yes | The market tick array account |
tokenPtEscrow | PublicKey | No | Yes | Market PT escrow account |
tokenSyEscrow | PublicKey | No | Yes | Market SY escrow account |
tokenSyWithdrawer | PublicKey | No | Yes | Withdrawer’s SY token account |
tokenPtWithdrawer | PublicKey | No | Yes | Withdrawer’s PT token account |
tokenProgram | PublicKey | No | No | SPL Token program |
marketAddressLookupTable | PublicKey | No | No | Market address lookup table |
syProgram | PublicKey | No | No | SY program |
tokenFeeTreasurySy | PublicKey | No | Yes | SY fee treasury account |
tokenFeeTreasuryPt | PublicKey | No | Yes | PT fee treasury account |
lpPosition | PublicKey | No | Yes | LP position account |
systemProgram | PublicKey | No | No | System program |
eventAuthority | PublicKey | No | No | Event authority PDA |
program | PublicKey | No | No | CLMM program ID |
Args
| Name | Type | Description |
|---|---|---|
| amountLp | u64 | The amount of LP tokens to withdraw |
| syConstraint | u64 | The maximum amount of SY to use when selling PT |
| redeemSyAccountsLength | u8 | The number of CPI remaining accounts used for SY redemption |
Returns
TransactionInstruction — a transaction instruction ready to be added to a transaction.