lenso-contract-codegen 0.10.2

Generates exact Rust, TypeScript, and WIT bindings from portable Lenso Capability contracts.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use sha2::{Digest, Sha256};
fn main() {
    let mut hasher = Sha256::new();
    let mut sources = std::fs::read_dir("src")
        .expect("generator sources")
        .map(|entry| entry.expect("source entry").path())
        .filter(|path| path.extension().is_some_and(|extension| extension == "rs"))
        .collect::<Vec<_>>();
    sources.sort();
    for path in sources {
        println!("cargo:rerun-if-changed={}", path.display());
        hasher.update(path.to_string_lossy().as_bytes());
        hasher.update(std::fs::read(path).expect("generator source"));
    }
    let revision = format!("{:x}", hasher.finalize());
    println!("cargo:rustc-env=LENSO_GENERATOR_REVISION={revision}");
}