ERPC SDK for Rust
Async Rust client for ERPC. The crate covers standard Solana and Ethereum JSON-RPC, indexed asset and history RPC, leader and analytics RPC, WebSocket subscriptions, price REST and server-sent events, account usage, and scoped Cloud reads.
[]
= "0.2"
= "1"
= { = "1", = ["macros", "rt-multi-thread"] }
The minimum supported Rust version is 1.85.
Quick start
use ;
async
RPC helpers return an inert PendingRpcRequest. Network I/O starts when
send() is awaited. Positional methods accept any serializable tuple, array,
or vector; named indexed-asset methods accept serializable structs or JSON
objects. The wire method names remain unchanged.
Namespaces
| Namespace | Purpose |
|---|---|
erpc.solana.rpc |
Standard Solana JSON-RPC |
erpc.solana.das |
Indexed assets and tokens |
erpc.solana.history |
Address transactions and transfers |
erpc.solana.leaders |
Leader slots and validator information |
erpc.solana.analytics |
Epoch, slot, program, and TPS analytics |
erpc.solana.subscriptions |
Enhanced WebSocket subscriptions |
erpc.ethereum.rpc |
Standard Ethereum JSON-RPC |
erpc.ethereum.subscriptions |
Ethereum WebSocket subscriptions |
erpc.price |
Price metadata, updates, and SSE streams |
erpc.account |
Token balance |
erpc.usage |
Masked monthly API-key usage |
Every JSON-RPC namespace also exposes request, raw, and batch for typed
results and forward-compatible methods.
Batch requests
# use ;
# async
The SDK sends one caller batch as one server batch, restores caller order when responses arrive out of order, accepts at most 256 calls, and rejects invalid mixed or unsupported batches locally. It never silently splits a batch.
Subscriptions
# use ErpcClient;
# async
Solana provides account_subscribe, transaction_subscribe, and
raw_subscribe. Dropping an HTTP request cancels its future; an explicit
CancellationToken can also be supplied through RequestOptions.
Cloud reads
# use ;
# async
Cloud configuration accepts HTTPS endpoints and local HTTP endpoints for testing. It retains only the access token supplied by the caller and does not implement interactive authorization or refresh-credential storage.
Safety boundaries
- API keys and access tokens are redacted from configuration debug output, public endpoints, transport errors, and JSON-RPC error data.
- State-changing calls, including transaction submission, are never retried automatically.
- REST and JSON-RPC server boundaries remain explicit.
- Unknown methods remain available through
rawwithout pretending they are part of the typed compatibility catalog.
The crate uses Rustls and does not require a platform TLS library.