diff --git a/constants/variables.js b/constants/variables.js index f7941b2..d3977bc 100644 --- a/constants/variables.js +++ b/constants/variables.js @@ -61,7 +61,6 @@ export const cachedEventsLength = { } export const httpConfig = { - withCredentials: false, // buffer for tor connections timeout: 30000, keepAlive: true diff --git a/networkConfig.js b/networkConfig.js index 96601f7..31973d8 100644 --- a/networkConfig.js +++ b/networkConfig.js @@ -278,8 +278,8 @@ export default { echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', rpcUrls: { Arbitrum: { - name: 'Arbitrum Public RPC', - url: 'https://arb1.arbitrum.io/rpc' + name: '1RPC', + url: 'https://1rpc.io/arb' } }, tokens: { diff --git a/store/application.js b/store/application.js index 84ed4fa..1c9f4f3 100644 --- a/store/application.js +++ b/store/application.js @@ -3,7 +3,7 @@ import Web3 from 'web3' import networkConfig from '@/networkConfig' -import { cachedEventsLength, eventsType } from '@/constants' +import { cachedEventsLength, eventsType, httpConfig } from '@/constants' import MulticallABI from '@/abis/Multicall.json' import InstanceABI from '@/abis/Instance.abi.json' @@ -117,7 +117,8 @@ const getters = { const config = networkConfig[`netId${netId}`] const { url } = rootState.settings[`netId${netId}`].rpc const address = config.tokens[currency].instanceAddress[amount] - const web3 = new Web3(url) + const httpProvider = new Web3.providers.HttpProvider(url, httpConfig) + const web3 = new Web3(httpProvider) return new web3.eth.Contract(InstanceABI, address) }, multicallContract: (state, getters, rootState) => ({ netId }) => { @@ -258,6 +259,7 @@ const getters = { const actions = { setAndUpdateStatistic({ dispatch, commit }, { currency, amount }) { commit('SET_SELECTED_STATISTIC', { currency, amount }) + dispatch('updateSelectEvents') }, async updateSelectEvents({ dispatch, commit, state, rootGetters, getters }) { @@ -265,15 +267,14 @@ const actions = { const { currency, amount } = state.selectedStatistic const eventService = getters.eventsInterface.getService({ netId, amount, currency }) - const graphEvents = await eventService.getEventsFromGraph({ methodName: 'getStatistic' }) let statistic = graphEvents?.events - if (!statistic || !statistic.length) { - const fresh = await eventService.getStatisticsRpc({ eventsCount: 10 }) + const latestDeposits = [] - statistic = fresh || [] + if (!statistic || !statistic.length) { + statistic = [] } const { nextDepositIndex, anonymitySet } = await dispatch('getLastDepositIndex', { @@ -284,8 +285,6 @@ const actions = { statistic = statistic.sort((a, b) => a.leafIndex - b.leafIndex) - const latestDeposits = [] - for (const event of statistic.slice(-10)) { latestDeposits.unshift({ index: event.leafIndex, diff --git a/store/gasPrices.js b/store/gasPrices.js index 49a5ba3..8145814 100644 --- a/store/gasPrices.js +++ b/store/gasPrices.js @@ -32,6 +32,7 @@ export const getters = { const address = config.ovmGasPriceOracleContract if (address) { const web3 = new Web3(url) + return new web3.eth.Contract(OvmGasPriceOracleABI, address) } diff --git a/store/governance/gov.js b/store/governance/gov.js index 5e7f69d..933d6df 100644 --- a/store/governance/gov.js +++ b/store/governance/gov.js @@ -10,6 +10,8 @@ import networkConfig from '@/networkConfig' import GovernanceABI from '@/abis/Governance.abi.json' import AggregatorABI from '@/abis/Aggregator.abi.json' +import { httpConfig } from '@/constants' + const { numberToHex, toWei, fromWei, toBN, hexToNumber, hexToNumberString } = require('web3-utils') const state = () => { @@ -47,7 +49,9 @@ const getters = { }, getWeb3: (state, getters, rootState) => ({ netId }) => { const { url } = rootState.settings[`netId${netId}`].rpc - return new Web3(url) + const httpProvider = new Web3.providers.HttpProvider(url, httpConfig) + + return new Web3(httpProvider) }, govContract: (state, getters, rootState) => ({ netId }) => { const config = getters.getConfig({ netId }) diff --git a/store/snark.js b/store/snark.js index f613929..516ab1f 100644 --- a/store/snark.js +++ b/store/snark.js @@ -18,7 +18,7 @@ function buildGroth16() { function getEns() { const { url } = Object.values(networkConfig.netId1.rpcUrls)[0] - const provider = new Web3(new Web3.providers.HttpProvider(url)) + const provider = new Web3(url) return provider.eth.ens }