ℹ️
Liquify
  • 😎Welcome to Liquify Gateway
    • Why Liquify Gateway?
    • Why Liquify?
    • Why Pocket Network POKT?
  • 💁RPC Quickstart Guide
    • Create a Liquify Gateway Account
    • Liquify Gateway Dashboard
    • Account Customisation
    • Create an RPC Endpoint
    • Delete an RPC Endpoint
  • SUPPORTED CHAINS
    • ⛓️Chainlist
      • Ethereum
        • Quickstart Guide
      • Polygon (PoS)
        • Quickstart Guide
      • Arbitrum
        • Quickstart Guide
      • Base
        • Quickstart Guide
      • BNB Chain
        • Quickstart Guide
      • Klaytn
        • Quickstart Guide
      • DFK Chain
        • Quickstart Guide
      • Fuse
        • Quickstart Guide
      • Solana
        • Quickstart Guide
  • Connect With Liquify.io
    • Medium
    • Github
    • X / Twitter
    • The Deep Dive Podcast
    • Contact Us
    • liquify.io
    • Liquify Early Adopters Program (LEAP)
Powered by GitBook
On this page
  • Prerequisites​
  • Make calls​
  • cURL​
  • Ruby
  • Solana Web3.js
  • Solana.py
  • Rust
  1. SUPPORTED CHAINS
  2. Chainlist
  3. Solana

Quickstart Guide

PreviousSolanaNextConnect With Liquify.io

Last updated 1 year ago

Prerequisites

Ensure you 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(())
}
⛓️
​
have an API key
​
​