ic_query/icrc/model/requests/
account.rs1use super::IcrcLedgerRequest;
8
9#[derive(Clone, Debug, Eq, PartialEq)]
16pub struct IcrcBalanceRequest {
17 pub ledger: IcrcLedgerRequest,
19 pub account_owner: String,
20 pub subaccount_hex: Option<String>,
21}
22
23impl IcrcBalanceRequest {
24 #[must_use]
25 pub fn new(ledger: IcrcLedgerRequest, account_owner: impl Into<String>) -> Self {
26 Self {
27 ledger,
28 account_owner: account_owner.into(),
29 subaccount_hex: None,
30 }
31 }
32}
33
34#[derive(Clone, Debug, Eq, PartialEq)]
41pub struct IcrcAllowanceRequest {
42 pub ledger: IcrcLedgerRequest,
44 pub account_owner: String,
45 pub account_subaccount_hex: Option<String>,
46 pub spender_owner: String,
47 pub spender_subaccount_hex: Option<String>,
48}
49
50impl IcrcAllowanceRequest {
51 #[must_use]
52 pub fn new(
53 ledger: IcrcLedgerRequest,
54 account_owner: impl Into<String>,
55 spender_owner: impl Into<String>,
56 ) -> Self {
57 Self {
58 ledger,
59 account_owner: account_owner.into(),
60 account_subaccount_hex: None,
61 spender_owner: spender_owner.into(),
62 spender_subaccount_hex: None,
63 }
64 }
65}