use serde::{Deserialize as SerdeDeserialize, Serialize};
use serde_json::Value as JsonValue;
#[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, 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,
}