diff --git a/networkConfig.js b/networkConfig.js index 8f8f2ee..5646c83 100644 --- a/networkConfig.js +++ b/networkConfig.js @@ -1,6 +1,6 @@ +export const enabledChains = ['1', '10', '56', '100', '137', '42161'] +export const chainsWithEncryptedNotes = ['1', '5', '56', '100', '137'] export default { - enabledChains: ['1', '10', '56', '100', '137', '42161'], - chainsWithEncryptedNotes: ['1', '5', '56', '100', '137'], netId1: { rpcCallRetryAttempt: 15, gasPrices: { diff --git a/scripts/checkEventsSync.js b/scripts/checkEventsSync.js index 33f43b9..e7b5150 100644 --- a/scripts/checkEventsSync.js +++ b/scripts/checkEventsSync.js @@ -1,11 +1,9 @@ -import networkConfig from '../networkConfig' +import networkConfig, { enabledChains } from '../networkConfig' import { loadCachedEvents } from './helpers' const EVENTS_PATH = './static/events/' function main() { - const enabledChains = networkConfig.enabledChains - for (const netId of enabledChains) { const config = networkConfig[`netId${netId}`] const { constants, tokens, nativeCurrency, deployedBlock } = config @@ -13,7 +11,7 @@ function main() { console.log(`\n ::: ${netId} [${nativeCurrency.toUpperCase()}] :::`) - for (const [instance, ] of Object.entries(CONTRACTS)) { + for (const [instance] of Object.entries(CONTRACTS)) { console.log(`\n instanceDenomation - ${instance}`) const withdrawalCachedEvents = loadCachedEvents({ diff --git a/scripts/updateEncryptedEvents.js b/scripts/updateEncryptedEvents.js index 1ab17b7..b880197 100644 --- a/scripts/updateEncryptedEvents.js +++ b/scripts/updateEncryptedEvents.js @@ -3,7 +3,7 @@ import 'dotenv/config' import fs from 'fs' import { uniqBy } from 'lodash' -import networkConfig from '../networkConfig' +import networkConfig, { enabledChains } from '../networkConfig' import ABI from '../abis/TornadoProxy.abi.json' import { getPastEvents, loadCachedEvents } from './helpers' @@ -64,8 +64,6 @@ async function saveEncryptedNote(netId) { async function main() { const [, , , chain] = process.argv - const enabledChains = networkConfig.enabledChains - if (!enabledChains.includes(chain)) { throw new Error(`Supported chain ids ${enabledChains.join(', ')}`) } diff --git a/scripts/updateEvents.js b/scripts/updateEvents.js index 7d58e29..e4f8d28 100644 --- a/scripts/updateEvents.js +++ b/scripts/updateEvents.js @@ -3,7 +3,7 @@ import 'dotenv/config' import fs from 'fs' import { uniqBy } from 'lodash' -import networkConfig from '../networkConfig' +import networkConfig, { enabledChains } from '../networkConfig' import ABI from '../abis/Instance.abi.json' import { loadCachedEvents, getPastEvents } from './helpers' @@ -82,8 +82,6 @@ async function main(type, netId) { async function start() { const [, , , chain] = process.argv - const enabledChains = networkConfig.enabledChains - if (!enabledChains.includes(chain)) { throw new Error(`Supported chain ids ${enabledChains.join(', ')}`) } diff --git a/scripts/updateTree.js b/scripts/updateTree.js index fd8e446..4388b57 100644 --- a/scripts/updateTree.js +++ b/scripts/updateTree.js @@ -6,7 +6,7 @@ import BloomFilter from 'bloomfilter.js' import { MerkleTree } from 'fixed-merkle-tree' import { buildMimcSponge } from 'circomlibjs' -import networkConfig from '../networkConfig' +import networkConfig, { enabledChains } from '../networkConfig' import { loadCachedEvents, save } from './helpers' @@ -144,8 +144,6 @@ async function initMimc() { async function main() { const [, , , chain] = process.argv - const enabledChains = networkConfig.enabledChains - if (!enabledChains.includes(chain)) { throw new Error(`Supported chain ids ${enabledChains.join(', ')}`) } diff --git a/scripts/updateZip.js b/scripts/updateZip.js index 83ed773..10443c8 100644 --- a/scripts/updateZip.js +++ b/scripts/updateZip.js @@ -1,6 +1,6 @@ import { uniqBy } from 'lodash' -import networkConfig from '../networkConfig' +import networkConfig, { enabledChains, chainsWithEncryptedNotes } from '../networkConfig' import { loadCachedEvents, save } from './helpers' @@ -29,7 +29,7 @@ async function updateCommon(netId) { if (isSaved) { try { - await testCommon(netId, type, filename) + testCommon(netId, type, filename) } catch (err) { console.error(err.message) } @@ -38,10 +38,10 @@ async function updateCommon(netId) { } } -async function testCommon(netId, type, filename) { +function testCommon(netId, type, filename) { const { deployedBlock } = networkConfig[`netId${netId}`] - const cachedEvents = await loadCachedEvents({ + const cachedEvents = loadCachedEvents({ name: filename, directory: EVENTS_PATH, deployedBlock @@ -65,9 +65,6 @@ async function testCommon(netId, type, filename) { } async function main() { - const enabledChains = networkConfig.enabledChains - const chainsWithEncryptedNotes = networkConfig.chainsWithEncryptedNotes - for (let i = 0; i < enabledChains.length; i++) { const netId = enabledChains[i] diff --git a/services/events.js b/services/events.js index e4c58ea..c4eb014 100644 --- a/services/events.js +++ b/services/events.js @@ -2,7 +2,7 @@ import Web3 from 'web3' import graph from '@/services/graph' import { download } from '@/store/snark' -import networkConfig from '@/networkConfig' +import networkConfig, { enabledChains } from '@/networkConfig' import InstanceABI from '@/abis/Instance.abi.json' import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants' import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils' @@ -19,7 +19,7 @@ class EventService { this.idb = window.$nuxt.$indexedDB(netId) const { nativeCurrency } = networkConfig[`netId${netId}`] - const hasCache = networkConfig.enabledChains.includes(netId.toString()) + const hasCache = enabledChains.includes(netId.toString()) this.netId = netId this.amount = amount