Important Integration Notes

View as Markdown

We want to highlight some intentional differences in how our Solana API returns swap instructions, compared to other providers. These differences are important for integrators to be aware of, especially when composing and sending transactions manually.

Token Support

  • SPL and Token-2022 Tokens:
    Our API supports both standard SPL tokens (owned by the SPL Token Program) and Token-2022 tokens (owned by the Token-2022 / Token Extensions Program). Most Token-2022 tokens are routable, but we do not route a Token-2022 token when any of the following extensions are active:

    • A transfer fee extension with a non-zero fee
    • A transfer hook extension with a non-null (non-default) program address
    • The non-transferable extension

    Note that the extension merely being present does not disqualify a token. A token can carry a transfer fee extension configured to zero, or a transfer hook set to the null (default) address — these are still routable. Token creators often configure them this way to reserve the ability to enable the extension later, since new extensions cannot be added after the mint is created.

Instructions Grouping

We currently return a single flat array of instructions. Here’s what’s currently included:

✅ Included Instructions

  • Setup Instructions (N):
    • These create associated token accounts (ATAs) for the user (taker) as needed. This uses createIdempotent, so instructions won’t fail if an ATA already exists.
    • The number of instructions (N) depends on how many tokens the route involves, sometimes there may be 1 extra instruction for native SOL support (for certain DEXs).
    • Integrator fee recipient ATAs are not created automatically. The swap_fee_recipient field accepts either a wallet address (for native SOL output) or a valid token account address (for token outputs). If you’re collecting fees on a token output, the token account you pass must already exist — 0x will not create it. If it may not exist, add a createAssociatedTokenAccountIdempotent instruction for the fee recipient + fee token mint before the swap/fee transfer path. See the Integrator Byte Costs guide for how to account for those extra bytes.
  • Swap Instruction (1):
    • A single instruction on our Settler program to perform the actual swap.
  • Cleanup Instructions (as required):
    • Cleanup instructions are included as needed for the swap route.

We’re planning to return these in distinct arrays (setupInstructions, swapInstructions) in a future release.

🚫 Not Included

  • Compute Budget Instructions:
    • You’ll need to manually add these if your transaction is complex and might exceed compute limits.

Instruction Execution Assumptions

  • All instructions are returned in a single array, and must be executed in order. It is the responsibility of the integrator to:
    • Assemble the full transaction (e.g., using VersionedTransaction)
    • Add signers
    • Insert optional instructions (e.g., compute budget or priority fee) if needed

Byte Budgeting

Solana v0 transactions are limited to 1232 bytes.

Each 0x swap transaction reserves a fixed portion of that space. When you add instructions around the swap (compute budget, transfers, close account, referral logic, etc.), you must ensure your serialized transaction remains under the limit.

We provide a detailed Integrator Byte Costs guide to help you compute this.