> ## 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 Sell PT

> Low-level instruction to sell PT for base assets in a single atomic operation

# createSellPtInstruction

Sells PT tokens for base assets in a single atomic operation. This is an alias for the sellPt instruction which handles the SY-to-base redemption internally via CPI remaining accounts. The caller supplies PT tokens and receives base tokens directly, without needing to manually redeem SY.

## Usage

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

const ix = createSellPtInstruction({
  seller: sellerKeypair.publicKey,
  market: new PublicKey("market..."),
  tokenSyTrader: new PublicKey("tokenSyTrader..."),
  tokenPtTrader: new PublicKey("tokenPtTrader..."),
  tokenSyEscrow: new PublicKey("tokenSyEscrow..."),
  tokenPtEscrow: new PublicKey("tokenPtEscrow..."),
  addressLookupTable: new PublicKey("lookupTable..."),
  tokenProgram: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),
  syProgram: new PublicKey("syProgram..."),
  tokenFeeTreasurySy: new PublicKey("tokenFeeTreasurySy..."),
  tokenFeeTreasuryPt: new PublicKey("tokenFeeTreasuryPt..."),
  ticks: new PublicKey("ticks..."),
  eventAuthority: new PublicKey("eventAuthority..."),
  program: new PublicKey("program..."),
  amountPt: 1_000_000n,
  minBaseAmount: 950_000n,
  priceSpotLimit: 1.05,
  redeemSyRemAccountsUntil: 3,
});
```

## Accounts

| Name                 | Type        | Signer | Writable | Description                   |
| -------------------- | ----------- | ------ | -------- | ----------------------------- |
| `seller`             | `PublicKey` | Yes    | Yes      | Wallet executing the trade    |
| `market`             | `PublicKey` | No     | Yes      | The CLMM market account       |
| `ticks`              | `PublicKey` | No     | Yes      | The market tick array account |
| `tokenSyTrader`      | `PublicKey` | No     | Yes      | Trader's SY token account     |
| `tokenPtTrader`      | `PublicKey` | No     | Yes      | Trader's PT token account     |
| `tokenSyEscrow`      | `PublicKey` | No     | Yes      | Market SY escrow account      |
| `tokenPtEscrow`      | `PublicKey` | No     | Yes      | Market PT escrow account      |
| `addressLookupTable` | `PublicKey` | No     | No       | Market address lookup table   |
| `tokenProgram`       | `PublicKey` | No     | No       | SPL Token program             |
| `syProgram`          | `PublicKey` | No     | No       | SY program                    |
| `tokenFeeTreasurySy` | `PublicKey` | No     | Yes      | SY fee treasury account       |
| `tokenFeeTreasuryPt` | `PublicKey` | No     | Yes      | PT fee treasury account       |
| `eventAuthority`     | `PublicKey` | No     | No       | Event authority PDA           |
| `program`            | `PublicKey` | No     | No       | CLMM program ID               |

## Args

| Name                     | Type             | Description                                                 |
| ------------------------ | ---------------- | ----------------------------------------------------------- |
| amountPt                 | `u64`            | The amount of PT tokens to sell                             |
| minBaseAmount            | `u64`            | The minimum amount of base asset to receive                 |
| priceSpotLimit           | `f64` (optional) | The price limit for the trade                               |
| redeemSyRemAccountsUntil | `u8`             | The number of CPI remaining accounts used for SY redemption |

## Returns

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