计算代币兑换的最佳路由,考虑价格影响和费用。返回最优路径和准备好的交易
curl --request POST \
--url https://api-dex.chainstream.io/dex/v1/{chain}/route \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"dex": "jupiter",
"userAddress": "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH",
"priorityFee": "1000",
"tipFee": "1000",
"isAntiMev": true,
"amount": "1000000000",
"swapMode": "ExactIn",
"slippage": 5,
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"recipientAddress": "0x0000000000000000000000000000000000000001",
"permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
"deadline": 1716806400
}'
{
"args": {
"dex": "jupiter",
"userAddress": "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH",
"priorityFee": "1000",
"tipFee": "1000",
"isAntiMev": true,
"amount": "1000000000",
"swapMode": "ExactIn",
"slippage": 5,
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"recipientAddress": "0x0000000000000000000000000000000000000001",
"permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
"deadline": 1716806400
},
"serializedTx": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"routeInfo": {
"inAmount": "1000000000",
"outAmount": "985000000",
"priceImpact": "0.15",
"route": [
"USDC",
"SOL"
]
},
"elapsedTime": 245
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
支持网络中列出的区块链名称
sol
, base
, bsc
, polygon
, arbitrum
, optimism
, avalanche
, ethereum
, zksync
, sui
The response is of type object
.
此页面对您有帮助吗?
curl --request POST \
--url https://api-dex.chainstream.io/dex/v1/{chain}/route \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"dex": "jupiter",
"userAddress": "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH",
"priorityFee": "1000",
"tipFee": "1000",
"isAntiMev": true,
"amount": "1000000000",
"swapMode": "ExactIn",
"slippage": 5,
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"recipientAddress": "0x0000000000000000000000000000000000000001",
"permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
"deadline": 1716806400
}'
{
"args": {
"dex": "jupiter",
"userAddress": "HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH",
"priorityFee": "1000",
"tipFee": "1000",
"isAntiMev": true,
"amount": "1000000000",
"swapMode": "ExactIn",
"slippage": 5,
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"recipientAddress": "0x0000000000000000000000000000000000000001",
"permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
"deadline": 1716806400
},
"serializedTx": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
"routeInfo": {
"inAmount": "1000000000",
"outAmount": "985000000",
"priceImpact": "0.15",
"route": [
"USDC",
"SOL"
]
},
"elapsedTime": 245
}