networkConfig: keep default export separate to not break UI

Signed-off-by: AlienTornadosaurusHex <>
This commit is contained in:
AlienTornadosaurusHex 2023-05-16 15:24:52 +00:00
parent ad0d1391dc
commit 2fbd860f51
7 changed files with 13 additions and 24 deletions

View File

@ -1,6 +1,6 @@
export const enabledChains = ['1', '10', '56', '100', '137', '42161']
export const chainsWithEncryptedNotes = ['1', '5', '56', '100', '137']
export default { export default {
enabledChains: ['1', '10', '56', '100', '137', '42161'],
chainsWithEncryptedNotes: ['1', '5', '56', '100', '137'],
netId1: { netId1: {
rpcCallRetryAttempt: 15, rpcCallRetryAttempt: 15,
gasPrices: { gasPrices: {

View File

@ -1,11 +1,9 @@
import networkConfig from '../networkConfig' import networkConfig, { enabledChains } from '../networkConfig'
import { loadCachedEvents } from './helpers' import { loadCachedEvents } from './helpers'
const EVENTS_PATH = './static/events/' const EVENTS_PATH = './static/events/'
function main() { function main() {
const enabledChains = networkConfig.enabledChains
for (const netId of enabledChains) { for (const netId of enabledChains) {
const config = networkConfig[`netId${netId}`] const config = networkConfig[`netId${netId}`]
const { constants, tokens, nativeCurrency, deployedBlock } = config const { constants, tokens, nativeCurrency, deployedBlock } = config
@ -13,7 +11,7 @@ function main() {
console.log(`\n ::: ${netId} [${nativeCurrency.toUpperCase()}] :::`) 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}`) console.log(`\n instanceDenomation - ${instance}`)
const withdrawalCachedEvents = loadCachedEvents({ const withdrawalCachedEvents = loadCachedEvents({

View File

@ -3,7 +3,7 @@ import 'dotenv/config'
import fs from 'fs' import fs from 'fs'
import { uniqBy } from 'lodash' import { uniqBy } from 'lodash'
import networkConfig from '../networkConfig' import networkConfig, { enabledChains } from '../networkConfig'
import ABI from '../abis/TornadoProxy.abi.json' import ABI from '../abis/TornadoProxy.abi.json'
import { getPastEvents, loadCachedEvents } from './helpers' import { getPastEvents, loadCachedEvents } from './helpers'
@ -64,8 +64,6 @@ async function saveEncryptedNote(netId) {
async function main() { async function main() {
const [, , , chain] = process.argv const [, , , chain] = process.argv
const enabledChains = networkConfig.enabledChains
if (!enabledChains.includes(chain)) { if (!enabledChains.includes(chain)) {
throw new Error(`Supported chain ids ${enabledChains.join(', ')}`) throw new Error(`Supported chain ids ${enabledChains.join(', ')}`)
} }

View File

@ -3,7 +3,7 @@ import 'dotenv/config'
import fs from 'fs' import fs from 'fs'
import { uniqBy } from 'lodash' import { uniqBy } from 'lodash'
import networkConfig from '../networkConfig' import networkConfig, { enabledChains } from '../networkConfig'
import ABI from '../abis/Instance.abi.json' import ABI from '../abis/Instance.abi.json'
import { loadCachedEvents, getPastEvents } from './helpers' import { loadCachedEvents, getPastEvents } from './helpers'
@ -82,8 +82,6 @@ async function main(type, netId) {
async function start() { async function start() {
const [, , , chain] = process.argv const [, , , chain] = process.argv
const enabledChains = networkConfig.enabledChains
if (!enabledChains.includes(chain)) { if (!enabledChains.includes(chain)) {
throw new Error(`Supported chain ids ${enabledChains.join(', ')}`) throw new Error(`Supported chain ids ${enabledChains.join(', ')}`)
} }

View File

@ -6,7 +6,7 @@ import BloomFilter from 'bloomfilter.js'
import { MerkleTree } from 'fixed-merkle-tree' import { MerkleTree } from 'fixed-merkle-tree'
import { buildMimcSponge } from 'circomlibjs' import { buildMimcSponge } from 'circomlibjs'
import networkConfig from '../networkConfig' import networkConfig, { enabledChains } from '../networkConfig'
import { loadCachedEvents, save } from './helpers' import { loadCachedEvents, save } from './helpers'
@ -144,8 +144,6 @@ async function initMimc() {
async function main() { async function main() {
const [, , , chain] = process.argv const [, , , chain] = process.argv
const enabledChains = networkConfig.enabledChains
if (!enabledChains.includes(chain)) { if (!enabledChains.includes(chain)) {
throw new Error(`Supported chain ids ${enabledChains.join(', ')}`) throw new Error(`Supported chain ids ${enabledChains.join(', ')}`)
} }

View File

@ -1,6 +1,6 @@
import { uniqBy } from 'lodash' import { uniqBy } from 'lodash'
import networkConfig from '../networkConfig' import networkConfig, { enabledChains, chainsWithEncryptedNotes } from '../networkConfig'
import { loadCachedEvents, save } from './helpers' import { loadCachedEvents, save } from './helpers'
@ -29,7 +29,7 @@ async function updateCommon(netId) {
if (isSaved) { if (isSaved) {
try { try {
await testCommon(netId, type, filename) testCommon(netId, type, filename)
} catch (err) { } catch (err) {
console.error(err.message) 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 { deployedBlock } = networkConfig[`netId${netId}`]
const cachedEvents = await loadCachedEvents({ const cachedEvents = loadCachedEvents({
name: filename, name: filename,
directory: EVENTS_PATH, directory: EVENTS_PATH,
deployedBlock deployedBlock
@ -65,9 +65,6 @@ async function testCommon(netId, type, filename) {
} }
async function main() { async function main() {
const enabledChains = networkConfig.enabledChains
const chainsWithEncryptedNotes = networkConfig.chainsWithEncryptedNotes
for (let i = 0; i < enabledChains.length; i++) { for (let i = 0; i < enabledChains.length; i++) {
const netId = enabledChains[i] const netId = enabledChains[i]

View File

@ -2,7 +2,7 @@ import Web3 from 'web3'
import graph from '@/services/graph' import graph from '@/services/graph'
import { download } from '@/store/snark' import { download } from '@/store/snark'
import networkConfig from '@/networkConfig' import networkConfig, { enabledChains } from '@/networkConfig'
import InstanceABI from '@/abis/Instance.abi.json' import InstanceABI from '@/abis/Instance.abi.json'
import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants' import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants'
import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils' import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils'
@ -19,7 +19,7 @@ class EventService {
this.idb = window.$nuxt.$indexedDB(netId) this.idb = window.$nuxt.$indexedDB(netId)
const { nativeCurrency } = networkConfig[`netId${netId}`] const { nativeCurrency } = networkConfig[`netId${netId}`]
const hasCache = networkConfig.enabledChains.includes(netId.toString()) const hasCache = enabledChains.includes(netId.toString())
this.netId = netId this.netId = netId
this.amount = amount this.amount = amount