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

clvm-utils

Utility functions for processing clvm programs and structures

18 releases (8 breaking)

new 0.9.0 May 23, 2024
0.7.0 Apr 24, 2024
0.6.0 Mar 21, 2024
0.3.0 Dec 6, 2023
0.1.15 Nov 28, 2022

#272 in Magic Beans

Download history 24/week @ 2024-01-31 3/week @ 2024-02-07 62/week @ 2024-02-14 347/week @ 2024-02-21 78/week @ 2024-02-28 36/week @ 2024-03-06 30/week @ 2024-03-13 156/week @ 2024-03-20 29/week @ 2024-03-27 41/week @ 2024-04-03 44/week @ 2024-04-10 28/week @ 2024-04-17 215/week @ 2024-04-24 11/week @ 2024-05-01 106/week @ 2024-05-08 131/week @ 2024-05-15

465 downloads per month
Used in 13 crates (8 directly)

Apache-2.0

61KB
1.5K 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

~11MB
~289K SLoC