Create Route Swap

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

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.

The endpoint allows you to specify priority fees and tips to later control the transaction inclusion and propagation. Refer to the Transaction Submission & Front-Running Protection & Transaction Bundle page for additional information about these parameters.

Request

Method:

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

Parameters:

Parameter
Type
Description

ownerAddress

string

Solana address which is placing swap.

steps

[] RaydiumRouteStep

Route definition for each swap step.

computeLimit

number

OPTIONAL. Specifies total compute limit to be allocated for all instructions within the created tx

computePrice

number

OPTIONAL. Specifies compute price in Lamport (0.000001 SOL = 1,000 Lamport) to be included as a part of instruction, known as priority fee.

tip

uint64

OPTIONAL. Specifies a tip amount that will be used to pay for front-running protection or bundle submission services. What is tip?

RaydiumRouteStep

Parameter
Type
Description

inToken

string

Symbol or token program address of the swap-in token for the current step.

outToken

string

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

inAmount

number

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

outAmount

number

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

outAmountMin

number

Minimum swap-out token amount accepted

project

StepProject

StepProject

Parameter
Type
Description

label

string

label for project name (e.g Raydium)

id

string

id for specified pool

Request example:

curl --header "Authorization: $AUTH_HEADER" -X 'POST' \
  'https://ny.solana.dex.blxrbdn.com/api/v2/raydium/route-swap' \
  -H 'Content-Type: application/json' \
  -d '{
  "ownerAddress": "AFT8....UDfQ",
  "steps": [
    {
      "inToken": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
      "outToken": "So11111111111111111111111111111111111111112",
      "inAmount": 0.01,
      "outAmount": 0.010769,
      "outAmountMin": 0.010662
    },
    {
      "inToken": "So11111111111111111111111111111111111111112",
      "outToken": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
      "inAmount": 0.007505,
      "outAmount": 0.002497,
      "outAmountMin": 0.002472
    }
  ]
}'

Response:

Fields:

Field
Type
Description

transactions

array

See transactions below for details.

outAmountMin

number

Amount of tokens expected from the swap

minOutAmount

number

Minimum amount of tokens allowed from swap given slippage

priceImpact

object

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

fee

array

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

priceImpact

Field
Type
Description

percent

number

Percentage impact on price.

infinity

string

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

fee

Field
Type
Description

amount

number

Amount paid to AMM project

mint

string

Token currency the fee is paid in

percent

number

Percentage of the swap consumed by the fee

Example:

{
  "transactions":[
    {
      "content":"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAghiWzbp+CkCcJi59TMOtcwykOMxiR/ZjYUe7GooT7b4isYMCheBFJRSX0HJMby9ZE+e34jiXrm6KnpL+Ox0Y/f9LlXFFGWLbo/H1aB5QdgwG6hUhGoMTtA6kyf5VxafJjKUmWLcB3CjJGm9D2TmvXTixOEV9QtjnIifGGZqREv8Wi1d34DJcGkbpBgYUEk9ecetETmxlYFxFwbIEvX9tRs44TFA+MCL5QSdHLCOmjy4r/0O/A1Bw41s0tbmdsFnwxpwXmb3tpHDP1X6IcHUAToM9mV4zMml18jdsCUH5F0ieZCOriB3q/T3b4ogYp2efEy7IfXXwHWH/V3A5GmeHGfUj1wfS8ERCQdk18D5wISsVPYBXyt1PlvjwM1Vyeik2yfhhdvMhWi2OSoukI9Fln/W8p0N7W+sKZ9zB0oE8754u7pVF+gVBi73Lf3qoPyNOHnDR2j6tWKCfWqxzyIcaWlz7hhtNoGf7acxXl54t5xEBQw97rGEAYALg0mt7az3tuzBcMggNT9NFgwKM3DiUJ42PjoGgqiUdv8jzU6Kb/PK12oXZiKBigJmLRLoZ+aZJ9VkZ0XHyNZ5cPbm2OjCd6epFFnvAnuQrROrKLNhrbniItgRDdixq8YXHaF3/TJJKG/qeUBGuk40vXmdKn1Y+2NiC+f6/zXjVha8efEcP3G5gnZbqMZ2O42JQfrfuwWxFdU4EE4tU9AOkF71ZDxKyf2ls2sAwhan+XTRRltrXJYuOBut94oEC91I0gF3n8u42ebuq7/HJeGSGXhDKeyFOuupQvpW03TDNVlzzRV1/r0lC4C87VQZxn19GucT9QKyOa+uJRpUZeAynNR43aitMZW4BBxcCwUYH4ArjocC2m3U8qYOkYz4b5+M5pSseurCgvEzEDmSKnlrrhokSiMnmAjNW3wbt4V5J7+MqW8x8GksgpmLmgm26x9frw9tnFGTKg98QR10rN8hAp5HLQPpswlWMPI/A8UbUQ66+vHT82At6qeaD5REG5vo+teCWTjyikDK7AOSM28B8gwNuoiq44hs2cvrKE9TfLl8AjQJIG18IIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpS9lJxDYCwz8gd5DtFqNSTKG5l1zxIaKpDP/sffi2is1BV7BYDzHF/ORKYlgtvPnXjudZQ6CEo5OzUDaNIomTCIUPLW4CpHr4JNCatp3ELXDLKMv6JJ+37le50lbBJ2Lvly634BTp/1V1DfGaEOMxR641fEY04houWagkY38M8FeZUbt+C5p+oRc0zakZ6L0eaeacANaQdsdF0U5RI/5BSwzCgMtr4xksUDg4Ac9EMBgPnj+GYyI6yAEGlxDb99UHzqWMAGFK626UEKCV08auYQ+SFyONJy/P0aO6gAhbC94CIBUZGhsBDhwCAwQdBQYHCAkKHgsMDQARABAnAAAAAAAAwQkAAAAAAAAgFBobAQ4cDxARHRITFBUWFx8MGA0AAQE=",
      "isCleanup":false
    }
  ],
  "outAmount":0.002497,
  "outAmountMin":0.002472,
  "priceImpact":{
    "percent":0,
    "infinity":"INF_NOT"
  },
  "fees":[
    
  ]
}

Last updated