Quote and swap in one request
curl --request POST \
--url https://raptor-beta.solanatracker.io/quote-and-swap \
--header 'Content-Type: application/json' \
--data '
{
"userPublicKey": "<string>",
"inputMint": "<string>",
"outputMint": "<string>",
"amount": 123,
"slippageBps": "<string>",
"dexes": "<string>",
"maxHops": 123,
"wrapUnwrapSol": true,
"txVersion": "v0",
"priorityFee": "<string>",
"feeAccount": "<string>",
"feeBps": 123,
"feeFromInput": false
}
'import requests
url = "https://raptor-beta.solanatracker.io/quote-and-swap"
payload = {
"userPublicKey": "<string>",
"inputMint": "<string>",
"outputMint": "<string>",
"amount": 123,
"slippageBps": "<string>",
"dexes": "<string>",
"maxHops": 123,
"wrapUnwrapSol": True,
"txVersion": "v0",
"priorityFee": "<string>",
"feeAccount": "<string>",
"feeBps": 123,
"feeFromInput": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
userPublicKey: '<string>',
inputMint: '<string>',
outputMint: '<string>',
amount: 123,
slippageBps: '<string>',
dexes: '<string>',
maxHops: 123,
wrapUnwrapSol: true,
txVersion: 'v0',
priorityFee: '<string>',
feeAccount: '<string>',
feeBps: 123,
feeFromInput: false
})
};
fetch('https://raptor-beta.solanatracker.io/quote-and-swap', 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://raptor-beta.solanatracker.io/quote-and-swap",
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([
'userPublicKey' => '<string>',
'inputMint' => '<string>',
'outputMint' => '<string>',
'amount' => 123,
'slippageBps' => '<string>',
'dexes' => '<string>',
'maxHops' => 123,
'wrapUnwrapSol' => true,
'txVersion' => 'v0',
'priorityFee' => '<string>',
'feeAccount' => '<string>',
'feeBps' => 123,
'feeFromInput' => false
]),
CURLOPT_HTTPHEADER => [
"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://raptor-beta.solanatracker.io/quote-and-swap"
payload := strings.NewReader("{\n \"userPublicKey\": \"<string>\",\n \"inputMint\": \"<string>\",\n \"outputMint\": \"<string>\",\n \"amount\": 123,\n \"slippageBps\": \"<string>\",\n \"dexes\": \"<string>\",\n \"maxHops\": 123,\n \"wrapUnwrapSol\": true,\n \"txVersion\": \"v0\",\n \"priorityFee\": \"<string>\",\n \"feeAccount\": \"<string>\",\n \"feeBps\": 123,\n \"feeFromInput\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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://raptor-beta.solanatracker.io/quote-and-swap")
.header("Content-Type", "application/json")
.body("{\n \"userPublicKey\": \"<string>\",\n \"inputMint\": \"<string>\",\n \"outputMint\": \"<string>\",\n \"amount\": 123,\n \"slippageBps\": \"<string>\",\n \"dexes\": \"<string>\",\n \"maxHops\": 123,\n \"wrapUnwrapSol\": true,\n \"txVersion\": \"v0\",\n \"priorityFee\": \"<string>\",\n \"feeAccount\": \"<string>\",\n \"feeBps\": 123,\n \"feeFromInput\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://raptor-beta.solanatracker.io/quote-and-swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"userPublicKey\": \"<string>\",\n \"inputMint\": \"<string>\",\n \"outputMint\": \"<string>\",\n \"amount\": 123,\n \"slippageBps\": \"<string>\",\n \"dexes\": \"<string>\",\n \"maxHops\": 123,\n \"wrapUnwrapSol\": true,\n \"txVersion\": \"v0\",\n \"priorityFee\": \"<string>\",\n \"feeAccount\": \"<string>\",\n \"feeBps\": 123,\n \"feeFromInput\": false\n}"
response = http.request(request)
puts response.read_body{
"quote": {
"inputMint": "<string>",
"outputMint": "<string>",
"amountIn": "<string>",
"amountOut": "<string>",
"minAmountOut": "<string>",
"feeAmount": "<string>",
"priceImpact": 123,
"slippageBps": 123,
"routePlan": [
{
"programId": "<string>",
"dex": "<string>",
"pool": "<string>",
"inputMint": "<string>",
"outputMint": "<string>",
"amountIn": "<string>",
"amountOut": "<string>",
"feeAmount": "<string>",
"priceImpact": 123,
"percent": 123
}
],
"contextSlot": 123,
"timeTaken": 123,
"swapUsdValue": "<string>",
"priorityFee": {
"recommended": 123,
"level": "<string>",
"levels": {
"min": 123,
"low": 123,
"medium": 123,
"high": 123,
"veryHigh": 123,
"unsafeMax": 123
}
},
"platformFee": {
"feeBps": 123,
"feeAccount": "<string>"
}
},
"swapTransaction": "<string>",
"lastValidBlockHeight": 123
}API Reference
Quote and swap in one request
单次请求完成询价与交易构建。
POST
/
quote-and-swap
Quote and swap in one request
curl --request POST \
--url https://raptor-beta.solanatracker.io/quote-and-swap \
--header 'Content-Type: application/json' \
--data '
{
"userPublicKey": "<string>",
"inputMint": "<string>",
"outputMint": "<string>",
"amount": 123,
"slippageBps": "<string>",
"dexes": "<string>",
"maxHops": 123,
"wrapUnwrapSol": true,
"txVersion": "v0",
"priorityFee": "<string>",
"feeAccount": "<string>",
"feeBps": 123,
"feeFromInput": false
}
'import requests
url = "https://raptor-beta.solanatracker.io/quote-and-swap"
payload = {
"userPublicKey": "<string>",
"inputMint": "<string>",
"outputMint": "<string>",
"amount": 123,
"slippageBps": "<string>",
"dexes": "<string>",
"maxHops": 123,
"wrapUnwrapSol": True,
"txVersion": "v0",
"priorityFee": "<string>",
"feeAccount": "<string>",
"feeBps": 123,
"feeFromInput": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
userPublicKey: '<string>',
inputMint: '<string>',
outputMint: '<string>',
amount: 123,
slippageBps: '<string>',
dexes: '<string>',
maxHops: 123,
wrapUnwrapSol: true,
txVersion: 'v0',
priorityFee: '<string>',
feeAccount: '<string>',
feeBps: 123,
feeFromInput: false
})
};
fetch('https://raptor-beta.solanatracker.io/quote-and-swap', 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://raptor-beta.solanatracker.io/quote-and-swap",
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([
'userPublicKey' => '<string>',
'inputMint' => '<string>',
'outputMint' => '<string>',
'amount' => 123,
'slippageBps' => '<string>',
'dexes' => '<string>',
'maxHops' => 123,
'wrapUnwrapSol' => true,
'txVersion' => 'v0',
'priorityFee' => '<string>',
'feeAccount' => '<string>',
'feeBps' => 123,
'feeFromInput' => false
]),
CURLOPT_HTTPHEADER => [
"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://raptor-beta.solanatracker.io/quote-and-swap"
payload := strings.NewReader("{\n \"userPublicKey\": \"<string>\",\n \"inputMint\": \"<string>\",\n \"outputMint\": \"<string>\",\n \"amount\": 123,\n \"slippageBps\": \"<string>\",\n \"dexes\": \"<string>\",\n \"maxHops\": 123,\n \"wrapUnwrapSol\": true,\n \"txVersion\": \"v0\",\n \"priorityFee\": \"<string>\",\n \"feeAccount\": \"<string>\",\n \"feeBps\": 123,\n \"feeFromInput\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
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://raptor-beta.solanatracker.io/quote-and-swap")
.header("Content-Type", "application/json")
.body("{\n \"userPublicKey\": \"<string>\",\n \"inputMint\": \"<string>\",\n \"outputMint\": \"<string>\",\n \"amount\": 123,\n \"slippageBps\": \"<string>\",\n \"dexes\": \"<string>\",\n \"maxHops\": 123,\n \"wrapUnwrapSol\": true,\n \"txVersion\": \"v0\",\n \"priorityFee\": \"<string>\",\n \"feeAccount\": \"<string>\",\n \"feeBps\": 123,\n \"feeFromInput\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://raptor-beta.solanatracker.io/quote-and-swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"userPublicKey\": \"<string>\",\n \"inputMint\": \"<string>\",\n \"outputMint\": \"<string>\",\n \"amount\": 123,\n \"slippageBps\": \"<string>\",\n \"dexes\": \"<string>\",\n \"maxHops\": 123,\n \"wrapUnwrapSol\": true,\n \"txVersion\": \"v0\",\n \"priorityFee\": \"<string>\",\n \"feeAccount\": \"<string>\",\n \"feeBps\": 123,\n \"feeFromInput\": false\n}"
response = http.request(request)
puts response.read_body{
"quote": {
"inputMint": "<string>",
"outputMint": "<string>",
"amountIn": "<string>",
"amountOut": "<string>",
"minAmountOut": "<string>",
"feeAmount": "<string>",
"priceImpact": 123,
"slippageBps": 123,
"routePlan": [
{
"programId": "<string>",
"dex": "<string>",
"pool": "<string>",
"inputMint": "<string>",
"outputMint": "<string>",
"amountIn": "<string>",
"amountOut": "<string>",
"feeAmount": "<string>",
"priceImpact": 123,
"percent": 123
}
],
"contextSlot": 123,
"timeTaken": 123,
"swapUsdValue": "<string>",
"priorityFee": {
"recommended": 123,
"level": "<string>",
"levels": {
"min": 123,
"low": 123,
"medium": 123,
"high": 123,
"veryHigh": 123,
"unsafeMax": 123
}
},
"platformFee": {
"feeBps": 123,
"feeAccount": "<string>"
}
},
"swapTransaction": "<string>",
"lastValidBlockHeight": 123
}请求体
application/json
User's wallet public key
Input token mint
Output token mint
Input amount in lamports
Slippage in basis points or 'dynamic'
Comma-separated DEX filter
Maximum routing hops
Automatically wrap/unwrap SOL
Transaction version
可用选项:
legacy, v0 Priority fee mode or microlamports
Platform fee recipient
Platform fee in basis points
Take fee from input
此页面对您有帮助吗?
⌘I