The ixWrapperPostOffer instruction posts a limit order to the Exponent orderbook.
Usage
import { PublicKey, Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
import { OfferType, offerOptions } from "@exponent-labs/exponent-sdk";
const { ix, setupIxs } = await orderbook.ixWrapperPostOffer({
trader: wallet.publicKey,
price: 4.5,
amount: 1_000_000_000n,
offerType: OfferType.SellYt,
offerOption: offerOptions("FillOrKill", [false]),
virtualOffer: false,
expirySeconds: 3600,
mintSy: syMintAddress,
});
// Build and send the transaction
const tx = new Transaction().add(...setupIxs, ix);
const signature = await sendAndConfirmTransaction(connection, tx, [wallet]);
Required Parameters
| Parameter | Type | Description |
|---|
trader | PublicKey | The trader’s wallet public key |
price | number | The limit price for the offer in APY terms |
amount | bigint | The amount to offer in lamports |
offerType | OfferType | The type of offer (OfferType.BuyYt / OfferType.SellYt) |
offerOption | OfferOptions | Offer execution option via offerOptions("FillOrKill", [boolean]) |
virtualOffer | boolean | Whether this is a virtual offer |
expirySeconds | number | Time until the offer expires (in seconds) |
mintSy | PublicKey | The SY token mint address |
Optional Parameters
| Parameter | Type | Description |
|---|
ptSrc | PublicKey | PT token source account |
ytSrc | PublicKey | YT token source account |
sySrc | PublicKey | SY token source account |
tokenBaseTrader | PublicKey | Base token account for the trader |
Returns
Returns an object with:
ix — The TransactionInstruction that posts the limit order
setupIxs — An array of setup instructions to run before ix:
setupIxs[0] — Creates the PT associated token account (if needed)
setupIxs[1] — Creates the YT associated token account (if needed)
setupIxs[2] — Creates the SY associated token account (if needed)
Use offerOptions("FillOrKill", [true]) to require the order to be filled completely or not at all. Pass false to allow partial fills.
Offer expiry is capped at vault maturity — if expirySeconds exceeds the time remaining until maturity, the offer expires at maturity instead. After maturity, new offers are rejected.