1use serde::{Deserialize as SerdeDeserialize, Serialize};
8use serde_json::Value as JsonValue;
9
10#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
17pub struct IcrcTokenReport {
18 pub schema_version: u32,
19 pub ledger_canister_id: String,
20 pub fetched_at: String,
21 pub source_endpoint: String,
22 pub fetched_by: String,
23 pub token_name: String,
24 pub token_symbol: String,
25 pub decimals: u8,
26 pub transfer_fee: String,
27 pub total_supply: String,
28 pub minting_account_owner: Option<String>,
29 pub minting_account_subaccount_hex: Option<String>,
30 pub supported_standards: Vec<IcrcTokenStandardRow>,
31 pub metadata: Vec<IcrcTokenMetadataRow>,
32}
33
34#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
41pub struct IcrcBalanceReport {
42 pub schema_version: u32,
43 pub ledger_canister_id: String,
44 pub account_owner: String,
45 pub subaccount_hex: Option<String>,
46 pub fetched_at: String,
47 pub source_endpoint: String,
48 pub fetched_by: String,
49 pub token_symbol: String,
50 pub decimals: u8,
51 pub balance: String,
52}
53
54#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
61pub struct IcrcAllowanceReport {
62 pub schema_version: u32,
63 pub ledger_canister_id: String,
64 pub account_owner: String,
65 pub account_subaccount_hex: Option<String>,
66 pub spender_owner: String,
67 pub spender_subaccount_hex: Option<String>,
68 pub fetched_at: String,
69 pub source_endpoint: String,
70 pub fetched_by: String,
71 pub token_symbol: String,
72 pub decimals: u8,
73 pub allowance: String,
74 pub expires_at_unix_nanos: Option<String>,
75}
76
77#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
84pub struct IcrcAccountTransactionPageReport {
85 pub schema_version: u32,
87 pub ledger_canister_id: String,
89 pub index_canister_id: String,
91 pub account_owner: String,
93 pub subaccount_hex: Option<String>,
95 pub requested_start: Option<String>,
97 pub requested_limit: u32,
99 pub next_start: Option<String>,
101 pub oldest_transaction_id: Option<String>,
103 pub balance: String,
105 pub token_symbol: String,
107 pub decimals: u8,
109 pub fetched_at: String,
111 pub source_endpoint: String,
113 pub fetched_by: String,
115 pub transactions: Vec<IcrcAccountTransactionRow>,
117}
118
119#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
126pub struct IcrcAccountTransactionCompleteness {
127 pub status: String,
129 pub page_size: u32,
131 pub page_count: u32,
133 pub row_count: usize,
135 pub point_in_time_guaranteed: bool,
137}
138
139#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
146pub struct IcrcAccountTransactionSnapshot {
147 pub schema_version: u32,
149 pub source_endpoint: String,
151 pub collection_started_at: String,
153 pub collection_completed_at: String,
155 pub fetched_by: String,
157 pub ledger_canister_id: String,
159 pub index_canister_id: String,
161 pub account_owner: String,
163 pub subaccount_hex: Option<String>,
165 pub balance: String,
167 pub token_symbol: String,
169 pub decimals: u8,
171 pub newest_transaction_id: Option<String>,
173 pub oldest_transaction_id: Option<String>,
175 pub completeness: IcrcAccountTransactionCompleteness,
177 pub transactions: Vec<IcrcAccountTransactionRow>,
179}
180
181#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
188pub struct IcrcAccountTransactionRefreshReport {
189 pub schema_version: u32,
191 pub ledger_canister_id: String,
193 pub index_canister_id: String,
195 pub account_owner: String,
197 pub subaccount_hex: Option<String>,
199 pub transaction_count: usize,
201 pub newest_transaction_id: Option<String>,
203 pub oldest_transaction_id: Option<String>,
205 pub page_size: u32,
207 pub page_count: u32,
209 pub point_in_time_guaranteed: bool,
211 pub replaced_existing_cache: bool,
213 pub attempt_finalization_error: Option<String>,
215 pub collection_started_at: String,
217 pub collection_completed_at: String,
219 pub source_endpoint: String,
221 pub fetched_by: String,
223 pub cache_path: String,
225 pub refresh_attempt_path: String,
227 pub refresh_lock_path: String,
229}
230
231#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
238pub struct IcrcAccountTransactionListReport {
239 pub schema_version: u32,
241 pub ledger_canister_id: String,
243 pub index_canister_id: String,
245 pub account_owner: String,
247 pub subaccount_hex: Option<String>,
249 pub requested_limit: u32,
251 pub sort: String,
253 pub total_transaction_count: usize,
255 pub returned_transaction_count: usize,
257 pub newest_transaction_id: Option<String>,
259 pub oldest_transaction_id: Option<String>,
261 pub balance: String,
263 pub token_symbol: String,
265 pub decimals: u8,
267 pub collection_started_at: String,
269 pub collection_completed_at: String,
271 pub source_endpoint: String,
273 pub fetched_by: String,
275 pub complete: bool,
277 pub point_in_time_guaranteed: bool,
279 pub page_size: u32,
281 pub page_count: u32,
283 pub cache_path: String,
285 pub transactions: Vec<IcrcAccountTransactionRow>,
287}
288
289#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
296pub struct IcrcAccountTransactionCacheStatusReport {
297 pub schema_version: u32,
299 pub ledger_canister_id: String,
301 pub account_owner: String,
303 pub subaccount_hex: Option<String>,
305 pub source_endpoint: String,
307 pub found: bool,
309 pub cache: Option<IcrcAccountTransactionCacheSummary>,
311 pub expected_cache_path: String,
313 pub refresh_attempt_path: String,
315 pub refresh_lock_path: String,
317 pub latest_attempt: Option<IcrcAccountTransactionRefreshAttemptStatus>,
319}
320
321#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
328pub struct IcrcAccountTransactionCacheSummary {
329 pub cache_status: String,
331 pub cache_error: Option<String>,
333 pub index_canister_id: Option<String>,
335 pub transaction_count: usize,
337 pub newest_transaction_id: Option<String>,
339 pub oldest_transaction_id: Option<String>,
341 pub page_size: u32,
343 pub page_count: u32,
345 pub complete: bool,
347 pub point_in_time_guaranteed: bool,
349 pub collection_started_at: String,
351 pub collection_completed_at: String,
353 pub cache_path: String,
355}
356
357#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
364pub struct IcrcAccountTransactionRefreshAttemptStatus {
365 pub status: String,
367 pub started_at: String,
369 pub updated_at: String,
371 pub index_canister_id: Option<String>,
373 pub page_size: u32,
375 pub pages_fetched: u32,
377 pub rows_fetched: usize,
379 pub last_cursor: Option<String>,
381 pub last_error: Option<String>,
383}
384
385#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
392pub struct IcrcIndexReport {
393 pub schema_version: u32,
394 pub ledger_canister_id: String,
395 pub fetched_at: String,
396 pub source_endpoint: String,
397 pub fetched_by: String,
398 pub index_canister_id: Option<String>,
399 pub index_error: Option<String>,
400}
401
402#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
409pub struct IcrcTransactionsReport {
410 pub schema_version: u32,
411 pub ledger_canister_id: String,
412 pub fetched_at: String,
413 pub source_endpoint: String,
414 pub fetched_by: String,
415 pub requested_start: String,
416 pub requested_limit: u32,
417 pub follow_archives: bool,
418 pub log_length: Option<String>,
419 pub blocks: Vec<IcrcTransactionBlockRow>,
420 pub archived_blocks: Vec<IcrcArchivedBlocksRow>,
421 pub followed_archive_blocks: Vec<IcrcFollowedArchiveBlockRow>,
422 pub archive_follow_errors: Vec<IcrcArchiveFollowErrorRow>,
423}
424
425#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
432pub struct IcrcBlockTypesReport {
433 pub schema_version: u32,
434 pub ledger_canister_id: String,
435 pub fetched_at: String,
436 pub source_endpoint: String,
437 pub fetched_by: String,
438 pub block_types: Vec<IcrcBlockTypeRow>,
439}
440
441#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
448pub struct IcrcArchivesReport {
449 pub schema_version: u32,
450 pub ledger_canister_id: String,
451 pub from_canister_id: Option<String>,
452 pub fetched_at: String,
453 pub source_endpoint: String,
454 pub fetched_by: String,
455 pub archives: Vec<IcrcArchiveRow>,
456}
457
458#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
465pub struct IcrcTipCertificateReport {
466 pub schema_version: u32,
467 pub ledger_canister_id: String,
468 pub fetched_at: String,
469 pub source_endpoint: String,
470 pub fetched_by: String,
471 pub certificate_present: bool,
472 pub certificate_hex: Option<String>,
473 pub certificate_bytes: Option<usize>,
474 pub hash_tree_hex: Option<String>,
475 pub hash_tree_bytes: Option<usize>,
476}
477
478#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
485pub struct IcrcCapabilitiesReport {
486 pub schema_version: u32,
487 pub ledger_canister_id: String,
488 pub fetched_at: String,
489 pub source_endpoint: String,
490 pub fetched_by: String,
491 pub supported_standards: Vec<IcrcTokenStandardRow>,
492 pub capabilities: Vec<IcrcCapabilityRow>,
493}
494
495#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
502pub struct IcrcCapabilityRow {
503 pub capability: String,
504 pub method: String,
505 pub status: String,
506 pub details: Option<String>,
507 pub error: Option<String>,
508}
509
510#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
517pub struct IcrcTokenStandardRow {
518 pub name: String,
519 pub url: String,
520}
521
522#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
529pub struct IcrcTokenMetadataRow {
530 pub key: String,
531 pub value_type: String,
532 pub value: JsonValue,
533}
534
535#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
542pub struct IcrcAccountRow {
543 pub owner: Option<String>,
545 pub subaccount_hex: Option<String>,
547 pub account_identifier: Option<String>,
549}
550
551#[derive(Clone, Debug, Eq, PartialEq, SerdeDeserialize, Serialize)]
558pub struct IcrcAccountTransactionRow {
559 pub id: String,
561 pub kind: String,
563 pub timestamp_unix_nanos: Option<String>,
565 pub amount_base_units: Option<String>,
567 pub fee_base_units: Option<String>,
569 pub from: Option<IcrcAccountRow>,
571 pub to: Option<IcrcAccountRow>,
573 pub spender: Option<IcrcAccountRow>,
575 pub memo_hex: Option<String>,
577 pub created_at_time_unix_nanos: Option<String>,
579 pub expires_at_unix_nanos: Option<String>,
581 pub expected_allowance_base_units: Option<String>,
583 pub raw_transaction: JsonValue,
585}
586
587#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
594pub struct IcrcTransactionBlockRow {
595 pub index: String,
596 pub block_type: Option<String>,
597 pub transaction_kind: Option<String>,
598 pub timestamp_unix_nanos: Option<String>,
599 pub amount_base_units: Option<String>,
600 pub raw_block: JsonValue,
601}
602
603#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
610pub struct IcrcArchivedBlocksRow {
611 pub callback_canister_id: String,
612 pub callback_method: String,
613 pub ranges: Vec<IcrcArchivedRangeRow>,
614}
615
616#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
623pub struct IcrcArchivedRangeRow {
624 pub start: String,
625 pub length: String,
626}
627
628#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
635pub struct IcrcFollowedArchiveBlockRow {
636 pub archive_canister_id: String,
637 pub callback_method: String,
638 pub index: String,
639 pub block_type: Option<String>,
640 pub transaction_kind: Option<String>,
641 pub timestamp_unix_nanos: Option<String>,
642 pub amount_base_units: Option<String>,
643 pub raw_block: JsonValue,
644}
645
646#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
653pub struct IcrcArchiveFollowErrorRow {
654 pub callback_canister_id: String,
655 pub callback_method: String,
656 pub ranges: Vec<IcrcArchivedRangeRow>,
657 pub error: String,
658}
659
660#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
667pub struct IcrcBlockTypeRow {
668 pub block_type: String,
669 pub url: String,
670}
671
672#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
679pub struct IcrcArchiveRow {
680 pub canister_id: String,
681 pub start: String,
682 pub end: String,
683}