#programs #clvm #chia #byte #processing #structures #clvmr

clvm-utils

Utility functions for processing clvm programs and structures

21 releases (11 breaking)

0.15.0 Oct 11, 2024
0.11.0 Aug 7, 2024
0.9.0 May 23, 2024
0.6.0 Mar 21, 2024
0.1.15 Nov 28, 2022

#5 in #chia

Download history 357/week @ 2024-07-29 195/week @ 2024-08-05 179/week @ 2024-08-12 91/week @ 2024-08-19 405/week @ 2024-08-26 251/week @ 2024-09-02 135/week @ 2024-09-09 221/week @ 2024-09-16 249/week @ 2024-09-23 86/week @ 2024-09-30 431/week @ 2024-10-07 279/week @ 2024-10-14 368/week @ 2024-10-21 228/week @ 2024-10-28 711/week @ 2024-11-04 460/week @ 2024-11-11

1,787 downloads per month
Used in 18 crates (12 directly)

Apache-2.0

76KB
2K SLoC

CLVM Utils

This provides various commonly needed utilities for working with CLVM values.

Currying Example

use clvm_utils::CurriedProgram;
use clvm_traits::{ToClvm, clvm_curried_args};
use clvmr::{Allocator, serde::node_to_bytes};

let a = &mut Allocator::new();

let program = a.one();

let ptr = CurriedProgram {
    program,
    args: clvm_curried_args!(42, 75),
}
.to_clvm(a)
.unwrap();

let hex = hex::encode(node_to_bytes(a, ptr).unwrap());

// (a (q . 1) (c (q . 42) (c (q . 75) 1)))
assert_eq!(hex, "ff02ffff0101ffff04ffff012affff04ffff014bff01808080");

Dependencies

~10MB
~262K SLoC