> ## 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.

# Withdraw SY

> Burn tranche LP shares and withdraw SY

The `ixWithdraw` instruction burns Senior or Junior LP shares and withdraws SY from the market. Use this when your integration wants SY output directly.

## Usage

```typescript theme={null}
import { Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
import { TrancheSide } from "@exponent-labs/exponent-sdk/client/tranching";

const ix = market.ixWithdraw({
  user: wallet.publicKey,
  trancheSide: TrancheSide.Senior,
  lpAmountIn: 500_000_000n, // raw Senior LP units to burn
  minAmountOut: 0n,         // raw SY units; set above 0 for output protection
  tokenLpSrc: userSeniorLpTokenAccount,
  tokenDst: userSyTokenAccount,
});

const tx = new Transaction().add(ix);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
```

## Parameters

| Parameter      | Type          | Required | Description                                                           |
| -------------- | ------------- | -------- | --------------------------------------------------------------------- |
| `user`         | `PublicKey`   | Yes      | Wallet withdrawing from the market                                    |
| `trancheSide`  | `TrancheSide` | Yes      | `TrancheSide.Senior` or `TrancheSide.Junior`                          |
| `lpAmountIn`   | `bigint`      | Yes      | Selected-tranche LP shares to burn, in raw LP units                   |
| `minAmountOut` | `bigint`      | No       | Minimum SY amount to receive, in raw SY token units. Defaults to `0n` |
| `tokenLpSrc`   | `PublicKey`   | Yes      | User LP token source account                                          |
| `tokenDst`     | `PublicKey`   | Yes      | User SY destination account                                           |
| `tokenProgram` | `PublicKey`   | No       | SPL Token program                                                     |

## Behavior

The instruction:

1. Syncs market NAV against the current SY exchange rate.
2. Validates the selected tranche and lifecycle state.
3. Calculates the SY claim for the burned LP shares.
4. Burns LP shares and transfers SY to `tokenDst`.

<Warning>
  A Junior withdrawal can fail with a coverage error if the post-withdraw utilization would exceed the allowed threshold.
</Warning>
