Skip to main content

Install

The rpc feature is enabled by default.

Building the client

Here’s a client with every option set:
Most of these have sensible defaults. A minimal setup:

Builder methods

.url(url) - The primary endpoint to send requests to. If not set, the SDK checks the ORBITFLARE_RPC_URL environment variable.
.urls(&[...]) - Set the primary and all fallbacks in one call. The first element is the primary, the rest are fallbacks.
.fallback_url(url) - Add a single fallback endpoint. Call multiple times to add several. When the primary fails, the SDK tries fallbacks in order.
.fallback_urls(&[...]) - Same as fallback_url but takes a slice.
.api_key(key) - Your OrbitFlare license key. If not set, the SDK checks ORBITFLARE_LICENSE_KEY from the environment. The key is injected into the URL at request time, never stored in the endpoint.
.commitment(level) - Default commitment level used for all typed helpers. Options: "processed", "confirmed", "finalized". Defaults to "confirmed".
.retry(policy) - Controls how the SDK retries failed requests. initial_delay is the wait before the first retry. multiplier scales the delay on each attempt. max_delay caps the backoff. max_attempts limits total retries per endpoint (0 means infinite). Defaults: 100ms initial, 30s max, 2x multiplier, infinite attempts.
.timeout(duration) - HTTP timeout for each individual request. Defaults to 30 seconds.

Available RPC methods

get_slot()

Returns the current slot number.

get_balance(address)

Returns the balance in lamports for an account.

get_account_info(address)

Returns the full account data or None if the account doesn’t exist. Data is base64-encoded.

get_multiple_accounts(addresses)

Fetches multiple accounts in one call. Automatically chunks into batches of 100 (Solana’s per-request limit), so you can pass any number of addresses.

get_latest_blockhash()

Returns the most recent blockhash and the last block height it’s valid for.

get_transaction(signature)

Fetches a confirmed transaction by its signature. Returns the full transaction with metadata.

get_signatures_for_address(address, limit)

Returns recent transaction signatures for an address, newest first.

get_program_accounts(program_id)

Returns all accounts owned by a program. Can return a lot of data.

get_recent_prioritization_fees(addresses)

Returns recent priority fees for a set of accounts. Useful for estimating compute unit pricing.

send_transaction(tx_base64)

Sends a signed transaction to the network. Takes a base64-encoded serialized transaction. Returns the transaction signature.
To land transactions through Apex, use the Apex Rust client.

simulate_transaction(tx_base64)

Simulates a transaction without submitting it. Returns logs, compute units consumed, and any errors.

get_token_accounts_by_owner(owner, mint, program_id)

Returns token accounts for a wallet. Pass either a specific mint or a token program ID. If both are None, defaults to the SPL Token program.

get_transactions_for_address(address, options)

OrbitFlare-specific method that combines getSignaturesForAddress and getTransaction into one call. Returns a GetTransactionsResult with the data array and an optional pagination_token for fetching the next page. Supports four detail levels (signatures, none, accounts, full), bidirectional sorting, time/slot filtering, status filtering, and token account inclusion.

request(method, params)

Call any RPC method by name. The SDK builds the JSON-RPC envelope, handles retry and failover, and returns the result field.

request_raw(body)

Send a raw JSON-RPC body string. Same retry and failover as everything else.

DAS API

The Digital Asset Standard methods read NFTs, compressed NFTs, MPL Core assets and SPL tokens. They are on RpcClient and use the same endpoint, with typed requests and responses in orbitflare_sdk::das. They were added in version 0.4.0.
get_asset, get_asset_batch and get_asset_with_proof have _with_options variants that take DisplayOptions. Requests take .page(), .limit(), .cursor(), .before(), .after() and .sort_by(); use one paging style per request. See the DAS API reference for every parameter and response field.

Full example

A script that checks the state of the network, fetches a wallet’s SOL balance and token holdings, and looks up recent transactions.