Taproot is a module that provides Bitcoin Taproot related functions.
use 0x1::option;
use 0x1::vector;
use 0x2::bcs;
use 0x2::compare;
use 0x2::consensus_codec;
use 0x2::hash;
use 0x2::result;
use 0x4::script_buf;
struct TaprootBuilder has drop, store
struct NodeInfo has drop, store
const ErrorInvalidMerkleTreeDepth: u64 = 1;
const ErrorNodeNotInDfsOrder: u64 = 2;
const ErrorOverCompleteTree: u64 = 3;
const ErrorUnreachable: u64 = 4;
const TAG_TAP_BRANCH: vector<u8> = [84, 97, 112, 66, 114, 97, 110, 99, 104];
const TAG_TAP_LEAF: vector<u8> = [84, 97, 112, 76, 101, 97, 102];
const TAPROOT_CONTROL_MAX_NODE_COUNT: u64 = 128;
Tapscript leaf version.
const TAPROOT_LEAF_TAPSCRIPT: u8 = 192;
public fun new(): taproot_builder::TaprootBuilder
public fun add_leaf(builder: &mut taproot_builder::TaprootBuilder, depth: u8, script_buf: script_buf::ScriptBuf): &mut taproot_builder::TaprootBuilder
Finalize the builder, return the state root, We use the address to represent the hash.
public fun finalize(builder: taproot_builder::TaprootBuilder): result::Result<address, taproot_builder::TaprootBuilder>