#internet-computer #timestamp #logging #sha-2 #transfer #wallet #tokens

b3_utils

Utility functions for building on the Internet Computer

55 releases (13 breaking)

0.13.1 Sep 28, 2024
0.12.1 Aug 27, 2024
0.11.0 Jul 4, 2024
0.9.0 Mar 2, 2024
0.0.6 Jul 28, 2023

#33 in #sha-2

Download history 2/week @ 2024-08-14 79/week @ 2024-08-21 51/week @ 2024-08-28 10/week @ 2024-09-11 25/week @ 2024-09-18 362/week @ 2024-09-25 54/week @ 2024-10-02 15/week @ 2024-10-09 6/week @ 2024-10-16 24/week @ 2024-10-30 28/week @ 2024-11-06 1/week @ 2024-11-13 8/week @ 2024-11-20 14/week @ 2024-11-27

63 downloads per month

MIT license

280KB
7K 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.

Reserved Stable Memory IDs

ID Description
254 Memory details
253 Backup Memory
252 Timer Memory
251 Owner Memory
250 Reserved Unknow
249 Notifier(idempotency) Memory
248 Notifier(Keys) Memory

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.
  • 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.

Dependencies

~2–14MB
~167K SLoC