Skip to main content
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

ParameterTypeDescription
traderPublicKeyThe trader’s wallet public key
pricenumberThe limit price for the offer in APY terms
amountbigintThe amount to offer in lamports
offerTypeOfferTypeThe type of offer (OfferType.BuyYt / OfferType.SellYt)
offerOptionOfferOptionsOffer execution option via offerOptions("FillOrKill", [boolean])
virtualOfferbooleanWhether this is a virtual offer
expirySecondsnumberTime until the offer expires (in seconds)
mintSyPublicKeyThe SY token mint address

Optional Parameters

ParameterTypeDescription
ptSrcPublicKeyPT token source account
ytSrcPublicKeyYT token source account
sySrcPublicKeySY token source account
tokenBaseTraderPublicKeyBase 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.