2022-03-24 15:41:06 +01:00
|
|
|
import { default as MerkleTree } from './FixedMerkleTree';
|
2022-03-14 10:42:36 +01:00
|
|
|
export { PartialMerkleTree } from './PartialMerkleTree';
|
|
|
|
export { simpleHash } from './simpleHash';
|
2022-03-24 15:41:06 +01:00
|
|
|
export { MerkleTree };
|
|
|
|
export default MerkleTree;
|
2022-03-14 10:42:36 +01:00
|
|
|
export declare type HashFunction<T> = {
|
|
|
|
(left: T, right: T): string;
|
|
|
|
};
|
|
|
|
export declare type MerkleTreeOptions = {
|
|
|
|
hashFunction?: HashFunction<Element>;
|
|
|
|
zeroElement?: Element;
|
|
|
|
};
|
|
|
|
export declare type Element = string | number;
|
|
|
|
export declare type SerializedTreeState = {
|
|
|
|
levels: number;
|
|
|
|
_zeros: Array<Element>;
|
|
|
|
_layers: Array<Element[]>;
|
|
|
|
};
|
|
|
|
export declare type SerializedPartialTreeState = {
|
|
|
|
levels: number;
|
2022-03-28 09:44:50 +02:00
|
|
|
_layers: Element[][];
|
2022-03-14 10:42:36 +01:00
|
|
|
_zeros: Array<Element>;
|
|
|
|
_edgeLeafProof: ProofPath;
|
|
|
|
_edgeLeaf: LeafWithIndex;
|
|
|
|
};
|
|
|
|
export declare type ProofPath = {
|
|
|
|
pathElements: Element[];
|
|
|
|
pathIndices: number[];
|
|
|
|
pathPositions: number[];
|
|
|
|
pathRoot: Element;
|
|
|
|
};
|
|
|
|
export declare type TreeEdge = {
|
|
|
|
edgeElement: Element;
|
|
|
|
edgePath: ProofPath;
|
|
|
|
edgeIndex: number;
|
|
|
|
edgeElementsCount: number;
|
|
|
|
};
|
|
|
|
export declare type TreeSlice = {
|
|
|
|
edge: TreeEdge;
|
|
|
|
elements: Element[];
|
|
|
|
};
|
|
|
|
export declare type LeafWithIndex = {
|
|
|
|
index: number;
|
|
|
|
data: Element;
|
|
|
|
};
|