Crate b3_helper_lib

Source
Expand description

§B3Helper Library

b3_helper_lib 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

  • Account - Create and manage accounts.
  • Constants - Constants used by the library.
  • Currency - Currency types and conversion functions.
  • Environment - Environment types and conversion functions.
  • Error - Error types and conversion functions.
  • Owner - Owner types and conversion functions.
  • Release - Release types and conversion functions.
  • Subaccount - Subaccount types and conversion functions.
  • System - System types and conversion functions.
  • Timestamp - Timestamp types and conversion functions.
  • Types - Types used by the library.
  • Utils - Utility functions.
  • Wallet - Wallet types and conversion functions.
  • Wasm - Wasm types and conversion functions.

§Examples

Here’s a simple example of how to create a new icrc1 account :

use b3_helper_lib::ICRCAccount;
use b3_helper_lib::Subaccount;
use b3_helper_lib::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.

§Contributing

We welcome contributions to the B3 Helper Library! Please see our contributing guide for more details.

§License

This project is licensed under the MIT License.

Modules§

constants
currency
error
mocks
owner
release
timestamp
types
wasm

Structs§

AccountIdentifier
ICPToken
ICRCAccount
Subaccount
TokenAmount

Enums§

AccountIdentifierError
Environment
ICRCAccountError
SubaccountError
TokenAmountError

Functions§

ic_canister_status
raw_keccak256
revert
sha2_sha256
vec_to_hex_string