ic_query/icrc/model/contracts/requests/
ledger_history.rs1#[derive(Clone, Debug, Eq, PartialEq)]
14pub struct IcrcTransactionsRequest {
15 pub source_endpoint: String,
16 pub now_unix_secs: u64,
17 pub ledger_canister_id: String,
18 pub start: u64,
19 pub limit: u32,
20 pub follow_archives: bool,
21}
22
23impl IcrcTransactionsRequest {
24 #[must_use]
25 pub fn new(
26 source_endpoint: impl Into<String>,
27 now_unix_secs: u64,
28 ledger_canister_id: impl Into<String>,
29 start: u64,
30 limit: u32,
31 ) -> Self {
32 Self {
33 source_endpoint: source_endpoint.into(),
34 now_unix_secs,
35 ledger_canister_id: ledger_canister_id.into(),
36 start,
37 limit,
38 follow_archives: false,
39 }
40 }
41
42 #[must_use]
43 pub const fn with_follow_archives(mut self, follow_archives: bool) -> Self {
44 self.follow_archives = follow_archives;
45 self
46 }
47}
48
49#[derive(Clone, Debug, Eq, PartialEq)]
56pub struct IcrcArchivesRequest {
57 pub source_endpoint: String,
58 pub now_unix_secs: u64,
59 pub ledger_canister_id: String,
60 pub from_canister_id: Option<String>,
61}
62
63impl IcrcArchivesRequest {
64 #[must_use]
65 pub fn new(
66 source_endpoint: impl Into<String>,
67 now_unix_secs: u64,
68 ledger_canister_id: impl Into<String>,
69 ) -> Self {
70 Self {
71 source_endpoint: source_endpoint.into(),
72 now_unix_secs,
73 ledger_canister_id: ledger_canister_id.into(),
74 from_canister_id: None,
75 }
76 }
77
78 #[must_use]
79 pub fn with_from_canister_id(mut self, from_canister_id: impl Into<String>) -> Self {
80 self.from_canister_id = Some(from_canister_id.into());
81 self
82 }
83}