Quickstart Guide
Prerequisites
Ensure you have an API key with the Solana network enabled.
Make calls
cURL
Run the following command in your terminal. This command will retrieve the latest block number from the Solana network.
Replace YOUR-API-KEY
with your actual Liquify Gateway API key.
https://gateway.liquify.com/api=YOUR-API-KEY \
-X POST
-H "Content-Type: application/json"
--data '{"jsonrpc": "2.0","id":1,"method":"getBlock","params":[94101948, {"encoding": "jsonParsed","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}]}'
Ruby
require "uri"
require "json"
require "net/http"
url = URI("https://gateway.liquify.com/api=YOUR-API-KEY \")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
94101948,
{
"encoding": "jsonParsed",
"maxSupportedTransactionVersion": 0,
"transactionDetails": "full",
"rewards": false
}
]
})
response = https.request(request)
puts response.read_body
Solana Web3.js
const web3 = require("@solana/web3.js");
(async () => {
const solana = new web3.Connection("https://gateway.liquify.com/api=YOUR-API-KEY \");
console.log(
await solana.getBlock(94101948, { maxSupportedTransactionVersion: 0 })
);
})();
Solana.py
from solana.rpc.api import Client
solana_client = Client("https://gateway.liquify.com/api=YOUR-API-KEY \")
print(solana_client.get_block(94101948, "jsonParsed", max_supported_transaction_version=0))
Rust
use reqwest::header;
use reqwest::Client;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut headers = header::HeaderMap::new();
headers.insert("Content-Type", "application/json".parse().unwrap());
let client = Client::new();
let json_data = r#"
{
"jsonrpc": "2.0",
"id": 1,
"method": "getBlock",
"params": [
94101948,
{
"encoding": "jsonParsed",
"maxSupportedTransactionVersion": 0,
"transactionDetails": "full",
"rewards": false
}
]
}"#;
let response = client
.post("https://gateway.liquify.com/api=YOUR-API-KEY \")
.headers(headers)
.body(json_data)
.send()
.await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Last updated