Skip to content

Commit

Permalink
++
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdivine committed Sep 9, 2024
1 parent 35a18a3 commit 807a6d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Principal>,
/// Corresponds to the `created_at_time` field in ICRC2.
pub created_at_time: Option<u64>,
}
2 changes: 1 addition & 1 deletion src/declarations/cycles_ledger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<serde_bytes::ByteBuf>,
Expand Down

0 comments on commit 807a6d9

Please sign in to comment.