mod account;
mod account_history;
mod ledger;
pub use account::{IcrcAllowanceData, IcrcAllowanceReport, IcrcBalanceData, IcrcBalanceReport};
pub use account_history::{
IcrcAccountRow, IcrcAccountTransactionCacheStatusReport, IcrcAccountTransactionCacheSummary,
IcrcAccountTransactionListReport, IcrcAccountTransactionPageData,
IcrcAccountTransactionPageReport, IcrcAccountTransactionRefreshAttemptStatus,
IcrcAccountTransactionRefreshReport, IcrcAccountTransactionRow, IcrcAccountTransactionSnapshot,
};
pub use ledger::{
IcrcArchiveFollowErrorRow, IcrcArchiveRow, IcrcArchivedBlocksRow, IcrcArchivedRangeRow,
IcrcArchivesReport, IcrcBlockTypeRow, IcrcBlockTypesReport, IcrcCapabilitiesReport,
IcrcCapabilityRow, IcrcCapabilityStatus, IcrcFollowedArchiveBlockRow, IcrcIndexReport,
IcrcTipCertificateEvidence, IcrcTipCertificateReport, IcrcTokenReport, IcrcTransactionBlockRow,
IcrcTransactionsData, IcrcTransactionsReport,
};
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize)]
pub struct IcrcReportProvenance {
pub schema_version: u32,
pub ledger_canister_id: String,
pub fetched_at: String,
pub source_endpoint: String,
pub fetched_by: String,
}
#[cfg(feature = "icrc-host")]
impl IcrcReportProvenance {
pub(in crate::icrc) fn from_request(
request: &crate::icrc::IcrcLedgerRequest,
schema_version: u32,
) -> Self {
Self {
schema_version,
ledger_canister_id: request.ledger_canister_id.clone(),
fetched_at: ic_host_text::timestamp::format_utc_timestamp_secs(request.now_unix_secs),
source_endpoint: request.source_endpoint.clone(),
fetched_by: crate::icrc::live::ICRC_FETCHED_BY.to_string(),
}
}
}