Swap Quote
curl --request GET \
--url https://payments.magicblock.app/v1/swap/quoteimport requests
url = "https://payments.magicblock.app/v1/swap/quote"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://payments.magicblock.app/v1/swap/quote', 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://payments.magicblock.app/v1/swap/quote",
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://payments.magicblock.app/v1/swap/quote"
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://payments.magicblock.app/v1/swap/quote")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.magicblock.app/v1/swap/quote")
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{
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"inAmount": "1000000",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"outAmount": "999519",
"otherAmountThreshold": "994522",
"swapMode": "ExactIn",
"slippageBps": 50,
"priceImpactPct": "0",
"routePlan": [
{
"swapInfo": {
"ammKey": "DB3sUCP2H4icbeKmK6yb6nUxU5ogbcRHtGuq7W2RoRwW",
"label": "HumidiFi",
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "So11111111111111111111111111111111111111112",
"inAmount": "1000000",
"outAmount": "11687625"
},
"percent": 100,
"bps": null
},
{
"swapInfo": {
"ammKey": "4rJggoVMajEUtipev1XhSMjESYk8Zibz6CDHPtUe1mem",
"label": "GoonFi V2",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"inAmount": "11687625",
"outAmount": "999519"
},
"percent": 100,
"bps": null
}
],
"contextSlot": 414697033,
"timeTaken": 0.001218
}Private Payments API
Swap 报价
GET
/
v1
/
swap
/
quote
Swap Quote
curl --request GET \
--url https://payments.magicblock.app/v1/swap/quoteimport requests
url = "https://payments.magicblock.app/v1/swap/quote"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://payments.magicblock.app/v1/swap/quote', 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://payments.magicblock.app/v1/swap/quote",
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://payments.magicblock.app/v1/swap/quote"
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://payments.magicblock.app/v1/swap/quote")
.asString();require 'uri'
require 'net/http'
url = URI("https://payments.magicblock.app/v1/swap/quote")
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{
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"inAmount": "1000000",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"outAmount": "999519",
"otherAmountThreshold": "994522",
"swapMode": "ExactIn",
"slippageBps": 50,
"priceImpactPct": "0",
"routePlan": [
{
"swapInfo": {
"ammKey": "DB3sUCP2H4icbeKmK6yb6nUxU5ogbcRHtGuq7W2RoRwW",
"label": "HumidiFi",
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "So11111111111111111111111111111111111111112",
"inAmount": "1000000",
"outAmount": "11687625"
},
"percent": 100,
"bps": null
},
{
"swapInfo": {
"ammKey": "4rJggoVMajEUtipev1XhSMjESYk8Zibz6CDHPtUe1mem",
"label": "GoonFi V2",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
"inAmount": "11687625",
"outAmount": "999519"
},
"percent": 100,
"bps": null
}
],
"contextSlot": 414697033,
"timeTaken": 0.001218
}查询参数
响应
Swap quote

