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