> ## 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 Post Offer

> Low-level instruction to post an offer with automatic SY minting or YT withdrawal

# createWrapperPostOfferInstruction

Builds a raw instruction that posts a limit order offer to the orderbook with automatic SY minting or YT withdrawal. This combines the SY minting/YT withdrawal and offer posting steps atomically.

## Usage

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

const ix = createWrapperPostOfferInstruction(
  {
    trader: wallet.publicKey,
    orderbook: orderbookAddress,
    vault: vaultAddress,
    cpiAccountOrderbook: cpiAccountsOrderbook,
    yieldPosition: yieldPositionPda,
    tokenEscrowYt: orderbookEscrowYt,
    tokenEscrowSy: orderbookEscrowSy,
    tokenEscrowPt: orderbookEscrowPt,
    tokenSyTrader: userSyTokenAccount,
    tokenYtTrader: userYtTokenAccount,
    tokenPtTrader: userPtTokenAccount,
    systemProgram: SystemProgram.programId,
    syProgram: syProgramId,
    tokenProgram: TOKEN_PROGRAM_ID,
    exponentCore: EXPONENT_CORE_PROGRAM_ID,
    addressLookupTable: vaultLookupTable,
    eventAuthority: eventAuthorityPda,
    program: EXPONENT_ORDERBOOK_PROGRAM_ID,
  },
  {
    priceApy: 5.5,
    amountBase: BigInt(1_000_000),
    offerType: { sellYt: {} },
    virtualOffer: false,
    expirySeconds: 3600,
    options: { fillOrKill: [false] },
    mintSyOrWithdrawYtAccountsUntil: 0,
  }
);
```

## Accounts

| Name                  | Type        | Signer | Writable | Description                  |
| --------------------- | ----------- | ------ | -------- | ---------------------------- |
| `trader`              | `PublicKey` | Yes    | No       | The trader posting the offer |
| `orderbook`           | `PublicKey` | No     | Yes      | Orderbook account            |
| `vault`               | `PublicKey` | No     | Yes      | Vault account                |
| `cpiAccountOrderbook` | `PublicKey` | No     | No       | CPI accounts orderbook       |
| `yieldPosition`       | `PublicKey` | No     | Yes      | User's yield position PDA    |
| `tokenEscrowYt`       | `PublicKey` | No     | Yes      | Orderbook YT escrow account  |
| `tokenEscrowSy`       | `PublicKey` | No     | Yes      | Orderbook SY escrow account  |
| `tokenEscrowPt`       | `PublicKey` | No     | Yes      | Orderbook PT escrow account  |
| `tokenSyTrader`       | `PublicKey` | No     | Yes      | Trader's SY token account    |
| `tokenYtTrader`       | `PublicKey` | No     | Yes      | Trader's YT token account    |
| `tokenPtTrader`       | `PublicKey` | No     | Yes      | Trader's PT token account    |
| `systemProgram`       | `PublicKey` | No     | No       | System program               |
| `syProgram`           | `PublicKey` | No     | No       | SY program                   |
| `tokenProgram`        | `PublicKey` | No     | No       | SPL Token program            |
| `exponentCore`        | `PublicKey` | No     | No       | Exponent Core program        |
| `addressLookupTable`  | `PublicKey` | No     | No       | Vault address lookup table   |
| `eventAuthority`      | `PublicKey` | No     | No       | Event authority PDA          |
| `program`             | `PublicKey` | No     | No       | Exponent Orderbook program   |

## Args

| Name                              | Type           | Description                                                                |
| --------------------------------- | -------------- | -------------------------------------------------------------------------- |
| `priceApy`                        | `number`       | Price as implied APY (f64)                                                 |
| `amountBase`                      | `bigint`       | Amount of base asset to use (in base units)                                |
| `offerType`                       | `OfferType`    | Type of offer (SellYt or BuyYt)                                            |
| `virtualOffer`                    | `boolean`      | Whether this is a virtual offer                                            |
| `expirySeconds`                   | `number`       | Expiry time in seconds (u32)                                               |
| `options`                         | `OfferOptions` | Offer options (e.g., FillOrKill)                                           |
| `mintSyOrWithdrawYtAccountsUntil` | `number`       | Index into remaining accounts for SY minting or YT withdrawal CPI accounts |

## Returns

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