robust-provider 1.0.1

Robust Provider is a library for creating resilient RPC providers for EVM-based blockchains with automatic retries and failover support.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use alloy::network::Ethereum;
use robust_provider::RobustProviderBuilder;

const RPC_URL: &str = "https://ethereum-rpc.publicnode.com";

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let provider = RobustProviderBuilder::<Ethereum, &str>::new(RPC_URL)
        .build()
        .await
        .expect("Should to build provider");
    let latest_block = provider.get_block_number().await.expect("should fetch latest block number");
    println!("Latest block: {latest_block}");
}