ic_papi_api/cycles.rs
1use candid::Principal;
2
3/// The cycles ledger canister ID on mainnet.
4///
5/// Note: This canister ID should also be used in test environments. The dfx.json
6/// can implement this with:
7/// ```
8/// { "canisters": {
9/// "cycles_ledger": {
10/// ...
11/// "specified_id": "um5iw-rqaaa-aaaaq-qaaba-cai",
12/// "remote": {
13/// "id": {
14/// "ic": "um5iw-rqaaa-aaaaq-qaaba-cai"
15/// }
16/// }
17/// },
18/// ...
19/// }
20/// ```
21pub const MAINNET_CYCLES_LEDGER_CANISTER_ID: &str = "um5iw-rqaaa-aaaaq-qaaba-cai";
22
23/// The `MAINNET_CYCLES_LEDGER_CANISTER_ID` as a `Principal`.
24///
25/// # Panics
26/// - If the `MAINNET_CYCLES_LEDGER_CANISTER_ID` is not a valid `Principal`.
27#[must_use]
28pub fn cycles_ledger_canister_id() -> Principal {
29 Principal::from_text(MAINNET_CYCLES_LEDGER_CANISTER_ID)
30 .expect("Invalid cycles ledger canister ID provided at compile time.")
31}