ton_lib_macros

Crates.ioton_lib_macros
lib.rston_lib_macros
version0.0.23
created_at2025-04-26 17:54:30.981637+00
updated_at2025-08-20 23:45:55.025647+00
descriptionA collection of types and utilities for interacting with the TON network
homepage
repositoryhttps://github.com/sild/ton_lib_rs
max_upload_size
id1650456
size24,471
Sild (Sild)

documentation

README

ton_lib_macros

Automatically derive TLB and TonContract traits for your types

TLB Derive

use ton_lib_macros::TLBDerive;

#[derive(Debug, Clone, PartialEq, TLBDerive)]
#[tlb_derive(prefix = 0xc4, bits_len = 8)]
pub struct GlobalVersion {
    pub version: u32,
    pub capabilities: u64,
}

// specify custom adapter (ser/de functions for TLB)
#[derive(Debug, Clone, PartialEq, TLBDerive)]
pub struct StateInit {
    #[tlb_derive(bits_len = 5)]
    pub split_depth: Option<u8>,
    pub tick_tock: Option<TickTock>,
    pub code: Option<TonCellRef>,
    pub data: Option<TonCellRef>,
    #[tlb_derive(adapter = "TLBHashMapE::<DictKeyAdapterTonHash, DictValAdapterTLB, _, _>::new(256)")]
    pub library: HashMap<TonHash, SimpleLib>,
}

TonContract

#[ton_contract]
pub struct JettonMaster;
impl GetJettonData for JettonMaster {}
impl GetWalletAddress for JettonMaster {}
Commit count: 382

cargo fmt