Skip to main content

QuickNode SDK Solana Overview

Updated on
Mar 20, 2024

Overview

The Solana class of the Quicknode SDK provides a convenient abstraction layer for interacting with the Solana blockchain.

Quickstart

import { solanaWeb3, Solana } from "@quicknode/sdk";

const endpoint = new Solana({
endpointUrl:
"https://some-cool-name.solana-mainnet.quiknode.pro/redacted",
});

await endpoint.connection.sendTransaction(...)

Configuration

Basic Configuration

The Solana class requires an endpointUrl that corresponds with an endpoint URL from your QuickNode account. If you don't have a QuickNode account yet, you can sign up for one here and create an endpoint for free today!

const endpoint = new Solana({
endpointUrl:
"https://some-cool-name.solana-mainnet.quiknode.pro/redacted",
});

await endpoint.connection.getSlot({})
.then(balance => console.log(balance))

Core RPC Functions

The SDK supports Core Solana JSON-RPC API. These functions are provided by @solana/web3.js package.

Example: Get Slot

To call the getSlot RPC method, refer to the following JavaScript code:

import { solanaWeb3, Solana } from "@quicknode/sdk";

const endpoint = new Solana({
endpointUrl:
"https://some-cool-name.solana-mainnet.quiknode.pro/redacted",
});

await endpoint.connection.getSlot({})
.then(balance => console.log(balance))
Share this doc