Solana Balanced Client
This is a wrapper over the RpcClient
of solana-client crate. It provides the ability to balance the requests between
multiple RPC endpoints taking into account their limits.
Usage
fn main() {
let default_rpc = Arc::new(RpcClient::new(
"https://api.mainnet-beta.solana.com".to_string(),
));
let your_rpc = Arc::new(RpcClient::new("<your-rpc-url>".to_string()));
let client = SolanaClient::new_with_default(your_rpc).add_rpc(
SolanaClientRpc::new(quicknode_rpc)
.add_limit(
SolanaClientRateLimit::new(
30 * 24 * 60 * 60 * 1000,
1_000,
1,
)
.ignore_endpoint(RpcRequest::GetHealth)
.add_endpoint_amount(RpcRequest::GetAccountInfo, 2)
.add_endpoint_amount(RpcRequest::GetMultipleAccounts, 10)
)
.add_limit(SolanaClientRateLimit::new(
1000,
10,
1,
)),
);
}
You can see more examples in the examples
directory.
License
This project is licensed under the MIT License - see the LICENSE file for details.