1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
//! # Circles Types
//!
//! Complete type definitions for the Circles protocol ecosystem in Rust.
//!
//! This crate provides comprehensive data structures for all aspects of the Circles
//! protocol, including avatar management, trust relations, token operations, pathfinding,
//! event handling, RPC communication, and contract interactions. All types support
//! full `serde` serialization and are compatible with the TypeScript Circles SDK.
//!
//! ## Features
//!
//! - **Complete Protocol Coverage**: Types for avatars, trust, tokens, groups, events
//! - **Alloy Integration**: Built on `alloy-primitives` for Ethereum compatibility
//! - **API Compatible**: Matches TypeScript SDK structure exactly
//! - **Type Safety**: Leverages Rust's type system while maintaining flexibility
//! - **Async Ready**: Traits for contract runners and batch operations
//! - **Query DSL**: Complete query builder for `circles_query` RPC method
//!
//! ## Usage Examples
//!
//! ```rust,ignore
//! use circles_types::{
//! // Core types
//! Address, U256, TxHash,
//! // Avatar and profile types
//! AvatarInfo, Profile, AvatarType,
//! // Pathfinding
//! FindPathParams, PathfindingResult,
//! // Trust relations
//! TrustRelation, TrustRelationType,
//! // Configuration
//! CirclesConfig,
//! };
//!
//! // Create avatar information
//! let avatar = AvatarInfo {
//! block_number: 12345,
//! timestamp: Some(1234567890),
//! transaction_index: 1,
//! log_index: 0,
//! transaction_hash: "0xabc123...".parse()?,
//! version: 2,
//! avatar_type: AvatarType::CrcV2RegisterHuman,
//! avatar: "0x123...".parse()?,
//! token_id: Some(U256::from(1)),
//! has_v1: false,
//! v1_token: None,
//! cid_v0_digest: None,
//! cid_v0: None,
//! v1_stopped: None,
//! is_human: true,
//! name: None,
//! symbol: None,
//! };
//!
//! // Create pathfinding parameters
//! let params = FindPathParams {
//! from: "0xabc...".parse()?,
//! to: "0xdef...".parse()?,
//! target_flow: U256::from(1000u64),
//! use_wrapped_balances: Some(true),
//! from_tokens: None,
//! to_tokens: None,
//! exclude_from_tokens: None,
//! exclude_to_tokens: None,
//! simulated_balances: None,
//! simulated_trusts: None,
//! max_transfers: Some(10),
//! };
//!
//! // Serialize to JSON
//! let json = serde_json::to_string(&avatar)?;
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! ## Type Categories
//!
//! ### Core Blockchain Types
//! - [`Address`] - Ethereum address (re-exported from alloy-primitives)
//! - [`TxHash`], [`BlockHash`] - Transaction and block hashes
//! - [`U256`], [`U192`] - Large unsigned integers
//! - [`TransactionRequest`] - Transaction request data
//!
//! ### Avatar & Profile Management
//! - [`AvatarInfo`] - Complete avatar information and metadata
//! - [`Profile`] - User profile with name, description, images
//! - [`GroupProfile`] - Group profile extending Profile with symbol
//! - [`AvatarType`] - Registration event types (Human, Group, Organization)
//!
//! ### Trust & Social Graph
//! - [`TrustRelation`] - Individual trust relationship
//! - [`AggregatedTrustRelation`] - Processed trust relationships
//! - [`TrustRelationType`] - Trust relationship types
//!
//! ### Token Operations
//! - [`TokenBalance`] - Token balance with metadata
//! - [`TokenInfo`] - Token creation and type information
//! - [`TokenHolder`] - Account token holdings
//! - [`Balance`] - Flexible balance type (raw or formatted)
//!
//! ### Group Management
//! - [`GroupRow`] - Group registration and metadata
//! - [`GroupMembershipRow`] - Group membership records
//! - [`GroupQueryParams`] - Parameters for group queries
//!
//! ### Pathfinding & Transfers
//! - [`FindPathParams`] - Parameters for path computation
//! - [`PathfindingResult`] - Computed transfer path
//! - [`TransferStep`] - Individual transfer in a path
//! - [`FlowMatrix`] - Complete flow representation for contracts
//! - [`SimulatedBalance`] - Balance simulation for pathfinding
//! - [`SimulatedTrust`] - Trust-edge simulation for pathfinding
//!
//! ### Event System
//! - [`CirclesEvent`] - Universal event structure
//! - [`CirclesEventType`] - All supported event types (25+ variants)
//! - [`CirclesBaseEvent`] - Common event metadata
//!
//! ### RPC & Communication
//! - [`JsonRpcRequest`], [`JsonRpcResponse`] - Standard JSON-RPC types
//! - [`CirclesQueryResponse`] - Response format for queries
//! - [`TokenBalanceResponse`] - Token balance from RPC calls
//!
//! ### Query System
//! - [`QueryParams`] - Parameters for `circles_query` RPC method
//! - [`FilterPredicate`], [`Conjunction`] - Query filtering DSL
//! - [`PagedResult`] - Paginated query results
//! - [`SortOrder`], [`OrderBy`] - Result sorting
//!
//! ### Contract Execution
//! - [`ContractRunner`] - Async trait for contract interactions
//! - [`BatchRun`] - Trait for batched transaction execution
//! - [`RunnerConfig`] - Configuration for contract runners
//!
//! ### Protocol Configuration
//! - [`CirclesConfig`] - Complete protocol configuration
//! - [`EscrowedAmountAndDays`] - Contract-specific response types
//! - [`DecodedContractError`] - Contract error information
//!
//! ### Network State
//! - [`NetworkSnapshot`] - Complete network state at a block
//! - [`EventRow`] - Base structure for event pagination
//! - [`Cursor`] - Pagination cursor for efficient queries
// =============================================================================
// External re-exports
// =============================================================================
// Alloy primitive types
pub use ;
pub use Address;
pub use Bytes;
pub use ;
// Alloy RPC types
pub use TransportResult;
pub use TransactionRequest;
// =============================================================================
// Internal modules with explicit re-exports
// =============================================================================
pub use ;
pub use CirclesConfig;
pub use EscrowedAmountAndDays;
pub use DecodedContractError;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;