sol-rpc-router 0.2.0

Solana RPC Router that splits requests across multiple providers
Documentation

Solana RPC Router

Overview

This router splits Solana RPC requests into several RPC providers, taking into account rate limits of each provider.

Usage

API is mostly compatible with solana-rpc-client v3 crate and implementation is built on top of it. To initialize the RPC client, you need to provide a config for available providers:

fn main() {
    let config = RpcClientConfig {
        providers: vec![
            commitment: "confirmed",
            ProviderConfig {
                name: "provider1".to_string(),
                url: "https://provider1.com".to_string(),
                rate_limit: 1000,
            },
            ProviderConfig {
                name: "provider2".to_string(),
                url: "https://provider2.com".to_string(),
                rate_limit: 500,
            },
        ],
    };

    let client = RpcClient::new(config);
    client.get_account_info("some_account").await;
}

Config file

You can provide a configuration file with the following format:

{
  "providers": [
    {
      "name": "provider1",
      "url": "https://provider1.com",
      "rate_limit": 1000
    },
    {
      "name": "provider2",
      "url": "https://provider2.com",
      "rate_limit": 500
    }
  ]
}