use candid::Principal;
pub use ic_cycles_ledger_client::Account;
use ic_ledger_types::Subaccount;
use serde_bytes::ByteBuf;
pub mod caller;
pub mod cycles;
pub mod error;
pub mod vendor;
pub use caller::PaymentType;
pub use error::PaymentError;
pub use vendor::Icrc2Payer;
const SUB_ACCOUNT_ZERO: Subaccount = Subaccount([0; 32]);
#[must_use]
pub fn principal2account(principal: &Principal) -> ByteBuf {
let hex_str = ic_ledger_types::AccountIdentifier::new(principal, &SUB_ACCOUNT_ZERO).to_hex();
hex::decode(&hex_str)
.unwrap_or_else(|_| {
unreachable!(
"Failed to decode hex account identifier we just created: {}",
hex_str
)
})
.into()
}