pub type CanisterId = candid::Principal; pub type CanisterIdText = String;
pub type CollectionId = candid::Principal; pub type CollectionIdText = String;
pub type UserId = candid::Principal; pub type UserIdText = String;
pub type CallerId = candid::Principal; pub type CallerIdText = String;
pub type Subaccount = ic_ledger_types::Subaccount; pub type SubaccountHex = String;
pub type AccountIdentifier = ic_ledger_types::AccountIdentifier; pub type AccountIdentifierHex = String;
pub fn u64_to_subaccount(value: u64) -> Subaccount {
let mut subaccount: [u8; 32] = [0; 32];
subaccount[24..].copy_from_slice(&value.to_be_bytes());
ic_ledger_types::Subaccount(subaccount)
}
#[inline]
pub fn caller() -> CallerId {
ic_cdk::api::caller()
}
#[inline]
pub fn self_canister_id() -> CanisterId {
ic_cdk::api::id()
}