Address, U256, B256, Filter, TransactionRequest, typed blocks, transactions, receipts, and logs), with OrbitFlare’s own transport: endpoint failover, retry with backoff, and self-healing WebSocket subscriptions.
The clients are generic over the chain (RpcClient<C>, WsClient<C>); the aliases below are convenience shorthands. gRPC is currently Polygon only (Bor).
Supported chains
Migrating from
orbitflare-robinhood-sdk? Robinhood Chain is now covered here via RobinhoodRpcClient / RobinhoodWsClient. The RPC and WebSocket surface is the same; the standalone crate is deprecated.Install
RPC
.url() or via an environment variable (see Endpoints), and the API key with .api_key() or ORBITFLARE_LICENSE_KEY.
Builder methods
.url(url) - The primary endpoint. Resolution order: .url() on the builder, then 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) / .fallback_urls(&[...]) - Add failover endpoints. Failing endpoints are quarantined with exponential cooldown (10s, 20s, 40s, max 60s) and automatically retried once the cooldown expires; healthy endpoints are always preferred.
.api_key(key) - Your OrbitFlare license key. If not set, the SDK checks ORBITFLARE_LICENSE_KEY. The key is appended to the endpoint URL as ?api_key=<key> at request time.
.block_tag(tag) - Default block tag used by state queries (get_balance, call, get_code, …). Defaults to Latest.
.retry(policy) - Controls retry on transient errors (5xx, 429, connection resets, JSON-RPC error code -32005) with exponential backoff before failing over to the next endpoint.
.timeout(duration) - HTTP timeout for each individual request.
Available methods
Log filters
get_logs takes alloy’s Filter directly:
Contract calls and transactions
call and estimate_gas take alloy’s TransactionRequest. To send a transaction, build and sign it with alloy (alloy-signer, alloy-network), then broadcast through the SDK:
Arbitrary methods
request calls any RPC method by name - the SDK builds the JSON-RPC envelope, handles retry and failover, and returns the result field. request_raw sends a raw JSON-RPC body string.
WebSocket
Enable thews feature. .build() is async - it establishes the connection before returning.
.urls(), .fallback_url(s), .api_key(), and .retry() with the RPC builder; the WebSocket-specific options are .ping_interval_secs(n) (default 10) and .max_missed_pongs(n) (default 3).
Subscriptions
Subscriptions are typed - each yields the corresponding alloy type instead of raw JSON:
All subscriptions return a
WsSubscription<T>. Call .next() for the next typed event (None means the subscription was closed), or .next_raw() for the untyped serde_json::Value payload. sub.unsubscribe().await removes one explicitly; dropping a subscription also works.
Reconnection
If the connection drops, the background task reconnects with exponential backoff and re-subscribes every active subscription automatically. Your.next() calls just keep working. Dead connections are detected via active ping/pong.
Polygon gRPC
Polygon exposes a Bor gRPC interface for low-overhead block, header, and receipt access. Enable thegrpc feature. gRPC runs over plaintext HTTP/2; authenticate with a token via .api_key() (sent as x-token) or use IP whitelisting.
H160/H256 values convert to alloy
Address/B256 with the ToAlloy trait.
Custom chains
Any EVM chain works: implementChain for a marker type and point a generic RpcClient<C> at its URL. CHAIN_ID is metadata (available as RpcClient::<C>::chain_id_const()); it does not gate requests.
Arbitrum and Nitro block fields
Robinhood Chain is Arbitrum Nitro, so its blocks carry extra fields (l1BlockNumber, sendRoot, sendCount) that standard EVM block types drop. The SDK preserves them and exposes typed accessors via NitroBlockExt. Any other non-standard field is still available on block.other.
call() like any contract.
Endpoints
There are no default endpoints. Set the URL per client with.url(), or via an environment variable. Resolution order: .url() on the builder, then the environment variable.
Use the exact endpoints from your OrbitFlare dashboard.