ckbez 1.0.0

CKB Easy is an experimental project that aims to provide human-friendly interfaces for common CKB operations.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Deserialize a script, modify its args, and reserialize it.

fn main() {
    let script_data = [
        0x39, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x82, 0xd7,
        0x6d, 0x1b, 0x75, 0xfe, 0x2f, 0xd9, 0xa2, 0x7d, 0xfb, 0xaa, 0x65, 0xa0, 0x39, 0x22, 0x1a, 0x38, 0x0d, 0x76,
        0xc9, 0x26, 0xf3, 0x78, 0xd3, 0xf8, 0x1c, 0xf3, 0xe7, 0xe1, 0x3f, 0x2e, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00,
        0x01, 0x02, 0x03,
    ];
    println!("Raw script in hex: {}", hex::encode(script_data));
    let mut script = ckbez::core::Script::molecule_decode(&script_data);
    println!("Raw script in obj: {:?}", script);
    script.args.reverse();
    println!("New script in obj: {:?}", script);
    println!("New script in hex: {}", hex::encode(script.molecule()));
}