forked from tornadocash/tornado-cli
Tornado CLI 1.0.8-alpha
audit provider network
This commit is contained in:
parent
a8fc72ccda
commit
37ce302ca5
1262
dist/cli.js
vendored
1262
dist/cli.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/program.d.ts
vendored
2
dist/program.d.ts
vendored
@ -30,7 +30,7 @@ export declare function getProgramOptions(options: commonProgramOptions): Promis
|
||||
fetchDataOptions: fetchDataOptions;
|
||||
}>;
|
||||
export declare function getProgramGraphAPI(options: commonProgramOptions, config: Config): string;
|
||||
export declare function getProgramProvider(netId: NetIdType, rpcUrl: string | undefined, config: Config, providerOptions?: getProviderOptions): JsonRpcProvider;
|
||||
export declare function getProgramProvider(rpcUrl: string | undefined, providerOptions: getProviderOptions): Promise<JsonRpcProvider>;
|
||||
export declare function getProgramSigner({ options, provider, }: {
|
||||
options: commonProgramOptions;
|
||||
provider: Provider;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tornado/cli",
|
||||
"version": "1.0.7-alpha",
|
||||
"version": "1.0.8-alpha",
|
||||
"description": "Modern Toolsets for Privacy Pools on Ethereum",
|
||||
"main": "./dist/cli.js",
|
||||
"types": "./dist/cli.d.ts",
|
||||
@ -51,7 +51,7 @@
|
||||
"optionalDependencies": {},
|
||||
"devDependencies": {
|
||||
"@colors/colors": "1.5.0",
|
||||
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#29744cfce47aae9bb1f5d46030eb575f00211a90",
|
||||
"@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#d0b032d7bef06de61872ba7ad07b769b9b1d9717",
|
||||
"@typechain/ethers-v6": "^0.5.1",
|
||||
"@types/figlet": "^1.5.8",
|
||||
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
||||
|
@ -37,7 +37,7 @@ import {
|
||||
OffchainOracle__factory,
|
||||
OvmGasPriceOracle__factory,
|
||||
getProviderOptions,
|
||||
getProviderWithNetId,
|
||||
getProvider,
|
||||
getTokenBalances,
|
||||
TornadoWallet,
|
||||
TornadoVoidSigner,
|
||||
@ -87,6 +87,9 @@ import {
|
||||
|
||||
const EXEC_NAME = 'tornado-cli';
|
||||
|
||||
// Inactive tokens to filter from syncing (Either they have no activity for more than a year, should be filtered from event syncs and withdrawals)
|
||||
const INACTIVE_TOKENS: string[] = ['cdai', 'usdc', 'usdt'];
|
||||
|
||||
/**
|
||||
* Static variables, shouldn't be modified by env unless you know what they are doing
|
||||
*/
|
||||
@ -241,17 +244,16 @@ export function getProgramGraphAPI(options: commonProgramOptions, config: Config
|
||||
return '';
|
||||
}
|
||||
|
||||
export function getProgramProvider(
|
||||
netId: NetIdType,
|
||||
rpcUrl: string = '',
|
||||
config: Config,
|
||||
providerOptions?: getProviderOptions,
|
||||
): JsonRpcProvider {
|
||||
export function getProgramProvider(rpcUrl: string = '', providerOptions: getProviderOptions): Promise<JsonRpcProvider> {
|
||||
const { netId } = providerOptions;
|
||||
|
||||
const config = getConfig(netId);
|
||||
|
||||
if (!rpcUrl) {
|
||||
rpcUrl = Object.values(config.rpcUrls)[0].url;
|
||||
rpcUrl = Object.values(config.rpcUrls)[0]?.url || '';
|
||||
}
|
||||
|
||||
return getProviderWithNetId(netId, rpcUrl, config, providerOptions);
|
||||
return getProvider(rpcUrl, providerOptions);
|
||||
}
|
||||
|
||||
export function getProgramSigner({
|
||||
@ -300,7 +302,8 @@ export async function getProgramRelayer({
|
||||
constants: { REGISTRY_BLOCK },
|
||||
} = ethConfig;
|
||||
|
||||
const provider = getProgramProvider(RELAYER_NETWORK, ethRpc, ethConfig, {
|
||||
const provider = await getProgramProvider(ethRpc, {
|
||||
netId: RELAYER_NETWORK,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -554,7 +557,8 @@ export function tornadoProgram() {
|
||||
const isEth = nativeCurrency === currency;
|
||||
const denomination = parseUnits(amount, decimals);
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -698,7 +702,8 @@ export function tornadoProgram() {
|
||||
const isEth = nativeCurrency === currency;
|
||||
const denomination = parseUnits(amount, decimals);
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -824,7 +829,8 @@ export function tornadoProgram() {
|
||||
const firstAmount = Object.keys(currencyConfig.instanceAddress).sort((a, b) => Number(a) - Number(b))[0];
|
||||
const isFirstAmount = Number(amount) === Number(firstAmount);
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -1168,7 +1174,8 @@ export function tornadoProgram() {
|
||||
instanceAddress: { [amount]: instanceAddress },
|
||||
} = currencyConfig;
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -1297,7 +1304,8 @@ export function tornadoProgram() {
|
||||
constants: { GOVERNANCE_BLOCK, REGISTRY_BLOCK, NOTE_ACCOUNT_BLOCK, ENCRYPTED_NOTES_BLOCK },
|
||||
} = config;
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
const graphApi = getProgramGraphAPI(options, config);
|
||||
@ -1369,6 +1377,11 @@ export function tornadoProgram() {
|
||||
const currencies = currencyOpts ? [currencyOpts.toLowerCase()] : Object.keys(tokens);
|
||||
|
||||
for (const currency of currencies) {
|
||||
// Skip syncing inactive instances
|
||||
if (INACTIVE_TOKENS.includes(currency)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const currencyConfig = tokens[currency];
|
||||
// Now load the denominations and address
|
||||
const amounts = Object.keys(currencyConfig.instanceAddress);
|
||||
@ -1519,7 +1532,8 @@ export function tornadoProgram() {
|
||||
constants: { ['NOTE_ACCOUNT_BLOCK']: deployedBlock },
|
||||
} = config;
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -1640,7 +1654,8 @@ export function tornadoProgram() {
|
||||
constants: { ENCRYPTED_NOTES_BLOCK },
|
||||
} = config;
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -1714,7 +1729,8 @@ export function tornadoProgram() {
|
||||
|
||||
const { currencyName, multicallContract } = config;
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -1850,7 +1866,8 @@ export function tornadoProgram() {
|
||||
|
||||
const { currencyName, multicallContract, tornContract, tokens } = config;
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -1906,9 +1923,8 @@ export function tornadoProgram() {
|
||||
|
||||
const netId = Number(deserializedTx.chainId);
|
||||
|
||||
const config = getConfig(netId);
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
@ -1941,9 +1957,8 @@ export function tornadoProgram() {
|
||||
throw new Error('NetId for the transaction is invalid, this command only supports EIP-155 transactions');
|
||||
}
|
||||
|
||||
const config = getConfig(netId);
|
||||
|
||||
const provider = getProgramProvider(netId, rpc, config, {
|
||||
const provider = await getProgramProvider(rpc, {
|
||||
netId,
|
||||
...fetchDataOptions,
|
||||
});
|
||||
|
||||
|
@ -781,9 +781,9 @@
|
||||
"@openzeppelin/contracts-v3" "npm:@openzeppelin/contracts@3.2.0-rc.0"
|
||||
ethers "^6.4.0"
|
||||
|
||||
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#29744cfce47aae9bb1f5d46030eb575f00211a90":
|
||||
version "1.0.11"
|
||||
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#29744cfce47aae9bb1f5d46030eb575f00211a90"
|
||||
"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#d0b032d7bef06de61872ba7ad07b769b9b1d9717":
|
||||
version "1.0.13"
|
||||
resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#d0b032d7bef06de61872ba7ad07b769b9b1d9717"
|
||||
dependencies:
|
||||
"@metamask/eth-sig-util" "^7.0.3"
|
||||
"@tornado/contracts" "^1.0.1"
|
||||
|
Loading…
Reference in New Issue
Block a user