Skip to main content
GET
Get swap quote instructions with transaction details

Overview

Solana Swap Execution - Alpha ModeThis endpoint is currently in alpha mode. This means:
  • The feature is functional but may have limitations or unexpected behavior
  • Performance and reliability improvements are ongoing
  • We recommend testing thoroughly before production use
  • Please report any issues to the Mobula team for faster resolution
The Swap Instructions endpoint returns individual Solana instructions instead of a serialized transaction. This allows you to:
  • Add your own instructions (e.g., Jito tips, custom fee transfers)
  • Combine multiple swaps in a single transaction
  • Have full control over transaction construction
  • Avoid deserializing/re-serializing transactions which adds latency
Note: This endpoint is only available for Solana chains. Mobula’s execution engine handles the instruction generation internally, supporting multiple DEXs and liquidity sources (Raydium, Orca, Pumpfun, etc.).

Query Parameters

  • chainId (required) — The blockchain identifier. Must be solana or solana:solana
  • tokenIn (required) — Address of the token to swap from (use So11111111111111111111111111111111111111111 for native SOL)
  • tokenOut (required) — Address of the token to swap to (use So11111111111111111111111111111111111111111 for native SOL)
  • amount (required if amountRaw not provided) — Human-readable amount of tokenIn to swap (e.g., "1.5" for 1.5 tokens)
  • amountRaw (required if amount not provided) — Raw amount as a string (e.g., "1500000000" for 1.5 SOL with 9 decimals)
  • walletAddress (required) — Wallet address that will execute the swap
  • slippage (optional) — Maximum acceptable slippage percentage (0-100). Default: 1
  • excludedProtocols (optional) — Comma-separated list of factory addresses to exclude from routing
  • onlyProtocols (optional) — Comma-separated list of tradable pool types to restrict routing
  • poolAddress (optional) — Specific pool address to use for the swap
  • onlyVerifiedTokens (optional) — When set to "true", rejects quotes where tokenOut is an unverified launchpad token (e.g., Pump.fun, Pumpswap, Raydium Launchlab). Default: "false".
  • prioritizationFeeLamports (optional) — Jupiter-compatible priority fee budget. Can be auto, a fixed lamport amount, or {"priorityLevelWithMaxLamports":{"priorityLevel":"medium"|"high"|"veryHigh","maxLamports":1000000,"global":false}}
  • dynamicComputeUnitLimit (optional) — Solana only. Dynamically sizes the compute unit limit from the built swap instructions. Default: true.
  • jitoTipLamports (optional) — Jito tip amount in lamports for block engine priority
  • payerAddress (optional) — Separate Solana fee payer. When provided and different from walletAddress, both wallets must sign. The payer covers transaction fees, priority/Jito tips, and ATA rent for accounts Mobula creates.
  • closeAuthority (optional) — Close authority for non-WSOL ATAs Mobula creates during the swap when payerAddress is used. Usually set this to the central payer wallet to reclaim rent later.
  • swapRecipientAddress (optional) — Wallet that receives the exact final swap output after router fee/slippage checks. The swap still uses walletAddress as taker, then MobulaRouter transfers the final output. Cannot be combined with destinationWallet. Legacy alias: finalRecipientWallet.
  • feePercentage (optional) — Fee percentage to charge on the swap (0.01 to 99). Fee is always taken from native SOL (deducted from the swap amount). At least one side of the swap must be native SOL. Must be used together with feeWallet.
  • feeWallet (optional) — Wallet address to receive fees. Required when feePercentage is set.

Usage Examples

Basic Swap Instructions

With Priority Fee

With Jito Tip

With Integration Fee

This example charges a 1% fee on the swap. The fee is deducted from native SOL and sent to your feeWallet via a SystemProgram.transfer instruction.

With Central Fee Payer, Close Authority, and Recipient

payerAddress pays transaction fees and ATA rent. closeAuthority lets that payer close non-WSOL ATAs Mobula created during the swap if they are left open later. swapRecipientAddress receives the final output while walletAddress remains the swap taker and token-transfer authority.

Response Format

Response Fields

Data Object

  • amountOutTokens (string, optional) — Estimated output amount in tokens
  • slippagePercentage (number, optional) — Slippage percentage
  • tokenIn (object, optional) — Input token metadata
    • address (string) — Token contract address
    • name (string, optional) — Token name
    • symbol (string, optional) — Token symbol
    • decimals (number) — Token decimals
    • logo (string | null, optional) — Token logo URL
  • tokenOut (object, optional) — Output token metadata
  • requestId (string) — Unique identifier for tracking this request
  • solana (object) — Solana instructions container
    • instructions (object) — All instructions needed for the swap
      • computeBudgetInstructions (array, optional) — Instructions to set compute budget
      • setupInstructions (array, optional) — Setup instructions (e.g., create token accounts)
      • swapInstructions (array) — The swap instructions (can be multiple for multi-hop routes)
      • cleanupInstructions (array, optional) — Cleanup instructions (e.g., close token accounts)
      • addressLookupTableAddresses (array, optional) — ALT addresses for versioned transactions
    • lastValidBlockHeight (number) — The last block height at which the blockhash is valid
    • recentBlockhash (string) — Recent blockhash to use when building the transaction

Instruction Format

Each instruction contains:
  • programId (string) — The program that will process this instruction
  • accounts (array) — Account keys involved in the instruction
    • pubkey (string) — Account public key
    • isSigner (boolean) — Whether the account must sign
    • isWritable (boolean) — Whether the account is writable
  • data (string) — Instruction data as base64 encoded string

Building a Transaction

After receiving instructions, you need to build and sign the transaction yourself:

Important Notes

  • Solana Only: This endpoint only works with Solana chains
  • Mobula Execution Engine: Instructions are generated by Mobula’s internal execution engine, which routes through multiple DEXs (Raydium, Orca, Pumpfun, etc.) for optimal pricing
  • Blockhash Expiry: The recentBlockhash and lastValidBlockHeight have a limited validity window (~150 blocks / ~1 minute). Build and send your transaction quickly.
  • ALT Required: For complex swaps, Address Lookup Tables are required. Always fetch and include them if addressLookupTableAddresses is provided.
  • Request ID: Keep the requestId for troubleshooting with Mobula support

Comparison with /swap/quoting

Query Parameters

chainId
string

Mobula chain id. EVM: evm:<integer> (e.g. evm:1, evm:8453, evm:42161). Solana: solana:solana. TON: ton:mainnet or ton:testnet.

tokenIn
string
required

Sell token address. Native identifiers — EVM: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (EIP-7528). Solana native SOL: So11111111111111111111111111111111111111111. Use wrapped SOL / WSOL mint So11111111111111111111111111111111111111112 only when swapping WSOL token-account balance. TON: EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c.

Minimum string length: 1
tokenOut
string
required

Buy token address. Same native identifier rules as tokenIn.

Minimum string length: 1
amount
string

Human-readable amount (e.g. "1.5" for 1.5 tokens). Converted server-side: raw = amount × 10^decimals. Mutually exclusive with amountRaw.

amountRaw
string

Raw amount as a digit-only string (e.g. "1500000" for 1.5 USDC at 6 decimals). Use this when you already have the bigint to avoid float precision loss. Mutually exclusive with amount.

amountUSD

USD value of tokenIn to spend. Resolved server-side from the live weighted token price. Mutually exclusive with amount and amountRaw.

slippage

auto (default) lets the router choose adaptive slippage. A number is a fixed slippage tolerance in % (0-100).

maxMarketImpactPercentage

Optional market impact guard in %. If the computed marketImpactPercentage is greater than this value, the quote is rejected with HTTP 400.

walletAddress
string
required

User wallet address — signer/source wallet for the swap.

Minimum string length: 1
destinationWallet
string

Solana only. Optional wallet that receives tokenOut. Defaults to walletAddress. Native SOL output is not supported yet with a separate destination wallet.

finalRecipientWallet
string

Deprecated Solana alias for swapRecipientAddress; kept for backward compatibility.

swapRecipientAddress
string

Solana only. Optional wallet that receives the exact final output after the Mobula on-chain router executes the swap and fee/slippage checks. For SPL outputs, Mobula creates the recipient ATA idempotently and closes router-created temporary output accounts when empty. Cannot be combined with destinationWallet.

excludedProtocols

DEX-level deny list (CSV). Example: pump-amm,raydium.

onlyProtocols

DEX-level allow list (CSV). Example: uniswap-v3,uniswap-v4.

poolAddress
string

Pin routing to a single pool (e.g. when you want a specific Uniswap V3 fee tier).

onlyRouters
string

Aggregator filter (CSV) — jupiter, kyberswap, lifi, naos. Omit to let the API pick.

prioritizationFeeLamports
any | null

Solana only. Jupiter-compatible priority fee budget. Use auto, a fixed lamport amount, or { "priorityLevelWithMaxLamports": { "priorityLevel": "medium" | "high" | "veryHigh", "maxLamports": 1000000, "global": false } }.

dynamicComputeUnitLimit
string

Solana only. Dynamically sizes the compute unit limit from the assembled swap instructions. Default: true.

jitoTipLamports
string

Solana only. Jito tip in lamports — adds a transfer to one of the Jito tip accounts for fast landing.

feePercentage

Caller referral fee in % (0-99). Mobula skims a 20% platform cut off the top. Requires feeWallet.

feeWallet
string

Wallet that receives the caller referral fee. Required when feePercentage > 0.

minFeesNative

Minimum caller referral fee in native-token units (TON, or SOL on Solana). Floors the referral fee; honored when the fee asset is the native token. Currently honored on TON native-input swaps; requires feeWallet.

feeToken
string

Solana only. Mint of a token in which to charge a flat MINIMUM fee (paired with minFeesTokenRaw). Charged via a separate transfer to feeWallet, independent of the swap route. Requires feeWallet.

minFeesTokenRaw

Solana only. Raw amount (smallest unit) of feeToken to charge as a flat minimum fee. The swap reverts if the user lacks balance.

payerAddress
string

Solana only. Fee abstraction — separate fee payer from walletAddress. When different, both wallets sign; payerAddress pays transaction fees, priority/Jito tips, and ATA rent for accounts Mobula creates.

closeAuthority
string

Solana only. Optional close authority for non-WSOL ATAs Mobula creates during the swap when payerAddress is used. If omitted, walletAddress remains the close authority. Ignored when no separate payerAddress is provided.

multiLander
string

Solana only. true returns N candidate transactions over a durable nonce — race them across landers (Jito, Nozomi, 0slot). Only one commits.

landerTipLamports
string

Per-lander tip when multiLander=true. Defaults to each lander's minimum.

onlyVerifiedTokens
string

When true, reject quotes involving unverified launchpad tokens.

Response

200 - application/json

Swap quoting instructions response

data
object
required
error
string