diff --git a/src/api/src/lib.rs b/src/api/src/lib.rs index e176c46..daa9b2a 100644 --- a/src/api/src/lib.rs +++ b/src/api/src/lib.rs @@ -21,4 +21,18 @@ pub enum PaymentError { #[non_exhaustive] pub enum PaymentType { AttachedCycles, + Icrc2(Icrc2Payment), +} + +/// User's payment details for an ICRC2 payment. +#[derive(Debug, CandidType, Deserialize, Clone, Eq, PartialEq)] +pub struct Icrc2Payment { + /// The user's principal and (optionally) subaccount. + pub payer: Account, + /// The ledger canister ID. + /// + /// By default, the cycles ledger is used. A given canister MAY accept other currencies. + pub ledger_canister_id: Option, + /// Corresponds to the `created_at_time` field in ICRC2. + pub created_at_time: Option, } diff --git a/src/declarations/cycles_ledger/src/lib.rs b/src/declarations/cycles_ledger/src/lib.rs index 7e2c9e9..be7b23d 100644 --- a/src/declarations/cycles_ledger/src/lib.rs +++ b/src/declarations/cycles_ledger/src/lib.rs @@ -83,7 +83,7 @@ pub enum CreateCanisterError { balance: candid::Nat, }, } -#[derive(CandidType, Deserialize, Debug, Clone)] +#[derive(CandidType, Deserialize, Debug, Clone, Eq, PartialEq)] pub struct Account { pub owner: Principal, pub subaccount: Option,