circles_types/
client.rs

1use alloy_primitives::{Address, U256};
2use serde::{Deserialize, Serialize};
3
4/// Avatar row data from RPC
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct AvatarRow {
7    pub address: Address,
8    pub version: u32,
9    #[serde(rename = "type")]
10    pub avatar_type: String,
11    /// Profile CID stored in the name registry
12    pub cid_v0: Option<String>,
13    // Additional fields as needed
14}
15
16/// Token balance row from RPC
17#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct TokenBalanceRow {
19    pub token_address: Address,
20    pub balance: U256,
21    // Additional fields as needed
22}
23
24/// Trust relation row from RPC
25#[derive(Debug, Clone, Serialize, Deserialize)]
26pub struct TrustRelationRow {
27    pub truster: Address,
28    pub trustee: Address,
29    pub expiry_time: u64,
30}
31
32/// Circles query result with pagination
33/// Note: This is a trait-like interface in TypeScript, but we'll use a struct with a callback
34#[derive(Debug, Clone)]
35pub struct CirclesQuery<T> {
36    pub rows: Vec<T>,
37    pub has_more: bool,
38    // In Rust, we'd typically use a function pointer or closure for the next_page functionality
39    // This could be implemented as a method that takes a client reference
40}
41
42impl<T> CirclesQuery<T> {
43    /// Create a new CirclesQuery
44    pub fn new(rows: Vec<T>, has_more: bool) -> Self {
45        Self { rows, has_more }
46    }
47}
48
49/// Group type enumeration
50#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
51pub enum GroupType {
52    #[serde(rename = "Standard")]
53    Standard,
54    #[serde(rename = "Custom")]
55    Custom,
56}