diff --git a/dist/cli.js b/dist/cli.js index f0ae2a8..9ea24de 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -187929,7 +187929,7 @@ function substring(str, length = 10) { return `${str.substring(0, length)}...${str.substring(str.length - length)}`; } -var __async$e = (__this, __arguments, generator) => { +var __async$f = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -187950,7 +187950,7 @@ var __async$e = (__this, __arguments, generator) => { }); }; function multicall(Multicall2, calls) { - return __async$e(this, null, function* () { + return __async$f(this, null, function* () { const calldata = calls.map((call) => { var _a, _b, _c; const target = ((_a = call.contract) == null ? void 0 : _a.target) || call.address; @@ -187995,7 +187995,7 @@ var __spreadValues$5 = (a, b) => { }; var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b)); var __superGet$1 = (cls, obj, key) => __reflectGet$1(__getProtoOf$1(cls), key, obj); -var __async$d = (__this, __arguments, generator) => { +var __async$e = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -188041,7 +188041,7 @@ function getHttpAgent({ } } function fetchData(_0) { - return __async$d(this, arguments, function* (url, options = {}) { + return __async$e(this, arguments, function* (url, options = {}) { var _a, _b, _c; const MAX_RETRY = (_a = options.maxRetry) != null ? _a : 3; const RETRY_ON = (_b = options.retryOn) != null ? _b : 500; @@ -188133,7 +188133,7 @@ function fetchData(_0) { throw errorObject; }); } -const fetchGetUrlFunc = (options = {}) => (req, _signal) => __async$d(void 0, null, function* () { +const fetchGetUrlFunc = (options = {}) => (req, _signal) => __async$e(void 0, null, function* () { let signal; if (_signal) { const controller = new AbortController(); @@ -188167,7 +188167,7 @@ const oracleMapper = /* @__PURE__ */ new Map(); const multicallMapper = /* @__PURE__ */ new Map(); function getGasOraclePlugin(networkKey, fetchOptions) { const gasStationApi = (fetchOptions == null ? void 0 : fetchOptions.gasStationApi) || "https://gasstation.polygon.technology/v2"; - return new FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __async$d(this, null, function* () { + return new FetchUrlFeeDataNetworkPlugin(gasStationApi, (fetchFeeData, provider, request) => __async$e(this, null, function* () { if (!oracleMapper.has(networkKey)) { oracleMapper.set(networkKey, GasPriceOracle__factory.connect(fetchOptions == null ? void 0 : fetchOptions.gasPriceOracle, provider)); } @@ -188226,7 +188226,7 @@ function getGasOraclePlugin(networkKey, fetchOptions) { })); } function dist_getProvider(rpcUrl, fetchOptions) { - return __async$d(this, null, function* () { + return __async$e(this, null, function* () { const fetchReq = new FetchRequest(rpcUrl); fetchReq.getUrlFunc = fetchGetUrlFunc(fetchOptions); const _staticNetwork = yield new JsonRpcProvider(fetchReq).getNetwork(); @@ -188276,7 +188276,7 @@ function getProviderWithNetId(netId, rpcUrl, config, fetchOptions) { provider.pollingInterval = (fetchOptions == null ? void 0 : fetchOptions.pollingInterval) || pollInterval * 1e3; return provider; } -const populateTransaction = (signer, tx) => __async$d(void 0, null, function* () { +const populateTransaction = (signer, tx) => __async$e(void 0, null, function* () { const provider = signer.provider; if (!tx.from) { tx.from = signer.address; @@ -188285,7 +188285,7 @@ const populateTransaction = (signer, tx) => __async$d(void 0, null, function* () throw new Error(errMsg); } const [feeData, nonce] = yield Promise.all([ - (() => __async$d(void 0, null, function* () { + (() => __async$e(void 0, null, function* () { if (tx.maxFeePerGas && tx.maxPriorityFeePerGas) { return new FeeData(null, BigInt(tx.maxFeePerGas), BigInt(tx.maxPriorityFeePerGas)); } @@ -188307,7 +188307,7 @@ const populateTransaction = (signer, tx) => __async$d(void 0, null, function* () ); } }))(), - (() => __async$d(void 0, null, function* () { + (() => __async$e(void 0, null, function* () { if (tx.nonce) { return tx.nonce; } @@ -188337,7 +188337,7 @@ const populateTransaction = (signer, tx) => __async$d(void 0, null, function* () delete tx.maxFeePerGas; delete tx.maxPriorityFeePerGas; } - tx.gasLimit = tx.gasLimit || (yield (() => __async$d(void 0, null, function* () { + tx.gasLimit = tx.gasLimit || (yield (() => __async$e(void 0, null, function* () { try { const gasLimit = yield provider.estimateGas(tx); return gasLimit === BigInt(21e3) ? gasLimit : gasLimit * (BigInt(1e4) + BigInt(signer.gasLimitBump)) / BigInt(1e4); @@ -188365,7 +188365,7 @@ class TornadoWallet extends Wallet { return new TornadoWallet(privateKey, provider, options); } populateTransaction(tx) { - return __async$d(this, null, function* () { + return __async$e(this, null, function* () { const txObject = yield populateTransaction(this, tx); this.nonce = txObject.nonce; return __superGet$1(TornadoWallet.prototype, this, "populateTransaction").call(this, txObject); @@ -188381,7 +188381,7 @@ class TornadoVoidSigner extends VoidSigner { this.bumpNonce = bumpNonce != null ? bumpNonce : false; } populateTransaction(tx) { - return __async$d(this, null, function* () { + return __async$e(this, null, function* () { const txObject = yield populateTransaction(this, tx); this.nonce = txObject.nonce; return __superGet$1(TornadoVoidSigner.prototype, this, "populateTransaction").call(this, txObject); @@ -188397,7 +188397,7 @@ class TornadoRpcSigner extends JsonRpcSigner { this.bumpNonce = bumpNonce != null ? bumpNonce : false; } sendUncheckedTransaction(tx) { - return __async$d(this, null, function* () { + return __async$e(this, null, function* () { return __superGet$1(TornadoRpcSigner.prototype, this, "sendUncheckedTransaction").call(this, yield populateTransaction(this, tx)); }); } @@ -188408,7 +188408,7 @@ class TornadoBrowserProvider extends BrowserProvider { this.options = options; } getSigner(address) { - return __async$d(this, null, function* () { + return __async$e(this, null, function* () { var _a, _b, _c, _d, _e, _f, _g, _h, _i; const signerAddress = (yield __superGet$1(TornadoBrowserProvider.prototype, this, "getSigner").call(this, address)).address; if (((_a = this.options) == null ? void 0 : _a.webChainId) && ((_b = this.options) == null ? void 0 : _b.connectWallet) && Number(yield __superGet$1(TornadoBrowserProvider.prototype, this, "send").call(this, "eth_chainId", [])) !== Number((_c = this.options) == null ? void 0 : _c.webChainId)) { @@ -188636,7 +188636,7 @@ var __spreadValues$4 = (a, b) => { return a; }; var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b)); -var __async$c = (__this, __arguments, generator) => { +var __async$d = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -188659,7 +188659,7 @@ var __async$c = (__this, __arguments, generator) => { const isEmptyArray = (arr) => !Array.isArray(arr) || !arr.length; const first = 1e3; function queryGraph(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, query, @@ -188688,7 +188688,7 @@ function queryGraph(_0) { }); } function getStatistic(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, currency, @@ -188735,7 +188735,7 @@ function getStatistic(_0) { }); } function getMeta(_0) { - return __async$c(this, arguments, function* ({ graphApi, subgraphName, fetchDataOptions: fetchDataOptions2 }) { + return __async$d(this, arguments, function* ({ graphApi, subgraphName, fetchDataOptions: fetchDataOptions2 }) { try { const { _meta: { @@ -188780,7 +188780,7 @@ function getRegisters({ }); } function getAllRegisters(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, fromBlock, @@ -188869,7 +188869,7 @@ function getDeposits({ }); } function getAllDeposits(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, currency, @@ -188966,7 +188966,7 @@ function getWithdrawals({ }); } function getAllWithdrawals(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, currency, @@ -189042,7 +189042,7 @@ function getAllWithdrawals(_0) { }); } function getNoteAccounts(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, address, @@ -189095,7 +189095,7 @@ function getGraphEchoEvents({ }); } function getAllGraphEchoEvents(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, fromBlock, @@ -189184,7 +189184,7 @@ function getEncryptedNotes({ }); } function getAllEncryptedNotes(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, fromBlock, @@ -189269,7 +189269,7 @@ function getGovernanceEvents({ }); } function getAllGovernanceEvents(_0) { - return __async$c(this, arguments, function* ({ + return __async$d(this, arguments, function* ({ graphApi, subgraphName, fromBlock, @@ -189428,7 +189428,7 @@ var graph = /*#__PURE__*/Object.freeze({ queryGraph: queryGraph }); -var __async$b = (__this, __arguments, generator) => { +var __async$c = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -189467,7 +189467,7 @@ class BatchBlockService { this.retryOn = retryOn; } getBlock(blockTag) { - return __async$b(this, null, function* () { + return __async$c(this, null, function* () { const blockObject = yield this.provider.getBlock(blockTag); if (!blockObject) { const errMsg = `No block for ${blockTag}`; @@ -189477,9 +189477,9 @@ class BatchBlockService { }); } createBatchRequest(batchArray) { - return batchArray.map((blocks, index) => __async$b(this, null, function* () { + return batchArray.map((blocks, index) => __async$c(this, null, function* () { yield dist_sleep(20 * index); - return (() => __async$b(this, null, function* () { + return (() => __async$c(this, null, function* () { let retries = 0; let err; while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { @@ -189496,7 +189496,7 @@ class BatchBlockService { })); } getBatchBlocks(blocks) { - return __async$b(this, null, function* () { + return __async$c(this, null, function* () { let blockCount = 0; const results = []; for (const chunks of chunk(blocks, this.concurrencySize * this.batchSize)) { @@ -189534,7 +189534,7 @@ class BatchTransactionService { this.retryOn = retryOn; } getTransaction(txHash) { - return __async$b(this, null, function* () { + return __async$c(this, null, function* () { const txObject = yield this.provider.getTransaction(txHash); if (!txObject) { const errMsg = `No transaction for ${txHash}`; @@ -189544,9 +189544,9 @@ class BatchTransactionService { }); } createBatchRequest(batchArray) { - return batchArray.map((txs, index) => __async$b(this, null, function* () { + return batchArray.map((txs, index) => __async$c(this, null, function* () { yield dist_sleep(20 * index); - return (() => __async$b(this, null, function* () { + return (() => __async$c(this, null, function* () { let retries = 0; let err; while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { @@ -189563,7 +189563,7 @@ class BatchTransactionService { })); } getBatchTransactions(txs) { - return __async$b(this, null, function* () { + return __async$c(this, null, function* () { let txCount = 0; const results = []; for (const chunks of chunk(txs, this.concurrencySize * this.batchSize)) { @@ -189599,7 +189599,7 @@ class BatchEventsService { this.retryOn = retryOn; } getPastEvents(_0) { - return __async$b(this, arguments, function* ({ fromBlock, toBlock, type }) { + return __async$c(this, arguments, function* ({ fromBlock, toBlock, type }) { let err; let retries = 0; while (!this.shouldRetry && retries === 0 || this.shouldRetry && retries < this.retryMax) { @@ -189619,13 +189619,13 @@ class BatchEventsService { }); } createBatchRequest(batchArray) { - return batchArray.map((event, index) => __async$b(this, null, function* () { + return batchArray.map((event, index) => __async$c(this, null, function* () { yield dist_sleep(20 * index); return this.getPastEvents(event); })); } getBatchEvents(_0) { - return __async$b(this, arguments, function* ({ fromBlock, toBlock, type = "*" }) { + return __async$c(this, arguments, function* ({ fromBlock, toBlock, type = "*" }) { if (!toBlock) { toBlock = yield this.provider.getBlockNumber(); } @@ -189678,7 +189678,7 @@ var __spreadValues$3 = (a, b) => { }; var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b)); var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj); -var __async$a = (__this, __arguments, generator) => { +var __async$b = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -189753,7 +189753,7 @@ class BaseEventsService { } /* eslint-enable @typescript-eslint/no-unused-vars */ formatEvents(events) { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { return yield new Promise((resolve) => resolve(events)); }); } @@ -189761,7 +189761,7 @@ class BaseEventsService { * Get saved or cached events */ getEventsFromDB() { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { return { events: [], lastBlock: null @@ -189769,7 +189769,7 @@ class BaseEventsService { }); } getEventsFromCache() { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { return { events: [], lastBlock: null @@ -189777,7 +189777,7 @@ class BaseEventsService { }); } getSavedEvents() { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { let cachedEvents = yield this.getEventsFromDB(); if (!cachedEvents || !cachedEvents.events.length) { cachedEvents = yield this.getEventsFromCache(); @@ -189789,7 +189789,7 @@ class BaseEventsService { * Get latest events */ getEventsFromGraph(_0) { - return __async$a(this, arguments, function* ({ + return __async$b(this, arguments, function* ({ fromBlock, methodName = "" }) { @@ -189809,7 +189809,7 @@ class BaseEventsService { }); } getEventsFromRpc(_0) { - return __async$a(this, arguments, function* ({ + return __async$b(this, arguments, function* ({ fromBlock, toBlock }) { @@ -189847,7 +189847,7 @@ class BaseEventsService { }); } getLatestEvents(_0) { - return __async$a(this, arguments, function* ({ fromBlock }) { + return __async$b(this, arguments, function* ({ fromBlock }) { const allEvents = []; const graphEvents = yield this.getEventsFromGraph({ fromBlock }); const lastSyncBlock = graphEvents.lastBlock && graphEvents.lastBlock >= fromBlock ? graphEvents.lastBlock : fromBlock; @@ -189869,14 +189869,14 @@ class BaseEventsService { */ // eslint-disable-next-line @typescript-eslint/no-unused-vars saveEvents(_0) { - return __async$a(this, arguments, function* ({ events, lastBlock }) { + return __async$b(this, arguments, function* ({ events, lastBlock }) { }); } /** * Trigger saving and receiving latest events */ updateEvents() { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { const savedEvents = yield this.getSavedEvents(); let fromBlock = this.deployedBlock; if (savedEvents && savedEvents.lastBlock) { @@ -189950,7 +189950,7 @@ class BaseDepositsService extends BaseEventsService { }; } formatEvents(events) { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { const type = this.getType().toLowerCase(); if (type === DEPOSIT) { const formattedEvents = events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { @@ -190029,7 +190029,7 @@ class BaseEchoService extends BaseEventsService { return "getAllGraphEchoEvents"; } formatEvents(events) { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { const { who, data } = args; if (who && data) { @@ -190047,7 +190047,7 @@ class BaseEchoService extends BaseEventsService { }); } getEventsFromGraph(_0) { - return __async$a(this, arguments, function* ({ fromBlock }) { + return __async$b(this, arguments, function* ({ fromBlock }) { if (!this.graphApi || this.graphApi.includes("api.thegraph.com")) { return { events: [], @@ -190080,7 +190080,7 @@ class BaseEncryptedNotesService extends BaseEventsService { return "getAllEncryptedNotes"; } formatEvents(events) { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { const { encryptedNote } = args; if (encryptedNote) { @@ -190123,7 +190123,7 @@ class BaseGovernanceService extends BaseEventsService { return "getAllGovernanceEvents"; } formatEvents(events) { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { const proposalEvents = []; const votedEvents = []; const delegatedEvents = []; @@ -190190,7 +190190,7 @@ class BaseGovernanceService extends BaseEventsService { }); } getEventsFromGraph(_0) { - return __async$a(this, arguments, function* ({ fromBlock }) { + return __async$b(this, arguments, function* ({ fromBlock }) { if (!this.graphApi || !this.subgraphName || this.graphApi.includes("api.thegraph.com")) { return { events: [], @@ -190225,7 +190225,7 @@ class BaseRegistryService extends BaseEventsService { return "getAllRegisters"; } formatEvents(events) { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { return events.map(({ blockNumber, index: logIndex, transactionHash, args }) => { const eventObjects = { blockNumber, @@ -190240,13 +190240,13 @@ class BaseRegistryService extends BaseEventsService { }); } fetchRelayers() { - return __async$a(this, null, function* () { + return __async$b(this, null, function* () { return (yield this.updateEvents()).events; }); } } -var __async$9 = (__this, __arguments, generator) => { +var __async$a = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -190267,7 +190267,7 @@ var __async$9 = (__this, __arguments, generator) => { }); }; function existsAsync(fileOrDir) { - return __async$9(this, null, function* () { + return __async$a(this, null, function* () { try { yield (0,promises_namespaceObject.stat)(fileOrDir); return true; @@ -190299,7 +190299,7 @@ function unzipAsync(data) { }); } function saveUserFile(_0) { - return __async$9(this, arguments, function* ({ + return __async$a(this, arguments, function* ({ fileName, userDirectory, dataString @@ -190317,7 +190317,7 @@ function saveUserFile(_0) { }); } function loadSavedEvents(_0) { - return __async$9(this, arguments, function* ({ + return __async$a(this, arguments, function* ({ name, userDirectory, deployedBlock @@ -190346,7 +190346,7 @@ function loadSavedEvents(_0) { }); } function download(_0) { - return __async$9(this, arguments, function* ({ name, cacheDirectory }) { + return __async$a(this, arguments, function* ({ name, cacheDirectory }) { const fileName = `${name}.json`.toLowerCase(); const zipName = `${fileName}.zip`; const zipPath = external_path_.join(cacheDirectory, zipName); @@ -190356,7 +190356,7 @@ function download(_0) { }); } function loadCachedEvents(_0) { - return __async$9(this, arguments, function* ({ + return __async$a(this, arguments, function* ({ name, cacheDirectory, deployedBlock @@ -190386,7 +190386,7 @@ function loadCachedEvents(_0) { }); } -var __async$8 = (__this, __arguments, generator) => { +var __async$9 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -190471,7 +190471,7 @@ class NodeDepositsService extends BaseDepositsService { } } getEventsFromDB() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.userDirectory) { console.log( "Updating events for", @@ -190502,7 +190502,7 @@ class NodeDepositsService extends BaseDepositsService { }); } getEventsFromCache() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.cacheDirectory) { console.log(`cachedEvents count - ${0}`); console.log(`cachedEvents lastBlock - ${this.deployedBlock} @@ -190524,7 +190524,7 @@ class NodeDepositsService extends BaseDepositsService { }); } saveEvents(_0) { - return __async$8(this, arguments, function* ({ events, lastBlock }) { + return __async$9(this, arguments, function* ({ events, lastBlock }) { const instanceName = this.getInstanceName(); console.log("\ntotalEvents count - ", events.length); console.log( @@ -190603,7 +190603,7 @@ class NodeEchoService extends BaseEchoService { } } getEventsFromDB() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.userDirectory) { console.log(`Updating events for ${this.netId} chain echo events `); @@ -190629,7 +190629,7 @@ class NodeEchoService extends BaseEchoService { }); } getEventsFromCache() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.cacheDirectory) { console.log(`cachedEvents count - ${0}`); console.log(`cachedEvents lastBlock - ${this.deployedBlock} @@ -190651,7 +190651,7 @@ class NodeEchoService extends BaseEchoService { }); } saveEvents(_0) { - return __async$8(this, arguments, function* ({ events, lastBlock }) { + return __async$9(this, arguments, function* ({ events, lastBlock }) { const instanceName = this.getInstanceName(); console.log("\ntotalEvents count - ", events.length); console.log( @@ -190729,7 +190729,7 @@ class NodeEncryptedNotesService extends BaseEncryptedNotesService { } } getEventsFromDB() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.userDirectory) { console.log(`Updating events for ${this.netId} chain encrypted events `); @@ -190755,7 +190755,7 @@ class NodeEncryptedNotesService extends BaseEncryptedNotesService { }); } getEventsFromCache() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.cacheDirectory) { console.log(`cachedEvents count - ${0}`); console.log(`cachedEvents lastBlock - ${this.deployedBlock} @@ -190777,7 +190777,7 @@ class NodeEncryptedNotesService extends BaseEncryptedNotesService { }); } saveEvents(_0) { - return __async$8(this, arguments, function* ({ events, lastBlock }) { + return __async$9(this, arguments, function* ({ events, lastBlock }) { const instanceName = this.getInstanceName(); console.log("\ntotalEvents count - ", events.length); console.log( @@ -190860,7 +190860,7 @@ class NodeGovernanceService extends BaseGovernanceService { } } getEventsFromDB() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.userDirectory) { console.log(`Updating events for ${this.netId} chain governance events `); @@ -190886,7 +190886,7 @@ class NodeGovernanceService extends BaseGovernanceService { }); } getEventsFromCache() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.cacheDirectory) { console.log(`cachedEvents count - ${0}`); console.log(`cachedEvents lastBlock - ${this.deployedBlock} @@ -190908,7 +190908,7 @@ class NodeGovernanceService extends BaseGovernanceService { }); } saveEvents(_0) { - return __async$8(this, arguments, function* ({ events, lastBlock }) { + return __async$9(this, arguments, function* ({ events, lastBlock }) { const instanceName = this.getInstanceName(); console.log("\ntotalEvents count - ", events.length); console.log( @@ -190986,7 +190986,7 @@ class NodeRegistryService extends BaseRegistryService { } } getEventsFromDB() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.userDirectory) { console.log(`Updating events for ${this.netId} chain registry events `); @@ -191012,7 +191012,7 @@ class NodeRegistryService extends BaseRegistryService { }); } getEventsFromCache() { - return __async$8(this, null, function* () { + return __async$9(this, null, function* () { if (!this.cacheDirectory) { console.log(`cachedEvents count - ${0}`); console.log(`cachedEvents lastBlock - ${this.deployedBlock} @@ -191034,7 +191034,7 @@ class NodeRegistryService extends BaseRegistryService { }); } saveEvents(_0) { - return __async$8(this, arguments, function* ({ events, lastBlock }) { + return __async$9(this, arguments, function* ({ events, lastBlock }) { const instanceName = this.getInstanceName(); console.log("\ntotalEvents count - ", events.length); console.log( @@ -191865,7 +191865,7 @@ dist_ajv.addKeyword({ errors: true }); -var __async$7 = (__this, __arguments, generator) => { +var __async$8 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -191890,13 +191890,13 @@ class Pedersen { this.pedersenPromise = this.initPedersen(); } initPedersen() { - return __async$7(this, null, function* () { + return __async$8(this, null, function* () { this.pedersenHash = yield pedersen_hash_buildPedersenHash(); this.babyJub = this.pedersenHash.babyJub; }); } unpackPoint(buffer) { - return __async$7(this, null, function* () { + return __async$8(this, null, function* () { var _a, _b; yield this.pedersenPromise; return (_b = this.babyJub) == null ? void 0 : _b.unpackPoint((_a = this.pedersenHash) == null ? void 0 : _a.hash(buffer)); @@ -191909,13 +191909,13 @@ class Pedersen { } const pedersen = new Pedersen(); function buffPedersenHash(buffer) { - return __async$7(this, null, function* () { + return __async$8(this, null, function* () { const [hash] = yield pedersen.unpackPoint(buffer); return pedersen.toStringBuffer(hash); }); } -var __async$6 = (__this, __arguments, generator) => { +var __async$7 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -191936,7 +191936,7 @@ var __async$6 = (__this, __arguments, generator) => { }); }; function createDeposit(_0) { - return __async$6(this, arguments, function* ({ nullifier, secret }) { + return __async$7(this, arguments, function* ({ nullifier, secret }) { const preimage = new Uint8Array([...dist_leInt2Buff(nullifier), ...dist_leInt2Buff(secret)]); const noteHex = toFixedHex(bytesToBN(preimage), 62); const commitment = BigInt(yield buffPedersenHash(preimage)); @@ -191996,7 +191996,7 @@ class Deposit { ); } static createNote(_0) { - return __async$6(this, arguments, function* ({ currency, amount, netId, nullifier, secret }) { + return __async$7(this, arguments, function* ({ currency, amount, netId, nullifier, secret }) { if (!nullifier) { nullifier = rBigInt(31); } @@ -192023,7 +192023,7 @@ class Deposit { }); } static parseNote(noteString) { - return __async$6(this, null, function* () { + return __async$7(this, null, function* () { const noteRegex = new RegExp("tornado-(?\\w+)-(?[\\d.]+)-(?\\d+)-0x(?[0-9a-fA-F]{124})", "g"); const match = noteRegex.exec(noteString); if (!match) { @@ -192283,7 +192283,7 @@ class TornadoFeeOracle { } } -var __async$5 = (__this, __arguments, generator) => { +var __async$6 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -192308,7 +192308,7 @@ class Mimc { this.mimcPromise = this.initMimc(); } initMimc() { - return __async$5(this, null, function* () { + return __async$6(this, null, function* () { this.sponge = yield mimcsponge_buildMimcSponge(); this.hash = (left, right) => { var _a, _b; @@ -192317,7 +192317,7 @@ class Mimc { }); } getHash() { - return __async$5(this, null, function* () { + return __async$6(this, null, function* () { yield this.mimcPromise; return { sponge: this.sponge, @@ -192328,7 +192328,7 @@ class Mimc { } const mimc = new Mimc(); -var __async$4 = (__this, __arguments, generator) => { +var __async$5 = (__this, __arguments, generator) => { return new Promise((resolve, reject) => { var fulfilled = (value) => { try { @@ -192371,7 +192371,7 @@ class MerkleTreeService { this.merkleWorkerPath = merkleWorkerPath; } createTree(events) { - return __async$4(this, null, function* () { + return __async$5(this, null, function* () { const { hash: hashFunction } = yield mimc.getHash(); if (this.merkleWorkerPath) { console.log("Using merkleWorker\n"); @@ -192423,7 +192423,7 @@ class MerkleTreeService { }); } createPartialTree(_0) { - return __async$4(this, arguments, function* ({ edge, elements }) { + return __async$5(this, arguments, function* ({ edge, elements }) { const { hash: hashFunction } = yield mimc.getHash(); if (this.merkleWorkerPath) { console.log("Using merkleWorker\n"); @@ -192477,7 +192477,7 @@ class MerkleTreeService { }); } verifyTree(events) { - return __async$4(this, null, function* () { + return __async$5(this, null, function* () { console.log( ` Creating deposit tree for ${this.netId} ${this.amount} ${this.currency.toUpperCase()} would take a while @@ -192562,6 +192562,26 @@ function parseRecoveryKey(value) { return value; } +var __async$4 = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; class TokenPriceOracle { constructor(provider, multicall2, oracle) { this.provider = provider; @@ -192569,17 +192589,22 @@ class TokenPriceOracle { this.oracle = oracle; } fetchPrices(tokens) { - if (!this.oracle) { - return new Promise((resolve) => resolve(tokens.map(() => parseEther("0.0001")))); - } - return multicall( - this.multicall, - tokens.map((token) => ({ - contract: this.oracle, - name: "getRateToEth", - params: [token, true] - })) - ); + return __async$4(this, null, function* () { + if (!this.oracle) { + return new Promise((resolve) => resolve(tokens.map(() => parseEther("0.0001")))); + } + const prices = yield multicall( + this.multicall, + tokens.map(({ tokenAddress }) => ({ + contract: this.oracle, + name: "getRateToEth", + params: [tokenAddress, true] + })) + ); + return prices.map((price, index) => { + return price * BigInt(10 ** tokens[index].decimals) / BigInt(10 ** 18); + }); + }); } } @@ -193801,7 +193826,7 @@ function tornadoProgram() { netId }).then(({ relayerClient: relayerClient2 }) => relayerClient2) : void 0, tornadoFeeOracle.fetchL1OptimismFee(), - !isEth ? tokenPriceOracle.fetchPrices([tokenAddress]).then((p) => p[0]) : BigInt(0), + !isEth ? tokenPriceOracle.fetchPrices([{ tokenAddress, decimals }]).then((p) => p[0]) : BigInt(0), provider.getFeeData() ]); if (!walletWithdrawal && !(relayerClient == null ? void 0 : relayerClient.selectedRelayer)) { diff --git a/package.json b/package.json index d32e77a..2127898 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@colors/colors": "1.5.0", "@metamask/eth-sig-util": "^7.0.1", "@tornado/contracts": "1.0.0", - "@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#c06ade89011eb515e3d94e61f59d30de60f08536", + "@tornado/core": "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#767883f1e74110f899a06ef31899692f101ff54a", "@tornado/fixed-merkle-tree": "0.7.3", "@tornado/snarkjs": "0.1.20", "@tornado/websnark": "0.0.4", diff --git a/src/program.ts b/src/program.ts index 7e82f0b..b6955d1 100644 --- a/src/program.ts +++ b/src/program.ts @@ -952,7 +952,7 @@ export function tornadoProgram() { }).then(({ relayerClient }) => relayerClient) : undefined, tornadoFeeOracle.fetchL1OptimismFee(), - !isEth ? tokenPriceOracle.fetchPrices([tokenAddress as string]).then((p) => p[0]) : BigInt(0), + !isEth ? tokenPriceOracle.fetchPrices([{ tokenAddress: tokenAddress as string, decimals }]).then((p) => p[0]) : BigInt(0), provider.getFeeData(), ]); diff --git a/yarn.lock b/yarn.lock index 122389f..5a70587 100644 --- a/yarn.lock +++ b/yarn.lock @@ -771,9 +771,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#c06ade89011eb515e3d94e61f59d30de60f08536": +"@tornado/core@git+https://git.tornado.ws/tornadocontrib/tornado-core.git#767883f1e74110f899a06ef31899692f101ff54a": version "1.0.0" - resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#c06ade89011eb515e3d94e61f59d30de60f08536" + resolved "git+https://git.tornado.ws/tornadocontrib/tornado-core.git#767883f1e74110f899a06ef31899692f101ff54a" dependencies: "@metamask/eth-sig-util" "^7.0.1" "@tornado/contracts" "^1.0.0"