Expand description
§helius-stream
A resilient WebSocket client for Helius RPC on Solana.
Built for production: gap detection, reconnect backoff with exponential jitter, circuit-breaker-friendly state machine, and zero panic surface.
Extracted from prometheus9, an MEV engine that ran 15h on Solana mainnet
against Raydium AMM v4 and Orca Whirlpool. The original engine subscribed
to specific vault accounts; this crate exposes the same machinery as a
general-purpose primitive.
§Quick start
use helius_stream::{HeliusStream, StreamConfig};
let config = StreamConfig::mainnet(std::env::var("HELIUS_API_KEY")?);
let mut stream = HeliusStream::connect(config)?;
// USDC mint as an example
stream.subscribe_account_b58("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")?;
while let Some(update) = stream.next_update() {
if stream.is_safe_for_simulation() {
println!("slot={} lamports={} bytes={}",
update.slot, update.lamports, update.data.len());
}
}§Why not just use solana-client?
solana-client pulls in 200+ transitive dependencies. This crate has 8.
For workloads that only need account subscriptions, that matters.
Structs§
- Account
Update - An account update received from the stream.
- Helius
Stream - A resilient Helius WebSocket client.
- Reconnect
Policy - Exponential backoff with cap, for reconnect attempts.
- Stream
Config - Configuration for a single stream connection.
- Stream
Health - Tracks slot continuity, gaps, and freshness of incoming updates.
Enums§
- Stream
Error - Stream
State - Current operational state of the stream.
Type Aliases§
- Pubkey
- A Solana account public key — 32 raw bytes.