POST
/
dex
/
{chain}
/
route
curl --request POST \
  --url https://api-dex.chainstream.io/dex/{chain}/route \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "dex": "raydium",
  "userAddress": "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH",
  "priorityFee": "0.000001",
  "amount": "1000000000",
  "swapMode": "ExactIn",
  "slippage": 5,
  "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
}'
{
  "args": {
    "dex": "raydium",
    "userAddress": "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH",
    "priorityFee": "0.000001",
    "amount": "1000000000",
    "swapMode": "ExactIn",
    "slippage": 5,
    "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
  },
  "serializedTx": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
  "routeInfo": {
    "inAmount": "1000000000",
    "outAmount": "985000000",
    "priceImpact": "0.15",
    "route": [
      "USDC",
      "SOL"
    ]
  },
  "elapsedTime": 245
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

chain
enum<string>
required

支持网络中列出的区块链名称

Available options:
sol,
base

Body

application/json
dex
enum<string>
required

交易的 DEX 标识符

Available options:
raydium,
meteora,
pumpfun,
moonshot,
jupiter
Example:

"raydium"

userAddress
string
required

发起交易的钱包公钥

Required string length: 8 - 64
Example:

"HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH"

amount
string
required

兑换数量。使用 "auto" 表示全部余额或百分比如 "50%"

Example:

"1000000000"

swapMode
enum<string>
required

兑换方向模式

Available options:
ExactIn,
ExactOut
Example:

"ExactIn"

slippage
number
default:5
required

滑点容忍百分比

Required range: 0 <= x <= 100
Example:

5

priorityFee
string

优先费用,以 SOL 增加交易处理速度

Example:

"0.000001"

inputMint
string

输入 Mint,基础代币地址

Required string length: 8 - 64
Example:

"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

outputMint
string

Ouput Mint,报价代币地址

Required string length: 8 - 64
Example:

"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"

Response

200 - application/json
args
object
required

原始兑换请求参数

serializedTx
string
required

Base64 编码的交易

Example:

"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

routeInfo
object
required

详细路由信息

Example:
{
  "inAmount": "1000000000",
  "outAmount": "985000000",
  "priceImpact": "0.15",
  "route": ["USDC", "SOL"]
}
elapsedTime
number
required

请求处理时间(毫秒)

Example:

245