計算交換報價(固定輸入)
curl --request GET \
--url https://transaction-v1.raydium.io/compute/swap-base-inimport requests
url = "https://transaction-v1.raydium.io/compute/swap-base-in"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://transaction-v1.raydium.io/compute/swap-base-in', 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://transaction-v1.raydium.io/compute/swap-base-in",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://transaction-v1.raydium.io/compute/swap-base-in"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://transaction-v1.raydium.io/compute/swap-base-in")
.asString();require 'uri'
require 'net/http'
url = URI("https://transaction-v1.raydium.io/compute/swap-base-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"success": true,
"version": "V1",
"data": {
"inputAmount": "<string>",
"outputAmount": "<string>",
"priceImpact": "<string>",
"routes": [
{}
]
}
}{
"id": "<string>",
"success": false,
"version": "V1",
"msg": "<string>"
}Compute
計算交換報價(固定輸入)
計算當交換固定輸入金額時的預期輸出金額。 適用於在構建交易前顯示預覽。
GET
/
compute
/
swap-base-in
計算交換報價(固定輸入)
curl --request GET \
--url https://transaction-v1.raydium.io/compute/swap-base-inimport requests
url = "https://transaction-v1.raydium.io/compute/swap-base-in"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://transaction-v1.raydium.io/compute/swap-base-in', 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://transaction-v1.raydium.io/compute/swap-base-in",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://transaction-v1.raydium.io/compute/swap-base-in"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://transaction-v1.raydium.io/compute/swap-base-in")
.asString();require 'uri'
require 'net/http'
url = URI("https://transaction-v1.raydium.io/compute/swap-base-in")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"success": true,
"version": "V1",
"data": {
"inputAmount": "<string>",
"outputAmount": "<string>",
"priceImpact": "<string>",
"routes": [
{}
]
}
}{
"id": "<string>",
"success": false,
"version": "V1",
"msg": "<string>"
}查詢參數
輸入代幣的 Mint 地址(base58 編碼的公鑰)。
輸出代幣的 Mint 地址(base58 編碼的公鑰)。
輸入金額(以 lamport 為單位,即 SPL 代幣的最小單位)。必須為非負整數字符串。
最大滑點容差,以基點計(0–10000)。1 bps = 0.01%。
可選的推薦人費用(基點計,0–10000)。僅在你有推薦人權限時使用。
Solana 交易版本。V0 使用地址查找表;LEGACY 為傳統格式。
可用選項:
V0, LEGACY ⌘I

