Crates.io | everscale-types |
lib.rs | everscale-types |
version | 0.1.2 |
source | src |
created_at | 2022-12-09 18:18:50.103379 |
updated_at | 2024-11-12 12:58:44.521982 |
description | A set of primitive types and utilities for the Everscale blockchain. |
homepage | |
repository | https://github.com/broxus/everscale-types |
max_upload_size | |
id | 733437 |
size | 1,576,117 |
Status: WIP
A set of primitive types and utilities for the Everscale blockchain.
Heavily inspired by ton-labs-types
,
but with much more emphasis on speed.
Get Cell
from Vec<u8>
representation of bytes
use everscale_types::boc::Boc;
let cell: Cell = Boc::decode(bytes)?;
Encode any model e.g.MerkleProof
to base64
BOC representation and vice versa
use everscale_types::boc::BocRepr;
let cell = MerkleProof::create_for_cell(cell.as_ref(), EMPTY_CELL_HASH)
.build()
.unwrap();
let encoded = BocRepr::encode_base64(&cell).unwrap();
let decoded = Boc::decode_base64(encoded)?.as_ref().parse::<MerkleProof>()?:
Get specific everscale type from Cell
use everscale_types::models::BlockProof;
let proof: BlockProof = cell.parse::<BlockProof>()?;
Same usage for virtualized cell
use everscale_types::prelude::DynCell;
use everscale_types::models::Block;
let virt_cell: &DynCell = cell.virtualize();
let block = virt_cell.parse::<Block>()?;
You can also use CellBuilder
to create any Cell
let mut builder = CellBuilder::new();
builder.store_bit_one()?;
builder.store_u32(100u32)?
builder.store_slice(slice)?;
builder.store_raw(&[0xdd, 0x55], 10)?;
// store references to another cells
builder.store_reference(cell)?;
builder.store_reference(another_cell)?;
let final_cell = builder.build()?;
cargo bench boc
cargo bench dict
# Add Miri component
rustup +nightly component add miri
# Run all tests with Miri
cargo +nightly miri test
# Install fuzzer
cargo install cargo-fuzz
# Run any of the fuzzer targets
cargo +nightly fuzz run boc_decode -j 12
cargo +nightly fuzz run boc_decode_encode -j 12
cargo +nightly fuzz run boc_decode_pair -j 12
cargo +nightly fuzz run boc_dict -j 12
cargo +nightly fuzz run boc_message -j 12
We welcome contributions to the project! If you notice any issues or errors, feel free to open an issue or submit a pull request.
Licensed under either of
at your option.