Skip to main content

tapTreeFromList

bitcoinjs-lib v1.0.7


bitcoinjs-lib / tapTreeFromList

Function: tapTreeFromList()

tapTreeFromList(leaves): Taptree

Defined in: ts_src/psbt/bip371.ts:243

Convert a BIP371 TapLeaf list to a TapTree (binary).

Parameters​

leaves​

TapLeaf[] = []

a list of tapleaves where each element of the list is (according to BIP371): One or more tuples representing the depth, leaf version, and script for a leaf in the Taproot tree, allowing the entire tree to be reconstructed. The tuples must be in depth first search order so that the tree is correctly reconstructed.

Returns​

Taptree

the corresponding taptree, or throws an exception if the tree cannot be reconstructed