mirror of
https://github.com/tornadocash/fixed-merkle-tree.git
synced 2024-11-22 09:47:15 +01:00
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { Element, HashFunction, MerkleTreeOptions, ProofPath, SerializedPartialTreeState, TreeEdge } from './';
|
|
import { BaseTree } from './BaseTree';
|
|
export declare class PartialMerkleTree extends BaseTree {
|
|
private _leaves;
|
|
private _leavesAfterEdge;
|
|
private _edgeLeaf;
|
|
private _initialRoot;
|
|
private _edgeLeafProof;
|
|
private _proofMap;
|
|
constructor(levels: number, { edgePath, edgeElement, edgeIndex, edgeElementsCount, }: TreeEdge, leaves: Element[], { hashFunction, zeroElement }?: MerkleTreeOptions);
|
|
get edgeIndex(): number;
|
|
get edgeElement(): Element;
|
|
get edgeLeafProof(): ProofPath;
|
|
private _createProofMap;
|
|
private _buildTree;
|
|
private _buildHashes;
|
|
/**
|
|
* Change an element in the tree
|
|
* @param {number} index Index of element to change
|
|
* @param element Updated element value
|
|
*/
|
|
update(index: number, element: Element): void;
|
|
path(index: number): ProofPath;
|
|
/**
|
|
* Shifts edge of tree to left
|
|
* @param edge new TreeEdge below current edge
|
|
* @param elements leaves between old and new edge
|
|
*/
|
|
shiftEdge(edge: TreeEdge, elements: Element[]): void;
|
|
serialize(): SerializedPartialTreeState;
|
|
static deserialize(data: SerializedPartialTreeState, hashFunction?: HashFunction<Element>): PartialMerkleTree;
|
|
toString(): string;
|
|
}
|