#wheel #klvm #chik #programs #processing #structures #cargo-workspace

klvm-utils

Utility functions for processing klvm programs and structures

8 releases (4 breaking)

new 0.6.0 Apr 15, 2024
0.5.1 Feb 21, 2024
0.4.0 Feb 18, 2024
0.3.3 Feb 16, 2024
0.2.7 Jul 24, 2023

#4 in #chik

Download history 553/week @ 2024-02-12 200/week @ 2024-02-19 39/week @ 2024-02-26 13/week @ 2024-03-11 40/week @ 2024-04-01

53 downloads per month
Used in 4 crates (3 directly)

Apache-2.0

52KB
1.5K SLoC

This cargo workspace contains code useful for working with the Chik network.

It contains a rust crate chik (here), a python wheel api chik_rs (in wheel), and web assembly (in wasm).


lib.rs:

KLVM Utils

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

Currying Example

use klvm_utils::CurriedProgram;
use klvm_traits::{ToKlvm, klvm_curried_args};
use klvmr::{Allocator, serde::node_to_bytes};

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

let program = a.one();

let ptr = CurriedProgram {
    program,
    args: klvm_curried_args!(42, 75),
}
.to_klvm(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
~288K SLoC