Compare commits
No commits in common. "20bb8c25a19a019c188282b9dca014afc7195419" and "722c426fcb729fc554c3daed21842fcf8fb3c76e" have entirely different histories.
20bb8c25a1
...
722c426fcb
44
.eslintrc.js
Normal file
44
.eslintrc.js
Normal file
@ -0,0 +1,44 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
es2021: true,
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
'prettier',
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:import/recommended',
|
||||
'plugin:import/typescript',
|
||||
'plugin:prettier/recommended',
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
files: ['.eslintrc.{js,cjs}'],
|
||||
parserOptions: {
|
||||
sourceType: 'script',
|
||||
},
|
||||
},
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint', 'prettier'],
|
||||
rules: {
|
||||
'prettier/prettier': [
|
||||
'error',
|
||||
{
|
||||
tabWidth: 4,
|
||||
printWidth: 120,
|
||||
singleQuote: true,
|
||||
},
|
||||
],
|
||||
'import/order': ['error'],
|
||||
'@typescript-eslint/no-unused-vars': ['warn'],
|
||||
'@typescript-eslint/no-unused-expressions': ['off'],
|
||||
},
|
||||
};
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1 +1 @@
|
||||
dist/**/* linguist-vendored
|
||||
dist/* linguist-vendored
|
||||
1
.npmrc
Normal file
1
.npmrc
Normal file
@ -0,0 +1 @@
|
||||
@tornado:registry=https://git.tornado.ws/api/packages/tornado-packages/npm/
|
||||
10
Dockerfile
10
Dockerfile
@ -1,13 +1,13 @@
|
||||
# Dockefile from https://notes.ethereum.org/@GW1ZUbNKR5iRjjKYx6_dJQ/Bk8zsJ9xj
|
||||
# FROM node:22.12.0-bullseye-slim
|
||||
FROM node@sha256:9f385b101f66ecdf9ed9218d000cd5a35600722f0aab8112632371765109c065
|
||||
# FROM node:20.18.0-bullseye-slim
|
||||
FROM node@sha256:9b558df8f10198fcd1f48cf344c55c4442c3446b8a9a69487523b3d890a4a59e
|
||||
|
||||
# install wget, git and necessary certificates
|
||||
RUN apt update && apt install --yes --no-install-recommends wget git apt-transport-https ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV GIT_REPOSITORY=https://github.com/tornadocontrib/tornado-scripts.git
|
||||
# From main branch, double check with git.tornado.ws and codeberg.org
|
||||
ENV GIT_COMMIT_HASH=d143bc2923e4dcb1c84e4123fbc56cb406e6db6f
|
||||
ENV GIT_REPOSITORY=https://git.tornado.ws/tornadocontrib/tornado-core.git
|
||||
# From development branch, double check with tornado.ws
|
||||
ENV GIT_COMMIT_HASH=f16bb2ed12464dce4f31aa5a237bb1643989e02d
|
||||
|
||||
# clone the repository
|
||||
RUN mkdir /app/
|
||||
|
||||
21
LICENSE
21
LICENSE
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Tornado Cash
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@ -2,7 +2,9 @@
|
||||
|
||||
<img src="./logo2.png">
|
||||
|
||||
# Tornado Scripts (tornado-scripts)
|
||||
# Tornado Core (@tornado/core)
|
||||
|
||||
### Notice: Repository migrated to [tornado-scripts](https://github.com/tornadocontrib/tornado-scripts) to avoid naming conflict with legacy tornado-core repository
|
||||
|
||||
🛠 An SDK for building applications on top of [Privacy Pools](https://www.forbes.com/sites/tomerniv/2023/09/07/privacy-pools-bridging-the-gap-between-blockchain-and-regulatory-compliance)
|
||||
|
||||
@ -10,9 +12,9 @@
|
||||
|
||||
</div>
|
||||
|
||||
### About Tornado Scripts
|
||||
### About Tornado Core
|
||||
|
||||
Tornado Scripts is a modern building block for Privacy Pools to build anything from custom UI or CLI tools
|
||||
Tornado Core is a modern building block for Privacy Pools to build anything from custom UI or CLI tools
|
||||
|
||||
+ Written in [TypeScript](https://www.typescriptlang.org/)
|
||||
|
||||
|
||||
2
dist/contracts.d.ts
vendored
2
dist/contracts.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export * from 'tornado-contracts';
|
||||
export * from '@tornado/contracts';
|
||||
export { Multicall, Multicall__factory, OffchainOracle, OffchainOracle__factory, OvmGasPriceOracle, OvmGasPriceOracle__factory, ReverseRecords, ReverseRecords__factory, ENSNameWrapper, ENSNameWrapper__factory, ENSRegistry, ENSRegistry__factory, ENSResolver, ENSResolver__factory, } from './typechain';
|
||||
|
||||
6
dist/ens.d.ts
vendored
6
dist/ens.d.ts
vendored
@ -8,11 +8,13 @@ export declare function makeLabelNodeAndParent(name: string): {
|
||||
labelhash: string;
|
||||
parentNode: string;
|
||||
};
|
||||
export declare const EnsContracts: Record<NetIdType, {
|
||||
export declare const EnsContracts: {
|
||||
[key: NetIdType]: {
|
||||
ensRegistry: string;
|
||||
ensPublicResolver: string;
|
||||
ensNameWrapper: string;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* ENSUtils to manage on-chain registered relayers
|
||||
*/
|
||||
|
||||
18
dist/events/base.d.ts
vendored
18
dist/events/base.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import { BaseContract, Provider, EventLog } from 'ethers';
|
||||
import { Tornado, TornadoRouter, TornadoProxyLight, Governance, RelayerRegistry, Echoer, Aggregator } from 'tornado-contracts';
|
||||
import { Tornado, TornadoRouter, TornadoProxyLight, Governance, RelayerRegistry, Echoer, Aggregator } from '@tornado/contracts';
|
||||
import type { MerkleTree } from 'fixed-merkle-tree';
|
||||
import { BatchEventsService, BatchBlockService, BatchTransactionService, BatchEventOnProgress, BatchBlockOnProgress } from '../batch';
|
||||
import { fetchDataOptions } from '../providers';
|
||||
@ -98,12 +98,16 @@ export declare class BaseTornadoService extends BaseEventsService<DepositsEvents
|
||||
}): Promise<BaseEvents<DepositsEvents | WithdrawalsEvents>>;
|
||||
}
|
||||
export interface BaseMultiTornadoServiceConstructor extends Omit<BaseEventsServiceConstructor, 'contract' | 'type'> {
|
||||
instances: Record<string, DepositType>;
|
||||
instances: {
|
||||
[key in string]: DepositType;
|
||||
};
|
||||
optionalTree?: boolean;
|
||||
merkleTreeService?: MerkleTreeService;
|
||||
}
|
||||
export declare class BaseMultiTornadoService extends BaseEventsService<MultiDepositsEvents | MultiWithdrawalsEvents> {
|
||||
instances: Record<string, DepositType>;
|
||||
instances: {
|
||||
[key in string]: DepositType;
|
||||
};
|
||||
optionalTree?: boolean;
|
||||
merkleTreeService?: MerkleTreeService;
|
||||
batchTransactionService: BatchTransactionService;
|
||||
@ -139,7 +143,9 @@ export declare class BaseEncryptedNotesService extends BaseEventsService<Encrypt
|
||||
getTovarishType(): string;
|
||||
formatEvents(events: EventLog[]): Promise<EncryptedNotesEvents[]>;
|
||||
}
|
||||
export declare const proposalState: Record<string, string>;
|
||||
export declare const proposalState: {
|
||||
[key: string]: string;
|
||||
};
|
||||
export interface GovernanceProposals extends GovernanceProposalCreatedEvents {
|
||||
title: string;
|
||||
proposerName?: string;
|
||||
@ -176,7 +182,9 @@ export declare class BaseGovernanceService extends BaseEventsService<AllGovernan
|
||||
delegatedAccs: string[];
|
||||
undelegatedAccs: string[];
|
||||
uniq: string[];
|
||||
uniqNames: Record<string, string>;
|
||||
uniqNames: {
|
||||
[key: string]: string;
|
||||
};
|
||||
balances: bigint[];
|
||||
balance: bigint;
|
||||
}>;
|
||||
|
||||
8
dist/gaszip.d.ts
vendored
8
dist/gaszip.d.ts
vendored
@ -1,6 +1,10 @@
|
||||
import { NetIdType } from './networkConfig';
|
||||
export declare const gasZipInbounds: Record<NetIdType, string>;
|
||||
export declare const gasZipID: Record<NetIdType, number>;
|
||||
export declare const gasZipInbounds: {
|
||||
[key in NetIdType]: string;
|
||||
};
|
||||
export declare const gasZipID: {
|
||||
[key in NetIdType]: number;
|
||||
};
|
||||
export declare function gasZipInput(to: string, shorts: number[]): string | null;
|
||||
export declare function gasZipMinMax(ethUsd: number): {
|
||||
min: number;
|
||||
|
||||
4
dist/graphql/index.d.ts
vendored
4
dist/graphql/index.d.ts
vendored
@ -12,7 +12,9 @@ export interface queryGraphParams {
|
||||
graphApi: string;
|
||||
subgraphName: string;
|
||||
query: string;
|
||||
variables?: Record<string, string | number>;
|
||||
variables?: {
|
||||
[key: string]: string | number;
|
||||
};
|
||||
fetchDataOptions?: fetchDataOptions;
|
||||
}
|
||||
export declare function queryGraph<T>({ graphApi, subgraphName, query, variables, fetchDataOptions, }: queryGraphParams): Promise<T>;
|
||||
|
||||
18
dist/hashes.json
vendored
18
dist/hashes.json
vendored
@ -1,11 +1,11 @@
|
||||
{
|
||||
"dist/index.js": "sha384-9VSo+DyOg7bk9fplN0eusAdRqdhB/o9VBM9Y4TinC0tYBljNm2IDfxC4G60luJDp",
|
||||
"dist/index.mjs": "sha384-Cm+w57MAhudCJ1Xk+H0dwspZlGJV3Yny1uFzoQBbNaCNaLwTH9CqDHdmu2mAYQxJ",
|
||||
"dist/merkleTreeWorker.js": "sha384-HPaQH762jYxlfAdS4KPJou1AXG9Ww4N+PDEc6vHgFeIX1HI8S/StRmOoJR+gHScM",
|
||||
"dist/merkleTreeWorker.umd.js": "sha384-+VOeGAa/XGNYsar06LgAquRWKO3CG7anvbpVvlWIa6J9pg9+DskqaDkAusiVz8HZ",
|
||||
"dist/merkleTreeWorker.umd.min.js": "sha384-fOCKW9eYxMVLFTOQcuKJxJwNyRu6MRIzmPFHqzxlp0P/ZT24y+A3HcgCylohIfJ0",
|
||||
"dist/tornado.umd.js": "sha384-/dWCQ81GwzoRqHnv+pi9tsHj2mzMyvxBk5ttIbOLe/0MIcSw9aBoSr3vgRoSlWZ+",
|
||||
"dist/tornado.umd.min.js": "sha384-CgPo6GlnCtdGLqeu7OIcOliLTRQy289Q3CxWv5xqXCQhrHxSUupP8nBv55xQiqkW",
|
||||
"dist/tornadoContracts.umd.js": "sha384-Gmawcz/XTH7WFUFnMJKPUCy2zrjDOhf/DtSv9xfHBulPyCEJwI70Hw+n7E1Y60EU",
|
||||
"dist/tornadoContracts.umd.min.js": "sha384-Sclkp3xkhjmDekfQaQFkgUctmauYUF7ieeyyFhFBnwAzyp2eFBS5qzxvOIBhlJza"
|
||||
"dist/index.js": "sha384-txpjgDLxNbeXsLgVCyNAwpaJRS0SmFN/ITfadSo8+xzSvLqwa5bQ9GoxQ1Su8QEr",
|
||||
"dist/index.mjs": "sha384-CrEHmX4zKIv/68CKWElNzvKk6FWRMMkKV8JmqL1KqYCxO73LPEAjDqxTYpxUuDBy",
|
||||
"dist/merkleTreeWorker.js": "sha384-XVv9HRGDZlaF0LeEZNQygle31UY6yvIwsZ4GWCTZUX7O/hZ7N5Zwpi3GqnHSBYzW",
|
||||
"dist/merkleTreeWorker.umd.js": "sha384-e5B65ZZ4IxKVOU1o02K6IL2tjJof20QCcEtD+vKe1cPmyfW2BPCHWDPIbPksIpvJ",
|
||||
"dist/merkleTreeWorker.umd.min.js": "sha384-AxQv1da+lSi3gMYkdGQuR1WN1+4HB8IT3cPFa17HBj14+ZzdZN6SS1fCw5Izc2rr",
|
||||
"dist/tornado.umd.js": "sha384-xTUkkUTm3aBsnHCUnVGxRgieAu3z4wCwrKT1DFj8VyCk/eZZO9nq+yP4/McLRfB4",
|
||||
"dist/tornado.umd.min.js": "sha384-ubqr6m6jEOPf7LQz0pXKmEo7tCCbNUAE+iSZWK6X/f7i4wt14rYW7pUcSzw5glth",
|
||||
"dist/tornadoContracts.umd.js": "sha384-bFq/cemb0bP0JbIq8p75n0UR8smQ/2Yh69pjegzSuu0upawO3sKOjehY8SjX85Xh",
|
||||
"dist/tornadoContracts.umd.min.js": "sha384-4ay7cmK0auAgZH1xfAsqyN6GtnHBNNgh9C22qy0rHxKicDzNtTsnNZDbz0qmd9GI"
|
||||
}
|
||||
75
dist/index.js
vendored
75
dist/index.js
vendored
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var ethers = require('ethers');
|
||||
var tornadoContracts = require('tornado-contracts');
|
||||
var contracts = require('@tornado/contracts');
|
||||
var crypto$1 = require('crypto');
|
||||
var BN = require('bn.js');
|
||||
var contentHashUtils = require('@ensdomains/content-hash');
|
||||
@ -865,9 +865,9 @@ const defaultConfig = {
|
||||
name: "MEV Blocker",
|
||||
url: "https://rpc.mevblocker.io"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/mainnet"
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com"
|
||||
},
|
||||
keydonix: {
|
||||
name: "Horswap ( Keydonix )",
|
||||
@ -1016,9 +1016,9 @@ const defaultConfig = {
|
||||
name: "BNB Chain 2",
|
||||
url: "https://bsc-dataseed1.ninicoin.io"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/bsc"
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/bsc"
|
||||
},
|
||||
nodereal: {
|
||||
name: "NodeReal",
|
||||
@ -1104,14 +1104,6 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/matic-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/polygon"
|
||||
},
|
||||
polygon: {
|
||||
name: "Polygon",
|
||||
url: "https://polygon-rpc.com"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/matic"
|
||||
@ -1164,14 +1156,6 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/optimism-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/op"
|
||||
},
|
||||
optimism: {
|
||||
name: "Optimism",
|
||||
url: "https://mainnet.optimism.io"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/op"
|
||||
@ -1230,9 +1214,9 @@ const defaultConfig = {
|
||||
name: "Arbitrum",
|
||||
url: "https://arb1.arbitrum.io/rpc"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/arbitrum"
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/arbitrum"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup",
|
||||
@ -1293,10 +1277,6 @@ const defaultConfig = {
|
||||
name: "Base",
|
||||
url: "https://mainnet.base.org"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/base"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup",
|
||||
url: "https://public.stackup.sh/api/v1/node/base-mainnet"
|
||||
@ -1384,10 +1364,6 @@ const defaultConfig = {
|
||||
name: "Blast",
|
||||
url: "https://rpc.blast.io"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/blast"
|
||||
},
|
||||
blastApi: {
|
||||
name: "BlastApi",
|
||||
url: "https://blastl2-mainnet.public.blastapi.io"
|
||||
@ -1441,10 +1417,6 @@ const defaultConfig = {
|
||||
name: "Gnosis",
|
||||
url: "https://rpc.gnosischain.com"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/gnosis"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/gnosis"
|
||||
@ -1492,18 +1464,10 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/avalanche-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/ext/bc/C/rpc"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/avax/c"
|
||||
},
|
||||
avalanche: {
|
||||
name: "Avalanche",
|
||||
url: "https://api.avax.network/ext/bc/C/rpc"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup",
|
||||
url: "https://public.stackup.sh/api/v1/node/avalanche-mainnet"
|
||||
@ -1556,14 +1520,14 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/sepolia"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/sepolia"
|
||||
},
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/sepolia"
|
||||
},
|
||||
sepolia: {
|
||||
name: "Sepolia RPC",
|
||||
url: "https://rpc.sepolia.org"
|
||||
@ -2093,10 +2057,13 @@ function getStatusSchema(netId, config, tovarish) {
|
||||
properties: {
|
||||
instanceAddress: {
|
||||
type: "object",
|
||||
properties: amounts.reduce((acc2, cur) => {
|
||||
properties: amounts.reduce(
|
||||
(acc2, cur) => {
|
||||
acc2[cur] = addressSchemaType;
|
||||
return acc2;
|
||||
}, {}),
|
||||
},
|
||||
{}
|
||||
),
|
||||
required: amounts.filter((amount) => !optionalInstances.includes(amount))
|
||||
},
|
||||
decimals: { enum: [decimals] }
|
||||
@ -2685,7 +2652,7 @@ class BaseMultiTornadoService extends BaseEventsService {
|
||||
batchBlockService;
|
||||
constructor(serviceConstructor) {
|
||||
const { instances, provider, optionalTree, merkleTreeService } = serviceConstructor;
|
||||
const contract = merkleTreeService?.Tornado || tornadoContracts.Tornado__factory.connect(Object.keys(instances)[0], provider);
|
||||
const contract = merkleTreeService?.Tornado || contracts.Tornado__factory.connect(Object.keys(instances)[0], provider);
|
||||
super({
|
||||
...serviceConstructor,
|
||||
contract,
|
||||
@ -3411,7 +3378,7 @@ class BaseRevenueService extends BaseEventsService {
|
||||
...new Set(events.map(({ transactionHash }) => transactionHash))
|
||||
]);
|
||||
const registeredRelayers = new Set(events.map(({ args }) => args.relayer));
|
||||
const tornadoInterface = tornadoContracts.Tornado__factory.createInterface();
|
||||
const tornadoInterface = contracts.Tornado__factory.createInterface();
|
||||
const withdrawHash = tornadoInterface.getEvent("Withdrawal").topicHash;
|
||||
const withdrawalLogs = receipts.map(
|
||||
(receipt) => receipt.logs.map((log) => {
|
||||
|
||||
71
dist/index.mjs
vendored
71
dist/index.mjs
vendored
@ -1,5 +1,5 @@
|
||||
import { isHexString, assertArgument, assert, EventLog, UndecodedEventLog, Log, FetchRequest, JsonRpcProvider, Network, EnsPlugin, GasCostPlugin, Wallet, HDNodeWallet, VoidSigner, JsonRpcSigner, BrowserProvider, isAddress, parseEther, getAddress, AbiCoder, formatEther, namehash, dataSlice, dataLength, Interface, Contract, computeAddress, keccak256, EnsResolver, parseUnits, Transaction, Signature, MaxUint256, ZeroAddress } from 'ethers';
|
||||
import { Tornado__factory } from 'tornado-contracts';
|
||||
import { Tornado__factory } from '@tornado/contracts';
|
||||
import { webcrypto } from 'crypto';
|
||||
import BN from 'bn.js';
|
||||
import * as contentHashUtils from '@ensdomains/content-hash';
|
||||
@ -843,9 +843,9 @@ const defaultConfig = {
|
||||
name: "MEV Blocker",
|
||||
url: "https://rpc.mevblocker.io"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/mainnet"
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com"
|
||||
},
|
||||
keydonix: {
|
||||
name: "Horswap ( Keydonix )",
|
||||
@ -994,9 +994,9 @@ const defaultConfig = {
|
||||
name: "BNB Chain 2",
|
||||
url: "https://bsc-dataseed1.ninicoin.io"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/bsc"
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/bsc"
|
||||
},
|
||||
nodereal: {
|
||||
name: "NodeReal",
|
||||
@ -1082,14 +1082,6 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/matic-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/polygon"
|
||||
},
|
||||
polygon: {
|
||||
name: "Polygon",
|
||||
url: "https://polygon-rpc.com"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/matic"
|
||||
@ -1142,14 +1134,6 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/optimism-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/op"
|
||||
},
|
||||
optimism: {
|
||||
name: "Optimism",
|
||||
url: "https://mainnet.optimism.io"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/op"
|
||||
@ -1208,9 +1192,9 @@ const defaultConfig = {
|
||||
name: "Arbitrum",
|
||||
url: "https://arb1.arbitrum.io/rpc"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/arbitrum"
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/arbitrum"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup",
|
||||
@ -1271,10 +1255,6 @@ const defaultConfig = {
|
||||
name: "Base",
|
||||
url: "https://mainnet.base.org"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/base"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup",
|
||||
url: "https://public.stackup.sh/api/v1/node/base-mainnet"
|
||||
@ -1362,10 +1342,6 @@ const defaultConfig = {
|
||||
name: "Blast",
|
||||
url: "https://rpc.blast.io"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/blast"
|
||||
},
|
||||
blastApi: {
|
||||
name: "BlastApi",
|
||||
url: "https://blastl2-mainnet.public.blastapi.io"
|
||||
@ -1419,10 +1395,6 @@ const defaultConfig = {
|
||||
name: "Gnosis",
|
||||
url: "https://rpc.gnosischain.com"
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/gnosis"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/gnosis"
|
||||
@ -1470,18 +1442,10 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/avalanche-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/ext/bc/C/rpc"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/avax/c"
|
||||
},
|
||||
avalanche: {
|
||||
name: "Avalanche",
|
||||
url: "https://api.avax.network/ext/bc/C/rpc"
|
||||
},
|
||||
stackup: {
|
||||
name: "Stackup",
|
||||
url: "https://public.stackup.sh/api/v1/node/avalanche-mainnet"
|
||||
@ -1534,14 +1498,14 @@ const defaultConfig = {
|
||||
tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph",
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: "Tornado Withdraw",
|
||||
url: "https://tornadowithdraw.com/sepolia"
|
||||
},
|
||||
oneRpc: {
|
||||
name: "1RPC",
|
||||
url: "https://1rpc.io/sepolia"
|
||||
},
|
||||
tornadoRpc: {
|
||||
name: "Tornado RPC",
|
||||
url: "https://tornadocash-rpc.com/sepolia"
|
||||
},
|
||||
sepolia: {
|
||||
name: "Sepolia RPC",
|
||||
url: "https://rpc.sepolia.org"
|
||||
@ -2071,10 +2035,13 @@ function getStatusSchema(netId, config, tovarish) {
|
||||
properties: {
|
||||
instanceAddress: {
|
||||
type: "object",
|
||||
properties: amounts.reduce((acc2, cur) => {
|
||||
properties: amounts.reduce(
|
||||
(acc2, cur) => {
|
||||
acc2[cur] = addressSchemaType;
|
||||
return acc2;
|
||||
}, {}),
|
||||
},
|
||||
{}
|
||||
),
|
||||
required: amounts.filter((amount) => !optionalInstances.includes(amount))
|
||||
},
|
||||
decimals: { enum: [decimals] }
|
||||
|
||||
2
dist/merkleTree.d.ts
vendored
2
dist/merkleTree.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import { MerkleTree, PartialMerkleTree, Element, TreeEdge } from 'fixed-merkle-tree';
|
||||
import type { Tornado } from 'tornado-contracts';
|
||||
import type { Tornado } from '@tornado/contracts';
|
||||
import type { DepositType } from './deposits';
|
||||
import type { DepositsEvents } from './events';
|
||||
import type { NetIdType } from './networkConfig';
|
||||
|
||||
20463
dist/merkleTreeWorker.js
vendored
20463
dist/merkleTreeWorker.js
vendored
File diff suppressed because it is too large
Load Diff
34433
dist/merkleTreeWorker.umd.js
vendored
34433
dist/merkleTreeWorker.umd.js
vendored
File diff suppressed because one or more lines are too long
2
dist/merkleTreeWorker.umd.min.js
vendored
2
dist/merkleTreeWorker.umd.min.js
vendored
File diff suppressed because one or more lines are too long
9
dist/merkleTreeWorker.umd.min.js.LICENSE.txt
vendored
9
dist/merkleTreeWorker.umd.min.js.LICENSE.txt
vendored
@ -15,3 +15,12 @@
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/**
|
||||
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
||||
*
|
||||
* @version 0.8.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2015-2018
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
28
dist/networkConfig.d.ts
vendored
28
dist/networkConfig.d.ts
vendored
@ -19,14 +19,20 @@ export interface RpcUrl {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
export type RpcUrls = Record<string, RpcUrl>;
|
||||
export interface RpcUrls {
|
||||
[key: string]: RpcUrl;
|
||||
}
|
||||
export interface SubgraphUrl {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
export type SubgraphUrls = Record<string, SubgraphUrl>;
|
||||
export interface SubgraphUrls {
|
||||
[key: string]: SubgraphUrl;
|
||||
}
|
||||
export interface TornadoInstance {
|
||||
instanceAddress: Record<string, string>;
|
||||
instanceAddress: {
|
||||
[key: string]: string;
|
||||
};
|
||||
instanceApproval?: boolean;
|
||||
optionalInstances?: string[];
|
||||
tokenAddress?: string;
|
||||
@ -35,7 +41,9 @@ export interface TornadoInstance {
|
||||
decimals: number;
|
||||
gasLimit?: number;
|
||||
}
|
||||
export type TokenInstances = Record<string, TornadoInstance>;
|
||||
export interface TokenInstances {
|
||||
[key: string]: TornadoInstance;
|
||||
}
|
||||
export interface Config {
|
||||
rpcCallRetryAttempt?: number;
|
||||
gasPrices: {
|
||||
@ -82,8 +90,12 @@ export interface Config {
|
||||
MINING_BLOCK_TIME?: number;
|
||||
};
|
||||
}
|
||||
export type networkConfig = Record<NetIdType, Config>;
|
||||
export type SubdomainMap = Record<NetIdType, string>;
|
||||
export interface networkConfig {
|
||||
[key: NetIdType]: Config;
|
||||
}
|
||||
export interface SubdomainMap {
|
||||
[key: NetIdType]: string;
|
||||
}
|
||||
export declare const defaultConfig: networkConfig;
|
||||
export declare const enabledChains: NetIdType[];
|
||||
/**
|
||||
@ -111,4 +123,6 @@ export declare function getInstanceByAddress(config: Config, address: string): {
|
||||
tokenAddress: string | undefined;
|
||||
} | undefined;
|
||||
export declare function getRelayerEnsSubdomains(): SubdomainMap;
|
||||
export declare function getMultiInstances(netId: NetIdType, config: Config): Record<string, DepositType>;
|
||||
export declare function getMultiInstances(netId: NetIdType, config: Config): {
|
||||
[key in string]: DepositType;
|
||||
};
|
||||
|
||||
6
dist/permit.d.ts
vendored
6
dist/permit.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
import { ERC20Permit, ERC20Mock, TORN } from 'tornado-contracts';
|
||||
import { ERC20Permit, ERC20Mock, TORN } from '@tornado/contracts';
|
||||
import { Signature, Signer, TypedDataField } from 'ethers';
|
||||
export interface PermitValue {
|
||||
spender: string;
|
||||
@ -18,7 +18,9 @@ export declare const permit2Address = "0x000000000022D473030F116dDEE9F6B43aC78BA
|
||||
*/
|
||||
export interface Witness {
|
||||
witnessTypeName: string;
|
||||
witnessType: Record<string, TypedDataField[]>;
|
||||
witnessType: {
|
||||
[key: string]: TypedDataField[];
|
||||
};
|
||||
witness: any;
|
||||
}
|
||||
export declare function getPermitSignature({ Token, signer, spender, value, nonce, deadline, }: PermitValue & {
|
||||
|
||||
28
dist/relayerClient.d.ts
vendored
28
dist/relayerClient.d.ts
vendored
@ -20,7 +20,9 @@ export interface RelayerInfo extends RelayerParams {
|
||||
instances: string[];
|
||||
stakeBalance?: string;
|
||||
gasPrice?: number;
|
||||
ethPrices?: Record<string, string>;
|
||||
ethPrices?: {
|
||||
[key in string]: string;
|
||||
};
|
||||
currentQueue: number;
|
||||
tornadoServiceFee: number;
|
||||
}
|
||||
@ -33,18 +35,24 @@ export interface RelayerError {
|
||||
export interface RelayerStatus {
|
||||
url: string;
|
||||
rewardAccount: string;
|
||||
instances: Record<string, {
|
||||
instanceAddress: Record<string, string>;
|
||||
instances: {
|
||||
[key in string]: {
|
||||
instanceAddress: {
|
||||
[key in string]: string;
|
||||
};
|
||||
tokenAddress?: string;
|
||||
symbol: string;
|
||||
decimals: number;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
gasPrices?: {
|
||||
fast: number;
|
||||
additionalProperties?: number;
|
||||
};
|
||||
netId: NetIdType;
|
||||
ethPrices?: Record<string, string>;
|
||||
ethPrices?: {
|
||||
[key in string]: string;
|
||||
};
|
||||
tornadoServiceFee: number;
|
||||
latestBlock?: number;
|
||||
version: string;
|
||||
@ -103,9 +111,13 @@ export function isRelayerUpdated(relayerVersion: string, netId: NetIdType) {
|
||||
**/
|
||||
export declare function calculateScore({ stakeBalance, tornadoServiceFee }: RelayerInfo): bigint;
|
||||
export declare function getWeightRandom(weightsScores: bigint[], random: bigint): number;
|
||||
export type RelayerInstanceList = Record<string, {
|
||||
instanceAddress: Record<string, string>;
|
||||
}>;
|
||||
export interface RelayerInstanceList {
|
||||
[key: string]: {
|
||||
instanceAddress: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
export declare function getSupportedInstances(instanceList: RelayerInstanceList): string[];
|
||||
export declare function pickWeightedRandomRelayer(relayers: RelayerInfo[]): RelayerInfo;
|
||||
export interface RelayerClientConstructor {
|
||||
|
||||
18
dist/schemas/status.d.ts
vendored
18
dist/schemas/status.d.ts
vendored
@ -5,7 +5,9 @@ export interface statusInstanceType {
|
||||
properties: {
|
||||
instanceAddress: {
|
||||
type: string;
|
||||
properties: Record<string, typeof addressSchemaType>;
|
||||
properties: {
|
||||
[key in string]: typeof addressSchemaType;
|
||||
};
|
||||
required: string[];
|
||||
};
|
||||
tokenAddress?: typeof addressSchemaType;
|
||||
@ -20,12 +22,16 @@ export interface statusInstanceType {
|
||||
}
|
||||
export interface statusInstancesType {
|
||||
type: string;
|
||||
properties: Record<string, statusInstanceType>;
|
||||
properties: {
|
||||
[key in string]: statusInstanceType;
|
||||
};
|
||||
required: string[];
|
||||
}
|
||||
export interface statusEthPricesType {
|
||||
type: string;
|
||||
properties: Record<string, typeof bnSchemaType>;
|
||||
properties: {
|
||||
[key in string]: typeof bnSchemaType;
|
||||
};
|
||||
required?: string[];
|
||||
}
|
||||
export interface statusSchema {
|
||||
@ -35,9 +41,11 @@ export interface statusSchema {
|
||||
instances?: statusInstancesType;
|
||||
gasPrices: {
|
||||
type: string;
|
||||
properties: Record<string, {
|
||||
properties: {
|
||||
[key in string]: {
|
||||
type: string;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
required: string[];
|
||||
};
|
||||
netId: {
|
||||
|
||||
33444
dist/tornado.umd.js
vendored
33444
dist/tornado.umd.js
vendored
File diff suppressed because one or more lines are too long
12
dist/tornado.umd.min.js
vendored
12
dist/tornado.umd.min.js
vendored
File diff suppressed because one or more lines are too long
9
dist/tornado.umd.min.js.LICENSE.txt
vendored
9
dist/tornado.umd.min.js.LICENSE.txt
vendored
@ -23,3 +23,12 @@
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
|
||||
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||
|
||||
/**
|
||||
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
||||
*
|
||||
* @version 0.8.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2015-2018
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
71
dist/tornadoContracts.umd.js
vendored
71
dist/tornadoContracts.umd.js
vendored
File diff suppressed because one or more lines are too long
2
dist/tornadoContracts.umd.min.js
vendored
2
dist/tornadoContracts.umd.min.js
vendored
File diff suppressed because one or more lines are too long
12
dist/utils.d.ts
vendored
12
dist/utils.d.ts
vendored
@ -8,22 +8,22 @@ export declare const chunk: <T>(arr: T[], size: number) => T[][];
|
||||
export declare function sleep(ms: number): Promise<unknown>;
|
||||
export declare function validateUrl(url: string, protocols?: string[]): boolean;
|
||||
export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
|
||||
export declare function bufferToBytes(b: Buffer): Uint8Array<ArrayBufferLike>;
|
||||
export declare function bufferToBytes(b: Buffer): Uint8Array;
|
||||
export declare function bytesToBase64(bytes: Uint8Array): string;
|
||||
export declare function base64ToBytes(base64: string): Uint8Array<ArrayBuffer>;
|
||||
export declare function base64ToBytes(base64: string): Uint8Array;
|
||||
export declare function bytesToHex(bytes: Uint8Array): string;
|
||||
export declare function hexToBytes(hexString: string): Uint8Array<ArrayBuffer>;
|
||||
export declare function hexToBytes(hexString: string): Uint8Array;
|
||||
export declare function bytesToBN(bytes: Uint8Array): bigint;
|
||||
export declare function bnToBytes(bigint: bigint | string): Uint8Array<ArrayBuffer>;
|
||||
export declare function bnToBytes(bigint: bigint | string): Uint8Array;
|
||||
export declare function leBuff2Int(bytes: Uint8Array): BN;
|
||||
export declare function leInt2Buff(bigint: bnInput | bigint): Uint8Array<ArrayBuffer>;
|
||||
export declare function leInt2Buff(bigint: bnInput | bigint): Uint8Array;
|
||||
export declare function toFixedHex(numberish: BigNumberish, length?: number): string;
|
||||
export declare function toFixedLength(string: string, length?: number): string;
|
||||
export declare function rBigInt(nbytes?: number): bigint;
|
||||
export declare function rHex(nbytes?: number): string;
|
||||
export declare function bigIntReplacer(key: any, value: any): any;
|
||||
export declare function substring(str: string, length?: number): string;
|
||||
export declare function digest(bytes: Uint8Array, algo?: string): Promise<Uint8Array<ArrayBuffer>>;
|
||||
export declare function digest(bytes: Uint8Array, algo?: string): Promise<Uint8Array>;
|
||||
export declare function numberFormatter(num: string | number | bigint, digits?: number): string;
|
||||
export declare function isHex(value: string): boolean;
|
||||
export declare function toContentHash(ipfsUrl: string): any;
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import prettierRecommendedConfig from 'eslint-plugin-prettier/recommended';
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
files: ['**/*.js', '**/*.mjs', '**/*.ts', '**/*.tsx'],
|
||||
extends: [eslint.configs.recommended, prettierRecommendedConfig],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'prettier/prettier': [
|
||||
'error',
|
||||
{
|
||||
tabWidth: 4,
|
||||
printWidth: 120,
|
||||
singleQuote: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
extends: [
|
||||
...tseslint.configs.recommended,
|
||||
...tseslint.configs.stylistic,
|
||||
importPlugin.flatConfigs.recommended,
|
||||
importPlugin.flatConfigs.typescript,
|
||||
],
|
||||
rules: {
|
||||
'import/order': ['error'],
|
||||
'@typescript-eslint/no-unused-vars': ['warn'],
|
||||
'@typescript-eslint/no-unused-expressions': ['off'],
|
||||
'@typescript-eslint/no-empty-function': ['off'],
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
project: './tsconfig.json',
|
||||
},
|
||||
},
|
||||
},
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
79
package.json
79
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tornado-scripts",
|
||||
"version": "1.0.20",
|
||||
"name": "@tornado/core",
|
||||
"version": "1.0.19",
|
||||
"description": "An SDK for building applications on top of Privacy Pools",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
@ -10,7 +10,7 @@
|
||||
"scripts": {
|
||||
"typechain": "typechain --target ethers-v6 --out-dir src/typechain src/abi/*.json",
|
||||
"types": "tsc --declaration --emitDeclarationOnly -p tsconfig.build.json",
|
||||
"lint": "eslint src/**/*.ts test/**/*.ts --ignore-pattern src/typechain",
|
||||
"lint": "eslint src/**/*.ts test/**/*.ts --ext .ts --ignore-pattern src/typechain",
|
||||
"build:node": "rollup -c",
|
||||
"build:web": "webpack",
|
||||
"build:hash": "ts-node scripts/hash.ts",
|
||||
@ -19,7 +19,7 @@
|
||||
"ipfs:hash": "docker container run --rm -it --entrypoint cat tornado-core /app/dist/hashes.json",
|
||||
"test": "nyc mocha --require ts-node/register --require source-map-support/register --recursive 'test/**/*.ts' --timeout '300000'"
|
||||
},
|
||||
"author": "Tornado Contrib",
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"dist",
|
||||
@ -36,69 +36,72 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@ensdomains/content-hash": "2.5.7",
|
||||
"@metamask/eth-sig-util": "^8.1.2",
|
||||
"@metamask/eth-sig-util": "^8.0.0",
|
||||
"@tornado/contracts": "git+https://git.tornado.ws/tornadocontrib/tornado-contracts.git#093ae2210e1f1b016b756b4db200c4a1b3308408",
|
||||
"ajv": "^8.17.1",
|
||||
"bn.js": "^5.2.1",
|
||||
"circomlibjs": "git+https://github.com/tornadocontrib/circomlibjs.git#2aef7aade8e2b8d103250e4b24c7f1526cf1dd8d",
|
||||
"cross-fetch": "^4.1.0",
|
||||
"circomlibjs": "0.1.7",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"ethers": "^6.13.4",
|
||||
"ffjavascript": "^0.3.1",
|
||||
"ffjavascript": "0.2.48",
|
||||
"fflate": "^0.8.2",
|
||||
"fixed-merkle-tree": "0.7.3",
|
||||
"idb": "^8.0.1",
|
||||
"idb": "^8.0.0",
|
||||
"snarkjs": "git+https://github.com/tornadocontrib/snarkjs.git#2c964b3fe6019e057acab04cc17705d1f7fdaf9a",
|
||||
"tornado-contracts": "git+https://github.com/tornadocontrib/tornado-contracts.git#4c2fe0b80fa1a0571ffa538a046e234d4e38d140",
|
||||
"websnark": "git+https://github.com/tornadocontrib/websnark.git#e5a79cca905d1ffb61a69739492be58d438c9f17"
|
||||
"websnark": "git+https://github.com/tornadocontrib/websnark.git#f0ddbf34b3045cac9e6d3e4d977bf3b439869fae"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nomicfoundation/hardhat-chai-matchers": "^2.0.8",
|
||||
"@nomicfoundation/hardhat-chai-matchers": "^2.0.7",
|
||||
"@nomicfoundation/hardhat-ethers": "^3.0.8",
|
||||
"@nomicfoundation/hardhat-ignition": "^0.15.9",
|
||||
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.9",
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.12",
|
||||
"@nomicfoundation/hardhat-ignition": "^0.15.5",
|
||||
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.5",
|
||||
"@nomicfoundation/hardhat-network-helpers": "^1.0.11",
|
||||
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.12",
|
||||
"@rollup/plugin-commonjs": "^28.0.2",
|
||||
"@nomicfoundation/hardhat-verify": "^2.0.10",
|
||||
"@nomicfoundation/ignition-core": "^0.15.5",
|
||||
"@rollup/plugin-commonjs": "^28.0.1",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||
"@rollup/plugin-node-resolve": "^15.3.0",
|
||||
"@typechain/ethers-v6": "^0.5.1",
|
||||
"@typechain/hardhat": "^9.1.0",
|
||||
"@types/bn.js": "^5.1.6",
|
||||
"@types/chai": "^5.0.1",
|
||||
"@types/chai": "^4.2.0",
|
||||
"@types/circomlibjs": "^0.1.6",
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/node-fetch": "^2.6.12",
|
||||
"chai": "^4.5.0",
|
||||
"@types/mocha": "^10.0.9",
|
||||
"@types/node": "^22.8.0",
|
||||
"@types/node-fetch": "^2.6.11",
|
||||
"@typescript-eslint/eslint-plugin": "^8.11.0",
|
||||
"@typescript-eslint/parser": "^8.11.0",
|
||||
"chai": "4.5.0",
|
||||
"esbuild-loader": "^4.2.2",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.7.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"fetch-mock": "^12.2.0",
|
||||
"hardhat": "^2.22.17",
|
||||
"hardhat-gas-reporter": "^2.2.2",
|
||||
"mocha": "^11.0.1",
|
||||
"node-polyfill-webpack-plugin": "^4.1.0",
|
||||
"fetch-mock": "^12.0.2",
|
||||
"hardhat": "^2.22.10",
|
||||
"hardhat-gas-reporter": "^2.2.1",
|
||||
"mocha": "^10.7.3",
|
||||
"node-polyfill-webpack-plugin": "^4.0.0",
|
||||
"nyc": "^17.1.0",
|
||||
"prettier": "^3.4.2",
|
||||
"rollup": "^4.29.1",
|
||||
"prettier": "^3.3.3",
|
||||
"rollup": "^4.24.0",
|
||||
"rollup-plugin-esbuild": "^6.1.1",
|
||||
"solidity-coverage": "^0.8.14",
|
||||
"solidity-coverage": "^0.8.13",
|
||||
"ts-node": "^10.9.2",
|
||||
"tsc": "^2.0.4",
|
||||
"typechain": "^8.3.2",
|
||||
"typescript": "^5.7.2",
|
||||
"typescript-eslint": "^8.18.1",
|
||||
"webpack": "^5.97.1",
|
||||
"webpack-cli": "^6.0.1"
|
||||
"typescript": "^5.6.3",
|
||||
"webpack": "^5.95.0",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"resolutions": {
|
||||
"strip-ansi": "6.0.1",
|
||||
"@adraffy/ens-normalize": "1.10.1",
|
||||
"@noble/curves": "1.2.0",
|
||||
"@noble/hashes": "1.3.2",
|
||||
"big-integer": "1.6.52",
|
||||
"ffjavascript": "^0.3.1"
|
||||
"ffjavascript": "0.2.48"
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ export async function getSubInfo(
|
||||
tag: string;
|
||||
topics: TopicFilter;
|
||||
}> {
|
||||
let topics: (null | string | string[])[];
|
||||
let topics: Array<null | string | Array<string>>;
|
||||
let fragment: null | EventFragment = null;
|
||||
|
||||
// Convert named events to topicHash and get the fragment for
|
||||
@ -242,6 +242,7 @@ export class BatchBlockService {
|
||||
let retries = 0;
|
||||
let err;
|
||||
|
||||
// eslint-disable-next-line no-unmodified-loop-condition
|
||||
while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) {
|
||||
try {
|
||||
return await Promise.all(blocks.map((b) => this.getBlock(b)));
|
||||
@ -345,6 +346,7 @@ export class BatchTransactionService {
|
||||
let retries = 0;
|
||||
let err;
|
||||
|
||||
// eslint-disable-next-line no-unmodified-loop-condition
|
||||
while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) {
|
||||
try {
|
||||
if (!receipt) {
|
||||
@ -489,6 +491,7 @@ export class BatchEventsService {
|
||||
let err;
|
||||
let retries = 0;
|
||||
|
||||
// eslint-disable-next-line no-unmodified-loop-condition
|
||||
while ((!this.shouldRetry && retries === 0) || (this.shouldRetry && retries < this.retryMax)) {
|
||||
try {
|
||||
if (this.address) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
export * from 'tornado-contracts';
|
||||
export * from '@tornado/contracts';
|
||||
export {
|
||||
Multicall,
|
||||
Multicall__factory,
|
||||
|
||||
@ -40,14 +40,13 @@ export function makeLabelNodeAndParent(name: string) {
|
||||
}
|
||||
|
||||
// https://github.com/ensdomains/ensjs/blob/main/packages/ensjs/src/contracts/consts.ts
|
||||
export const EnsContracts: Record<
|
||||
NetIdType,
|
||||
{
|
||||
export const EnsContracts: {
|
||||
[key: NetIdType]: {
|
||||
ensRegistry: string;
|
||||
ensPublicResolver: string;
|
||||
ensNameWrapper: string;
|
||||
}
|
||||
> = {
|
||||
};
|
||||
} = {
|
||||
[NetId.MAINNET]: {
|
||||
ensRegistry: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
|
||||
ensPublicResolver: '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63',
|
||||
|
||||
@ -20,7 +20,7 @@ import {
|
||||
Echoer,
|
||||
Aggregator,
|
||||
Tornado__factory,
|
||||
} from 'tornado-contracts';
|
||||
} from '@tornado/contracts';
|
||||
|
||||
import type { MerkleTree } from 'fixed-merkle-tree';
|
||||
import {
|
||||
@ -131,6 +131,7 @@ export class BaseEventsService<EventType extends MinimalEvents> {
|
||||
/* eslint-enable @typescript-eslint/no-unused-vars */
|
||||
|
||||
async formatEvents(events: EventLog[]): Promise<EventType[]> {
|
||||
// eslint-disable-next-line no-return-await
|
||||
return await new Promise((resolve) => resolve(events as unknown as EventType[]));
|
||||
}
|
||||
|
||||
@ -439,13 +440,17 @@ export class BaseTornadoService extends BaseEventsService<DepositsEvents | Withd
|
||||
}
|
||||
|
||||
export interface BaseMultiTornadoServiceConstructor extends Omit<BaseEventsServiceConstructor, 'contract' | 'type'> {
|
||||
instances: Record<string, DepositType>;
|
||||
instances: {
|
||||
[key in string]: DepositType;
|
||||
};
|
||||
optionalTree?: boolean;
|
||||
merkleTreeService?: MerkleTreeService;
|
||||
}
|
||||
|
||||
export class BaseMultiTornadoService extends BaseEventsService<MultiDepositsEvents | MultiWithdrawalsEvents> {
|
||||
instances: Record<string, DepositType>;
|
||||
instances: {
|
||||
[key in string]: DepositType;
|
||||
};
|
||||
|
||||
optionalTree?: boolean;
|
||||
merkleTreeService?: MerkleTreeService;
|
||||
@ -712,7 +717,7 @@ export class BaseEncryptedNotesService extends BaseEventsService<EncryptedNotesE
|
||||
|
||||
const abiCoder = AbiCoder.defaultAbiCoder();
|
||||
|
||||
export const proposalState: Record<string, string> = {
|
||||
export const proposalState: { [key: string]: string } = {
|
||||
0: 'Pending',
|
||||
1: 'Active',
|
||||
2: 'Defeated',
|
||||
@ -961,7 +966,7 @@ export class BaseGovernanceService extends BaseEventsService<AllGovernanceEvents
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
{} as { [key: string]: string },
|
||||
);
|
||||
|
||||
return proposalEvents.map((event, index) => {
|
||||
@ -1013,7 +1018,7 @@ export class BaseGovernanceService extends BaseEventsService<AllGovernanceEvents
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
{} as { [key: string]: string },
|
||||
);
|
||||
|
||||
const votes = votedEvents.map((event) => {
|
||||
@ -1072,7 +1077,7 @@ export class BaseGovernanceService extends BaseEventsService<AllGovernanceEvents
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
{} as { [key: string]: string },
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@ -17,7 +17,7 @@ const DUMMY_WITHDRAW_DATA =
|
||||
export function convertETHToTokenAmount(
|
||||
amountInWei: BigNumberish,
|
||||
tokenPriceInWei: BigNumberish,
|
||||
tokenDecimals = 18,
|
||||
tokenDecimals: number = 18,
|
||||
): bigint {
|
||||
const tokenDecimalsMultiplier = BigInt(10 ** Number(tokenDecimals));
|
||||
return (BigInt(amountInWei) * tokenDecimalsMultiplier) / BigInt(tokenPriceInWei);
|
||||
|
||||
@ -2,7 +2,7 @@ import { isAddress } from 'ethers';
|
||||
import { NetId, NetIdType } from './networkConfig';
|
||||
|
||||
// https://dev.gas.zip/gas/chain-support/inbound
|
||||
export const gasZipInbounds: Record<NetIdType, string> = {
|
||||
export const gasZipInbounds: { [key in NetIdType]: string } = {
|
||||
[NetId.MAINNET]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604',
|
||||
[NetId.BSC]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604',
|
||||
[NetId.POLYGON]: '0x391E7C679d29bD940d63be94AD22A25d25b5A604',
|
||||
@ -15,7 +15,7 @@ export const gasZipInbounds: Record<NetIdType, string> = {
|
||||
};
|
||||
|
||||
// https://dev.gas.zip/gas/chain-support/outbound
|
||||
export const gasZipID: Record<NetIdType, number> = {
|
||||
export const gasZipID: { [key in NetIdType]: number } = {
|
||||
[NetId.MAINNET]: 255,
|
||||
[NetId.BSC]: 14,
|
||||
[NetId.POLYGON]: 17,
|
||||
|
||||
@ -49,7 +49,9 @@ export interface queryGraphParams {
|
||||
graphApi: string;
|
||||
subgraphName: string;
|
||||
query: string;
|
||||
variables?: Record<string, string | number>;
|
||||
variables?: {
|
||||
[key: string]: string | number;
|
||||
};
|
||||
fetchDataOptions?: fetchDataOptions;
|
||||
}
|
||||
|
||||
@ -268,6 +270,7 @@ export async function getAllRegisters({
|
||||
const events = [];
|
||||
let lastSyncBlock = fromBlock;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
let {
|
||||
relayers: result,
|
||||
@ -403,6 +406,7 @@ export async function getAllDeposits({
|
||||
const events = [];
|
||||
let lastSyncBlock = fromBlock;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
let {
|
||||
deposits: result,
|
||||
@ -548,6 +552,7 @@ export async function getAllWithdrawals({
|
||||
const events = [];
|
||||
let lastSyncBlock = fromBlock;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
let {
|
||||
withdrawals: result,
|
||||
@ -751,6 +756,7 @@ export async function getAllGraphEchoEvents({
|
||||
const events = [];
|
||||
let lastSyncBlock = fromBlock;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
let {
|
||||
noteAccounts: result,
|
||||
@ -882,6 +888,7 @@ export async function getAllEncryptedNotes({
|
||||
const events = [];
|
||||
let lastSyncBlock = fromBlock;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
let {
|
||||
encryptedNotes: result,
|
||||
@ -1039,6 +1046,7 @@ export async function getAllGovernanceEvents({
|
||||
|
||||
let lastSyncBlock = fromBlock;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const {
|
||||
proposals,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Worker as NodeWorker } from 'worker_threads';
|
||||
import { MerkleTree, PartialMerkleTree, Element, TreeEdge } from 'fixed-merkle-tree';
|
||||
import type { Tornado } from 'tornado-contracts';
|
||||
import type { Tornado } from '@tornado/contracts';
|
||||
import { isNode, toFixedHex } from './utils';
|
||||
import { mimc } from './mimc';
|
||||
import type { DepositType } from './deposits';
|
||||
|
||||
@ -23,17 +23,23 @@ export interface RpcUrl {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type RpcUrls = Record<string, RpcUrl>;
|
||||
export interface RpcUrls {
|
||||
[key: string]: RpcUrl;
|
||||
}
|
||||
|
||||
export interface SubgraphUrl {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export type SubgraphUrls = Record<string, SubgraphUrl>;
|
||||
export interface SubgraphUrls {
|
||||
[key: string]: SubgraphUrl;
|
||||
}
|
||||
|
||||
export interface TornadoInstance {
|
||||
instanceAddress: Record<string, string>;
|
||||
instanceAddress: {
|
||||
[key: string]: string;
|
||||
};
|
||||
instanceApproval?: boolean;
|
||||
optionalInstances?: string[];
|
||||
tokenAddress?: string;
|
||||
@ -43,7 +49,9 @@ export interface TornadoInstance {
|
||||
gasLimit?: number;
|
||||
}
|
||||
|
||||
export type TokenInstances = Record<string, TornadoInstance>;
|
||||
export interface TokenInstances {
|
||||
[key: string]: TornadoInstance;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
rpcCallRetryAttempt?: number;
|
||||
@ -98,9 +106,13 @@ export interface Config {
|
||||
};
|
||||
}
|
||||
|
||||
export type networkConfig = Record<NetIdType, Config>;
|
||||
export interface networkConfig {
|
||||
[key: NetIdType]: Config;
|
||||
}
|
||||
|
||||
export type SubdomainMap = Record<NetIdType, string>;
|
||||
export interface SubdomainMap {
|
||||
[key: NetIdType]: string;
|
||||
}
|
||||
|
||||
export const defaultConfig: networkConfig = {
|
||||
[NetId.MAINNET]: {
|
||||
@ -123,9 +135,9 @@ export const defaultConfig: networkConfig = {
|
||||
name: 'MEV Blocker',
|
||||
url: 'https://rpc.mevblocker.io',
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/mainnet',
|
||||
tornadoRpc: {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com',
|
||||
},
|
||||
keydonix: {
|
||||
name: 'Horswap ( Keydonix )',
|
||||
@ -274,9 +286,9 @@ export const defaultConfig: networkConfig = {
|
||||
name: 'BNB Chain 2',
|
||||
url: 'https://bsc-dataseed1.ninicoin.io',
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/bsc',
|
||||
tornadoRpc: {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/bsc',
|
||||
},
|
||||
nodereal: {
|
||||
name: 'NodeReal',
|
||||
@ -362,14 +374,6 @@ export const defaultConfig: networkConfig = {
|
||||
tornadoSubgraph: 'tornadocash/matic-tornado-subgraph',
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/polygon',
|
||||
},
|
||||
polygon: {
|
||||
name: 'Polygon',
|
||||
url: 'https://polygon-rpc.com',
|
||||
},
|
||||
oneRpc: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/matic',
|
||||
@ -422,14 +426,6 @@ export const defaultConfig: networkConfig = {
|
||||
tornadoSubgraph: 'tornadocash/optimism-tornado-subgraph',
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/op',
|
||||
},
|
||||
optimism: {
|
||||
name: 'Optimism',
|
||||
url: 'https://mainnet.optimism.io',
|
||||
},
|
||||
oneRpc: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/op',
|
||||
@ -488,9 +484,9 @@ export const defaultConfig: networkConfig = {
|
||||
name: 'Arbitrum',
|
||||
url: 'https://arb1.arbitrum.io/rpc',
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/arbitrum',
|
||||
tornadoRpc: {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/arbitrum',
|
||||
},
|
||||
stackup: {
|
||||
name: 'Stackup',
|
||||
@ -551,10 +547,6 @@ export const defaultConfig: networkConfig = {
|
||||
name: 'Base',
|
||||
url: 'https://mainnet.base.org',
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/base',
|
||||
},
|
||||
stackup: {
|
||||
name: 'Stackup',
|
||||
url: 'https://public.stackup.sh/api/v1/node/base-mainnet',
|
||||
@ -642,10 +634,6 @@ export const defaultConfig: networkConfig = {
|
||||
name: 'Blast',
|
||||
url: 'https://rpc.blast.io',
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/blast',
|
||||
},
|
||||
blastApi: {
|
||||
name: 'BlastApi',
|
||||
url: 'https://blastl2-mainnet.public.blastapi.io',
|
||||
@ -699,10 +687,6 @@ export const defaultConfig: networkConfig = {
|
||||
name: 'Gnosis',
|
||||
url: 'https://rpc.gnosischain.com',
|
||||
},
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/gnosis',
|
||||
},
|
||||
oneRpc: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/gnosis',
|
||||
@ -750,18 +734,10 @@ export const defaultConfig: networkConfig = {
|
||||
tornadoSubgraph: 'tornadocash/avalanche-tornado-subgraph',
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/ext/bc/C/rpc',
|
||||
},
|
||||
oneRpc: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/avax/c',
|
||||
},
|
||||
avalanche: {
|
||||
name: 'Avalanche',
|
||||
url: 'https://api.avax.network/ext/bc/C/rpc',
|
||||
},
|
||||
stackup: {
|
||||
name: 'Stackup',
|
||||
url: 'https://public.stackup.sh/api/v1/node/avalanche-mainnet',
|
||||
@ -814,14 +790,14 @@ export const defaultConfig: networkConfig = {
|
||||
tornadoSubgraph: 'tornadocash/sepolia-tornado-subgraph',
|
||||
subgraphs: {},
|
||||
rpcUrls: {
|
||||
tornadoWithdraw: {
|
||||
name: 'Tornado Withdraw',
|
||||
url: 'https://tornadowithdraw.com/sepolia',
|
||||
},
|
||||
oneRpc: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/sepolia',
|
||||
},
|
||||
tornadoRpc: {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/sepolia',
|
||||
},
|
||||
sepolia: {
|
||||
name: 'Sepolia RPC',
|
||||
url: 'https://rpc.sepolia.org',
|
||||
@ -973,7 +949,7 @@ export function getRelayerEnsSubdomains() {
|
||||
}, {} as SubdomainMap);
|
||||
}
|
||||
|
||||
export function getMultiInstances(netId: NetIdType, config: Config): Record<string, DepositType> {
|
||||
export function getMultiInstances(netId: NetIdType, config: Config): { [key in string]: DepositType } {
|
||||
return Object.entries(config.tokens).reduce(
|
||||
(acc, [currency, { instanceAddress }]) => {
|
||||
Object.entries(instanceAddress).forEach(([amount, contractAddress]) => {
|
||||
@ -985,6 +961,6 @@ export function getMultiInstances(netId: NetIdType, config: Config): Record<stri
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, DepositType>,
|
||||
{} as { [key in string]: DepositType },
|
||||
);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ERC20Permit, ERC20Mock, TORN } from 'tornado-contracts';
|
||||
import { ERC20Permit, ERC20Mock, TORN } from '@tornado/contracts';
|
||||
import { MaxUint256, Provider, Signature, Signer, TypedDataField } from 'ethers';
|
||||
|
||||
export interface PermitValue {
|
||||
@ -22,7 +22,9 @@ export const permit2Address = '0x000000000022D473030F116dDEE9F6B43aC78BA3';
|
||||
*/
|
||||
export interface Witness {
|
||||
witnessTypeName: string;
|
||||
witnessType: Record<string, TypedDataField[]>;
|
||||
witnessType: {
|
||||
[key: string]: TypedDataField[];
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
witness: any;
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ export const fetchGetUrlFunc =
|
||||
|
||||
const resp = await fetchData(req.url, init);
|
||||
|
||||
const headers = {} as Record<string, any>;
|
||||
const headers = {} as { [key in string]: any };
|
||||
resp.headers.forEach((value: any, key: string) => {
|
||||
headers[key.toLowerCase()] = value;
|
||||
});
|
||||
|
||||
@ -28,7 +28,9 @@ export interface RelayerInfo extends RelayerParams {
|
||||
instances: string[];
|
||||
stakeBalance?: string;
|
||||
gasPrice?: number;
|
||||
ethPrices?: Record<string, string>;
|
||||
ethPrices?: {
|
||||
[key in string]: string;
|
||||
};
|
||||
currentQueue: number;
|
||||
tornadoServiceFee: number;
|
||||
}
|
||||
@ -43,21 +45,24 @@ export interface RelayerError {
|
||||
export interface RelayerStatus {
|
||||
url: string;
|
||||
rewardAccount: string;
|
||||
instances: Record<
|
||||
string,
|
||||
{
|
||||
instanceAddress: Record<string, string>;
|
||||
instances: {
|
||||
[key in string]: {
|
||||
instanceAddress: {
|
||||
[key in string]: string;
|
||||
};
|
||||
tokenAddress?: string;
|
||||
symbol: string;
|
||||
decimals: number;
|
||||
}
|
||||
>;
|
||||
};
|
||||
};
|
||||
gasPrices?: {
|
||||
fast: number;
|
||||
additionalProperties?: number;
|
||||
};
|
||||
netId: NetIdType;
|
||||
ethPrices?: Record<string, string>;
|
||||
ethPrices?: {
|
||||
[key in string]: string;
|
||||
};
|
||||
tornadoServiceFee: number;
|
||||
latestBlock?: number;
|
||||
version: string;
|
||||
@ -144,12 +149,13 @@ export function getWeightRandom(weightsScores: bigint[], random: bigint) {
|
||||
return Math.floor(Math.random() * weightsScores.length);
|
||||
}
|
||||
|
||||
export type RelayerInstanceList = Record<
|
||||
string,
|
||||
{
|
||||
instanceAddress: Record<string, string>;
|
||||
}
|
||||
>;
|
||||
export interface RelayerInstanceList {
|
||||
[key: string]: {
|
||||
instanceAddress: {
|
||||
[key: string]: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export function getSupportedInstances(instanceList: RelayerInstanceList) {
|
||||
const rawList = Object.values(instanceList)
|
||||
|
||||
@ -6,7 +6,9 @@ export interface statusInstanceType {
|
||||
properties: {
|
||||
instanceAddress: {
|
||||
type: string;
|
||||
properties: Record<string, typeof addressSchemaType>;
|
||||
properties: {
|
||||
[key in string]: typeof addressSchemaType;
|
||||
};
|
||||
required: string[];
|
||||
};
|
||||
tokenAddress?: typeof addressSchemaType;
|
||||
@ -18,13 +20,17 @@ export interface statusInstanceType {
|
||||
|
||||
export interface statusInstancesType {
|
||||
type: string;
|
||||
properties: Record<string, statusInstanceType>;
|
||||
properties: {
|
||||
[key in string]: statusInstanceType;
|
||||
};
|
||||
required: string[];
|
||||
}
|
||||
|
||||
export interface statusEthPricesType {
|
||||
type: string;
|
||||
properties: Record<string, typeof bnSchemaType>;
|
||||
properties: {
|
||||
[key in string]: typeof bnSchemaType;
|
||||
};
|
||||
required?: string[];
|
||||
}
|
||||
|
||||
@ -35,12 +41,11 @@ export interface statusSchema {
|
||||
instances?: statusInstancesType;
|
||||
gasPrices: {
|
||||
type: string;
|
||||
properties: Record<
|
||||
string,
|
||||
{
|
||||
properties: {
|
||||
[key in string]: {
|
||||
type: string;
|
||||
}
|
||||
>;
|
||||
};
|
||||
};
|
||||
required: string[];
|
||||
};
|
||||
netId: {
|
||||
@ -143,10 +148,18 @@ export function getStatusSchema(netId: NetIdType, config: Config, tovarish: bool
|
||||
properties: {
|
||||
instanceAddress: {
|
||||
type: 'object',
|
||||
properties: amounts.reduce((acc: Record<string, typeof addressSchemaType>, cur) => {
|
||||
properties: amounts.reduce(
|
||||
(
|
||||
acc: {
|
||||
[key in string]: typeof addressSchemaType;
|
||||
},
|
||||
cur,
|
||||
) => {
|
||||
acc[cur] = addressSchemaType;
|
||||
return acc;
|
||||
}, {}),
|
||||
},
|
||||
{},
|
||||
),
|
||||
required: amounts.filter((amount) => !optionalInstances.includes(amount)),
|
||||
},
|
||||
decimals: { enum: [decimals] },
|
||||
@ -190,7 +203,7 @@ export function getStatusSchema(netId: NetIdType, config: Config, tovarish: bool
|
||||
if (_tokens.length) {
|
||||
const ethPrices: statusEthPricesType = {
|
||||
type: 'object',
|
||||
properties: _tokens.reduce((acc: Record<string, typeof bnSchemaType>, token: string) => {
|
||||
properties: _tokens.reduce((acc: { [key in string]: typeof bnSchemaType }, token: string) => {
|
||||
acc[token] = bnSchemaType;
|
||||
return acc;
|
||||
}, {}),
|
||||
|
||||
@ -327,6 +327,7 @@ export class TovarishClient extends RelayerClient {
|
||||
const events = [];
|
||||
let lastSyncBlock = fromBlock;
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { events: fetchedEvents, lastSyncBlock: currentBlock } = (await fetchData(url, {
|
||||
|
||||
12
src/utils.ts
12
src/utils.ts
@ -122,17 +122,17 @@ export function toFixedHex(numberish: BigNumberish, length = 32) {
|
||||
);
|
||||
}
|
||||
|
||||
export function toFixedLength(string: string, length = 32) {
|
||||
export function toFixedLength(string: string, length: number = 32) {
|
||||
string = string.replace('0x', '');
|
||||
return '0x' + string.padStart(length * 2, '0');
|
||||
}
|
||||
|
||||
// Random BigInt in a range of bytes
|
||||
export function rBigInt(nbytes = 31) {
|
||||
export function rBigInt(nbytes: number = 31) {
|
||||
return bytesToBN(crypto.getRandomValues(new Uint8Array(nbytes)));
|
||||
}
|
||||
|
||||
export function rHex(nbytes = 32) {
|
||||
export function rHex(nbytes: number = 32) {
|
||||
return bytesToHex(crypto.getRandomValues(new Uint8Array(nbytes)));
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ export function bigIntReplacer(key: any, value: any) {
|
||||
return typeof value === 'bigint' ? value.toString() : value;
|
||||
}
|
||||
|
||||
export function substring(str: string, length = 10) {
|
||||
export function substring(str: string, length: number = 10) {
|
||||
if (str.length < length * 2) {
|
||||
return str;
|
||||
}
|
||||
@ -150,11 +150,11 @@ export function substring(str: string, length = 10) {
|
||||
return `${str.substring(0, length)}...${str.substring(str.length - length)}`;
|
||||
}
|
||||
|
||||
export async function digest(bytes: Uint8Array, algo = 'SHA-384') {
|
||||
export async function digest(bytes: Uint8Array, algo: string = 'SHA-384') {
|
||||
return new Uint8Array(await crypto.subtle.digest(algo, bytes));
|
||||
}
|
||||
|
||||
export function numberFormatter(num: string | number | bigint, digits = 3): string {
|
||||
export function numberFormatter(num: string | number | bigint, digits: number = 3): string {
|
||||
const lookup = [
|
||||
{ value: 1, symbol: '' },
|
||||
{ value: 1e3, symbol: 'K' },
|
||||
|
||||
@ -4,7 +4,7 @@ import { ethers } from 'hardhat';
|
||||
import { expect } from 'chai';
|
||||
import { formatEther } from 'ethers';
|
||||
|
||||
import { ETHTornado__factory, Verifier__factory } from 'tornado-contracts';
|
||||
import { ETHTornado__factory, Verifier__factory } from '@tornado/contracts';
|
||||
import { Deposit, deployHasher } from '../src';
|
||||
|
||||
const { getSigners } = ethers;
|
||||
|
||||
@ -3,7 +3,5 @@
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"exclude": ["./test/**/*"],
|
||||
"files": []
|
||||
}
|
||||
@ -110,9 +110,6 @@
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*",
|
||||
"./test/**/*"
|
||||
],
|
||||
"include": ["./src/**/*"],
|
||||
"files": ["./hardhat.config.ts"]
|
||||
}
|
||||
|
||||
@ -2,23 +2,14 @@ const { BannerPlugin } = require('webpack');
|
||||
const path = require('path');
|
||||
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
|
||||
|
||||
const commonRules = [
|
||||
{
|
||||
const esbuildLoader = {
|
||||
test: /\.ts?$/,
|
||||
loader: 'esbuild-loader',
|
||||
options: {
|
||||
loader: 'ts',
|
||||
target: 'es2022',
|
||||
}
|
||||
},
|
||||
// Disable strict dependency resolution for ESM modules, so that polyfill plugin can handle the rest
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
resolve: {
|
||||
fullySpecified: false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const commonAlias = {
|
||||
fs: false,
|
||||
@ -35,7 +26,7 @@ module.exports = [
|
||||
{
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [...commonRules]
|
||||
rules: [esbuildLoader]
|
||||
},
|
||||
entry: './src/index.ts',
|
||||
output: {
|
||||
@ -60,7 +51,7 @@ module.exports = [
|
||||
{
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [...commonRules]
|
||||
rules: [esbuildLoader]
|
||||
},
|
||||
entry: './src/index.ts',
|
||||
output: {
|
||||
@ -82,7 +73,7 @@ module.exports = [
|
||||
{
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [...commonRules]
|
||||
rules: [esbuildLoader]
|
||||
},
|
||||
entry: './src/merkleTreeWorker.ts',
|
||||
output: {
|
||||
@ -110,7 +101,7 @@ module.exports = [
|
||||
{
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [...commonRules]
|
||||
rules: [esbuildLoader]
|
||||
},
|
||||
entry: './src/merkleTreeWorker.ts',
|
||||
output: {
|
||||
@ -135,7 +126,7 @@ module.exports = [
|
||||
{
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [...commonRules]
|
||||
rules: [esbuildLoader]
|
||||
},
|
||||
entry: './src/contracts.ts',
|
||||
output: {
|
||||
@ -160,7 +151,7 @@ module.exports = [
|
||||
{
|
||||
mode: 'production',
|
||||
module: {
|
||||
rules: [...commonRules]
|
||||
rules: [esbuildLoader]
|
||||
},
|
||||
entry: './src/contracts.ts',
|
||||
output: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user