ton_macros

Crates.ioton_macros
lib.rston_macros
version0.0.9
created_at2025-10-20 15:20:00.161536+00
updated_at2026-01-15 10:20:25.791629+00
descriptionA collection of types and utilities for interacting with the TON network
homepage
repositoryhttps://github.com/sild/ton_lib_rs
max_upload_size
id1892135
size37,404
Sild (Sild)

documentation

README

ton_macros

Automatically derive TLB and TonContract traits for your types

TLB Derive

use ton_macros::TLB;

#[derive(Debug, Clone, PartialEq, TLB)]
#[tlb(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, TLB)]
pub struct StateInit {
    #[tlb(bits_len = 5)]
    pub split_depth: Option<u8>,
    pub tick_tock: Option<TickTock>,
    pub code: Option<TLBRef<TonCell>>,
    pub data: Option<TLBRef<TonCell>>,
    #[tlb(adapter = "TLBHashMapE::<DictKeyAdapterTonHash, DictValAdapterTLB<_>>::new(256)")]
    pub library: HashMap<TonHash, SimpleLib>,
}

TonContract

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

cargo fmt