Documentation Index
Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
Use this file to discover all available pages before exploring further.
Install
cargo add orbitflare-sdk --features jetstream
Building the client
use orbitflare_sdk::{JetstreamClientBuilder, RetryPolicy, Result};
use std::time::Duration;
let client = JetstreamClientBuilder::new()
.url("http://ny.jetstream.orbitflare.com")
.fallback_url("http://fra.jetstream.orbitflare.com")
.retry(RetryPolicy {
initial_delay: Duration::from_millis(100),
max_delay: Duration::from_secs(30),
multiplier: 2.0,
max_attempts: 0,
})
.timeout_secs(30)
.keepalive_secs(60)
.ping_interval_secs(10)
.max_missed_pongs(3)
.channel_capacity(4096)
.build()?;
Minimal:
let client = JetstreamClientBuilder::new()
.url("http://ny.jetstream.orbitflare.com")
.build()?;
URL falls back to ORBITFLARE_JETSTREAM_URL env var. All builder methods are identical to the gRPC client - same defaults, same behavior.
Writing a YAML config
JetStream supports transaction and account filters. No slots, blocks, or commitment - those are Yellowstone-specific.
# jetstream.yml
transactions:
raydium:
account_include:
- "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"
pumpfun:
account_include:
- "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
accounts:
my_wallet:
account:
- "YOUR_WALLET_ADDRESS"
owner:
- "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
YAML filter reference
transactions - named filters. account_include matches transactions involving those addresses. account_exclude removes matches. account_required means all listed addresses must appear.
accounts - watch specific addresses with account, or all accounts owned by a program with owner.
Supports ${ENV_VAR} expansion.
Subscribing and reading events
From YAML
let mut stream = client.subscribe_yaml("jetstream.yml")?;
Programmatically
use std::collections::HashMap;
use orbitflare_sdk::proto::jetstream::*;
let mut filters = HashMap::new();
filters.insert("target".into(), SubscribeRequestFilterTransactions {
account_include: vec![some_address.to_string()],
account_exclude: vec![],
account_required: vec![],
});
let request = SubscribeRequest {
transactions: filters,
accounts: HashMap::new(),
ping: Some(SubscribeRequestPing { id: 1 }),
};
let mut stream = client.subscribe(request);
Reading the stream
use orbitflare_sdk::proto::jetstream::subscribe_update::UpdateOneof;
while let Some(update) = stream.next().await {
let update = update?;
match update.update_oneof {
Some(UpdateOneof::Transaction(tx)) => {
// tx.slot - the slot number
// tx.transaction - transaction info with signature, account_keys,
// instructions, address_table_lookups
}
Some(UpdateOneof::Account(acct)) => {
// acct.slot - the slot
// acct.account - account info (pubkey, lamports, owner, data)
// acct.is_startup - true during initial snapshot
}
_ => {}
}
}
Closing, multiple streams, reconnection, and ping/pong all work identically to the gRPC client.
Full example
A stream that watches Raydium AMM swaps and prints each transaction’s signature and instruction count.
use orbitflare_sdk::{JetstreamClientBuilder, Result};
use orbitflare_sdk::proto::jetstream::subscribe_update::UpdateOneof;
#[tokio::main]
async fn main() -> Result<()> {
let client = JetstreamClientBuilder::new()
.url("http://ny.jetstream.orbitflare.com")
.build()?;
let mut stream = client.subscribe_yaml("jetstream.yml")?;
let mut count: u64 = 0;
println!("streaming raydium txs...");
while let Some(update) = stream.next().await {
let update = update?;
if let Some(UpdateOneof::Transaction(tx)) = update.update_oneof {
count += 1;
if let Some(info) = &tx.transaction {
let sig = bs58::encode(&info.signature).into_string();
let num_ix = info.instructions.len();
let num_accounts = info.account_keys.len();
println!(
"#{count} slot={} sig={}... ix={num_ix} accounts={num_accounts}",
tx.slot,
&sig[..16],
);
}
}
}
Ok(())
}
With this jetstream.yml:
transactions:
raydium:
account_include:
- "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"