メインコンテンツへスキップ
POST
/
v2
/
dex
/
{chain}
/
route
Dex - ルート
curl --request POST \
  --url https://api.chainstream.io/v2/dex/{chain}/route \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "dex": "jupiter",
  "userAddress": "oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7",
  "amount": "1000000000",
  "swapMode": "ExactIn",
  "slippage": 5,
  "priorityFee": "1000",
  "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
  "recipientAddress": "0x0000000000000000000000000000000000000001",
  "permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
  "deadline": 1716806400000,
  "tipFee": "1000000",
  "isAntiMev": true,
  "maxFeePerGas": "50000000000",
  "maxPriorityFeePerGas": "2000000000",
  "gasPrice": "50000000000",
  "gasLimit": "300000"
}
'
import requests

url = "https://api.chainstream.io/v2/dex/{chain}/route"

payload = {
"dex": "jupiter",
"userAddress": "oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7",
"amount": "1000000000",
"swapMode": "ExactIn",
"slippage": 5,
"priorityFee": "1000",
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"recipientAddress": "0x0000000000000000000000000000000000000001",
"permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
"deadline": 1716806400000,
"tipFee": "1000000",
"isAntiMev": True,
"maxFeePerGas": "50000000000",
"maxPriorityFeePerGas": "2000000000",
"gasPrice": "50000000000",
"gasLimit": "300000"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dex: 'jupiter',
userAddress: 'oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7',
amount: '1000000000',
swapMode: 'ExactIn',
slippage: 5,
priorityFee: '1000',
inputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
outputMint: 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
recipientAddress: '0x0000000000000000000000000000000000000001',
permit: '66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9',
deadline: 1716806400000,
tipFee: '1000000',
isAntiMev: true,
maxFeePerGas: '50000000000',
maxPriorityFeePerGas: '2000000000',
gasPrice: '50000000000',
gasLimit: '300000'
})
};

fetch('https://api.chainstream.io/v2/dex/{chain}/route', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chainstream.io/v2/dex/{chain}/route",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'dex' => 'jupiter',
'userAddress' => 'oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7',
'amount' => '1000000000',
'swapMode' => 'ExactIn',
'slippage' => 5,
'priorityFee' => '1000',
'inputMint' => 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
'outputMint' => 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB',
'recipientAddress' => '0x0000000000000000000000000000000000000001',
'permit' => '66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9',
'deadline' => 1716806400000,
'tipFee' => '1000000',
'isAntiMev' => true,
'maxFeePerGas' => '50000000000',
'maxPriorityFeePerGas' => '2000000000',
'gasPrice' => '50000000000',
'gasLimit' => '300000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.chainstream.io/v2/dex/{chain}/route"

payload := strings.NewReader("{\n \"dex\": \"jupiter\",\n \"userAddress\": \"oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippage\": 5,\n \"priorityFee\": \"1000\",\n \"inputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"outputMint\": \"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB\",\n \"recipientAddress\": \"0x0000000000000000000000000000000000000001\",\n \"permit\": \"66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9\",\n \"deadline\": 1716806400000,\n \"tipFee\": \"1000000\",\n \"isAntiMev\": true,\n \"maxFeePerGas\": \"50000000000\",\n \"maxPriorityFeePerGas\": \"2000000000\",\n \"gasPrice\": \"50000000000\",\n \"gasLimit\": \"300000\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.chainstream.io/v2/dex/{chain}/route")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"dex\": \"jupiter\",\n \"userAddress\": \"oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippage\": 5,\n \"priorityFee\": \"1000\",\n \"inputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"outputMint\": \"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB\",\n \"recipientAddress\": \"0x0000000000000000000000000000000000000001\",\n \"permit\": \"66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9\",\n \"deadline\": 1716806400000,\n \"tipFee\": \"1000000\",\n \"isAntiMev\": true,\n \"maxFeePerGas\": \"50000000000\",\n \"maxPriorityFeePerGas\": \"2000000000\",\n \"gasPrice\": \"50000000000\",\n \"gasLimit\": \"300000\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.chainstream.io/v2/dex/{chain}/route")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dex\": \"jupiter\",\n \"userAddress\": \"oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7\",\n \"amount\": \"1000000000\",\n \"swapMode\": \"ExactIn\",\n \"slippage\": 5,\n \"priorityFee\": \"1000\",\n \"inputMint\": \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n \"outputMint\": \"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB\",\n \"recipientAddress\": \"0x0000000000000000000000000000000000000001\",\n \"permit\": \"66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9\",\n \"deadline\": 1716806400000,\n \"tipFee\": \"1000000\",\n \"isAntiMev\": true,\n \"maxFeePerGas\": \"50000000000\",\n \"maxPriorityFeePerGas\": \"2000000000\",\n \"gasPrice\": \"50000000000\",\n \"gasLimit\": \"300000\"\n}"

response = http.request(request)
puts response.read_body
{
  "args": {
    "dex": "jupiter",
    "userAddress": "oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7",
    "amount": "1000000000",
    "swapMode": "ExactIn",
    "slippage": 5,
    "priorityFee": "1000",
    "inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
    "recipientAddress": "0x0000000000000000000000000000000000000001",
    "permit": "66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9",
    "deadline": 1716806400000,
    "tipFee": "1000000",
    "isAntiMev": true,
    "maxFeePerGas": "50000000000",
    "maxPriorityFeePerGas": "2000000000",
    "gasPrice": "50000000000",
    "gasLimit": "300000"
  },
  "serializedTx": "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
  "routeInfo": {
    "inAmount": "1000000000",
    "outAmount": "985000000",
    "priceImpact": "0.15",
    "route": [
      "USDC",
      "SOL"
    ]
  },
  "elapsedTime": 245,
  "recentBlockhash": "JE38e5sYDcpjcfuKA7Madpq8p3A4zc8UQuonCZDbn2yP",
  "lastValidBlockHeight": 416681972
}

承認

Authorization
string
header
必須

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

パスパラメータ

chain
enum<string>
必須

サポートされているネットワークに記載されているチェーン名

利用可能なオプション:
sol,
bsc,
eth

ボディ

application/json
dex
enum<string>
必須

取引用の DEX 識別子

利用可能なオプション:
jupiter,
kyberswap,
raydium,
pumpfun,
moonshot,
candy,
launchpad
:

"jupiter"

userAddress
string
必須

トランザクションを開始するウォレットの公開鍵

Required string length: 8 - 64
:

"oQPnhXAbLbMuKHESaGrbXT17CyvWCpLyERSJA9HCYd7"

amount
string
必須

スワップ数量。全残高の場合は "auto"、割合指定の場合は "50%" のように指定

:

"1000000000"

swapMode
enum<string>
必須

スワップ方向モード

利用可能なオプション:
ExactIn,
ExactOut
:

"ExactIn"

slippage
integer<int64>
デフォルト:5
必須

スリッページ許容率

必須範囲: 0 <= x <= 100
:

5

priorityFee
string

トランザクション処理速度を上げるための優先手数料(SOL 単位)

:

"1000"

inputMint
string

入力トークンのミントアドレス

:

"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

outputMint
string

出力トークンのミントアドレス

:

"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"

recipientAddress
string

スワップの受取先ウォレットアドレス

:

"0x0000000000000000000000000000000000000001"

permit
string

スワップ用の Permit データ

:

"66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9"

deadline
integer<int64>

スワップの有効期限タイムスタンプ

:

1716806400000

tipFee
string

トランザクション処理速度を上げるためのチップ手数料(SOL 単位)

:

"1000000"

isAntiMev
boolean
デフォルト:false

アンチ MEV 保護を有効にするかどうか

:

true

maxFeePerGas
string

Gas 単位あたりの最大手数料(EIP-1559)(wei 単位)

:

"50000000000"

maxPriorityFeePerGas
string

Gas 単位あたりの最大優先手数料(EIP-1559)(wei 単位)

:

"2000000000"

gasPrice
string

Gas 価格(wei 単位、レガシートランザクション)

:

"50000000000"

gasLimit
string

トランザクションの Gas Limit

:

"300000"

レスポンス

200 - application/json
args
object
必須

元のスワップリクエストパラメータ

serializedTx
string
必須

Base64 エンコードされたトランザクション

:

"AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDRgYGpQEDAQIABQcICQoLDA0ODwAAAAAAAAAAAAAQERITFBUWFxgZGhscHR4fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

routeInfo
object
必須

詳細なルーティング情報

:
{
"inAmount": "1000000000",
"outAmount": "985000000",
"priceImpact": "0.15",
"route": ["USDC", "SOL"]
}
elapsedTime
integer<int64>
必須

リクエスト処理にかかった時間(ミリ秒)

:

245

recentBlockhash
string

スワップトランザクションの最近のブロックハッシュ

:

"JE38e5sYDcpjcfuKA7Madpq8p3A4zc8UQuonCZDbn2yP"

lastValidBlockHeight
integer<int64>

スワップトランザクションの最後の有効ブロック高

:

416681972