Create Route Swap

Creates an unsigned transaction for a swap along the provided route using Jupiter.

This endpoint does not submit the transaction to the network.

This endpoint is intended for advanced usage. A simple application of this endpoint would be to use Get Quotes to compute several routes, and then use the best route to create the steps in this endpoint.

Request

Method:

POST ./api/v2/jupiter/route-swap

The tip parameter is currently not supported. You can create an additional transaction with an tip instruction and submit the swap & tip transactions as a Bundle.

Parameters:

ParameterTypeDescription

ownerAddress

string

Solana address which is placing swap.

steps

[]JupiterRouteStep

Route definition for each swap step.

slippage

double

The maximum slippage tolerance in percentage.

computePrice

uint64

OPTIONAL. Specifies compute price in Lamport (0.000001 SOL = 1,000 Lamport) to overwrite default Jupiter compute price.

JupiterRouteStep

ParameterTypeDescription

inToken

string

Symbol of the swap-in token for the current step.

outToken

string

Symbol of the swap-out token for the current step. Mutually exclusive with project.id

inAmount

double

Amount of the swap-in token for the current step.

outAmount

double

Amount of the swap-out token for the current step.

fee

Fee

Fee information. See fee for detail.

project

StepProject

See StepProject below

StepProject

ParameterTypeDescription

label

string

Cosmetic label describing containing project. Not necessary for this usage.

id

string

Pool address to swap through for this step. Mandatory for Jupiter swaps, to distinguish between different AMM projects available in Jupiter.

Fee

ParameterTypeDescription

amount

float

Amount of the fee being charged off.

mint

string

Token mint address of the token being charged off.

percent

float

Percentage of the swap was charged as fee.

Request example:

curl --header "Authorization: $AUTH_HEADER" -X 'POST' \
  'https://ny.solana.dex.blxrbdn.com/api/v2/jupiter/route-swap' \
  -H 'Content-Type: application/json' \
  -d '{
    "ownerAddress": "AFT8...UDfQ",
    "steps": [
        {
            "project": {
                "label": "Invariant",
                "id": "2SgUGxYDczrB6wUzXHPJH65pNhWkEzNMEx3km4xTYUTC"
            },
            "inToken": "So11111111111111111111111111111111111111112",
            "outToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
            "inAmount": 0.1,
            "outAmount": 0.000099274,
            "fee": {
                "amount": 0.000001,
                "mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
                "percent": 0.0001
            }
        }
    ]
}'

Response:

Fields:

FieldTypeDescription

transactions

[] TransactionMessage

See TransactionMesasge below below for details.

outAmount

double

Amount of tokens expected from the swap

outAmountMin

double

Minimum amount of tokens allowed from swap given slippage

priceImpact

PriceImpactV2

Impact of swap upon the pool's liquidity. See PriceImpactV2 below for details.

fee

[]Fee

Fee paid to AMM project. See Fee below for details.

TransactionMessage

ParameterDescription

content

txbase64Payload

Raw bytes of signed transaction.

PriceImpactV2

FieldTypeDescription

percent

double

Percentage impact on price.

infinity

string

Indicates possible infinity values: INF_NOT, INF_POSITIVE, INF_NEGATIVE. Usually INF_NOT.

Fee

FieldTypeDescription

amount

float

Amount paid to AMM project

mint

string

Token currency the fee is paid in

percent

float

Percentage of the swap consumed by the fee

Example:

Last updated