Skip to main content
Set up the Exponent SDK and walk through the complete CLMM lifecycle — from buying and selling PT/YT, to providing liquidity, withdrawing, and reading market state.

Installation

Setup

1

Buy PT

Use ixWrapperBuyPt to buy PT (Principal Tokens) using base assets. This wraps the base into SY and swaps SY for PT in a single atomic operation.
2

Sell PT

Use ixWrapperSellPt to sell PT back for base assets. This swaps PT for SY and redeems SY for base in one transaction.
3

Buy YT

Use ixWrapperBuyYt to buy YT (Yield Tokens) using base assets. This wraps base into SY, strips SY into PT and YT, and sells the excess PT back — all atomically.
4

Sell YT

Use ixWrapperSellYt to sell YT back for base assets. This buys PT with SY, merges PT and YT back into SY, and redeems SY for base.
5

Provide Liquidity

Use ixWrapperProvideLiquidity to provide liquidity from base assets within a specified APY range. This wraps base into SY, strips into PT and YT, adds PT liquidity, and returns YT and LP tokens.
The signers array contains the generated LP position keypair. You must include it when signing the transaction, otherwise the transaction will fail.
The lowerTickApy and upperTickApy parameters are decimal numbers — use 0.05 for 5% APY, not 500 or 50000.
6

Withdraw Liquidity

Use ixWithdrawLiquidityToBase to withdraw an LP position back to base assets. You need the LP position’s public key, which you can obtain from getUserLpPositions.
The lpPosition parameter is the public key of your LP position account. See the next step to learn how to retrieve it.
7

Check LP Positions

Use getUserLpPositions to retrieve all LP positions for a wallet in a specific market.
8

Calculate Withdrawal Amounts

Use getPtAndSyOnWithdrawLiquidity to preview how much PT and SY you would receive when withdrawing a position.
You can pass an optional second parameter to calculate a partial withdrawal: market.getPtAndSyOnWithdrawLiquidity(position, partialLpAmount).

Reading Market State

The MarketThree instance exposes getter properties for reading onchain state:

Next Steps

Core Concepts

Understand APY-based ticks, fee decay, YT flash-swap routing, swap behavior, and the core accounts behind the CLMM.

Instructions

Explore the full set of high-level instruction builders for PT and YT trading, liquidity provision, and liquidity withdrawal.

Read Functions

Query quotes, LP positions, withdrawal previews, balances, and market state without sending transactions.

Account References

Inspect the main market account and related CLMM accounts, including financial state, emissions, and configuration fields.