ev_client/lib.rs
1//! Rollkit Rust Client Library
2//!
3//! This library provides a Rust client for interacting with Rollkit nodes via gRPC.
4//!
5//! # Example
6//!
7//! ```no_run
8//! use ev_client::{Client, HealthClient};
9//!
10//! #[tokio::main]
11//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
12//! // Connect to a Rollkit node
13//! let client = Client::connect("http://localhost:50051").await?;
14//!
15//! // Check health
16//! let health = HealthClient::new(&client);
17//! let is_healthy = health.is_healthy().await?;
18//! println!("Node healthy: {}", is_healthy);
19//!
20//! Ok(())
21//! }
22//! ```
23//!
24//! # Using the Builder Pattern
25//!
26//! ```no_run
27//! use ev_client::Client;
28//! use std::time::Duration;
29//!
30//! #[tokio::main]
31//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
32//! // Create a client with custom timeouts
33//! let client = Client::builder()
34//! .endpoint("http://localhost:50051")
35//! .timeout(Duration::from_secs(30))
36//! .connect_timeout(Duration::from_secs(10))
37//! .build()
38//! .await?;
39//!
40//! Ok(())
41//! }
42//! ```
43//!
44//! # Using TLS
45//!
46//! ```no_run
47//! use ev_client::Client;
48//! use tonic::transport::ClientTlsConfig;
49//!
50//! #[tokio::main]
51//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
52//! // Create a client with TLS enabled
53//! let client = Client::builder()
54//! .endpoint("https://secure-node.rollkit.dev")
55//! .tls() // Enable TLS with default configuration
56//! .build()
57//! .await?;
58//!
59//! // Or with custom TLS configuration
60//! let tls_config = ClientTlsConfig::new()
61//! .domain_name("secure-node.rollkit.dev");
62//!
63//! let client = Client::builder()
64//! .endpoint("https://secure-node.rollkit.dev")
65//! .tls_config(tls_config)
66//! .build()
67//! .await?;
68//!
69//! Ok(())
70//! }
71//! ```
72
73pub mod client;
74pub mod error;
75pub mod health;
76pub mod p2p;
77pub mod signer;
78pub mod store;
79
80// Re-export main types for convenience
81pub use client::{Client, ClientBuilder};
82pub use error::{ClientError, Result};
83pub use health::HealthClient;
84pub use p2p::P2PClient;
85pub use signer::SignerClient;
86pub use store::StoreClient;
87
88// Re-export types from rollkit-types for convenience
89pub use ev_types::v1;
90
91// Re-export tonic transport types for convenience
92pub use tonic::transport::ClientTlsConfig;