#timestamp #logging #transfer #tokens #ledger #account #vetkd

b3_utils

This is helper library for B3Wallet project

50 releases (10 breaking)

new 0.10.0 Apr 14, 2024
0.9.0 Mar 2, 2024
0.8.4 Nov 28, 2023
0.0.6 Jul 28, 2023

#2379 in Magic Beans

Download history 53/week @ 2024-02-18 108/week @ 2024-02-25 83/week @ 2024-03-03 21/week @ 2024-03-10 2/week @ 2024-03-17 26/week @ 2024-03-31

53 downloads per month

MIT license

255KB
6K SLoC

B3Utils library

B3Utils Library 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.

For more detailed examples, see the documentation.

License

This project is licensed under the MIT License.


lib.rs:

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 dependencies ic_bls12_381, sha2, and subtle.
  • stable_memory: Enables stable memory features. Includes the b3-stable-structures dependency.
  • logging: Enables logging functionality.
  • ledger: Enables ledger-related functionalities.

To enable a feature, add it to your Cargo.toml like so:

[dependencies]
b3_utils = { version = "0.9", 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.

Dependencies

~2.3–3.5MB
~72K SLoC