ic_canister_kit/
identity.rs1pub type CanisterId = candid::Principal; pub type CanisterIdText = String; pub type UserId = candid::Principal; pub type UserIdText = String; pub type CallerId = candid::Principal; pub type CallerIdText = String; pub type Subaccount = icrc_ledger_types::icrc1::account::Subaccount; pub type SubaccountHex = String; pub type AccountIdentifier = ic_ledger_types::AccountIdentifier; pub type AccountIdentifierHex = String; pub fn u64_to_subaccount(value: u64) -> Subaccount {
44 let mut subaccount: [u8; 32] = [0; 32];
45 subaccount[24..].copy_from_slice(&value.to_be_bytes());
46 subaccount
47}
48
49#[inline]
51pub fn caller() -> CallerId {
52 ic_cdk::api::msg_caller()
53}
54
55#[inline]
57pub fn self_canister_id() -> CanisterId {
58 ic_cdk::api::canister_self()
59}