> ## Documentation Index
> Fetch the complete documentation index at: https://docs.exponent.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Wrapper Withdraw Liquidity Classic

> Low-level instruction to withdraw liquidity and return PT and base assets separately

# createWrapperWithdrawLiquidityClassicInstruction

Withdraws liquidity from a CLMM market and returns PT tokens and base assets separately. This instruction removes the LP position, returns the PT component directly to the withdrawer, and redeems the SY portion for the underlying base asset. This is useful when the caller wants to retain their PT tokens rather than selling them.

## Usage

```typescript theme={null}
import { createWrapperWithdrawLiquidityClassicInstruction } from "@exponent-labs/exponent-sdk/client/clmm";
import { PublicKey, SystemProgram } from "@solana/web3.js";

const ix = createWrapperWithdrawLiquidityClassicInstruction({
  withdrawer: withdrawerKeypair.publicKey,
  market: new PublicKey("market..."),
  ticks: new PublicKey("ticks..."),
  tokenPtEscrow: new PublicKey("tokenPtEscrow..."),
  tokenSyEscrow: new PublicKey("tokenSyEscrow..."),
  tokenSyWithdrawer: new PublicKey("tokenSyWithdrawer..."),
  tokenPtWithdrawer: new PublicKey("tokenPtWithdrawer..."),
  tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
  marketAddressLookupTable: new PublicKey("lookupTable..."),
  syProgram: new PublicKey("syProgram..."),
  lpPosition: new PublicKey("lpPosition..."),
  systemProgram: SystemProgram.programId,
  eventAuthority: new PublicKey("eventAuthority..."),
  program: new PublicKey("program..."),
  amountLp: 1_000_000n,
  redeemSyAccountsLength: 3,
});
```

## 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                    |
| `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                         |
| redeemSyAccountsLength | `u8`  | The number of CPI remaining accounts used for SY redemption |

## Returns

`TransactionInstruction` — a transaction instruction ready to be added to a transaction.
