Skip to main content
Every program on this page is complete. Copy it into a file, set your key, and run it. Each one was run against real OrbitFlare endpoints before it was published.

Before you start

Set your license key once. All three SDKs read it from the environment, so it never has to appear in your code.
The examples use Frankfurt (fra). Change the host to the region closest to your servers. If your license is in API Key Only mode, the SDKs also send the key to Jetstream and Yellowstone. In IP Whitelist mode, add your server’s IP to the license in the dashboard before running the streaming recipe.
ws and @grpc/grpc-js are optional peer dependencies of the SDK. Without them the WebSocket and Jetstream clients fail with Cannot find package 'ws' or Cannot find package '@grpc/grpc-js'. Run a file with npx tsx file.ts.

Check that your key works

The fastest way to rule out setup problems. If this prints a slot number, your key, region and network path are fine.
If it fails, the error says why: The full list is in the error reference.

Watch an account for changes

Subscribes over WebSocket and prints every update. The example watches the Clock sysvar because it changes every slot, so you see output immediately. Swap in any account address.
Updates arrive only when the account changes. A quiet account means a quiet subscription, not a broken one. See WebSocket debugging if nothing arrives.

Wait for a transaction to confirm

Pass a signature on the command line. The program polls getSignatureStatuses until the transaction is confirmed, fails, or is clearly not coming.
Polling with searchTransactionHistory works for any signature, old or new. signatureSubscribe only knows about recent transactions, so subscribing to one that confirmed a few minutes ago never notifies. A null status means the cluster has not seen the transaction. Transaction debugging covers what to do about that.

Stream a program’s transactions

Uses Jetstream v2 to print every transaction that touches pump.fun, with the fee payer and compute unit price from the enrichment fields.
The grpcurl version needs jetstream_v2.proto from the SDK repository in the current folder. Jetstream filters transactions only. To watch account state, use Yellowstone.

Read a wallet’s recent transactions

Returns the 10 most recent transactions for an address using getTransactionsForAddress.
Each entry has signature, slot, blockTime, err and confirmationStatus. Pass the returned paginationToken to get the next page. For complete transactions, set transactionDetails to "full" together with "maxSupportedTransactionVersion": 1. Without it, version 1 transactions are silently left out. See getTransactionsForAddress for filters and sorting.

More examples

Error reference

Every error OrbitFlare returns and what to do about it.

Transaction debugging

Why a transaction failed, was dropped, or never landed.

Sending through Apex

Land transactions faster with OrbitFlare Apex.

SDK reference

Every client, builder option and method in the SDKs.