Skip to main content

ic_query/icrc/model/contracts/reports/
account.rs

1//! Module: icrc::model::contracts::reports::account
2//!
3//! Responsibility: serialized ICRC balance and allowance report contracts.
4//! Does not own: account history, ledger-wide reports, live transport, or rendering.
5//! Boundary: preserves raw account and allowance result fields.
6
7use serde::Serialize;
8
9///
10/// IcrcBalanceReport
11///
12/// Serializable report for one generic ICRC account balance lookup.
13///
14
15#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
16pub struct IcrcBalanceReport {
17    pub schema_version: u32,
18    pub ledger_canister_id: String,
19    pub account_owner: String,
20    pub subaccount_hex: Option<String>,
21    pub fetched_at: String,
22    pub source_endpoint: String,
23    pub fetched_by: String,
24    pub token_symbol: String,
25    pub decimals: u8,
26    pub balance: String,
27}
28
29///
30/// IcrcAllowanceReport
31///
32/// Serializable report for one generic ICRC allowance lookup.
33///
34
35#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
36pub struct IcrcAllowanceReport {
37    pub schema_version: u32,
38    pub ledger_canister_id: String,
39    pub account_owner: String,
40    pub account_subaccount_hex: Option<String>,
41    pub spender_owner: String,
42    pub spender_subaccount_hex: Option<String>,
43    pub fetched_at: String,
44    pub source_endpoint: String,
45    pub fetched_by: String,
46    pub token_symbol: String,
47    pub decimals: u8,
48    pub allowance: String,
49    pub expires_at_unix_nanos: Option<String>,
50}