Integrators
PropAMM Integration Guide
Tradewinds is an on-chain just-in-time (JIT) curve-routing aggregator on Solana. At landing, it reads live pool state, solves the optimal split across venues, and invokes each funded venue with a direct swap CPI.
The router supports two independent order instructions: Market orders
(Swap, supporting direct splits and up to 4 nested two-hop paths)
and Partial-fill IOC limit orders (SwapIoc,
direct venues only, clearing only the portion of input at or above a Q64.64 limit price).
Every transaction is submitted in Solana v1 format (SIMD-0385) with
zero Address Lookup Tables: up to 64 inline accounts and 4,096 bytes. Priority fees,
compute limits, loaded-accounts data limits, and heap size (32..=256
KB) are carried in the v1 message config rather than legacy
ComputeBudget instructions.
Identity
Program Identity & Constants
Click any address below to copy it. Verified against venue-math and
curve-router on jit-curve-router
(edd4e864).
| Constant | Value | Notes |
|---|---|---|
| Program ID | Mainnet curve-router program (ROUTER_PROGRAM_ID). |
|
| CPI Signer PDA |
PDA of seed b"caller", bump
255 (CALLER_SIGNER).
|
Authentication
Caller Verification
PropAMMs can authenticate Tradewinds swap CPIs using either the signed caller PDA (recommended) or the
Instructions sysvar.
1. CPI Signer PDA Verification
Recommended
Verify that 2gpAGzUg7ppSTvqVSafqPo6x8Z3fbSnToV3LmbWKaQwg is
present in your swap instruction's account list and has
is_signer == true.
Tradewinds passes this PDA as a read-only, zero-data account (unsigned at the top level) at your
swap instruction's dedicated caller-signer slot (or one slot past your last swap account if you do
not have a dedicated slot) and signs it during CPI with
invoke_signed using seeds
[b"caller", &[255]]. Because users can invoke Tradewinds via
CPI from another program, the top-level instruction in the
Instructions sysvar may not be Tradewinds, whereas this PDA
signature remains cryptographically verifiable on the swap CPI with zero sysvar reads.
2. Instructions Sysvar & Stack Height Check
Top-Level Only
Load the currently executing top-level instruction from
Sysvar1nstructions1111111111111111111111111 and verify that its
program_id equals
tradeWiNDs5q7HQENmGAUEEeDcMQ5REag2FSWhiMqmL. You can also
check get_stack_height() == TRANSACTION_LEVEL_STACK_HEIGHT + 1
(2) to ensure a direct CPI from the top-level router instruction.
Wire Format
Instruction Wire Layout
Tradewinds instruction data is a u8-tagged
wincode (packed little-endian)
Instruction enum with two independent swap variants:
0 (Swap) and
1 (SwapIoc). Both place their
fixed-width header fields ahead of route so propAMMs can inspect the
tag, amount_in, min_out, and IOC
parameters directly from the Instructions sysvar without decoding the
variable-length route body.
// Packed little-endian wire layout (wincode, u8 discriminant at byte offset 0)
#[wincode(tag_encoding = "u8")]
pub enum Instruction {
Swap(Swap), // offset 0: tag = 0u8
SwapIoc(SwapIoc), // offset 0: tag = 1u8
}
pub struct Swap {
pub amount_in: u64, // offset 1..9 (8 bytes, u64 LE, > 0)
pub min_out: u64, // offset 9..17 (8 bytes, u64 LE)
pub heap_kb: u16, // offset 17..19 (2 bytes, u16 LE, 32..=256)
pub leg_tolerance_ppb: u32, // offset 19..23 (4 bytes, u32 LE, 0..=1_000_000_000)
pub route: Route, // offset 23.. (variable, wincode)
}
pub struct SwapIoc {
pub amount_in: u64, // offset 1..9 (8 bytes, u64 LE, > 0)
pub min_out: u64, // offset 9..17 (8 bytes, u64 LE)
pub heap_kb: u16, // offset 17..19 (2 bytes, u16 LE, 32..=256)
pub leg_tolerance_ppb: u32, // offset 19..23 (4 bytes, u32 LE, 0..=1_000_000_000)
pub limit_price_q64: u128, // offset 23..39 (16 bytes, u128 LE, > 0)
pub min_fill_in: u64, // offset 39..47 (8 bytes, u64 LE, <= amount_in)
pub route: Route, // offset 47.. (variable, wincode)
}
Swap: Market Order tag = 0
Reads live pool state at landing, splits amount_in across direct
venues and/or multi-hop paths, and invokes each funded venue with one direct CPI. On split or
multi-hop routes, the amount_in passed to your venue swap CPI is
that leg's allocated slice and may be smaller than the top-level
amount_in.
| Offset | Size | Type | Field | Rules & Semantics |
|---|---|---|---|---|
| 0 | 1 B | u8 | tag |
0 (TAG_SWAP). Unknown tags
fail with Custom(2).
|
| 1..9 | 8 B | u64 LE | amount_in | Top-level input amount in atomic units. Must be > 0. |
| 9..17 | 8 B | u64 LE | min_out |
Global minimum balance increase enforced on DESTINATION in
atomic units.
|
| 17..19 | 2 B | u16 LE | heap_kb |
Declared BPF heap in KB (32..=256). Must match the v1
transaction's requested heap_size / 1024; out-of-range
values fail with Custom(2).
|
| 19..23 | 4 B | u32 LE | leg_tolerance_ppb | Per-leg tolerance (0..=1_000_000_000). |
| 23.. | var | Route | route | Wincode-encoded route. |
SwapIoc: Partial-Fill IOC Limit Order tag = 1
Routes across direct venues only (no multi-hop paths), filling only the portion of
amount_in that clears at or above
limit_price_q64. Executes 0 or more venue CPIs; a 0-fill succeeds
cleanly when min_fill_in == 0 and
min_out == 0. Even when your pool is the sole funded venue, the leg
CPI amount_in may be strictly less than the top-level
amount_in.
| Offset | Size | Type | Field | Rules & Semantics |
|---|---|---|---|---|
| 0 | 1 B | u8 | tag | 1 (TAG_SWAP_IOC). |
| 1..9 | 8 B | u64 LE | amount_in | Maximum top-level input amount in atomic units. Must be > 0. |
| 9..17 | 8 B | u64 LE | min_out |
Global minimum balance increase on DESTINATION
(0 permits a clean 0-fill when
min_fill_in == 0).
|
| 17..19 | 2 B | u16 LE | heap_kb |
Declared BPF heap in KB (32..=256). Must match the v1
transaction's requested heap_size / 1024.
|
| 19..23 | 4 B | u32 LE | leg_tolerance_ppb | Per-leg tolerance (0..=1_000_000_000). |
| 23..39 | 16 B | u128 LE | limit_price_q64 |
Q64.64 output/input limit price floor (must be > 0).
Realized output must satisfy
realized >= ceil(spent * limit_price_q64 / 2^64).
|
| 39..47 | 8 B | u64 LE | min_fill_in |
Minimum input atoms to fill (<= amount_in).
0 permits clean 0-fill; > 0
reverts with Custom(5) if
spent < min_fill_in.
|
| 47.. | var | Route | route | Wincode-encoded route. |
Accounts
Account Layout
Every Swap and SwapIoc instruction
opens with five fixed user accounts (0..5,
USER_ACCOUNTS = 5), followed by a deduplicated account table referenced
by each venue's pricing and
swap.accounts spans.
| Index | Account | Writable | Signer | Purpose |
|---|---|---|---|---|
| 0 | AUTHORITY | Conditional | Yes |
Taker wallet. Must sign and own SOURCE,
DESTINATION, and every multi-hop intermediate token account.
Writable when spending/receiving native SOL or wrapping/unwrapping WSOL.
|
| 1 | SOURCE | Yes | Conditional |
User's input SPL Token or Token-2022 account holding INPUT_MINT
(owned by AUTHORITY). Equals
AUTHORITY (and is a signer) when spending native SOL directly.
|
| 2 | DESTINATION | Yes | Conditional |
User's output SPL Token or Token-2022 account holding
OUTPUT_MINT (owned by AUTHORITY).
Equals AUTHORITY (and is a signer) when receiving native SOL
directly.
|
| 3 | INPUT_MINT | No | No |
Top-level input mint pubkey (So11111111111111111111111111111111111111112
for native SOL input).
|
| 4 | OUTPUT_MINT | No | No |
Top-level output mint pubkey. Always differs from INPUT_MINT.
|
| 5.. | Venue & Route Tail | Per-venue | No | Venue pricing, swap, and router accounts. |
Onboarding
Integrating Your PropAMM
Tradewinds prices every venue directly on-chain from live account state at landing. To integrate your propAMM (or verify an existing integration), send us the following details so we can implement exact quoting and swap CPI construction without guesswork.
1. Program Identity & Upgrades
- Mainnet program ID(s) and active pool / market addresses.
- Upgrade / deployment cadence and preferred channel for advance upgrade notifications.
-
Caller authentication and fee-tier rules: whether you want Tradewinds to pass and sign our CPI
signer PDA (
2gpAGzUg7ppSTvqVSafqPo6x8Z3fbSnToV3LmbWKaQwg, and at which 0-based swap account index) or allowlist our router program ID viaSysvar1nstructions1111111111111111111111111.
2. Swap Instruction & Account Layout
- Exact swap instruction discriminator(s) (exact-in and/or exact-out).
- Byte-level payload layout: offsets, integer widths, endianness, input amount, minimum output amount, direction / A-to-B flags, and any extra parameters.
- Exact account list, ordering, writability, signer flags, and PDA seeds (pool state, vaults, mints, token programs, oracles, sysvars, and optional caller-signer slot).
3. Account State & Per-Slot Pricing / Curve Logic
- Exact byte layout (or Rust struct / IDL) for every pool, market, and oracle account read during quoting.
- Deterministic pricing and curve evaluation logic at any slot from on-chain account state: pricing math, fee tiers, spread or inventory-skew adjustments, slot-based staleness or decay, rounding direction, min/max trade size bounds, and pause / halt flags.
4. CPI & Runtime Constraints
- CPI compatibility with Tradewinds' router and typical compute-unit (CU) cost per swap.
-
Solana
v1transaction compatibility (zero ALTs, resource limits and priority fees inv1::TransactionConfigrather than legacyComputeBudgetinstructions). - Any per-transaction constraints (e.g. Token-2022 support, native SOL vs. WSOL handling, single-swap-per-tx limits, or required pre-existing accounts).