function tapTreeToList(tree) {
  if (!isTaptree(tree))
    throw new Error(
      'Cannot convert taptree to tapleaf list. Expecting a tapree structure.',
    );
  return _tapTreeToList(tree);
}
Convert a binary tree to a BIP371 type list. 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.
@param tree the binary tap tree
@returns a list of BIP 371 tapleaves