Tính báo giá swap (đầu vào cơ sở)
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
Tính báo giá swap (đầu vào cơ sở)
Tính toán lượng đầu ra dự kiến khi swap một lượng đầu vào cố định. Hữu ích để hiển thị xem trước trước khi xây dựng giao dịch.
GET
/
compute
/
swap-base-in
Tính báo giá swap (đầu vào cơ sở)
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>"
}Tham số truy vấn
Địa chỉ mint của token đầu vào (khóa công khai được mã hóa base58).
Địa chỉ mint của token đầu ra (khóa công khai được mã hóa base58).
Lượng đầu vào tính bằng lamports (đơn vị nhỏ nhất của SPL token). Phải là một chuỗi số nguyên không âm.
Dung sai slippage tối đa tính bằng basis points (0–10000). 1 bps = 0,01%.
Phí người giới thiệu tùy chọn tính bằng basis points (0–10000). Chỉ được sử dụng nếu bạn có quyền hạn người giới thiệu.
Phiên bản giao dịch Solana. V0 sử dụng bảng tra cứu địa chỉ; LEGACY là định dạng truyền thống.
Tùy chọn có sẵn:
V0, LEGACY Phản hồi
Báo giá swap được tính toán thành công.
Trang này có hữu ích không?

