40 lines
1.1 KiB
TypeScript
Vendored
40 lines
1.1 KiB
TypeScript
Vendored
/**
|
|
* Create tree cache file from node.js
|
|
*
|
|
* Only works for node.js, modified from https://github.com/tornadocash/tornado-classic-ui/blob/master/scripts/updateTree.js
|
|
*/
|
|
import { MerkleTree } from '@tornado/fixed-merkle-tree';
|
|
import { DepositsEvents } from '@tornado/core';
|
|
import type { NetIdType } from '@tornado/core';
|
|
export interface TreeCacheConstructor {
|
|
userDirectory: string;
|
|
PARTS_COUNT?: number;
|
|
LEAVES?: number;
|
|
zeroElement?: string;
|
|
}
|
|
export interface treeMetadata {
|
|
blockNumber: number;
|
|
logIndex: number;
|
|
transactionHash: string;
|
|
timestamp: number;
|
|
from: string;
|
|
leafIndex: number;
|
|
}
|
|
export declare class TreeCache {
|
|
userDirectory: string;
|
|
PARTS_COUNT: number;
|
|
constructor({ userDirectory, PARTS_COUNT }: TreeCacheConstructor);
|
|
static getInstanceName({ netId, amount, currency, }: {
|
|
netId: NetIdType;
|
|
amount: string;
|
|
currency: string;
|
|
}): string;
|
|
createTree({ netId, amount, currency, events, tree, }: {
|
|
netId: NetIdType;
|
|
amount: string;
|
|
currency: string;
|
|
events: DepositsEvents[];
|
|
tree: MerkleTree;
|
|
}): Promise<void>;
|
|
}
|