Use 4 tab size

This commit is contained in:
Tornado Contrib 2024-11-01 00:43:07 +00:00
parent 42e6b1713b
commit b2f31b4e43
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
12 changed files with 3903 additions and 3978 deletions

@ -1,65 +1,44 @@
module.exports = {
"env": {
"es2021": true,
"node": true
env: {
es2021: true,
node: true,
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
"plugin:prettier/recommended",
extends: [
'prettier',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
"overrides": [
overrides: [
{
"env": {
"node": true
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"prettier/prettier": [
"error",
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'prettier/prettier': [
'error',
{
tabWidth: 4,
printWidth: 120,
singleQuote: true,
printWidth: 120
}
},
],
"import/order": ["error"],
/**
"indent": [
"error",
2
],
**/
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"@typescript-eslint/no-unused-vars": ["warn"]
}
}
'import/order': ['error'],
'@typescript-eslint/no-unused-vars': ['warn'],
'@typescript-eslint/no-unused-expressions': ['off'],
},
};

1184
dist/cli.js vendored

File diff suppressed because it is too large Load Diff

@ -53,7 +53,7 @@
"optionalDependencies": {},
"devDependencies": {
"@colors/colors": "^1.6.0",
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#8041bd7f7801fd97a87d8c1945c0251b49032ec3",
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#f411159f15566cb0cfe46d07b1c2c4eb23af2e1f",
"@typechain/ethers-v6": "^0.5.1",
"@types/figlet": "^1.7.0",
"@typescript-eslint/eslint-plugin": "^8.11.0",

@ -140,7 +140,10 @@ export async function promptConfirmation(nonInteractive?: boolean) {
return;
}
const prompt = createInterface({ input: process.stdin, output: process.stdout });
const prompt = createInterface({
input: process.stdin,
output: process.stdout,
});
const query = 'Confirm? [Y/n]\n';
const confirmation = await new Promise((resolve) => prompt.question(query, resolve));
@ -174,8 +177,10 @@ export async function getProgramOptions(options: commonProgramOptions): Promise<
options = {
rpc: options.rpc || (process.env.RPC_URL ? parseUrl(process.env.RPC_URL) : undefined),
ethRpc: options.ethRpc || (process.env.ETHRPC_URL ? parseUrl(process.env.ETHRPC_URL) : undefined),
disableTovarish: Boolean(options.disableTovarish) || (process.env.DISABLE_TOVARISH === 'true' ? true : undefined),
accountKey: options.accountKey || (process.env.ACCOUNT_KEY ? parseRecoveryKey(process.env.ACCOUNT_KEY) : undefined),
disableTovarish:
Boolean(options.disableTovarish) || (process.env.DISABLE_TOVARISH === 'true' ? true : undefined),
accountKey:
options.accountKey || (process.env.ACCOUNT_KEY ? parseRecoveryKey(process.env.ACCOUNT_KEY) : undefined),
relayer: options.relayer || (process.env.RELAYER ? parseRelayer(process.env.RELAYER) : undefined),
walletWithdrawal:
Boolean(options.walletWithdrawal) || (process.env.WALLET_WITHDRAWAL === 'true' ? true : undefined),
@ -572,7 +577,11 @@ export function tornadoProgram() {
const isEth = nativeCurrency === currency;
const denomination = parseUnits(amount, decimals);
const deposit = await Deposit.createNote({ currency, amount, netId });
const deposit = await Deposit.createNote({
currency,
amount,
netId,
});
const { noteHex, note, commitmentHex } = deposit;
@ -585,14 +594,20 @@ export function tornadoProgram() {
encoding: 'utf8',
});
const depositData = TornadoRouterInterface.encodeFunctionData('deposit', [instanceAddress, commitmentHex, '0x']);
const depositData = TornadoRouterInterface.encodeFunctionData('deposit', [
instanceAddress,
commitmentHex,
'0x',
]);
if (!isEth) {
const approveData = ERC20Interface.encodeFunctionData('approve', [routerContract, MaxUint256]);
console.log(`Approve Data: ${JSON.stringify({ to: tokenAddress, data: approveData }, null, 2)}]\n`);
console.log(`Transaction Data: ${JSON.stringify({ to: routerContract, data: depositData }, null, 2)}\n`);
console.log(
`Transaction Data: ${JSON.stringify({ to: routerContract, data: depositData }, null, 2)}\n`,
);
} else {
console.log(
`Transaction Data: ${JSON.stringify({ to: routerContract, value: denomination.toString(), data: depositData }, null, 2)}`,
@ -692,7 +707,10 @@ export function tornadoProgram() {
const resp = await programSendTransaction({
signer,
options,
populatedTransaction: await (Token as ERC20).approve.populateTransaction(routerContract, MaxUint256),
populatedTransaction: await (Token as ERC20).approve.populateTransaction(
routerContract,
MaxUint256,
),
});
// wait until signer sends the approve transaction offline
@ -707,7 +725,11 @@ export function tornadoProgram() {
}
}
const deposit = await Deposit.createNote({ currency, amount, netId });
const deposit = await Deposit.createNote({
currency,
amount,
netId,
});
const { note, noteHex, commitmentHex } = deposit;
@ -832,7 +854,10 @@ export function tornadoProgram() {
await programSendTransaction({
signer,
options,
populatedTransaction: await (Token as ERC20).approve.populateTransaction(routerContract, MaxUint256),
populatedTransaction: await (Token as ERC20).approve.populateTransaction(
routerContract,
MaxUint256,
),
});
// wait until signer sends the approve transaction offline
@ -847,9 +872,14 @@ export function tornadoProgram() {
await programSendTransaction({
signer,
options,
populatedTransaction: await TornadoProxy.deposit.populateTransaction(instanceAddress, commitmentHex, '0x', {
populatedTransaction: await TornadoProxy.deposit.populateTransaction(
instanceAddress,
commitmentHex,
'0x',
{
value: isEth ? denomination : BigInt(0),
}),
},
),
});
process.exit(0);
@ -867,7 +897,12 @@ export function tornadoProgram() {
.argument('<recipient>', 'Recipient to receive withdrawn amount', parseAddress)
.argument('[ETH_purchase]', 'ETH to purchase', parseNumber)
.action(
async (note: string, recipient: string, ethPurchase: number | undefined, cmdOptions: commonProgramOptions) => {
async (
note: string,
recipient: string,
ethPurchase: number | undefined,
cmdOptions: commonProgramOptions,
) => {
const { options, fetchDataOptions } = await getProgramOptions(cmdOptions);
const { rpc, walletWithdrawal, disableTovarish } = options;
@ -900,7 +935,9 @@ export function tornadoProgram() {
const isEth = nativeCurrency === currency;
const denomination = parseUnits(amount, decimals);
const firstAmount = Object.keys(currencyConfig.instanceAddress).sort((a, b) => Number(a) - Number(b))[0];
const firstAmount = Object.keys(currencyConfig.instanceAddress).sort(
(a, b) => Number(a) - Number(b),
)[0];
const isFirstAmount = Number(amount) === Number(firstAmount);
const provider = await getProgramProvider(rpc, {
@ -943,7 +980,10 @@ export function tornadoProgram() {
}
const Tornado = Tornado__factory.connect(instanceAddress, provider);
const TornadoProxy = TornadoRouter__factory.connect(routerContract, !walletWithdrawal ? provider : signer);
const TornadoProxy = TornadoRouter__factory.connect(
routerContract,
!walletWithdrawal ? provider : signer,
);
const Multicall = Multicall__factory.connect(multicallContract, provider);
const tornadoFeeOracle = new TornadoFeeOracle(
@ -956,7 +996,9 @@ export function tornadoProgram() {
const tokenPriceOracle = new TokenPriceOracle(
provider,
Multicall,
offchainOracleContract ? OffchainOracle__factory.connect(offchainOracleContract, provider) : undefined,
offchainOracleContract
? OffchainOracle__factory.connect(offchainOracleContract, provider)
: undefined,
);
const TornadoServiceConstructor = {
@ -990,11 +1032,14 @@ export function tornadoProgram() {
type: 'Withdrawal',
});
const { events: depositEvents, validateResult: tree } = await depositsService.updateEvents<MerkleTree>();
const { events: depositEvents, validateResult: tree } =
await depositsService.updateEvents<MerkleTree>();
const withdrawalEvents = (await withdrawalsService.updateEvents()).events as WithdrawalsEvents[];
const depositEvent = (depositEvents as DepositsEvents[]).find(({ commitment }) => commitment === commitmentHex);
const depositEvent = (depositEvents as DepositsEvents[]).find(
({ commitment }) => commitment === commitmentHex,
);
const withdrawalEvent = withdrawalEvents.find(({ nullifierHash }) => nullifierHash === nullifierHex);
@ -1077,7 +1122,8 @@ export function tornadoProgram() {
: tornadoFeeOracle.defaultEthRefund(gasPrice, refundGasLimit);
}
const { rewardAccount, tornadoServiceFee: relayerFeePercent } = relayerClient?.selectedRelayer || {};
const { rewardAccount, tornadoServiceFee: relayerFeePercent } =
relayerClient?.selectedRelayer || {};
fee = tornadoFeeOracle.calculateRelayerFee({
gasPrice,
@ -1129,7 +1175,9 @@ export function tornadoProgram() {
let { fee, refund, proof, args } = await getProof();
const withdrawOverrides = {
from: !walletWithdrawal ? relayerClient?.selectedRelayer?.rewardAccount : (signer?.address as string),
from: !walletWithdrawal
? relayerClient?.selectedRelayer?.rewardAccount
: (signer?.address as string),
value: args[5] || 0,
};
@ -1153,7 +1201,13 @@ export function tornadoProgram() {
const withdrawTable = new Table();
withdrawTable.push(
[{ colSpan: 2, content: 'Withdrawal Info', hAlign: 'center' }],
[
{
colSpan: 2,
content: 'Withdrawal Info',
hAlign: 'center',
},
],
[
'Deposit Date',
`${depositDate.toLocaleDateString()} ${depositDate.toLocaleTimeString()} (${moment.unix(depositEvent.timestamp).fromNow()})`,
@ -1179,7 +1233,8 @@ export function tornadoProgram() {
['Relayer', `${relayerClient?.selectedRelayer?.url}`],
[
'Relayer Fee',
`${formatUnits(relayerFee, decimals)} ${currency.toUpperCase()} ` + `( ${relayerFeePercent}% )`,
`${formatUnits(relayerFee, decimals)} ${currency.toUpperCase()} ` +
`( ${relayerFeePercent}% )`,
],
[
'Total Fee',
@ -1190,7 +1245,10 @@ export function tornadoProgram() {
'Amount to receive',
`${Number(formatUnits(denomination - fee, decimals)).toFixed(5)} ${currency.toUpperCase()}`,
],
[`${nativeCurrency.toUpperCase()} purchase`, `${formatEther(refund)} ${nativeCurrency.toUpperCase()}`],
[
`${nativeCurrency.toUpperCase()} purchase`,
`${formatEther(refund)} ${nativeCurrency.toUpperCase()}`,
],
['To', recipient],
['Nullifier', nullifierHex],
);
@ -1224,7 +1282,11 @@ export function tornadoProgram() {
await programSendTransaction({
signer: signer as TornadoVoidSigner | TornadoWallet,
options,
populatedTransaction: await TornadoProxy.withdraw.populateTransaction(instanceAddress, proof, ...args),
populatedTransaction: await TornadoProxy.withdraw.populateTransaction(
instanceAddress,
proof,
...args,
),
});
}
@ -1265,7 +1327,13 @@ export function tornadoProgram() {
});
const tovarishClient = !disableTovarish
? (await getTovarishRelayer({ options, fetchDataOptions, netId })).relayerClient
? (
await getTovarishRelayer({
options,
fetchDataOptions,
netId,
})
).relayerClient
: undefined;
if (tovarishClient?.selectedRelayer) {
@ -1364,7 +1432,11 @@ export function tornadoProgram() {
.argument('[netId]', 'Network Chain ID to connect with (see https://chainlist.org for examples)', parseNumber)
.argument('[currency]', 'Currency to sync events')
.action(
async (netIdOpts: NetIdType | undefined, currencyOpts: string | undefined, cmdOptions: commonProgramOptions) => {
async (
netIdOpts: NetIdType | undefined,
currencyOpts: string | undefined,
cmdOptions: commonProgramOptions,
) => {
const { options, fetchDataOptions } = await getProgramOptions(cmdOptions);
const { rpc, disableTovarish } = options;
@ -1391,14 +1463,25 @@ export function tornadoProgram() {
});
const tovarishClient = !disableTovarish
? (await getTovarishRelayer({ options, fetchDataOptions, netId })).relayerClient
? (
await getTovarishRelayer({
options,
fetchDataOptions,
netId,
})
).relayerClient
: undefined;
if (tovarishClient?.selectedRelayer) {
console.log(`\nConnected with Tovarish Relayer ${tovarishClient.selectedRelayer.url}\n`);
}
if (netId === RELAYER_NETWORK && governanceContract && aggregatorContract && reverseRecordsContract) {
if (
netId === RELAYER_NETWORK &&
governanceContract &&
aggregatorContract &&
reverseRecordsContract
) {
const governanceService = new NodeGovernanceService({
netId,
provider,
@ -1557,7 +1640,16 @@ export function tornadoProgram() {
'serviceFee',
].map((content) => ({ content: colors.red.bold(content) })),
...validRelayers.map(
({ netId, url, ensName, stakeBalance, relayerAddress, rewardAccount, currentQueue, tornadoServiceFee }) => {
({
netId,
url,
ensName,
stakeBalance,
relayerAddress,
rewardAccount,
currentQueue,
tornadoServiceFee,
}) => {
return [
netId,
url,
@ -1575,8 +1667,16 @@ export function tornadoProgram() {
const invalidRelayersTable = new Table();
invalidRelayersTable.push(
[{ colSpan: 3, content: `Invalid ${relayerName}`, hAlign: 'center' }],
['hostname', 'relayerAddress', 'errorMessage'].map((content) => ({ content: colors.red.bold(content) })),
[
{
colSpan: 3,
content: `Invalid ${relayerName}`,
hAlign: 'center',
},
],
['hostname', 'relayerAddress', 'errorMessage'].map((content) => ({
content: colors.red.bold(content),
})),
...invalidRelayers.map(({ hostname, relayerAddress, errorMessage }) => {
return [hostname, relayerAddress, errorMessage ? substring(errorMessage, 40) : ''];
}),
@ -1624,7 +1724,13 @@ export function tornadoProgram() {
}
const tovarishClient = !disableTovarish
? (await getTovarishRelayer({ options, fetchDataOptions, netId })).relayerClient
? (
await getTovarishRelayer({
options,
fetchDataOptions,
netId,
})
).relayerClient
: undefined;
if (tovarishClient?.selectedRelayer) {
@ -1657,9 +1763,23 @@ export function tornadoProgram() {
if (existingAccounts.length) {
accountsTable.push(
[{ colSpan: 2, content: `Note Accounts (${netId})`, hAlign: 'center' }],
[{ colSpan: 2, content: `Backed up by: ${signer.address}`, hAlign: 'center' }],
['blockNumber', 'noteAccount'].map((content) => ({ content: colors.red.bold(content) })),
[
{
colSpan: 2,
content: `Note Accounts (${netId})`,
hAlign: 'center',
},
],
[
{
colSpan: 2,
content: `Backed up by: ${signer.address}`,
hAlign: 'center',
},
],
['blockNumber', 'noteAccount'].map((content) => ({
content: colors.red.bold(content),
})),
...existingAccounts.map(({ blockNumber, recoveryKey }) => {
return [blockNumber, recoveryKey];
}),
@ -1670,10 +1790,24 @@ export function tornadoProgram() {
const newAccount = new NoteAccount({});
accountsTable.push(
[{ colSpan: 1, content: `New Note Account (${netId})`, hAlign: 'center' }],
['noteAccount'].map((content) => ({ content: colors.red.bold(content) })),
[
{
colSpan: 1,
content: `New Note Account (${netId})`,
hAlign: 'center',
},
],
['noteAccount'].map((content) => ({
content: colors.red.bold(content),
})),
[newAccount.recoveryKey],
[{ colSpan: 1, content: `Would be backed up by: ${signer.address}`, hAlign: 'center' }],
[
{
colSpan: 1,
content: `Would be backed up by: ${signer.address}`,
hAlign: 'center',
},
],
);
const fileName = `backup-note-account-key-0x${newAccount.recoveryKey.slice(0, 8)}.txt`;
@ -1734,7 +1868,13 @@ export function tornadoProgram() {
});
const tovarishClient = !disableTovarish
? (await getTovarishRelayer({ options, fetchDataOptions, netId })).relayerClient
? (
await getTovarishRelayer({
options,
fetchDataOptions,
netId,
})
).relayerClient
: undefined;
if (tovarishClient?.selectedRelayer) {
@ -1767,10 +1907,6 @@ export function tornadoProgram() {
const accounts = [];
if (accountKey) {
accounts.push(new NoteAccount({ recoveryKey: accountKey }));
}
// Recover encryption keys possibly encrypted by a signer
const signer = getProgramSigner({
options,
@ -1783,6 +1919,10 @@ export function tornadoProgram() {
accounts.push(...(await NoteAccount.decryptSignerNoteAccounts(signer, echoEvents)));
}
if (accountKey && !accounts.find(({ recoveryKey }) => recoveryKey === accountKey)) {
accounts.push(new NoteAccount({ recoveryKey: accountKey }));
}
if (!accounts.length) {
throw new Error(
'No encryption key find! Please supply encryption key from either UI or create one with createAccount command',
@ -1792,9 +1932,23 @@ export function tornadoProgram() {
const accountsTable = new Table();
accountsTable.push(
[{ colSpan: 2, content: `Note Accounts (${netId})`, hAlign: 'center' }],
[{ colSpan: 2, content: `Backed up by: ${signer?.address}`, hAlign: 'center' }],
['blockNumber', 'noteAccount'].map((content) => ({ content: colors.red.bold(content) })),
[
{
colSpan: 2,
content: `Note Accounts (${netId})`,
hAlign: 'center',
},
],
[
{
colSpan: 2,
content: `Backed up by: ${signer?.address}`,
hAlign: 'center',
},
],
['blockNumber', 'noteAccount'].map((content) => ({
content: colors.red.bold(content),
})),
...accounts.map(({ blockNumber, recoveryKey }) => {
return [blockNumber, recoveryKey];
}),
@ -1809,15 +1963,33 @@ export function tornadoProgram() {
.map(({ blockNumber, address, noteHex }) => {
const { amount, currency } = getInstanceByAddress(config, address) || {};
if (amount) {
return [blockNumber, `tornado-${currency}-${amount}-${netId}-${noteHex}`];
}
return [blockNumber, noteHex];
});
const notesTable = new Table();
notesTable.push(
[{ colSpan: 2, content: `Note Accounts (${netId})`, hAlign: 'center' }],
[{ colSpan: 2, content: `Account key: ${accountKey}`, hAlign: 'center' }],
['blockNumber', 'note'].map((content) => ({ content: colors.red.bold(content) })),
[
{
colSpan: 2,
content: `Note Accounts (${netId})`,
hAlign: 'center',
},
],
[
{
colSpan: 2,
content: `Account key: ${accountKey}`,
hAlign: 'center',
},
],
['blockNumber', 'note'].map((content) => ({
content: colors.red.bold(content),
})),
...decryptedNotes,
);
@ -1992,7 +2164,9 @@ export function tornadoProgram() {
...fetchDataOptions,
});
const userAddress = addressArgs ? parseAddress(addressArgs) : getProgramSigner({ options, provider })?.address;
const userAddress = addressArgs
? parseAddress(addressArgs)
: getProgramSigner({ options, provider })?.address;
const tokenAddress = tokenArgs ? parseAddress(tokenArgs) : tokenOpts;
if (!userAddress) {
@ -2017,10 +2191,18 @@ export function tornadoProgram() {
tokenAddresses: [...(tokenAddress ? [tokenAddress] : tokenAddresses)],
});
const balanceTable = new Table({ head: ['Token', 'Contract Address', 'Balance'] });
const balanceTable = new Table({
head: ['Token', 'Contract Address', 'Balance'],
});
balanceTable.push(
[{ colSpan: 3, content: `User: ${userAddress}`, hAlign: 'center' }],
[
{
colSpan: 3,
content: `User: ${userAddress}`,
hAlign: 'center',
},
],
...tokenBalances.map(({ address, name, symbol, decimals, balance }) => {
return [`${name} (${symbol})`, address, `${formatUnits(balance, decimals)} ${symbol}`];
}),
@ -2075,7 +2257,9 @@ export function tornadoProgram() {
const netId = Number(Transaction.from(signedTx).chainId);
if (!netId) {
throw new Error('NetId for the transaction is invalid, this command only supports EIP-155 transactions');
throw new Error(
'NetId for the transaction is invalid, this command only supports EIP-155 transactions',
);
}
const provider = await getProgramProvider(rpc, {
@ -2114,7 +2298,13 @@ export function tornadoProgram() {
} = config;
const tovarishClient = !disableTovarish
? (await getTovarishRelayer({ options, fetchDataOptions, netId })).relayerClient
? (
await getTovarishRelayer({
options,
fetchDataOptions,
netId,
})
).relayerClient
: undefined;
if (tovarishClient?.selectedRelayer) {
@ -2144,10 +2334,37 @@ export function tornadoProgram() {
const proposalTable = new Table();
proposalTable.push(
[{ colSpan: 9, content: 'Last 20 Proposals', hAlign: 'center' }],
['ID', 'Title', 'Proposer', 'Start Time', 'End Time', 'Quorum', 'For Votes', 'Against Votes', 'State'],
[
{
colSpan: 9,
content: 'Last 20 Proposals',
hAlign: 'center',
},
],
[
'ID',
'Title',
'Proposer',
'Start Time',
'End Time',
'Quorum',
'For Votes',
'Against Votes',
'State',
],
...recentProposals.map(
({ id, title, proposer, proposerName, startTime, endTime, quorum, forVotes, againstVotes, state }) => {
({
id,
title,
proposer,
proposerName,
startTime,
endTime,
quorum,
forVotes,
againstVotes,
state,
}) => {
return [
id,
title,
@ -2192,7 +2409,13 @@ export function tornadoProgram() {
const proposalTable = new Table();
proposalTable.push(
[{ colSpan: 2, content: `Proposal ${proposalId}`, hAlign: 'center' }],
[
{
colSpan: 2,
content: `Proposal ${proposalId}`,
hAlign: 'center',
},
],
['Title', title],
['Description', description],
['Proposer', proposerName || proposer],
@ -2268,7 +2491,13 @@ export function tornadoProgram() {
} = config;
const tovarishClient = !disableTovarish
? (await getTovarishRelayer({ options, fetchDataOptions, netId })).relayerClient
? (
await getTovarishRelayer({
options,
fetchDataOptions,
netId,
})
).relayerClient
: undefined;
if (tovarishClient?.selectedRelayer) {

@ -186,15 +186,23 @@ export class NodeTornadoService extends BaseTornadoService {
events,
lastBlock,
hasNewEvents,
}: BaseEvents<DepositsEvents | WithdrawalsEvents> & { hasNewEvents?: boolean }): Promise<S> {
const tree = await super.validateEvents<S>({ events, lastBlock, hasNewEvents });
}: BaseEvents<DepositsEvents | WithdrawalsEvents> & {
hasNewEvents?: boolean;
}): Promise<S> {
const tree = await super.validateEvents<S>({
events,
lastBlock,
hasNewEvents,
});
if (tree && this.currency === this.nativeCurrency && this.treeCache) {
const merkleTree = tree as unknown as MerkleTree;
await this.treeCache.createTree(events as DepositsEvents[], merkleTree);
console.log(`${this.getInstanceName()}: Updated tree cache with root ${toFixedHex(BigInt(merkleTree.root))}\n`);
console.log(
`${this.getInstanceName()}: Updated tree cache with root ${toFixedHex(BigInt(merkleTree.root))}\n`,
);
}
return tree;
@ -207,7 +215,12 @@ export class NodeTornadoService extends BaseTornadoService {
[{ colSpan: 2, content: `${this.getType()}s`, hAlign: 'center' }],
['Instance', `${this.netId} chain ${this.amount} ${this.currency.toUpperCase()}`],
['Anonymity set', `${events.length} equal user ${this.getType().toLowerCase()}s`],
[{ colSpan: 2, content: `Latest ${this.getType().toLowerCase()}s` }],
[
{
colSpan: 2,
content: `Latest ${this.getType().toLowerCase()}s`,
},
],
...events
.slice(events.length - 10)
.reverse()

@ -785,9 +785,9 @@
"@openzeppelin/contracts-v3" "npm:@openzeppelin/contracts@3.2.0-rc.0"
ethers "^6.13.4"
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#8041bd7f7801fd97a87d8c1945c0251b49032ec3":
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#f411159f15566cb0cfe46d07b1c2c4eb23af2e1f":
version "1.0.19"
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#8041bd7f7801fd97a87d8c1945c0251b49032ec3"
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#f411159f15566cb0cfe46d07b1c2c4eb23af2e1f"
dependencies:
"@metamask/eth-sig-util" "^8.0.0"
"@tornado/contracts" "git+https://git.tornado.ws/tornadocontrib/tornado-contracts.git#1b1d707878c16a3dc60d295299d4f0e7ce6ba831"