Minor updates #1

Closed
tornadocontrib wants to merge 67 commits from tornadocontrib/tornado-core:main into main
10 changed files with 39 additions and 188 deletions
Showing only changes of commit 092989ebaa - Show all commits

View File

@ -8,8 +8,6 @@ import type { TovarishClient } from '../tovarishClient';
import type { ReverseRecords } from '../typechain';
import type { MerkleTreeService } from '../merkleTree';
import type { BaseEvents, CachedEvents, MinimalEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, AllGovernanceEvents, GovernanceProposalCreatedEvents, GovernanceVotedEvents, EchoEvents, AllRelayerRegistryEvents, StakeBurnedEvents } from './types';
export declare const DEPOSIT = "deposit";
export declare const WITHDRAWAL = "withdrawal";
export interface BaseEventsServiceConstructor {
netId: NetIdType;
provider: Provider;

52
dist/index.js vendored
View File

@ -744,14 +744,6 @@ const defaultConfig = {
networkName: "Ethereum Mainnet",
deployedBlock: 9116966,
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/mainnet"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com"
},
mevblockerRPC: {
name: "MEV Blocker",
url: "https://rpc.mevblocker.io"
@ -895,14 +887,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/bsc-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/bsc"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/bsc"
},
bnbchain: {
name: "BNB Chain",
url: "https://bsc-dataseed.bnbchain.org"
@ -1124,14 +1108,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/xdai-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/gnosis"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/gnosis"
},
gnosis: {
name: "Gnosis",
url: "https://rpc.gnosischain.com"
@ -1239,14 +1215,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/sepolia"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/sepolia"
},
sepolia: {
name: "Sepolia RPC",
url: "https://rpc.sepolia.org"
@ -1629,10 +1597,10 @@ const encryptedNotesSchema = {
}
};
function getEventsSchemaValidator(type) {
if (type === DEPOSIT) {
if (type === "deposit") {
return ajv.compile(depositsEventsSchema);
}
if (type === WITHDRAWAL) {
if (type === "withdrawal") {
return ajv.compile(withdrawalsEventsSchema);
}
if (type === "governance") {
@ -2006,8 +1974,6 @@ class RelayerClient {
}
}
const DEPOSIT = "deposit";
const WITHDRAWAL = "withdrawal";
class BaseEventsService {
netId;
provider;
@ -2120,7 +2086,7 @@ class BaseEventsService {
}
}
async getLatestEvents({ fromBlock }) {
if (this.tovarishClient?.selectedRelayer && ![DEPOSIT, WITHDRAWAL].includes(this.type.toLowerCase())) {
if (this.tovarishClient?.selectedRelayer && !["Deposit", "Withdrawal"].includes(this.type)) {
const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({
type: this.getTovarishType(),
fromBlock
@ -2217,8 +2183,8 @@ class BaseTornadoService extends BaseEventsService {
return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`;
}
async formatEvents(events) {
const type = this.getType().toLowerCase();
if (type === DEPOSIT) {
const type = this.getType();
if (type === "Deposit") {
const txs = await this.batchTransactionService.getBatchTransactions([
...new Set(events.map(({ transactionHash }) => transactionHash))
]);
@ -2256,7 +2222,7 @@ class BaseTornadoService extends BaseEventsService {
events,
hasNewEvents
}) {
if (events.length && this.getType().toLowerCase() === DEPOSIT) {
if (events.length && this.getType() === "Deposit") {
const depositEvents = events;
const lastEvent = depositEvents[depositEvents.length - 1];
if (lastEvent.leafIndex !== depositEvents.length - 1) {
@ -2904,9 +2870,9 @@ RevenueService: Mismatch on withdrawal logs (${withdrawalLogs.length} ) and even
}
}
function zipAsync(file) {
function zipAsync(file, options) {
return new Promise((res, rej) => {
fflate.zip(file, { mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => {
fflate.zip(file, { ...options || {}, mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => {
if (err) {
rej(err);
return;
@ -10342,7 +10308,6 @@ exports.DBGovernanceService = DBGovernanceService;
exports.DBRegistryService = DBRegistryService;
exports.DBRevenueService = DBRevenueService;
exports.DBTornadoService = DBTornadoService;
exports.DEPOSIT = DEPOSIT;
exports.Deposit = Deposit;
exports.ENSNameWrapper__factory = ENSNameWrapper__factory;
exports.ENSRegistry__factory = ENSRegistry__factory;
@ -10375,7 +10340,6 @@ exports.TornadoRpcSigner = TornadoRpcSigner;
exports.TornadoVoidSigner = TornadoVoidSigner;
exports.TornadoWallet = TornadoWallet;
exports.TovarishClient = TovarishClient;
exports.WITHDRAWAL = WITHDRAWAL;
exports.addNetwork = addNetwork;
exports.addressSchemaType = addressSchemaType;
exports.ajv = ajv;

52
dist/index.mjs vendored
View File

@ -722,14 +722,6 @@ const defaultConfig = {
networkName: "Ethereum Mainnet",
deployedBlock: 9116966,
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/mainnet"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com"
},
mevblockerRPC: {
name: "MEV Blocker",
url: "https://rpc.mevblocker.io"
@ -873,14 +865,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/bsc-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/bsc"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/bsc"
},
bnbchain: {
name: "BNB Chain",
url: "https://bsc-dataseed.bnbchain.org"
@ -1102,14 +1086,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/xdai-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/gnosis"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/gnosis"
},
gnosis: {
name: "Gnosis",
url: "https://rpc.gnosischain.com"
@ -1217,14 +1193,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/sepolia"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/sepolia"
},
sepolia: {
name: "Sepolia RPC",
url: "https://rpc.sepolia.org"
@ -1607,10 +1575,10 @@ const encryptedNotesSchema = {
}
};
function getEventsSchemaValidator(type) {
if (type === DEPOSIT) {
if (type === "deposit") {
return ajv.compile(depositsEventsSchema);
}
if (type === WITHDRAWAL) {
if (type === "withdrawal") {
return ajv.compile(withdrawalsEventsSchema);
}
if (type === "governance") {
@ -1984,8 +1952,6 @@ class RelayerClient {
}
}
const DEPOSIT = "deposit";
const WITHDRAWAL = "withdrawal";
class BaseEventsService {
netId;
provider;
@ -2098,7 +2064,7 @@ class BaseEventsService {
}
}
async getLatestEvents({ fromBlock }) {
if (this.tovarishClient?.selectedRelayer && ![DEPOSIT, WITHDRAWAL].includes(this.type.toLowerCase())) {
if (this.tovarishClient?.selectedRelayer && !["Deposit", "Withdrawal"].includes(this.type)) {
const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({
type: this.getTovarishType(),
fromBlock
@ -2195,8 +2161,8 @@ class BaseTornadoService extends BaseEventsService {
return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`;
}
async formatEvents(events) {
const type = this.getType().toLowerCase();
if (type === DEPOSIT) {
const type = this.getType();
if (type === "Deposit") {
const txs = await this.batchTransactionService.getBatchTransactions([
...new Set(events.map(({ transactionHash }) => transactionHash))
]);
@ -2234,7 +2200,7 @@ class BaseTornadoService extends BaseEventsService {
events,
hasNewEvents
}) {
if (events.length && this.getType().toLowerCase() === DEPOSIT) {
if (events.length && this.getType() === "Deposit") {
const depositEvents = events;
const lastEvent = depositEvents[depositEvents.length - 1];
if (lastEvent.leafIndex !== depositEvents.length - 1) {
@ -2882,9 +2848,9 @@ RevenueService: Mismatch on withdrawal logs (${withdrawalLogs.length} ) and even
}
}
function zipAsync(file) {
function zipAsync(file, options) {
return new Promise((res, rej) => {
zip(file, { mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => {
zip(file, { ...options || {}, mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => {
if (err) {
rej(err);
return;
@ -10304,4 +10270,4 @@ async function calculateSnarkProof(input, circuit, provingKey) {
return { proof, args };
}
export { BaseEchoService, BaseEncryptedNotesService, BaseEventsService, BaseGovernanceService, BaseRegistryService, BaseRevenueService, BaseTornadoService, BatchBlockService, BatchEventsService, BatchTransactionService, DBEchoService, DBEncryptedNotesService, DBGovernanceService, DBRegistryService, DBRevenueService, DBTornadoService, DEPOSIT, Deposit, ENSNameWrapper__factory, ENSRegistry__factory, ENSResolver__factory, ENSUtils, ENS__factory, ERC20__factory, EnsContracts, INDEX_DB_ERROR, IndexedDB, Invoice, MAX_FEE, MAX_TOVARISH_EVENTS, MIN_FEE, MIN_STAKE_BALANCE, MerkleTreeService, Mimc, Multicall__factory, NetId, NoteAccount, OffchainOracle__factory, OvmGasPriceOracle__factory, Pedersen, RelayerClient, ReverseRecords__factory, TokenPriceOracle, TornadoBrowserProvider, TornadoFeeOracle, TornadoRpcSigner, TornadoVoidSigner, TornadoWallet, TovarishClient, WITHDRAWAL, addNetwork, addressSchemaType, ajv, base64ToBytes, bigIntReplacer, bnSchemaType, bnToBytes, buffPedersenHash, bufferToBytes, bytes32BNSchemaType, bytes32SchemaType, bytesToBN, bytesToBase64, bytesToHex, calculateScore, calculateSnarkProof, chunk, concatBytes, convertETHToTokenAmount, createDeposit, crypto, customConfig, defaultConfig, defaultUserAgent, deployHasher, depositsEventsSchema, digest, downloadZip, echoEventsSchema, enabledChains, encodedLabelToLabelhash, encryptedNotesSchema, index as factories, fetchData, fetchGetUrlFunc, fetchIp, fromContentHash, gasZipID, gasZipInbounds, gasZipInput, gasZipMinMax, getActiveTokenInstances, getActiveTokens, getConfig, getEventsSchemaValidator, getHttpAgent, getIndexedDB, getInstanceByAddress, getNetworkConfig, getPermit2CommitmentsSignature, getPermit2Signature, getPermitCommitmentsSignature, getPermitSignature, getProvider, getProviderWithNetId, getRelayerEnsSubdomains, getStatusSchema, getSupportedInstances, getTokenBalances, getTovarishNetworks, getWeightRandom, governanceEventsSchema, hasherBytecode, hexToBytes, initGroth16, isHex, isNode, jobRequestSchema, jobsSchema, labelhash, leBuff2Int, leInt2Buff, loadDBEvents, loadRemoteEvents, makeLabelNodeAndParent, mimc, multicall, numberFormatter, packEncryptedMessage, parseInvoice, parseNote, pedersen, permit2Address, pickWeightedRandomRelayer, populateTransaction, proofSchemaType, proposalState, rBigInt, rHex, relayerRegistryEventsSchema, saveDBEvents, sleep, stakeBurnedEventsSchema, substring, toContentHash, toFixedHex, toFixedLength, unpackEncryptedMessage, unzipAsync, validateUrl, withdrawalsEventsSchema, zipAsync };
export { BaseEchoService, BaseEncryptedNotesService, BaseEventsService, BaseGovernanceService, BaseRegistryService, BaseRevenueService, BaseTornadoService, BatchBlockService, BatchEventsService, BatchTransactionService, DBEchoService, DBEncryptedNotesService, DBGovernanceService, DBRegistryService, DBRevenueService, DBTornadoService, Deposit, ENSNameWrapper__factory, ENSRegistry__factory, ENSResolver__factory, ENSUtils, ENS__factory, ERC20__factory, EnsContracts, INDEX_DB_ERROR, IndexedDB, Invoice, MAX_FEE, MAX_TOVARISH_EVENTS, MIN_FEE, MIN_STAKE_BALANCE, MerkleTreeService, Mimc, Multicall__factory, NetId, NoteAccount, OffchainOracle__factory, OvmGasPriceOracle__factory, Pedersen, RelayerClient, ReverseRecords__factory, TokenPriceOracle, TornadoBrowserProvider, TornadoFeeOracle, TornadoRpcSigner, TornadoVoidSigner, TornadoWallet, TovarishClient, addNetwork, addressSchemaType, ajv, base64ToBytes, bigIntReplacer, bnSchemaType, bnToBytes, buffPedersenHash, bufferToBytes, bytes32BNSchemaType, bytes32SchemaType, bytesToBN, bytesToBase64, bytesToHex, calculateScore, calculateSnarkProof, chunk, concatBytes, convertETHToTokenAmount, createDeposit, crypto, customConfig, defaultConfig, defaultUserAgent, deployHasher, depositsEventsSchema, digest, downloadZip, echoEventsSchema, enabledChains, encodedLabelToLabelhash, encryptedNotesSchema, index as factories, fetchData, fetchGetUrlFunc, fetchIp, fromContentHash, gasZipID, gasZipInbounds, gasZipInput, gasZipMinMax, getActiveTokenInstances, getActiveTokens, getConfig, getEventsSchemaValidator, getHttpAgent, getIndexedDB, getInstanceByAddress, getNetworkConfig, getPermit2CommitmentsSignature, getPermit2Signature, getPermitCommitmentsSignature, getPermitSignature, getProvider, getProviderWithNetId, getRelayerEnsSubdomains, getStatusSchema, getSupportedInstances, getTokenBalances, getTovarishNetworks, getWeightRandom, governanceEventsSchema, hasherBytecode, hexToBytes, initGroth16, isHex, isNode, jobRequestSchema, jobsSchema, labelhash, leBuff2Int, leInt2Buff, loadDBEvents, loadRemoteEvents, makeLabelNodeAndParent, mimc, multicall, numberFormatter, packEncryptedMessage, parseInvoice, parseNote, pedersen, permit2Address, pickWeightedRandomRelayer, populateTransaction, proofSchemaType, proposalState, rBigInt, rHex, relayerRegistryEventsSchema, saveDBEvents, sleep, stakeBurnedEventsSchema, substring, toContentHash, toFixedHex, toFixedLength, unpackEncryptedMessage, unzipAsync, validateUrl, withdrawalsEventsSchema, zipAsync };

57
dist/tornado.umd.js vendored
View File

@ -60737,8 +60737,6 @@ __webpack_require__.d(__webpack_exports__, {
cE: () => (/* binding */ BaseRegistryService),
Do: () => (/* binding */ BaseRevenueService),
e0: () => (/* binding */ BaseTornadoService),
Lx: () => (/* binding */ DEPOSIT),
oW: () => (/* binding */ WITHDRAWAL),
EU: () => (/* binding */ getTovarishNetworks),
sf: () => (/* binding */ proposalState)
});
@ -90256,8 +90254,6 @@ var relayerClient = __webpack_require__(57194);
const DEPOSIT = "deposit";
const WITHDRAWAL = "withdrawal";
class BaseEventsService {
netId;
provider;
@ -90370,7 +90366,7 @@ class BaseEventsService {
}
}
async getLatestEvents({ fromBlock }) {
if (this.tovarishClient?.selectedRelayer && ![DEPOSIT, WITHDRAWAL].includes(this.type.toLowerCase())) {
if (this.tovarishClient?.selectedRelayer && !["Deposit", "Withdrawal"].includes(this.type)) {
const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents({
type: this.getTovarishType(),
fromBlock
@ -90467,8 +90463,8 @@ class BaseTornadoService extends BaseEventsService {
return `${this.getType().toLowerCase()}s_${this.netId}_${this.currency}_${this.amount}`;
}
async formatEvents(events) {
const type = this.getType().toLowerCase();
if (type === DEPOSIT) {
const type = this.getType();
if (type === "Deposit") {
const txs = await this.batchTransactionService.getBatchTransactions([
...new Set(events.map(({ transactionHash }) => transactionHash))
]);
@ -90506,7 +90502,7 @@ class BaseTornadoService extends BaseEventsService {
events,
hasNewEvents
}) {
if (events.length && this.getType().toLowerCase() === DEPOSIT) {
if (events.length && this.getType() === "Deposit") {
const depositEvents = events;
const lastEvent = depositEvents[depositEvents.length - 1];
if (lastEvent.leafIndex !== depositEvents.length - 1) {
@ -91553,8 +91549,6 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ DBRegistryService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.hD),
/* harmony export */ DBRevenueService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.wV),
/* harmony export */ DBTornadoService: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.f8),
/* harmony export */ DEPOSIT: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.Lx),
/* harmony export */ WITHDRAWAL: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.oW),
/* harmony export */ getTovarishNetworks: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.EU),
/* harmony export */ loadDBEvents: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.w8),
/* harmony export */ loadRemoteEvents: () => (/* reexport safe */ _db__WEBPACK_IMPORTED_MODULE_2__.Oz),
@ -92783,14 +92777,6 @@ const defaultConfig = {
networkName: "Ethereum Mainnet",
deployedBlock: 9116966,
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/mainnet"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com"
},
mevblockerRPC: {
name: "MEV Blocker",
url: "https://rpc.mevblocker.io"
@ -92934,14 +92920,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/bsc-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/bsc"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/bsc"
},
bnbchain: {
name: "BNB Chain",
url: "https://bsc-dataseed.bnbchain.org"
@ -93163,14 +93141,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/xdai-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/gnosis"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/gnosis"
},
gnosis: {
name: "Gnosis",
url: "https://rpc.gnosischain.com"
@ -93278,14 +93248,6 @@ const defaultConfig = {
tornadoSubgraph: "tornadocash/sepolia-tornado-subgraph",
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: "tornadowithdraw.eth",
url: "https://tornadowithdraw.com/sepolia"
},
tornadoRpc: {
name: "torn-city.eth",
url: "https://tornadocash-rpc.com/sepolia"
},
sepolia: {
name: "Sepolia RPC",
url: "https://rpc.sepolia.org"
@ -101448,8 +101410,6 @@ ajv_ajv.addKeyword({
errors: true
});
// EXTERNAL MODULE: ./src/events/index.ts
var events = __webpack_require__(94513);
;// ./src/schemas/types.ts
const addressSchemaType = {
@ -101472,7 +101432,6 @@ const bytes32BNSchemaType = { ...bytes32SchemaType, BN: true };
const baseEventsSchemaProperty = {
blockNumber: {
type: "number"
@ -101692,10 +101651,10 @@ const encryptedNotesSchema = {
}
};
function getEventsSchemaValidator(type) {
if (type === events.DEPOSIT) {
if (type === "deposit") {
return ajv_ajv.compile(depositsEventsSchema);
}
if (type === events.WITHDRAWAL) {
if (type === "withdrawal") {
return ajv_ajv.compile(withdrawalsEventsSchema);
}
if (type === "governance") {
@ -110480,9 +110439,9 @@ var utils = __webpack_require__(67418);
function zipAsync(file) {
function zipAsync(file, options) {
return new Promise((res, rej) => {
zip(file, { mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => {
zip(file, { ...options || {}, mtime: /* @__PURE__ */ new Date("1/1/1980") }, (err, data) => {
if (err) {
rej(err);
return;

File diff suppressed because one or more lines are too long

4
dist/zip.d.ts vendored
View File

@ -1,5 +1,5 @@
import { AsyncZippable, Unzipped } from 'fflate';
export declare function zipAsync(file: AsyncZippable): Promise<Uint8Array>;
import { AsyncZippable, Unzipped, ZipAttributes } from 'fflate';
export declare function zipAsync(file: AsyncZippable, options?: ZipAttributes): Promise<Uint8Array>;
export declare function unzipAsync(data: Uint8Array): Promise<Unzipped>;
export declare function downloadZip<T>({ staticUrl, zipName, zipDigest, parseJson, }: {
staticUrl?: string;

View File

@ -58,9 +58,6 @@ import type {
StakeBurnedEvents,
} from './types';
export const DEPOSIT = 'deposit';
export const WITHDRAWAL = 'withdrawal';
export interface BaseEventsServiceConstructor {
netId: NetIdType;
provider: Provider;
@ -208,7 +205,7 @@ export class BaseEventsService<EventType extends MinimalEvents> {
}
async getLatestEvents({ fromBlock }: { fromBlock: number }): Promise<BaseEvents<EventType>> {
if (this.tovarishClient?.selectedRelayer && ![DEPOSIT, WITHDRAWAL].includes(this.type.toLowerCase())) {
if (this.tovarishClient?.selectedRelayer && !['Deposit', 'Withdrawal'].includes(this.type)) {
const { events, lastSyncBlock: lastBlock } = await this.tovarishClient.getEvents<EventType>({
type: this.getTovarishType(),
fromBlock,
@ -341,8 +338,8 @@ export class BaseTornadoService extends BaseEventsService<DepositsEvents | Withd
}
async formatEvents(events: EventLog[]): Promise<(DepositsEvents | WithdrawalsEvents)[]> {
const type = this.getType().toLowerCase();
if (type === DEPOSIT) {
const type = this.getType();
if (type === 'Deposit') {
const txs = await this.batchTransactionService.getBatchTransactions([
...new Set(events.map(({ transactionHash }) => transactionHash)),
]);
@ -387,7 +384,7 @@ export class BaseTornadoService extends BaseEventsService<DepositsEvents | Withd
}: BaseEvents<DepositsEvents | WithdrawalsEvents> & {
hasNewEvents?: boolean;
}) {
if (events.length && this.getType().toLowerCase() === DEPOSIT) {
if (events.length && this.getType() === 'Deposit') {
const depositEvents = events as DepositsEvents[];
const lastEvent = depositEvents[depositEvents.length - 1];

View File

@ -126,14 +126,6 @@ export const defaultConfig: networkConfig = {
networkName: 'Ethereum Mainnet',
deployedBlock: 9116966,
rpcUrls: {
tornadoWithdraw: {
name: 'tornadowithdraw.eth',
url: 'https://tornadowithdraw.com/mainnet',
},
tornadoRpc: {
name: 'torn-city.eth',
url: 'https://tornadocash-rpc.com',
},
mevblockerRPC: {
name: 'MEV Blocker',
url: 'https://rpc.mevblocker.io',
@ -277,14 +269,6 @@ export const defaultConfig: networkConfig = {
tornadoSubgraph: 'tornadocash/bsc-tornado-subgraph',
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: 'tornadowithdraw.eth',
url: 'https://tornadowithdraw.com/bsc',
},
tornadoRpc: {
name: 'torn-city.eth',
url: 'https://tornadocash-rpc.com/bsc',
},
bnbchain: {
name: 'BNB Chain',
url: 'https://bsc-dataseed.bnbchain.org',
@ -506,14 +490,6 @@ export const defaultConfig: networkConfig = {
tornadoSubgraph: 'tornadocash/xdai-tornado-subgraph',
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: 'tornadowithdraw.eth',
url: 'https://tornadowithdraw.com/gnosis',
},
tornadoRpc: {
name: 'torn-city.eth',
url: 'https://tornadocash-rpc.com/gnosis',
},
gnosis: {
name: 'Gnosis',
url: 'https://rpc.gnosischain.com',
@ -621,14 +597,6 @@ export const defaultConfig: networkConfig = {
tornadoSubgraph: 'tornadocash/sepolia-tornado-subgraph',
subgraphs: {},
rpcUrls: {
tornadoWithdraw: {
name: 'tornadowithdraw.eth',
url: 'https://tornadowithdraw.com/sepolia',
},
tornadoRpc: {
name: 'torn-city.eth',
url: 'https://tornadocash-rpc.com/sepolia',
},
sepolia: {
name: 'Sepolia RPC',
url: 'https://rpc.sepolia.org',

View File

@ -1,4 +1,3 @@
import { DEPOSIT, WITHDRAWAL } from '../events';
import { ajv } from './ajv';
import { addressSchemaType, bnSchemaType, bytes32SchemaType } from './types';
@ -230,11 +229,11 @@ export const encryptedNotesSchema = {
} as const;
export function getEventsSchemaValidator(type: string) {
if (type === DEPOSIT) {
if (type === 'deposit') {
return ajv.compile(depositsEventsSchema);
}
if (type === WITHDRAWAL) {
if (type === 'withdrawal') {
return ajv.compile(withdrawalsEventsSchema);
}

View File

@ -1,10 +1,10 @@
import { zip, unzip, AsyncZippable, Unzipped } from 'fflate';
import { zip, unzip, AsyncZippable, Unzipped, ZipAttributes } from 'fflate';
import { fetchData } from './providers';
import { bytesToBase64, digest } from './utils';
export function zipAsync(file: AsyncZippable): Promise<Uint8Array> {
export function zipAsync(file: AsyncZippable, options?: ZipAttributes): Promise<Uint8Array> {
return new Promise((res, rej) => {
zip(file, { mtime: new Date('1/1/1980') }, (err, data) => {
zip(file, { ...(options || {}), mtime: new Date('1/1/1980') }, (err, data) => {
if (err) {
rej(err);
return;