hypersync_format/lib.rs
1//! # HyperSync Format
2//!
3//! Core data types and serialization formats for the HyperSync protocol.
4//!
5//! This crate provides the fundamental data structures used to represent blockchain
6//! data in a standardized format, including blocks, transactions, logs, and traces.
7//!
8//! ## Features
9//!
10//! - **Standard blockchain types**: Comprehensive data structures for Ethereum-compatible chains
11//! - **Efficient serialization**: Optimized JSON and binary serialization
12//! - **Type safety**: Strong typing for addresses, hashes, and numeric values
13//! - **Hex encoding**: Automatic handling of hexadecimal encoding/decoding
14//!
15//! ## Key Types
16//!
17//! - [`Block`] - Complete block data including header and body
18//! - [`Transaction`] - Transaction data with all fields
19//! - [`Log`] - Event log from contract execution
20//! - [`Trace`] - Execution trace information
21//! - [`Address`] - 20-byte Ethereum address
22//! - [`Hash`] - 32-byte cryptographic hash
23//! - [`Hex`] - Wrapper for hexadecimal data
24//!
25//! ## Example
26//!
27//! ```
28//! use hypersync_format::{Address, Hash};
29//!
30//! // Parse an Ethereum address
31//! let addr: Address = "0x742d35Cc6634C0532925a3b8D400ACDCD5C94C33".parse()?;
32//! println!("Address: {}", addr);
33//!
34//! // Create a hash from hex string
35//! let hash: Hash = "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef".parse()?;
36//! println!("Hash: {}", hash);
37//! # Ok::<(), Box<dyn std::error::Error>>(())
38//! ```
39
40mod error;
41mod types;
42
43pub use error::{Error, Result};
44pub use types::{
45 uint::UInt, AccessList, Address, Authorization, Block, BlockHeader, BlockNumber, BloomFilter,
46 Data, DebugBlockTrace, DebugTxTrace, FilterWrapper, FixedSizeData, Hash, Hex, Log, LogArgument,
47 LogIndex, Nonce, Quantity, Trace, TraceAction, TraceResult, Transaction, TransactionIndex,
48 TransactionReceipt, TransactionStatus, TransactionType, Withdrawal,
49};