POST
/
v1
/
dex
/
{chain}
/
route
DEX - 路由
curl --request POST \
  --url https://api-dex.chainstream.io/v1/dex/{chain}/route \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "dex": "jupiter",
  "userAddress": "oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7",
  "priorityFee": "1000",
  "amount": "1000000000",
  "swapMode": "ExactIn",
  "slippage": 5,
  "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
  "recipientAddress": "0x0000000000000000000000000000000000000001",
  "permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
  "deadline": 1716806400,
  "tipFee": "1000",
  "isAntiMev": true
}'
{
  "args": {
    "dex": "jupiter",
    "userAddress": "oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7",
    "priorityFee": "1000",
    "amount": "1000000000",
    "swapMode": "ExactIn",
    "slippage": 5,
    "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
    "recipientAddress": "0x0000000000000000000000000000000000000001",
    "permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
    "deadline": 1716806400,
    "tipFee": "1000",
    "isAntiMev": true
  },
  "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,
bsc,
polygon,
arbitrum,
optimism,
avalanche,
ethereum,
zksync,
sui

Body

application/json
dex
enum<string>
required

交易的 DEX 标识符

Available options:
jupiter,
kyberswap
Example:

"jupiter"

userAddress
string
required

发起交易的钱包公钥

Required string length: 8 - 64
Example:

"oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7"

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:

"1000"

inputMint
string

输入 Mint,基础代币地址

Required string length: 8 - 64
Example:

"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

outputMint
string

Ouput Mint,报价代币地址

Required string length: 8 - 64
Example:

"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"

recipientAddress
string

兑换接收方钱包地址

Required string length: 8 - 64
Example:

"0x0000000000000000000000000000000000000001"

permit
string

兑换的授权数据

Example:

"66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9"

deadline
number

兑换截止时间戳

Example:

1716806400

tipFee
string

SOL中的小费费用,用于提高交易处理速度

Example:

"1000"

isAntiMev
boolean
default:false

是否启用反MEV保护

Example:

true

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