MCPcopy Create free account

hub / github.com/merkletreejs/merkletreejs / functions

Functions237 in github.com/merkletreejs/merkletreejs

↓ 132 callersMethodtoString
* toString * @desc Returns a visual representation of the merkle tree as a string. * @example *```js *console.log(tree.toString()) *```
src/MerkleTree.ts:1433
↓ 54 callersMethodbufferify
* bufferify * @desc Returns a buffer type for the given value. * @param {String|Number|Object|Buffer|ArrayBuffer} value * @return {Buffer}
src/Base.ts:161
↓ 44 callersMethodgetHexRoot
* getHexRoot * @desc Returns the Merkle root hash as a hex string. * @return {String} * @example *```js *const root = tree.getHexRoot()
src/MerkleTree.ts:544
↓ 29 callersMethodgetRoot
* getRoot * @desc Returns the Merkle root hash as a Buffer. * @return {Buffer} * @example *```js *const root = tree.getRoot() *```
src/MerkleTree.ts:527
↓ 27 callersMethodinsert
* Inserts a key-value pair into the binary tree. * The key is split into two parts: * - stem (first 31 bytes): Determines the path in the tree
src/UnifiedBinaryTree.ts:413
↓ 26 callersMethodbufferToHex
* bufferToHex * @desc Returns a hex string with 0x prefix for given buffer. * @param {Buffer} value * @return {String} * @example *```j
src/Base.ts:321
↓ 23 callersMethodverify
* verify * @desc Returns true if the proof path (array of hashes) can connect the target node * to the Merkle root. * @param {Object[]} proof
src/MerkleTree.ts:1130
↓ 20 callersMethodgetProof
* getProof * @desc Returns the proof for a target leaf. * @param {Buffer} leaf - Target leaf * @param {Number} [index] - Target leaf index in
src/MerkleTree.ts:568
↓ 20 callersFunctionposeidon
(inputs)
test/IncrementalMerkleTree.test.js:9
↓ 19 callersFunctioncreateMerkleTree
( leaves: LeafData[], hashFn: HashFunction = defaultHashFn, options: Options = {} )
src/functional.ts:22
↓ 19 callersMethodinsert
(key: string, value: TValue)
src/MerkleRadixTree.ts:56
↓ 16 callersFunctiongetHexRoot
(tree: MerkleTree)
src/functional.ts:35
↓ 15 callersMethodgetHexLeaves
* getHexLeaves * @desc Returns array of leaves of Merkle Tree as hex strings. * @return {String[]} * @example *```js *const leaves = tr
src/MerkleTree.ts:384
↓ 12 callersMethodbigNumberify
(value: any)
src/Base.ts:242
↓ 12 callersMethodgetLayers
* getLayers * @desc Returns multi-dimensional array of all layers of Merkle Tree, including leaves and root. * @return {Buffer[][]} * @exampl
src/MerkleTree.ts:442
↓ 11 callersFunctiongetHeight
* Recursively computes the height of the tree. * A StemNode has a height of 1; an InternalNode's height is 1 plus * the maximum height of its ch
test/UnifiedBinaryTree.test.js:50
↓ 11 callersMethodgetLeafCount
* getLeafCount * @desc Returns the total number of leaves. * @return {number} * @example *```js *const count = tree.getLeafCount() *
src/MerkleTree.ts:371
↓ 11 callersMethodgetMultiProof
* getMultiProof * @desc Returns the multiproof for given tree indices. * @param {Number[]} indices - Tree indices. * @return {Buffer[]} - Mul
src/MerkleTree.ts:938
↓ 10 callersFunctiongetLeafCount
(tree: MerkleTree)
src/functional.ts:162
↓ 9 callersMethodmerkelize
* Computes the Merkle root of the entire tree. * The Merkle root is a single 32-byte hash that uniquely represents the entire tree state. * *
src/UnifiedBinaryTree.ts:648
↓ 9 callersMethodupdate
* Incrementally updates the value for an existing key. * For our implementation, update is the same as insert. * * @param key - A 32-byte key
src/UnifiedBinaryTree.ts:713
↓ 8 callersMethodgetHexLayers
* getHexLayers * @desc Returns multi-dimensional array of all layers of Merkle Tree, including leaves and root as hex strings. * @return {String
src/MerkleTree.ts:455
↓ 8 callersMethodgetLeaves
* getLeaves * @desc Returns array of leaves of Merkle Tree. * @return {Buffer[]} * @example *```js *const leaves = tree.getLeaves()
src/MerkleTree.ts:271
↓ 7 callersMethodgetHexProof
* getHexProof * @desc Returns the proof for a target leaf as hex strings. * @param {Buffer} leaf - Target leaf * @param {Number} [index] - Ta
src/MerkleTree.ts:625
↓ 7 callersMethodgetLayersFlat
* getLayersFlat * @desc Returns single flat array of all layers of Merkle Tree, including leaves and root. * @return {Buffer[]} * @example
src/MerkleTree.ts:476
↓ 7 callersMethodgetLeaf
* getLeaf * @desc Returns the leaf at the given index. * @param {Number} - Index number * @return {Buffer} * @example *```js *const
src/MerkleTree.ts:316
↓ 7 callersMethodlog2
* log2 * @desc Returns the log2 of number. * @param {Number} value * @return {Number}
src/Base.ts:392
↓ 6 callersMethodbufferArrayIncludes
(bufferArray: Buffer[], targetBuffer: Buffer)
src/Base.ts:417
↓ 6 callersMethodbufferifyFn
* bufferifyFn * @desc Returns a function that will bufferify the return value. * @param {Function} * @return {Function} * * @example
src/Base.ts:202
↓ 6 callersMethodgetDepth
* getDepth * @desc Returns the tree depth (number of layers) * @return {Number} * @example *```js *const depth = tree.getDepth() *``
src/MerkleTree.ts:1296
↓ 6 callersMethodsetValue
* Sets the value at the given index. * * @param index - The index to set the value at. * @param value - The 32-byte value to set.
src/UnifiedBinaryTree.ts:342
↓ 6 callersMethodsizeToBuffer
(size: BigInt)
src/MerkleSumTree.ts:104
↓ 5 callersMethodaddLeaf
* addLeaf * @desc Adds a leaf to the tree and re-calculates layers. * @param {String|Buffer} - Leaf * @param {Boolean} - Set to true if the l
src/MerkleTree.ts:238
↓ 5 callersMethodgetLeafIndex
* getLeafIndex * @desc Returns the index of the given leaf, or -1 if the leaf is not found. * @param {String|Buffer} - Target leaf * @return
src/MerkleTree.ts:349
↓ 5 callersMethodgetMaxLeaves
()
src/IncrementalMerkleTree.ts:137
↓ 5 callersMethodgetSize
* @desc It returns the size of the tree.
src/MerkleMountainRange.ts:164
↓ 5 callersMethodlookup
(key: string)
src/MerkleRadixTree.ts:100
↓ 5 callersMethodprocessLeaves
(leaves: TLeaf[])
src/MerkleTree.ts:141
↓ 5 callersMethodverifyMultiProof
* verifyMultiProof * @desc Returns true if the multiproofs can connect the leaves to the Merkle root. * @param {Buffer} root - Merkle tree root
src/MerkleTree.ts:1214
↓ 4 callersMethodbinarySearch
* binarySearch * @desc Returns the first index of which given item is found in array using binary search. * @param {Buffer[]} array - Array of i
src/Base.ts:55
↓ 4 callersMethodgetHexLayersFlat
* getHexLayersFlat * @desc Returns single flat array of all layers of Merkle Tree, including leaves and root as hex string. * @return {String[]}
src/MerkleTree.ts:501
↓ 4 callersFunctiongetHexLeaves
(tree: MerkleTree)
src/functional.ts:143
↓ 4 callersMethodgetLayersAsObject
* getLayersAsObject * @desc Returns the layers as nested objects instead of an array. * @example *```js *const layersObj = tree.getLayersA
src/MerkleTree.ts:1308
↓ 4 callersMethodgetOptions
()
src/MerkleTree.ts:128
↓ 4 callersMethodgetPeakIndexes
* @desc It returns all peaks of the smallest merkle mountain range tree which includes * the given index(size).
src/MerkleMountainRange.ts:109
↓ 4 callersMethodgetProofFlags
* getProofFlags * @desc Returns list of booleans where proofs should be used instead of hashing. * Proof flags are used in the Solidity multipro
src/MerkleTree.ts:1075
↓ 4 callersFunctiongetTreeKey
( address: Address32, treeIndex: number, subIndex: number, hashFn: HashFunction )
src/UnifiedBinaryTree.ts:99
↓ 4 callersMethodhashBranch
* @desc It returns the hash a parent node with hash(M | Left child | Right child) * M is the index of the node.
src/MerkleMountainRange.ts:81
↓ 4 callersMethodhashData
* Applies the hash function to the given data with special handling for null values. * Used primarily for Merkle tree calculations and node hashing
src/UnifiedBinaryTree.ts:607
↓ 4 callersMethodisHexString
* isHexString * @desc Returns true if value is a hex string. * @param {String} value * @return {Boolean} * * @example * ```js *co
src/Base.ts:293
↓ 4 callersMethodnumOfPeaks
(width: number)
src/MerkleMountainRange.ts:132
↓ 4 callersMethodpeakBagging
(width: number, peaks: any[])
src/MerkleMountainRange.ts:144
↓ 4 callersFunctionsetFillDefaultHash
(value, onlySave)
example/main.js:227
↓ 4 callersFunctiontreeHash
(input: Buffer, hashFn: HashFunction)
src/UnifiedBinaryTree.ts:71
↓ 4 callersMethodupdateHash
()
src/MerkleRadixTree.ts:41
↓ 4 callersMethodverifyProof
(root: Bucket, leaf: Leaf, proof: ProofStep[])
src/MerkleSumTree.ts:143
↓ 4 callersMethodzip
* zip * @desc Returns true if value is a hex string. * @param {String[]|Number[]|Buffer[]} a - first array * @param {String[]|Number[]|Buffer
src/Base.ts:409
↓ 3 callersMethodaddLeaves
* addLeaves * @desc Adds multiple leaves to the tree and re-calculates layers. * @param {String[]|Buffer[]} - Array of leaves * @param {Boole
src/MerkleTree.ts:255
↓ 3 callersMethodbufferIndexOf
* bufferIndexOf * @desc Returns the first index of which given buffer is found in array. * @param {Buffer[]} haystack - Array of buffers. * @
src/Base.ts:29
↓ 3 callersFunctionchunkifyCode
(code: Buffer)
src/UnifiedBinaryTree.ts:245
↓ 3 callersMethodcommonPrefixLength
(str1: string, str2: string)
src/MerkleRadixTree.ts:123
↓ 3 callersFunctioncomputeHash
* Helper function to compute node hashes in the Merkle Radix Tree * Hash computation follows the format: H(H('') || key || value) * where H is the h
test/MerkleRadixTree.test.js:50
↓ 3 callersMethodgetArity
()
src/IncrementalMerkleTree.ts:133
↓ 3 callersMethodgetChildren
* @desc It returns the children when it is a parent node.
src/MerkleMountainRange.ts:226
↓ 3 callersMethodgetHexMultiProof
* getHexMultiProof * @desc Returns the multiproof for given tree indices as hex strings. * @param {Number[]} indices - Tree indices. * @retur
src/MerkleTree.ts:1057
↓ 3 callersFunctiongetLeaf
(tree: MerkleTree, index: number)
src/functional.ts:172
↓ 3 callersFunctiongetOptions
()
example/main.js:69
↓ 3 callersFunctiongetProof
( tree: MerkleTree, leaf: LeafData, index?: number )
src/functional.ts:87
↓ 3 callersMethodgetProofs
* getProofs * @desc Returns the proofs for all leaves. * @return {Object[]} - Array of objects containing a position property of type string
src/MerkleTree.ts:646
↓ 3 callersFunctiongetTreeKeyForBasicData
(address: Address32, hashFn: HashFunction)
src/UnifiedBinaryTree.ts:137
↓ 3 callersFunctiongetTreeKeyForCodeHash
(address: Address32, hashFn: HashFunction)
src/UnifiedBinaryTree.ts:151
↓ 3 callersMethodhashLeaf
* @desc It returns the hash of a leaf node with hash(M | DATA ) * M is the index of the node.
src/MerkleMountainRange.ts:69
↓ 3 callersMethodheightAt
* @desc It returns the height of the index.
src/MerkleMountainRange.ts:200
↓ 3 callersMethodmarshalLeaves
* marshalLeaves * @desc Returns array of leaves of Merkle Tree as a JSON string. * @param {String[]|Buffer[]} - Merkle tree leaves * @return
src/MerkleTree.ts:398
↓ 3 callersFunctionoldStyleAddressToAddress32
(address: Address)
src/UnifiedBinaryTree.ts:53
↓ 3 callersFunctionposeidonHash
(inputs)
test/MerkleTree.test.js:1389
↓ 3 callersMethodremoveLeaf
(index: number)
src/MerkleTree.ts:286
↓ 3 callersFunctionrunTest
(hashFn, libName)
test/UnifiedBinaryTree.test.js:38
↓ 3 callersFunctionsetVerified
(verified)
example/main.js:112
↓ 3 callersFunctionsha256
(data)
test/MerkleTree.test.js:16
↓ 3 callersMethodupdateLeaf
(index: number, value: Buffer, shouldHash: boolean = false)
src/MerkleTree.ts:296
↓ 2 callersFunctionaddLeaf
( tree: MerkleTree, leaf: LeafData, options: { shouldHash?: boolean } = {} )
src/functional.ts:55
↓ 2 callersFunctionaddLeaves
( tree: MerkleTree, leaves: LeafData[], options: { shouldHash?: boolean } = {} )
src/functional.ts:71
↓ 2 callersMethodappend
* @desc This only stores the hashed value of the leaf. * If you need to retrieve the detail data later, use a map to store them.
src/MerkleMountainRange.ts:37
↓ 2 callersMethodbytesToBits
* Converts a byte array to an array of individual bits. * Each byte is converted to 8 bits, maintaining the most-significant-bit first order. *
src/UnifiedBinaryTree.ts:519
↓ 2 callersFunctioncompareFunction
(a, b)
test/Base.test.js:64
↓ 2 callersFunctioncompute
()
example/main.js:42
↓ 2 callersMethodcomputeHash
()
src/MerkleRadixTree.ts:30
↓ 2 callersMethodcopyList
(list: any[])
src/IncrementalMerkleTree.ts:154
↓ 2 callersMethoddelete
(index: number)
src/IncrementalMerkleTree.ts:95
↓ 2 callersMethodgenerateProof
(key: string)
src/MerkleRadixTree.ts:131
↓ 2 callersMethodgetBucket
()
src/MerkleSumTree.ts:37
↓ 2 callersFunctiongetHashFn
()
example/main.js:134
↓ 2 callersFunctiongetHashType
()
example/main.js:129
↓ 2 callersMethodgetHexLeaf
* getHexLeaf * @desc Returns the leaf at the given index as a hex string. * @param {Number} - Index number * @return {String} * @example
src/MerkleTree.ts:334
↓ 2 callersMethodgetHexProofs
* getHexProofs * @desc Returns the proofs for all leaves as hex strings. * @return {String[]} - Proofs array as hex strings. * @example *
src/MerkleTree.ts:708
↓ 2 callersMethodgetLayers
()
src/IncrementalMerkleTree.ts:158
↓ 2 callersMethodgetPairNode
* getPairNode * @desc Returns the node at the index for given layer. * @param {Buffer[]} layer - Tree layer * @param {Number} index - Index a
src/MerkleTree.ts:1401
↓ 2 callersMethodgetProofIndices
* getProofIndices * @desc Returns the proof indices for given tree indices. * @param {Number[]} treeIndices - Tree indices * @param {Number}
src/MerkleTree.ts:849
↓ 2 callersFunctiongetRoot
(tree: MerkleTree)
src/functional.ts:44
next →1–100 of 237, ranked by callers