Constructor
Number of levels in the tree
BigNumberish[] of initial elements
Object with the following properties: hashFunction - Function used to hash 2 leaves zeroElement - Value for non-existent leaves
Get merkle path to a leaf
pathElements: Object[], pathIndex: number[] - An object containing adjacent elements and left-right index
Leaf index to generate path for
Serialize entire tree state including intermediate layers into a plain object Deserializing it back will not require to recompute any hashes Elements are not converted to a plain type, this is responsibility of the caller
Static
calculateThis function calculates the desired index given the pathIndices
an array of (0, 1) values representing (left, right) selection of nodes for each level in the merkle tree. The leaves level of the tree is at index 0 and the root of the tree is at index 'levels'
Static
createCreate a merkle tree with the target root by inserting the given leaves one-by-one. If the root matches after an insertion, return the tree. Else, return undefined.
MerkleTree | undefined
An array of ordered leaves to be inserted in a merkle tree
The root that the caller is trying to build a tree against
Static
deserializeGenerated using TypeDoc
Merkle tree