Evolve Rust Client
A Rust client library for interacting with Evolve nodes via gRPC.
Features
- Full gRPC client implementation for all Evolve services
- Type-safe interfaces using generated protobuf types
- Async/await support with Tokio
- Connection management with configurable timeouts
- Comprehensive error handling
Installation
Add this to your Cargo.toml:
[]
= { = "path/to/client" }
= { = "1.45", = ["full"] }
Usage
Basic Example
use ;
async
Using the Builder Pattern
use Client;
use Duration;
// Create a client with custom timeouts
let client = builder
.endpoint
.timeout
.connect_timeout
.build
.await?;
TLS Configuration
use ;
// Enable TLS with default configuration
let client = builder
.endpoint
.tls
.build
.await?;
// Or with custom TLS configuration
let tls_config = new
.domain_name;
let client = builder
.endpoint
.tls_config
.build
.await?;
Legacy Connection Method
use Client;
use Duration;
// Still supported for backward compatibility
let client = connect_with_config.await?;
Services
The client provides wrappers for all Rollkit gRPC services. All service methods are now thread-safe and can be called concurrently:
Health Service
livez()- Check if the node is aliveis_healthy()- Check if the node is healthy
P2P Service
get_peer_info()- Get information about connected peersget_net_info()- Get network information
Signer Service
sign(message)- Sign a messageget_public_key()- Get the node's public key
Store Service
get_block_by_height(height)- Get a block by heightget_block_by_hash(hash)- Get a block by hashget_state()- Get the current stateget_metadata(key)- Get metadata by key
Examples
See the examples directory for more detailed usage examples:
Concurrent Usage Example
use ;
use task;
async
Error Handling
All methods return Result<T, ClientError> where ClientError encompasses:
- Transport errors
- RPC errors
- Connection errors
- Invalid endpoint errors
- Timeout errors
License
Apache-2.0