Crate bity_ic_ledger_utils

Crate bity_ic_ledger_utils 

Source
Expand description

Module for handling Internet Computer ledger operations and account management.

This module provides utilities for working with the Internet Computer’s ledger system, including account identifier computation, subaccount management, and conversion between different account formats.

§Example

use candid::Principal;
use ic_ledger_types::AccountIdentifier;

let principal = Principal::from_text("rrkah-fqaaa-aaaaa-aaaaq-cai").unwrap();
let account_id = principal_to_legacy_account_id(principal, None);

Functions§

compute_neuron_staking_subaccount_bytes
Computes a neuron staking subaccount using SHA-256 hashing.
icrc_account_to_legacy_account_id
Converts an ICRC-1 account to a legacy account identifier.
principal_to_legacy_account_id
Creates a legacy account identifier from a principal and optional subaccount.