curl --request POST \
--url https://transaction-v1.raydium.io/transaction/swap-base-in \
--header 'Content-Type: application/json' \
--data '
{
"wallet": "11111111111111111111111111111111",
"swapResponse": {
"id": "<string>",
"success": true,
"version": "<string>",
"data": {}
},
"txVersion": "V0",
"computeUnitPriceMicroLamports": "1000",
"wrapSol": false,
"unwrapSol": false,
"inputAccount": "TokenAccount1111111111111111111111111111111111",
"outputAccount": "TokenAccount2222222222222222222222222222222222",
"jitoInfo": {
"address": "<string>",
"amount": "<string>"
},
"referrerWallet": "ReferrerWallet1111111111111111111111111111111111"
}
'import requests
url = "https://transaction-v1.raydium.io/transaction/swap-base-in"
payload = {
"wallet": "11111111111111111111111111111111",
"swapResponse": {
"id": "<string>",
"success": True,
"version": "<string>",
"data": {}
},
"txVersion": "V0",
"computeUnitPriceMicroLamports": "1000",
"wrapSol": False,
"unwrapSol": False,
"inputAccount": "TokenAccount1111111111111111111111111111111111",
"outputAccount": "TokenAccount2222222222222222222222222222222222",
"jitoInfo": {
"address": "<string>",
"amount": "<string>"
},
"referrerWallet": "ReferrerWallet1111111111111111111111111111111111"
}
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({
wallet: '11111111111111111111111111111111',
swapResponse: {id: '<string>', success: true, version: '<string>', data: {}},
txVersion: 'V0',
computeUnitPriceMicroLamports: '1000',
wrapSol: false,
unwrapSol: false,
inputAccount: 'TokenAccount1111111111111111111111111111111111',
outputAccount: 'TokenAccount2222222222222222222222222222222222',
jitoInfo: {address: '<string>', amount: '<string>'},
referrerWallet: 'ReferrerWallet1111111111111111111111111111111111'
})
};
fetch('https://transaction-v1.raydium.io/transaction/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/transaction/swap-base-in",
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([
'wallet' => '11111111111111111111111111111111',
'swapResponse' => [
'id' => '<string>',
'success' => true,
'version' => '<string>',
'data' => [
]
],
'txVersion' => 'V0',
'computeUnitPriceMicroLamports' => '1000',
'wrapSol' => false,
'unwrapSol' => false,
'inputAccount' => 'TokenAccount1111111111111111111111111111111111',
'outputAccount' => 'TokenAccount2222222222222222222222222222222222',
'jitoInfo' => [
'address' => '<string>',
'amount' => '<string>'
],
'referrerWallet' => 'ReferrerWallet1111111111111111111111111111111111'
]),
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://transaction-v1.raydium.io/transaction/swap-base-in"
payload := strings.NewReader("{\n \"wallet\": \"11111111111111111111111111111111\",\n \"swapResponse\": {\n \"id\": \"<string>\",\n \"success\": true,\n \"version\": \"<string>\",\n \"data\": {}\n },\n \"txVersion\": \"V0\",\n \"computeUnitPriceMicroLamports\": \"1000\",\n \"wrapSol\": false,\n \"unwrapSol\": false,\n \"inputAccount\": \"TokenAccount1111111111111111111111111111111111\",\n \"outputAccount\": \"TokenAccount2222222222222222222222222222222222\",\n \"jitoInfo\": {\n \"address\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"referrerWallet\": \"ReferrerWallet1111111111111111111111111111111111\"\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://transaction-v1.raydium.io/transaction/swap-base-in")
.header("Content-Type", "application/json")
.body("{\n \"wallet\": \"11111111111111111111111111111111\",\n \"swapResponse\": {\n \"id\": \"<string>\",\n \"success\": true,\n \"version\": \"<string>\",\n \"data\": {}\n },\n \"txVersion\": \"V0\",\n \"computeUnitPriceMicroLamports\": \"1000\",\n \"wrapSol\": false,\n \"unwrapSol\": false,\n \"inputAccount\": \"TokenAccount1111111111111111111111111111111111\",\n \"outputAccount\": \"TokenAccount2222222222222222222222222222222222\",\n \"jitoInfo\": {\n \"address\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"referrerWallet\": \"ReferrerWallet1111111111111111111111111111111111\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://transaction-v1.raydium.io/transaction/swap-base-in")
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 \"wallet\": \"11111111111111111111111111111111\",\n \"swapResponse\": {\n \"id\": \"<string>\",\n \"success\": true,\n \"version\": \"<string>\",\n \"data\": {}\n },\n \"txVersion\": \"V0\",\n \"computeUnitPriceMicroLamports\": \"1000\",\n \"wrapSol\": false,\n \"unwrapSol\": false,\n \"inputAccount\": \"TokenAccount1111111111111111111111111111111111\",\n \"outputAccount\": \"TokenAccount2222222222222222222222222222222222\",\n \"jitoInfo\": {\n \"address\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"referrerWallet\": \"ReferrerWallet1111111111111111111111111111111111\"\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"success": true,
"version": "V1",
"data": {
"transaction": "<string>",
"addressLookupTableAddresses": [
"<string>"
]
}
}{
"id": "<string>",
"success": false,
"version": "V1",
"msg": "<string>"
}Build swap transaction (base input)
Generate a serialized swap transaction for a fixed input amount.
Requires a successful compute response from /compute/swap-base-in.
curl --request POST \
--url https://transaction-v1.raydium.io/transaction/swap-base-in \
--header 'Content-Type: application/json' \
--data '
{
"wallet": "11111111111111111111111111111111",
"swapResponse": {
"id": "<string>",
"success": true,
"version": "<string>",
"data": {}
},
"txVersion": "V0",
"computeUnitPriceMicroLamports": "1000",
"wrapSol": false,
"unwrapSol": false,
"inputAccount": "TokenAccount1111111111111111111111111111111111",
"outputAccount": "TokenAccount2222222222222222222222222222222222",
"jitoInfo": {
"address": "<string>",
"amount": "<string>"
},
"referrerWallet": "ReferrerWallet1111111111111111111111111111111111"
}
'import requests
url = "https://transaction-v1.raydium.io/transaction/swap-base-in"
payload = {
"wallet": "11111111111111111111111111111111",
"swapResponse": {
"id": "<string>",
"success": True,
"version": "<string>",
"data": {}
},
"txVersion": "V0",
"computeUnitPriceMicroLamports": "1000",
"wrapSol": False,
"unwrapSol": False,
"inputAccount": "TokenAccount1111111111111111111111111111111111",
"outputAccount": "TokenAccount2222222222222222222222222222222222",
"jitoInfo": {
"address": "<string>",
"amount": "<string>"
},
"referrerWallet": "ReferrerWallet1111111111111111111111111111111111"
}
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({
wallet: '11111111111111111111111111111111',
swapResponse: {id: '<string>', success: true, version: '<string>', data: {}},
txVersion: 'V0',
computeUnitPriceMicroLamports: '1000',
wrapSol: false,
unwrapSol: false,
inputAccount: 'TokenAccount1111111111111111111111111111111111',
outputAccount: 'TokenAccount2222222222222222222222222222222222',
jitoInfo: {address: '<string>', amount: '<string>'},
referrerWallet: 'ReferrerWallet1111111111111111111111111111111111'
})
};
fetch('https://transaction-v1.raydium.io/transaction/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/transaction/swap-base-in",
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([
'wallet' => '11111111111111111111111111111111',
'swapResponse' => [
'id' => '<string>',
'success' => true,
'version' => '<string>',
'data' => [
]
],
'txVersion' => 'V0',
'computeUnitPriceMicroLamports' => '1000',
'wrapSol' => false,
'unwrapSol' => false,
'inputAccount' => 'TokenAccount1111111111111111111111111111111111',
'outputAccount' => 'TokenAccount2222222222222222222222222222222222',
'jitoInfo' => [
'address' => '<string>',
'amount' => '<string>'
],
'referrerWallet' => 'ReferrerWallet1111111111111111111111111111111111'
]),
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://transaction-v1.raydium.io/transaction/swap-base-in"
payload := strings.NewReader("{\n \"wallet\": \"11111111111111111111111111111111\",\n \"swapResponse\": {\n \"id\": \"<string>\",\n \"success\": true,\n \"version\": \"<string>\",\n \"data\": {}\n },\n \"txVersion\": \"V0\",\n \"computeUnitPriceMicroLamports\": \"1000\",\n \"wrapSol\": false,\n \"unwrapSol\": false,\n \"inputAccount\": \"TokenAccount1111111111111111111111111111111111\",\n \"outputAccount\": \"TokenAccount2222222222222222222222222222222222\",\n \"jitoInfo\": {\n \"address\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"referrerWallet\": \"ReferrerWallet1111111111111111111111111111111111\"\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://transaction-v1.raydium.io/transaction/swap-base-in")
.header("Content-Type", "application/json")
.body("{\n \"wallet\": \"11111111111111111111111111111111\",\n \"swapResponse\": {\n \"id\": \"<string>\",\n \"success\": true,\n \"version\": \"<string>\",\n \"data\": {}\n },\n \"txVersion\": \"V0\",\n \"computeUnitPriceMicroLamports\": \"1000\",\n \"wrapSol\": false,\n \"unwrapSol\": false,\n \"inputAccount\": \"TokenAccount1111111111111111111111111111111111\",\n \"outputAccount\": \"TokenAccount2222222222222222222222222222222222\",\n \"jitoInfo\": {\n \"address\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"referrerWallet\": \"ReferrerWallet1111111111111111111111111111111111\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://transaction-v1.raydium.io/transaction/swap-base-in")
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 \"wallet\": \"11111111111111111111111111111111\",\n \"swapResponse\": {\n \"id\": \"<string>\",\n \"success\": true,\n \"version\": \"<string>\",\n \"data\": {}\n },\n \"txVersion\": \"V0\",\n \"computeUnitPriceMicroLamports\": \"1000\",\n \"wrapSol\": false,\n \"unwrapSol\": false,\n \"inputAccount\": \"TokenAccount1111111111111111111111111111111111\",\n \"outputAccount\": \"TokenAccount2222222222222222222222222222222222\",\n \"jitoInfo\": {\n \"address\": \"<string>\",\n \"amount\": \"<string>\"\n },\n \"referrerWallet\": \"ReferrerWallet1111111111111111111111111111111111\"\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"success": true,
"version": "V1",
"data": {
"transaction": "<string>",
"addressLookupTableAddresses": [
"<string>"
]
}
}{
"id": "<string>",
"success": false,
"version": "V1",
"msg": "<string>"
}Body
Signer wallet address (base58).
"11111111111111111111111111111111"
The complete response object from the compute endpoint.
Show child attributes
Show child attributes
Solana transaction version.
V0, LEGACY "V0"
Compute unit price in micro-lamports (for priority fees).
"1000"
Whether to wrap SOL if the input is native SOL.
false
Whether to unwrap WSOL to SOL in the output.
false
Optional token account address for input. Required if not wrapping SOL.
"TokenAccount1111111111111111111111111111111111"
Optional token account address for output.
"TokenAccount2222222222222222222222222222222222"
Optional Jito bundle params for MEV protection.
Show child attributes
Show child attributes
Optional referrer wallet address for fee collection.
"ReferrerWallet1111111111111111111111111111111111"
Was this page helpful?

