메인 콘텐츠로 건너뛰기
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

입력 토큰 Mint 주소

예시:

"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"

outputMint
string

출력 토큰 Mint 주소

예시:

"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"

recipientAddress
string

스왑 수신 지갑 주소

예시:

"0x0000000000000000000000000000000000000001"

permit
string

스왑 Permit 데이터

예시:

"66c85d1637257e890e581f724f69f4d4fc17eee156c0619c4719ed0c66eed0e9"

deadline
integer<int64>

스왑 마감 타임스탬프

예시:

1716806400000

tipFee
string

트랜잭션 처리 속도를 높이기 위한 팁 수수료 (SOL 단위)

예시:

"1000000"

isAntiMev
boolean
기본값:false

Anti-MEV 보호 활성화 여부

예시:

true

maxFeePerGas
string

가스당 최대 수수료 (EIP-1559, wei 단위)

예시:

"50000000000"

maxPriorityFeePerGas
string

가스당 최대 우선 수수료 (EIP-1559, wei 단위)

예시:

"2000000000"

gasPrice
string

가스 가격 (레거시 트랜잭션, wei 단위)

예시:

"50000000000"

gasLimit
string

트랜잭션 가스 한도

예시:

"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