fixed-merkle-tree/lib/index.d.ts

46 lines
1.1 KiB
TypeScript
Raw Normal View History

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