Documentation Index
Fetch the complete documentation index at: https://v2-docs.exponent.finance/llms.txt
Use this file to discover all available pages before exploring further.
createTradePtExactOutInstruction
Buys an exact amount of PT tokens by specifying the desired output amount. This instruction usescreateTradePtExactOutInstruction with swapDirection: { buyPt: {} } to purchase a precise quantity of PT from the CLMM market, spending SY tokens as input. The caller specifies the exact PT amount to receive, and an optional maximum SY input constraint can be set for slippage protection.
Usage
Accounts
| Name | Type | Signer | Writable | Description |
|---|---|---|---|---|
trader | PublicKey | Yes | Yes | Wallet executing the trade |
market | PublicKey | No | Yes | The CLMM market account |
ticks | PublicKey | No | Yes | The market tick array account |
tokenSyTrader | PublicKey | No | Yes | Trader’s SY token account |
tokenPtTrader | PublicKey | No | Yes | Trader’s PT token account |
tokenSyEscrow | PublicKey | No | Yes | Market SY escrow account |
tokenPtEscrow | PublicKey | No | Yes | Market PT escrow account |
addressLookupTable | PublicKey | No | No | Market address lookup table |
tokenProgram | PublicKey | No | No | SPL Token program |
syProgram | PublicKey | No | No | SY program |
tokenFeeTreasurySy | PublicKey | No | Yes | SY fee treasury account |
tokenFeeTreasuryPt | PublicKey | No | Yes | PT fee treasury account |
eventAuthority | PublicKey | No | No | Event authority PDA |
program | PublicKey | No | No | CLMM program ID |
Args
| Name | Type | Description |
|---|---|---|
| amountOut | u64 | The exact amount of PT tokens to receive |
| swapDirection | SwapDirection | Set to { buyPt: {} } to buy PT |
| amountInConstraint | u64 (optional) | The maximum amount of SY to spend as slippage protection |
| priceSpotLimit | f64 (optional) | The price limit for the trade |
Returns
TransactionInstruction — a transaction instruction ready to be added to a transaction.