Send Plain Text Transaction
URI Params
Param
Type
Description
Methods
Method
REST Method
Description
Example Request
Expected Response
Status Code
Description
Last updated
Last updated
curl --location 'https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction' \
--header 'Content-Type: text/plain' \
--data 'base64_encoded_txn'#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::builder()
.build()?;
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("Content-Type", "text/plain".parse()?);
let data = "base64_encoded_txn";
let request = client.request(reqwest::Method::POST, "https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction")
.headers(headers)
.body(data);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
import { Transaction, VersionedTransaction } from "@solana/web3.js";
/**
* Sends a base64-encoded Solana transaction as plain text
* to the Astralane Iris2 gateway.
*/
async function sendTransaction(
transaction: Transaction | VersionedTransaction,
apiKey: string
): Promise<void> {
const url = new URL("https://lim.gateway.astralane.io/iris2");
url.searchParams.set("api-key", apiKey);
url.searchParams.set("method", "sendTransaction");
// Serialize and base64-encode the transaction
const base64Tx = Buffer.from(transaction.serialize()).toString("base64");
const response = await fetch(url.toString(), {
method: "POST",
headers: {
"Content-Type": "text/plain",
},
body: base64Tx,
});
if (!response.ok) {
throw new Error(
`sendTransaction failed: ${response.status} ${response.statusText}`
);
}
}
// Usage
// ... build and sign your transaction ...
await sendTransaction(signedTransaction, "YOUR_API_KEY");const axios = require('axios');
let data = 'base64_encoded_txn';
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction',
headers: {
'Content-Type': 'text/plain'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://lim.gateway.astralane.io/iris2?api-key=APIKEY&method=sendTransaction"
method := "POST"
payload := strings.NewReader(`base64_encoded_txn`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "text/plain")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}{
"result": "5KtPn1LGuxhFiwjxErkxTb7XxtLVjFW9QjMpv3Y7gW1x..."
}