Create Pro Buy Transaction
Generate a buy transaction for a pro pool.
Flow: First call /quote/pro/buy to get a quote, then pass the quote_response and pool address here. The returned transaction wraps SOL, executes the swap, and unwraps remaining SOL.
Pro pool buys work identically to standard pool buys but reference the pro pool’s state account directly.
curl --request POST \
--url https://tx.api.heaven.xyz/tx/pro/buy \
--header 'Content-Type: application/json' \
--data '
{
"payer": "<string>",
"quote_response": {
"config_version": 1,
"max_lamport_spend": 1,
"max_sol_spend": 123,
"minimum_out": 1,
"minimum_out_ui": 123,
"mint": "<string>",
"program_id": "<string>",
"slippage_bps": 1
},
"encoded_user_defined_event_data": "<string>",
"pool": "<string>",
"compute_unit_limit": 1,
"compute_unit_price": 1,
"source": "<string>"
}
'import requests
url = "https://tx.api.heaven.xyz/tx/pro/buy"
payload = {
"payer": "<string>",
"quote_response": {
"config_version": 1,
"max_lamport_spend": 1,
"max_sol_spend": 123,
"minimum_out": 1,
"minimum_out_ui": 123,
"mint": "<string>",
"program_id": "<string>",
"slippage_bps": 1
},
"encoded_user_defined_event_data": "<string>",
"pool": "<string>",
"compute_unit_limit": 1,
"compute_unit_price": 1,
"source": "<string>"
}
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({
payer: '<string>',
quote_response: {
config_version: 1,
max_lamport_spend: 1,
max_sol_spend: 123,
minimum_out: 1,
minimum_out_ui: 123,
mint: '<string>',
program_id: '<string>',
slippage_bps: 1
},
encoded_user_defined_event_data: '<string>',
pool: '<string>',
compute_unit_limit: 1,
compute_unit_price: 1,
source: '<string>'
})
};
fetch('https://tx.api.heaven.xyz/tx/pro/buy', 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://tx.api.heaven.xyz/tx/pro/buy",
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([
'payer' => '<string>',
'quote_response' => [
'config_version' => 1,
'max_lamport_spend' => 1,
'max_sol_spend' => 123,
'minimum_out' => 1,
'minimum_out_ui' => 123,
'mint' => '<string>',
'program_id' => '<string>',
'slippage_bps' => 1
],
'encoded_user_defined_event_data' => '<string>',
'pool' => '<string>',
'compute_unit_limit' => 1,
'compute_unit_price' => 1,
'source' => '<string>'
]),
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://tx.api.heaven.xyz/tx/pro/buy"
payload := strings.NewReader("{\n \"payer\": \"<string>\",\n \"quote_response\": {\n \"config_version\": 1,\n \"max_lamport_spend\": 1,\n \"max_sol_spend\": 123,\n \"minimum_out\": 1,\n \"minimum_out_ui\": 123,\n \"mint\": \"<string>\",\n \"program_id\": \"<string>\",\n \"slippage_bps\": 1\n },\n \"encoded_user_defined_event_data\": \"<string>\",\n \"pool\": \"<string>\",\n \"compute_unit_limit\": 1,\n \"compute_unit_price\": 1,\n \"source\": \"<string>\"\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://tx.api.heaven.xyz/tx/pro/buy")
.header("Content-Type", "application/json")
.body("{\n \"payer\": \"<string>\",\n \"quote_response\": {\n \"config_version\": 1,\n \"max_lamport_spend\": 1,\n \"max_sol_spend\": 123,\n \"minimum_out\": 1,\n \"minimum_out_ui\": 123,\n \"mint\": \"<string>\",\n \"program_id\": \"<string>\",\n \"slippage_bps\": 1\n },\n \"encoded_user_defined_event_data\": \"<string>\",\n \"pool\": \"<string>\",\n \"compute_unit_limit\": 1,\n \"compute_unit_price\": 1,\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tx.api.heaven.xyz/tx/pro/buy")
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 \"payer\": \"<string>\",\n \"quote_response\": {\n \"config_version\": 1,\n \"max_lamport_spend\": 1,\n \"max_sol_spend\": 123,\n \"minimum_out\": 1,\n \"minimum_out_ui\": 123,\n \"mint\": \"<string>\",\n \"program_id\": \"<string>\",\n \"slippage_bps\": 1\n },\n \"encoded_user_defined_event_data\": \"<string>\",\n \"pool\": \"<string>\",\n \"compute_unit_limit\": 1,\n \"compute_unit_price\": 1,\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tx": "<string>"
}Body
Request to create a buy transaction for a pro pool. First call Quote Pro Buy to get the quote_response, then pass it here.
Public key of the wallet that will sign and pay for the transaction.
The full quote response object from the Quote Pro Buy endpoint. Contains the calculated amounts, fees, and slippage parameters.
Show child attributes
Show child attributes
Arbitrary string data emitted as an on-chain event. Useful for tracking or attributing transactions.
On-chain address of the pro pool state account. Returned in the response when creating a pool.
Maximum compute units for the transaction. Higher values allow more complex operations but cost more. Defaults to a sensible value if omitted.
x >= 0Priority fee in micro-lamports per compute unit. Higher values increase transaction priority. Defaults to a sensible value if omitted.
x >= 0Optional source wallet. If different from payer, tokens will be debited from this wallet. Defaults to payer if omitted.
Response
Base64 encoded versioned transaction. Decode, sign with the payer, and submit to the Solana network.
curl --request POST \
--url https://tx.api.heaven.xyz/tx/pro/buy \
--header 'Content-Type: application/json' \
--data '
{
"payer": "<string>",
"quote_response": {
"config_version": 1,
"max_lamport_spend": 1,
"max_sol_spend": 123,
"minimum_out": 1,
"minimum_out_ui": 123,
"mint": "<string>",
"program_id": "<string>",
"slippage_bps": 1
},
"encoded_user_defined_event_data": "<string>",
"pool": "<string>",
"compute_unit_limit": 1,
"compute_unit_price": 1,
"source": "<string>"
}
'import requests
url = "https://tx.api.heaven.xyz/tx/pro/buy"
payload = {
"payer": "<string>",
"quote_response": {
"config_version": 1,
"max_lamport_spend": 1,
"max_sol_spend": 123,
"minimum_out": 1,
"minimum_out_ui": 123,
"mint": "<string>",
"program_id": "<string>",
"slippage_bps": 1
},
"encoded_user_defined_event_data": "<string>",
"pool": "<string>",
"compute_unit_limit": 1,
"compute_unit_price": 1,
"source": "<string>"
}
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({
payer: '<string>',
quote_response: {
config_version: 1,
max_lamport_spend: 1,
max_sol_spend: 123,
minimum_out: 1,
minimum_out_ui: 123,
mint: '<string>',
program_id: '<string>',
slippage_bps: 1
},
encoded_user_defined_event_data: '<string>',
pool: '<string>',
compute_unit_limit: 1,
compute_unit_price: 1,
source: '<string>'
})
};
fetch('https://tx.api.heaven.xyz/tx/pro/buy', 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://tx.api.heaven.xyz/tx/pro/buy",
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([
'payer' => '<string>',
'quote_response' => [
'config_version' => 1,
'max_lamport_spend' => 1,
'max_sol_spend' => 123,
'minimum_out' => 1,
'minimum_out_ui' => 123,
'mint' => '<string>',
'program_id' => '<string>',
'slippage_bps' => 1
],
'encoded_user_defined_event_data' => '<string>',
'pool' => '<string>',
'compute_unit_limit' => 1,
'compute_unit_price' => 1,
'source' => '<string>'
]),
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://tx.api.heaven.xyz/tx/pro/buy"
payload := strings.NewReader("{\n \"payer\": \"<string>\",\n \"quote_response\": {\n \"config_version\": 1,\n \"max_lamport_spend\": 1,\n \"max_sol_spend\": 123,\n \"minimum_out\": 1,\n \"minimum_out_ui\": 123,\n \"mint\": \"<string>\",\n \"program_id\": \"<string>\",\n \"slippage_bps\": 1\n },\n \"encoded_user_defined_event_data\": \"<string>\",\n \"pool\": \"<string>\",\n \"compute_unit_limit\": 1,\n \"compute_unit_price\": 1,\n \"source\": \"<string>\"\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://tx.api.heaven.xyz/tx/pro/buy")
.header("Content-Type", "application/json")
.body("{\n \"payer\": \"<string>\",\n \"quote_response\": {\n \"config_version\": 1,\n \"max_lamport_spend\": 1,\n \"max_sol_spend\": 123,\n \"minimum_out\": 1,\n \"minimum_out_ui\": 123,\n \"mint\": \"<string>\",\n \"program_id\": \"<string>\",\n \"slippage_bps\": 1\n },\n \"encoded_user_defined_event_data\": \"<string>\",\n \"pool\": \"<string>\",\n \"compute_unit_limit\": 1,\n \"compute_unit_price\": 1,\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tx.api.heaven.xyz/tx/pro/buy")
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 \"payer\": \"<string>\",\n \"quote_response\": {\n \"config_version\": 1,\n \"max_lamport_spend\": 1,\n \"max_sol_spend\": 123,\n \"minimum_out\": 1,\n \"minimum_out_ui\": 123,\n \"mint\": \"<string>\",\n \"program_id\": \"<string>\",\n \"slippage_bps\": 1\n },\n \"encoded_user_defined_event_data\": \"<string>\",\n \"pool\": \"<string>\",\n \"compute_unit_limit\": 1,\n \"compute_unit_price\": 1,\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"tx": "<string>"
}