Skip to main content

ethcli/
lib.rs

1//! ethcli - Comprehensive Ethereum CLI
2//!
3//! A Rust library and CLI for Ethereum data: fetching logs, analyzing transactions,
4//! querying accounts, and exploring contracts.
5//!
6//! # Example - Fetching Logs
7//!
8//! ```rust,no_run
9//! use ethcli::{Config, LogFetcher, Chain, OutputFormat};
10//!
11//! #[tokio::main]
12//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
13//!     let config = Config::builder()
14//!         .chain(Chain::Ethereum)
15//!         .contract("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48")
16//!         .event("Transfer(address indexed from, address indexed to, uint256 value)")
17//!         .from_block(18_000_000)
18//!         .to_block_number(18_001_000)
19//!         .concurrency(10)
20//!         .build()?;
21//!
22//!     let fetcher = LogFetcher::new(config).await?;
23//!     let result = fetcher.fetch_all().await?;
24//!
25//!     println!("Fetched {} logs", result.len());
26//!     Ok(())
27//! }
28//! ```
29
30pub mod abi;
31pub mod aggregator;
32pub mod bytecode;
33pub mod chainlink;
34pub mod checkpoint;
35pub mod cli;
36pub mod config;
37pub mod error;
38pub mod etherscan;
39pub mod fetcher;
40pub mod output;
41pub mod proxy;
42pub mod rpc;
43pub mod tx;
44pub mod utils;
45
46// Legacy alias for cache module (now in etherscan::cache)
47pub mod cache {
48    pub use crate::etherscan::cache::*;
49}
50
51// Re-exports for convenience
52pub use abi::{AbiFetcher, DecodedLog, EventSignature, LogDecoder};
53pub use checkpoint::{Checkpoint, CheckpointManager};
54pub use config::{
55    BlockNumber, BlockRange, Chain, ChainId, Config, ConfigBuilder, ConfigFile, EndpointConfig,
56    NodeType, OutputConfig, OutputFormat, ProxyConfig, RpcConfig,
57};
58pub use error::{AbiError, CheckpointError, ConfigError, Error, OutputError, Result, RpcError};
59pub use etherscan::{CacheStats, Client as EtherscanClient, SignatureCache};
60pub use fetcher::{
61    FetchLogs, FetchProgress, FetchResult, FetchStats, LogFetcher, StreamingFetcher,
62};
63pub use output::{create_writer, CsvWriter, JsonWriter, OutputWriter, SqliteWriter};
64pub use proxy::{validate_proxy_url, ProxyRotator, RotationMode};
65pub use rpc::{
66    optimize_endpoint, test_connectivity, Endpoint, EndpointHealth, HealthTracker,
67    OptimizationResult, RpcPool,
68};
69pub use tx::{format_analysis, TransactionAnalysis, TxAnalyzer};
70pub use utils::format::{Align, Column, Table};
71pub use utils::TokenMetadata;