Installation
Setup
1
Get a Quote
getQuote simulates a trade and returns the expected output before you send a transaction.2
Post a Limit Order
ixWrapperPostOffer places a limit order on the orderbook. The wrapper handles token account creation for you.The
setupIxs array creates PT, YT, and SY token accounts if they do not exist. Always include them before ix in your transaction.3
Execute a Market Order
ixWrapperMarketOffer fills against existing orders immediately.4
Check Open Orders
Query your active orders to see what is currently on the book.
5
Remove an Order
Cancel an open order using its
offerIdx from getUserOpenOrders.Use
getUserOpenOrders to find the offerIdx of the order you want to remove. Removing an order returns PT/YT back to your escrow balance.6
Collect Interest
Collect yield that has accrued on YT held in your open or filled orders.
7
Withdraw Funds
Withdraw PT, YT, and SY from your orderbook escrow back to your wallet.
Use
amount("All") to withdraw all available funds, or amount("Some", [500_000_000n]) for a specific amount. The amount helper is imported from @exponent-labs/exponent-sdk.Reading State
Read orderbook and user state without transactions:Next Steps
Core Concepts
Understand escrows, fee decay, interest accrual, expiry behavior, and the account model behind the orderbook.
Virtual Offers
Learn how PT trades route through shared YT liquidity using strip and merge flows under the hood.
TypeScript Instructions
Explore the full set of instruction builders for posting offers, taking liquidity, removing orders, collecting interest, and withdrawing funds.
Read Functions
Query quotes, balances, open orders, and other orderbook state without sending transactions.