use serde::{Deserialize as SerdeDeserialize, Serialize};
use serde_json::Value as JsonValue;
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcTokenReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub token_name: String,
pub token_symbol: String,
pub decimals: u8,
pub transfer_fee: String,
pub total_supply: String,
pub minting_account_owner: Option<String>,
pub minting_account_subaccount_hex: Option<String>,
pub supported_standards: Vec<IcrcTokenStandardRow>,
pub metadata: Vec<IcrcTokenMetadataRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcBalanceReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub account_owner: String,
pub subaccount_hex: Option<String>,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub token_symbol: String,
pub decimals: u8,
pub balance: String,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcAllowanceReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub account_owner: String,
pub account_subaccount_hex: Option<String>,
pub spender_owner: String,
pub spender_subaccount_hex: Option<String>,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub token_symbol: String,
pub decimals: u8,
pub allowance: String,
pub expires_at_unix_nanos: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcAccountTransactionPageReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub index_canister_id: String,
pub account_owner: String,
pub subaccount_hex: Option<String>,
pub requested_start: Option<String>,
pub requested_limit: u32,
pub next_start: Option<String>,
pub oldest_transaction_id: Option<String>,
pub balance: String,
pub token_symbol: String,
pub decimals: u8,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub transactions: Vec<IcrcAccountTransactionRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
pub struct IcrcAccountTransactionCompleteness {
pub status: String,
pub page_size: u32,
pub page_count: u32,
pub row_count: usize,
pub point_in_time_guaranteed: bool,
}
#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
pub struct IcrcAccountTransactionSnapshot {
pub schema_version: u32,
pub source_endpoint: String,
pub collection_started_at: String,
pub collection_completed_at: String,
pub fetched_by: String,
pub ledger_canister_id: String,
pub index_canister_id: String,
pub account_owner: String,
pub subaccount_hex: Option<String>,
pub balance: String,
pub token_symbol: String,
pub decimals: u8,
pub newest_transaction_id: Option<String>,
pub oldest_transaction_id: Option<String>,
pub completeness: IcrcAccountTransactionCompleteness,
pub transactions: Vec<IcrcAccountTransactionRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcAccountTransactionRefreshReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub index_canister_id: String,
pub account_owner: String,
pub subaccount_hex: Option<String>,
pub transaction_count: usize,
pub newest_transaction_id: Option<String>,
pub oldest_transaction_id: Option<String>,
pub page_size: u32,
pub page_count: u32,
pub point_in_time_guaranteed: bool,
pub replaced_existing_cache: bool,
pub attempt_finalization_error: Option<String>,
pub collection_started_at: String,
pub collection_completed_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub cache_path: String,
pub refresh_attempt_path: String,
pub refresh_lock_path: String,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcAccountTransactionListReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub index_canister_id: String,
pub account_owner: String,
pub subaccount_hex: Option<String>,
pub requested_limit: u32,
pub sort: String,
pub total_transaction_count: usize,
pub returned_transaction_count: usize,
pub newest_transaction_id: Option<String>,
pub oldest_transaction_id: Option<String>,
pub balance: String,
pub token_symbol: String,
pub decimals: u8,
pub collection_started_at: String,
pub collection_completed_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub complete: bool,
pub point_in_time_guaranteed: bool,
pub page_size: u32,
pub page_count: u32,
pub cache_path: String,
pub transactions: Vec<IcrcAccountTransactionRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcAccountTransactionCacheStatusReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub account_owner: String,
pub subaccount_hex: Option<String>,
pub source_endpoint: String,
pub found: bool,
pub cache: Option<IcrcAccountTransactionCacheSummary>,
pub expected_cache_path: String,
pub refresh_attempt_path: String,
pub refresh_lock_path: String,
pub latest_attempt: Option<IcrcAccountTransactionRefreshAttemptStatus>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcAccountTransactionCacheSummary {
pub cache_status: String,
pub cache_error: Option<String>,
pub index_canister_id: Option<String>,
pub transaction_count: usize,
pub newest_transaction_id: Option<String>,
pub oldest_transaction_id: Option<String>,
pub page_size: u32,
pub page_count: u32,
pub complete: bool,
pub point_in_time_guaranteed: bool,
pub collection_started_at: String,
pub collection_completed_at: String,
pub cache_path: String,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcAccountTransactionRefreshAttemptStatus {
pub status: String,
pub started_at: String,
pub updated_at: String,
pub index_canister_id: Option<String>,
pub page_size: u32,
pub pages_fetched: u32,
pub rows_fetched: usize,
pub last_cursor: Option<String>,
pub last_error: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcIndexReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub index_canister_id: Option<String>,
pub index_error: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcTransactionsReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub requested_start: String,
pub requested_limit: u32,
pub follow_archives: bool,
pub log_length: Option<String>,
pub blocks: Vec<IcrcTransactionBlockRow>,
pub archived_blocks: Vec<IcrcArchivedBlocksRow>,
pub followed_archive_blocks: Vec<IcrcFollowedArchiveBlockRow>,
pub archive_follow_errors: Vec<IcrcArchiveFollowErrorRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcBlockTypesReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub block_types: Vec<IcrcBlockTypeRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcArchivesReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub from_canister_id: Option<String>,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub archives: Vec<IcrcArchiveRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcTipCertificateReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub certificate_present: bool,
pub certificate_hex: Option<String>,
pub certificate_bytes: Option<usize>,
pub hash_tree_hex: Option<String>,
pub hash_tree_bytes: Option<usize>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcCapabilitiesReport {
pub schema_version: u32,
pub ledger_canister_id: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
pub supported_standards: Vec<IcrcTokenStandardRow>,
pub capabilities: Vec<IcrcCapabilityRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcCapabilityRow {
pub capability: String,
pub method: String,
pub status: String,
pub details: Option<String>,
pub error: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcTokenStandardRow {
pub name: String,
pub url: String,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcTokenMetadataRow {
pub key: String,
pub value_type: String,
pub value: JsonValue,
}
#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
pub struct IcrcAccountRow {
pub owner: Option<String>,
pub subaccount_hex: Option<String>,
pub account_identifier: Option<String>,
}
#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
pub struct IcrcAccountTransactionRow {
pub id: String,
pub kind: String,
pub timestamp_unix_nanos: Option<String>,
pub amount_base_units: Option<String>,
pub fee_base_units: Option<String>,
pub from: Option<IcrcAccountRow>,
pub to: Option<IcrcAccountRow>,
pub spender: Option<IcrcAccountRow>,
pub memo_hex: Option<String>,
pub created_at_time_unix_nanos: Option<String>,
pub expires_at_unix_nanos: Option<String>,
pub expected_allowance_base_units: Option<String>,
pub raw_transaction: JsonValue,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcTransactionBlockRow {
pub index: String,
pub block_type: Option<String>,
pub transaction_kind: Option<String>,
pub timestamp_unix_nanos: Option<String>,
pub amount_base_units: Option<String>,
pub raw_block: JsonValue,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcArchivedBlocksRow {
pub callback_canister_id: String,
pub callback_method: String,
pub ranges: Vec<IcrcArchivedRangeRow>,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcArchivedRangeRow {
pub start: String,
pub length: String,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcFollowedArchiveBlockRow {
pub archive_canister_id: String,
pub callback_method: String,
pub index: String,
pub block_type: Option<String>,
pub transaction_kind: Option<String>,
pub timestamp_unix_nanos: Option<String>,
pub amount_base_units: Option<String>,
pub raw_block: JsonValue,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcArchiveFollowErrorRow {
pub callback_canister_id: String,
pub callback_method: String,
pub ranges: Vec<IcrcArchivedRangeRow>,
pub error: String,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcBlockTypeRow {
pub block_type: String,
pub url: String,
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
pub struct IcrcArchiveRow {
pub canister_id: String,
pub start: String,
pub end: String,
}