Expand description
§B3Utils Library
b3_utils
is a Rust library designed to simplify the development of applications and wallets on the Internet Computer. It provides utility functions and types for handling various operations such as transfers, tokens, timestamps, and more.
§Features
vetkd
: Enables functionality related to vetkd. Includes dependenciesic_bls12_381
,sha2
, andsubtle
.stable_memory
: Enables stable memory features. Includes theb3-stable-structures
dependency.logging
: Enables logging functionality.ledger
: Enables ledger-related functionalities.owner
: Enables owner-related functionalities.sha2
: Enables SHA-2 hashing functionality.wasm
: Enables WebAssembly-related functionalities.rpc
: Enables EVM-RPC-canister functionalities.
To enable a feature, add it to your Cargo.toml
like so:
[dependencies]
b3_utils = { version = "0.12", features = ["exprimental_vetkd", "logging"] }
§Examples
Here’s a simple example of how to create a new icrc1 account :
use b3_utils::ledger::ICRCAccount;
use b3_utils::Subaccount;
use b3_utils::Environment;
use candid::Principal;
let owner = Principal::from_text("b7pqa-qqaaa-aaaap-abdva-cai").unwrap();
let subaccount = Subaccount::new(Environment::Production, 1);
let account = ICRCAccount::new(owner, Some(subaccount));
assert_eq!(account.to_text(), "b7pqa-qqaaa-aaaap-abdva-cai-vpwy45i.1");
For more detailed examples, see the documentation for each module.
§More Information
For more information, see the API documentation.
§License
This project is licensed under the MIT License.
Re-exports§
pub use outcall::*;
Modules§
Macros§
- Macro to enforce a condition and return an error if it fails.
Structs§
Enums§
Functions§
- Converts a string to a slug.
- Reports an error by converting it to a string.