From 4623e386a158a01438ac2d7a8b7107cffd10242e Mon Sep 17 00:00:00 2001 From: Tornado Contrib Date: Wed, 1 May 2024 09:04:01 +0000 Subject: [PATCH] Rename DepositsService to TornadoService and export saveEventsPromise --- dist/events/base.d.ts | 7 ++++--- dist/events/node.d.ts | 8 ++++---- dist/index.js | 10 +++++----- dist/index.mjs | 8 ++++---- dist/index.umd.js | 14 +++++++------- src/events/base.ts | 10 ++++++---- src/events/node.ts | 10 +++++----- 7 files changed, 35 insertions(+), 32 deletions(-) diff --git a/dist/events/base.d.ts b/dist/events/base.d.ts index 910f907..7e8379e 100644 --- a/dist/events/base.d.ts +++ b/dist/events/base.d.ts @@ -38,6 +38,7 @@ export declare class BaseEventsService { deployedBlock: number; batchEventsService: BatchEventsService; fetchDataOptions?: fetchDataOptions; + saveEventsPromise?: Promise; constructor({ netId, provider, graphApi, subgraphName, contract, type, deployedBlock, fetchDataOptions, }: BaseEventsServiceConstructor); getInstanceName(): string; getType(): string; @@ -81,7 +82,7 @@ export declare class BaseEventsService { lastBlock: number | null; }>; } -export type BaseDepositsServiceConstructor = { +export type BaseTornadoServiceConstructor = { netId: NetIdType; provider: Provider; graphApi?: string; @@ -97,12 +98,12 @@ export type DepositsGraphParams = BaseGraphParams & { amount: string; currency: string; }; -export declare class BaseDepositsService extends BaseEventsService { +export declare class BaseTornadoService extends BaseEventsService { amount: string; currency: string; batchTransactionService: BatchTransactionService; batchBlockService: BatchBlockService; - constructor({ netId, provider, graphApi, subgraphName, Tornado, type, amount, currency, deployedBlock, fetchDataOptions, }: BaseDepositsServiceConstructor); + constructor({ netId, provider, graphApi, subgraphName, Tornado, type, amount, currency, deployedBlock, fetchDataOptions, }: BaseTornadoServiceConstructor); getInstanceName(): string; getGraphMethod(): string; getGraphParams(): DepositsGraphParams; diff --git a/dist/events/node.d.ts b/dist/events/node.d.ts index 331204e..8cc2eb4 100644 --- a/dist/events/node.d.ts +++ b/dist/events/node.d.ts @@ -1,14 +1,14 @@ import { BatchBlockOnProgress, BatchEventOnProgress } from '../batch'; -import { BaseDepositsService, BaseEncryptedNotesService, BaseGovernanceService, BaseRegistryService, BaseDepositsServiceConstructor, BaseEncryptedNotesServiceConstructor, BaseGovernanceServiceConstructor, BaseRegistryServiceConstructor, BaseEchoServiceConstructor, BaseEchoService } from './base'; +import { BaseTornadoService, BaseEncryptedNotesService, BaseGovernanceService, BaseRegistryService, BaseTornadoServiceConstructor, BaseEncryptedNotesServiceConstructor, BaseGovernanceServiceConstructor, BaseRegistryServiceConstructor, BaseEchoServiceConstructor, BaseEchoService } from './base'; import type { BaseEvents, DepositsEvents, WithdrawalsEvents, EncryptedNotesEvents, RegistersEvents, AllGovernanceEvents, EchoEvents } from './types'; -export type NodeDepositsServiceConstructor = BaseDepositsServiceConstructor & { +export type NodeTornadoServiceConstructor = BaseTornadoServiceConstructor & { cacheDirectory?: string; userDirectory?: string; }; -export declare class NodeDepositsService extends BaseDepositsService { +export declare class NodeTornadoService extends BaseTornadoService { cacheDirectory?: string; userDirectory?: string; - constructor({ netId, provider, graphApi, subgraphName, Tornado, type, amount, currency, deployedBlock, fetchDataOptions, cacheDirectory, userDirectory, }: NodeDepositsServiceConstructor); + constructor({ netId, provider, graphApi, subgraphName, Tornado, type, amount, currency, deployedBlock, fetchDataOptions, cacheDirectory, userDirectory, }: NodeTornadoServiceConstructor); updateEventProgress({ type, fromBlock, toBlock, count }: Parameters[0]): void; updateTransactionProgress({ currentIndex, totalIndex }: Parameters[0]): void; updateBlockProgress({ currentIndex, totalIndex }: Parameters[0]): void; diff --git a/dist/index.js b/dist/index.js index a28c076..0813b5e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4638,7 +4638,7 @@ class BaseEventsService { }); const lastBlock = newEvents ? newEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : null; this.validateEvents({ events: allEvents, lastBlock }); - yield this.saveEvents({ events: allEvents, lastBlock }); + this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); return { events: allEvents, lastBlock @@ -4646,7 +4646,7 @@ class BaseEventsService { }); } } -class BaseDepositsService extends BaseEventsService { +class BaseTornadoService extends BaseEventsService { constructor({ netId, provider, @@ -5144,7 +5144,7 @@ var __async$9 = (__this, __arguments, generator) => { step((generator = generator.apply(__this, __arguments)).next()); }); }; -class NodeDepositsService extends BaseDepositsService { +class NodeTornadoService extends BaseTornadoService { constructor({ netId, provider, @@ -7889,12 +7889,12 @@ function calculateSnarkProof(input, circuit, provingKey) { }); } -exports.BaseDepositsService = BaseDepositsService; exports.BaseEchoService = BaseEchoService; exports.BaseEncryptedNotesService = BaseEncryptedNotesService; exports.BaseEventsService = BaseEventsService; exports.BaseGovernanceService = BaseGovernanceService; exports.BaseRegistryService = BaseRegistryService; +exports.BaseTornadoService = BaseTornadoService; exports.BatchBlockService = BatchBlockService; exports.BatchEventsService = BatchEventsService; exports.BatchTransactionService = BatchTransactionService; @@ -7918,11 +7918,11 @@ exports.MerkleTreeService = MerkleTreeService; exports.Mimc = Mimc; exports.Multicall__factory = Multicall__factory; exports.NetId = NetId; -exports.NodeDepositsService = NodeDepositsService; exports.NodeEchoService = NodeEchoService; exports.NodeEncryptedNotesService = NodeEncryptedNotesService; exports.NodeGovernanceService = NodeGovernanceService; exports.NodeRegistryService = NodeRegistryService; +exports.NodeTornadoService = NodeTornadoService; exports.NoteAccount = NoteAccount; exports.OffchainOracle__factory = OffchainOracle__factory; exports.OvmGasPriceOracle__factory = OvmGasPriceOracle__factory; diff --git a/dist/index.mjs b/dist/index.mjs index 9c2e2db..bb85ffc 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -4617,7 +4617,7 @@ class BaseEventsService { }); const lastBlock = newEvents ? newEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : null; this.validateEvents({ events: allEvents, lastBlock }); - yield this.saveEvents({ events: allEvents, lastBlock }); + this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); return { events: allEvents, lastBlock @@ -4625,7 +4625,7 @@ class BaseEventsService { }); } } -class BaseDepositsService extends BaseEventsService { +class BaseTornadoService extends BaseEventsService { constructor({ netId, provider, @@ -5123,7 +5123,7 @@ var __async$9 = (__this, __arguments, generator) => { step((generator = generator.apply(__this, __arguments)).next()); }); }; -class NodeDepositsService extends BaseDepositsService { +class NodeTornadoService extends BaseTornadoService { constructor({ netId, provider, @@ -7868,4 +7868,4 @@ function calculateSnarkProof(input, circuit, provingKey) { }); } -export { BaseDepositsService, BaseEchoService, BaseEncryptedNotesService, BaseEventsService, BaseGovernanceService, BaseRegistryService, BatchBlockService, BatchEventsService, BatchTransactionService, DEPOSIT, Deposit, ENS__factory, ERC20__factory, GET_DEPOSITS, GET_ECHO_EVENTS, GET_ENCRYPTED_NOTES, GET_GOVERNANCE_APY, GET_GOVERNANCE_EVENTS, GET_NOTE_ACCOUNTS, GET_REGISTERED, GET_STATISTIC, GET_WITHDRAWALS, GasPriceOracle__factory, Invoice, MIN_STAKE_BALANCE, MerkleTreeService, Mimc, Multicall__factory, NetId, NodeDepositsService, NodeEchoService, NodeEncryptedNotesService, NodeGovernanceService, NodeRegistryService, NoteAccount, OffchainOracle__factory, OvmGasPriceOracle__factory, Pedersen, RelayerClient, ReverseRecords__factory, TokenPriceOracle, TornadoBrowserProvider, TornadoFeeOracle, TornadoRpcSigner, TornadoVoidSigner, TornadoWallet, TreeCache, WITHDRAWAL, _META, addNetwork, ajv, base64ToBytes, bigIntReplacer, bnToBytes, buffPedersenHash, bufferToBytes, bytesToBN, bytesToBase64, bytesToHex, calculateScore, calculateSnarkProof, chunk, concatBytes, convertETHToTokenAmount, createDeposit, crypto, customConfig, defaultConfig, defaultUserAgent, download, enabledChains, existsAsync, index as factories, fetch, fetchData, fetchGetUrlFunc, getAllDeposits, getAllEncryptedNotes, getAllGovernanceEvents, getAllGraphEchoEvents, getAllRegisters, getAllWithdrawals, getConfig, getDeposits, getEncryptedNotes, getGasOraclePlugin, getGovernanceEvents, getGraphEchoEvents, getHttpAgent, getInstanceByAddress, getMeta, getNetworkConfig, getNoteAccounts, getProvider, getProviderWithNetId, getRegisters, getStatistic, getStatusSchema, getSubdomains, getSupportedInstances, getTokenBalances, getWeightRandom, getWithdrawals, hexToBytes, initGroth16, isNode, isRelayerUpdated, jobsSchema, leBuff2Int, leInt2Buff, loadCachedEvents, loadSavedEvents, mimc, multicall, packEncryptedMessage, parseAddress, parseKey, parseMnemonic, parseNumber, parseRecoveryKey, parseRelayer, parseSemanticVersion, parseUrl, pedersen, pickWeightedRandomRelayer, populateTransaction, queryGraph, rBigInt, saveUserFile, sleep, substring, toFixedHex, toFixedLength, unpackEncryptedMessage, unzipAsync, validateUrl, zipAsync }; +export { BaseEchoService, BaseEncryptedNotesService, BaseEventsService, BaseGovernanceService, BaseRegistryService, BaseTornadoService, BatchBlockService, BatchEventsService, BatchTransactionService, DEPOSIT, Deposit, ENS__factory, ERC20__factory, GET_DEPOSITS, GET_ECHO_EVENTS, GET_ENCRYPTED_NOTES, GET_GOVERNANCE_APY, GET_GOVERNANCE_EVENTS, GET_NOTE_ACCOUNTS, GET_REGISTERED, GET_STATISTIC, GET_WITHDRAWALS, GasPriceOracle__factory, Invoice, MIN_STAKE_BALANCE, MerkleTreeService, Mimc, Multicall__factory, NetId, NodeEchoService, NodeEncryptedNotesService, NodeGovernanceService, NodeRegistryService, NodeTornadoService, NoteAccount, OffchainOracle__factory, OvmGasPriceOracle__factory, Pedersen, RelayerClient, ReverseRecords__factory, TokenPriceOracle, TornadoBrowserProvider, TornadoFeeOracle, TornadoRpcSigner, TornadoVoidSigner, TornadoWallet, TreeCache, WITHDRAWAL, _META, addNetwork, ajv, base64ToBytes, bigIntReplacer, bnToBytes, buffPedersenHash, bufferToBytes, bytesToBN, bytesToBase64, bytesToHex, calculateScore, calculateSnarkProof, chunk, concatBytes, convertETHToTokenAmount, createDeposit, crypto, customConfig, defaultConfig, defaultUserAgent, download, enabledChains, existsAsync, index as factories, fetch, fetchData, fetchGetUrlFunc, getAllDeposits, getAllEncryptedNotes, getAllGovernanceEvents, getAllGraphEchoEvents, getAllRegisters, getAllWithdrawals, getConfig, getDeposits, getEncryptedNotes, getGasOraclePlugin, getGovernanceEvents, getGraphEchoEvents, getHttpAgent, getInstanceByAddress, getMeta, getNetworkConfig, getNoteAccounts, getProvider, getProviderWithNetId, getRegisters, getStatistic, getStatusSchema, getSubdomains, getSupportedInstances, getTokenBalances, getWeightRandom, getWithdrawals, hexToBytes, initGroth16, isNode, isRelayerUpdated, jobsSchema, leBuff2Int, leInt2Buff, loadCachedEvents, loadSavedEvents, mimc, multicall, packEncryptedMessage, parseAddress, parseKey, parseMnemonic, parseNumber, parseRecoveryKey, parseRelayer, parseSemanticVersion, parseUrl, pedersen, pickWeightedRandomRelayer, populateTransaction, queryGraph, rBigInt, saveUserFile, sleep, substring, toFixedHex, toFixedLength, unpackEncryptedMessage, unzipAsync, validateUrl, zipAsync }; diff --git a/dist/index.umd.js b/dist/index.umd.js index c069312..eac2755 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -63898,8 +63898,8 @@ class NoteAccount { /* harmony export */ Lx: () => (/* binding */ DEPOSIT), /* harmony export */ O_: () => (/* binding */ BaseEncryptedNotesService), /* harmony export */ cE: () => (/* binding */ BaseRegistryService), +/* harmony export */ e0: () => (/* binding */ BaseTornadoService), /* harmony export */ oW: () => (/* binding */ WITHDRAWAL), -/* harmony export */ qD: () => (/* binding */ BaseDepositsService), /* harmony export */ uw: () => (/* binding */ BaseEventsService) /* harmony export */ }); /* harmony import */ var ethers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(30031); @@ -64154,7 +64154,7 @@ class BaseEventsService { }); const lastBlock = newEvents ? newEvents.lastBlock : allEvents[allEvents.length - 1] ? allEvents[allEvents.length - 1].blockNumber : null; this.validateEvents({ events: allEvents, lastBlock }); - yield this.saveEvents({ events: allEvents, lastBlock }); + this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); return { events: allEvents, lastBlock @@ -64162,7 +64162,7 @@ class BaseEventsService { }); } } -class BaseDepositsService extends BaseEventsService { +class BaseTornadoService extends BaseEventsService { constructor({ netId, provider, @@ -64509,18 +64509,18 @@ class BaseRegistryService extends BaseEventsService { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ BaseDepositsService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.qD), /* harmony export */ BaseEchoService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.GS), /* harmony export */ BaseEncryptedNotesService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.O_), /* harmony export */ BaseEventsService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.uw), /* harmony export */ BaseGovernanceService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.JJ), /* harmony export */ BaseRegistryService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.cE), +/* harmony export */ BaseTornadoService: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.e0), /* harmony export */ DEPOSIT: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.Lx), -/* harmony export */ NodeDepositsService: () => (/* reexport safe */ _node__WEBPACK_IMPORTED_MODULE_2__.fD), /* harmony export */ NodeEchoService: () => (/* reexport safe */ _node__WEBPACK_IMPORTED_MODULE_2__.Rl), /* harmony export */ NodeEncryptedNotesService: () => (/* reexport safe */ _node__WEBPACK_IMPORTED_MODULE_2__.l5), /* harmony export */ NodeGovernanceService: () => (/* reexport safe */ _node__WEBPACK_IMPORTED_MODULE_2__.Om), /* harmony export */ NodeRegistryService: () => (/* reexport safe */ _node__WEBPACK_IMPORTED_MODULE_2__.b5), +/* harmony export */ NodeTornadoService: () => (/* reexport safe */ _node__WEBPACK_IMPORTED_MODULE_2__.$X), /* harmony export */ WITHDRAWAL: () => (/* reexport safe */ _base__WEBPACK_IMPORTED_MODULE_1__.oW) /* harmony export */ }); /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(61060); @@ -64543,10 +64543,10 @@ __webpack_require__.r(__webpack_exports__); "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ $X: () => (/* binding */ NodeTornadoService), /* harmony export */ Om: () => (/* binding */ NodeGovernanceService), /* harmony export */ Rl: () => (/* binding */ NodeEchoService), /* harmony export */ b5: () => (/* binding */ NodeRegistryService), -/* harmony export */ fD: () => (/* binding */ NodeDepositsService), /* harmony export */ l5: () => (/* binding */ NodeEncryptedNotesService) /* harmony export */ }); /* harmony import */ var cli_table3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(29530); @@ -64581,7 +64581,7 @@ var __async = (__this, __arguments, generator) => { -class NodeDepositsService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseDepositsService */ .qD { +class NodeTornadoService extends _base__WEBPACK_IMPORTED_MODULE_3__/* .BaseTornadoService */ .e0 { constructor({ netId, provider, diff --git a/src/events/base.ts b/src/events/base.ts index 8b79d62..507f140 100644 --- a/src/events/base.ts +++ b/src/events/base.ts @@ -77,6 +77,8 @@ export class BaseEventsService { batchEventsService: BatchEventsService; fetchDataOptions?: fetchDataOptions; + saveEventsPromise?: Promise; + constructor({ netId, provider, @@ -315,7 +317,7 @@ export class BaseEventsService { this.validateEvents({ events: allEvents, lastBlock }); - await this.saveEvents({ events: allEvents, lastBlock }); + this.saveEventsPromise = this.saveEvents({ events: allEvents, lastBlock }); return { events: allEvents, @@ -324,7 +326,7 @@ export class BaseEventsService { } } -export type BaseDepositsServiceConstructor = { +export type BaseTornadoServiceConstructor = { netId: NetIdType; provider: Provider; graphApi?: string; @@ -342,7 +344,7 @@ export type DepositsGraphParams = BaseGraphParams & { currency: string; }; -export class BaseDepositsService extends BaseEventsService { +export class BaseTornadoService extends BaseEventsService { amount: string; currency: string; batchTransactionService: BatchTransactionService; @@ -359,7 +361,7 @@ export class BaseDepositsService extends BaseEventsService