Remove chainnodes rpc and fixed progress bar #1

Closed
tornadocontrib wants to merge 2 commits from fix-progress into development
9 changed files with 6 additions and 69 deletions

View File

@ -1,8 +1,6 @@
PINATA_API_KEY= PINATA_API_KEY=
PINATA_SECRET_API_KEY= PINATA_SECRET_API_KEY=
CHAINNODES_KEY=
WC_BRIDGE= WC_BRIDGE=
STORE_NAME= STORE_NAME=

View File

@ -32,7 +32,6 @@ jobs:
- name: Build - name: Build
run: yarn generate run: yarn generate
env: env:
CHAINNODES_KEY: ${{ secrets.CHAINNODES_KEY }}
WC_BRIDGE: ${{ secrets.WC_BRIDGE }} WC_BRIDGE: ${{ secrets.WC_BRIDGE }}
OLD_STORE_NAME: ${{ secrets.OLD_STORE_NAME }} OLD_STORE_NAME: ${{ secrets.OLD_STORE_NAME }}
STORE_NAME: ${{ secrets.STORE_NAME }} STORE_NAME: ${{ secrets.STORE_NAME }}

View File

@ -3,14 +3,15 @@
<div class="loading-container"> <div class="loading-container">
<div class="loading-tornado" data-test="tornado_loader"></div> <div class="loading-tornado" data-test="tornado_loader"></div>
<div class="loading-message">{{ message }}...</div> <div class="loading-message">{{ message }}...</div>
<div v-if="progress >= 0" class="loading-message">{{ progress }}%</div>
<approve-loader v-if="isApprove" /> <approve-loader v-if="isApprove" />
</div> </div>
</b-loading> </b-loading>
</template> </template>
<script> <script>
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import ApproveLoader from './ApproveLoader' import ApproveLoader from './ApproveLoader'
export default { export default {
components: { components: {
ApproveLoader ApproveLoader
@ -18,7 +19,7 @@ export default {
computed: { computed: {
...mapGetters('metamask', ['isWalletConnect']), ...mapGetters('metamask', ['isWalletConnect']),
...mapState('metamask', ['providerName']), ...mapState('metamask', ['providerName']),
...mapState('loading', ['enabled', 'message', 'progress', 'type']), ...mapState('loading', ['enabled', 'message', 'type']),
isApprove() { isApprove() {
return this.type === 'approve' return this.type === 'approve'
} }

View File

@ -338,7 +338,6 @@ export default {
} }
this.$store.dispatch('application/setAndUpdateStatistic', { currency, amount: Number(amount) }) this.$store.dispatch('application/setAndUpdateStatistic', { currency, amount: Number(amount) })
this.$store.dispatch('fees/calculateWithdrawalFeeViaRelayer', {}) this.$store.dispatch('fees/calculateWithdrawalFeeViaRelayer', {})
this.$store.dispatch('loading/updateProgress', { progress: -1 })
this.depositsPast = Number(depositsPast) <= 0 ? 0 : depositsPast this.depositsPast = Number(depositsPast) <= 0 ? 0 : depositsPast
this.depositTxHash = txHash this.depositTxHash = txHash
this.depositTimestamp = timestamp this.depositTimestamp = timestamp

View File

@ -25,10 +25,6 @@ export default {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/mainnet' url: 'https://tornadocash-rpc.com/mainnet'
}, },
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
mevblockerRPC: { mevblockerRPC: {
name: 'MevblockerRPC', name: 'MevblockerRPC',
url: 'https://rpc.mevblocker.io' url: 'https://rpc.mevblocker.io'
@ -152,10 +148,6 @@ export default {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/bsc' url: 'https://tornadocash-rpc.com/bsc'
}, },
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
oneRPC: { oneRPC: {
name: '1RPC', name: '1RPC',
url: 'https://1rpc.io/bnb' url: 'https://1rpc.io/bnb'
@ -203,10 +195,6 @@ export default {
multicall: '0x11ce4B23bD875D7F5C6a31084f55fDe1e9A87507', multicall: '0x11ce4B23bD875D7F5C6a31084f55fDe1e9A87507',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
oneRpc: { oneRpc: {
name: '1RPC', name: '1RPC',
url: 'https://1rpc.io/matic' url: 'https://1rpc.io/matic'
@ -259,10 +247,6 @@ export default {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/op' url: 'https://tornadocash-rpc.com/op'
}, },
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
oneRpc: { oneRpc: {
name: '1RPC', name: '1RPC',
url: 'https://1rpc.io/op' url: 'https://1rpc.io/op'
@ -310,14 +294,6 @@ export default {
multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2', multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2',
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4', echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
rpcUrls: { rpcUrls: {
tornadoRPC: {
name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/arbitrum'
},
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://arbitrum-one.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
oneRpc: { oneRpc: {
name: '1rpc', name: '1rpc',
url: 'https://1rpc.io/arb' url: 'https://1rpc.io/arb'
@ -373,10 +349,6 @@ export default {
name: 'Tornado RPC', name: 'Tornado RPC',
url: 'https://tornadocash-rpc.com/gnosis' url: 'https://tornadocash-rpc.com/gnosis'
}, },
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
},
blockPi: { blockPi: {
name: 'BlockPi', name: 'BlockPi',
url: 'https://gnosis.blockpi.network/v1/rpc/public' url: 'https://gnosis.blockpi.network/v1/rpc/public'
@ -486,10 +458,6 @@ export default {
sepolia: { sepolia: {
name: 'Sepolia RPC', name: 'Sepolia RPC',
url: 'https://rpc.sepolia.org' url: 'https://rpc.sepolia.org'
},
chainnodes: {
name: 'Chainnodes RPC',
url: 'https://sepolia.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
} }
}, },
tokens: { tokens: {

View File

@ -187,7 +187,6 @@ export default {
new webpack.IgnorePlugin(/worker_threads/), new webpack.IgnorePlugin(/worker_threads/),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': JSON.stringify({ 'process.env': JSON.stringify({
CHAINNODES_KEY: process.env.CHAINNODES_KEY,
WC_BRIDGE: process.env.WC_BRIDGE, WC_BRIDGE: process.env.WC_BRIDGE,
OLD_STORE_NAME: process.env.OLD_STORE_NAME, OLD_STORE_NAME: process.env.OLD_STORE_NAME,
STORE_NAME: process.env.STORE_NAME, STORE_NAME: process.env.STORE_NAME,
@ -225,7 +224,7 @@ export default {
}, },
provider: { provider: {
rpcUrl: `https://mainnet.chainnodes.org/${process.env.CHAINNODES_KEY}` rpcUrl: 'https://tornadocash-rpc.com'
}, },
// todo make custom loading page // todo make custom loading page

View File

@ -7,13 +7,6 @@ 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'
let store
if (process.browser) {
window.onNuxtReady(({ $store }) => {
store = $store
})
}
class EventService { class EventService {
constructor({ netId, amount, currency, factoryMethods }) { constructor({ netId, amount, currency, factoryMethods }) {
this.idb = window.$nuxt.$indexedDB(netId) this.idb = window.$nuxt.$indexedDB(netId)
@ -36,15 +29,6 @@ class EventService {
return `${type}s_${this.netId}_${this.currency}_${this.amount}` return `${type}s_${this.netId}_${this.currency}_${this.amount}`
} }
updateEventProgress(percentage, type) {
if (store) {
store.dispatch('loading/updateProgress', {
message: `Fetching past ${type} events`,
progress: Math.ceil(percentage * 100)
})
}
}
async getEvents(type) { async getEvents(type) {
let cachedEvents = await this.getEventsFromDB(type) let cachedEvents = await this.getEventsFromDB(type)
@ -345,8 +329,6 @@ class EventService {
const batchCount = Math.ceil(batchDigest / batchSize) const batchCount = Math.ceil(batchDigest / batchSize)
if (fromBlock < currentBlockNumber) { if (fromBlock < currentBlockNumber) {
this.updateEventProgress(0, type)
for (let batchIndex = 0; batchIndex < batchCount; batchIndex++) { for (let batchIndex = 0; batchIndex < batchCount; batchIndex++) {
const isLastBatch = batchIndex === batchCount - 1 const isLastBatch = batchIndex === batchCount - 1
const params = new Array(batchSize).fill('').map((_, i) => { const params = new Array(batchSize).fill('').map((_, i) => {
@ -361,8 +343,6 @@ class EventService {
failed = failed.concat(requests.filter((e) => e.isFailedBatch)) failed = failed.concat(requests.filter((e) => e.isFailedBatch))
lastBlock = params[batchSize - 1].toBlock lastBlock = params[batchSize - 1].toBlock
const progressIndex = batchIndex - failed.length / batchSize
if (isLastBatch && failed.length !== 0) { if (isLastBatch && failed.length !== 0) {
const failedBatch = await Promise.all(this.createBatchRequest(failed)) const failedBatch = await Promise.all(this.createBatchRequest(failed))
const failedReqs = flattenNArray(failedBatch) const failedReqs = flattenNArray(failedBatch)
@ -374,7 +354,6 @@ class EventService {
throw new Error('Failed to batch events') throw new Error('Failed to batch events')
} }
} }
this.updateEventProgress(progressIndex / batchCount, type)
} }
return { return {

View File

@ -26,7 +26,7 @@ const CHAIN_GRAPH_URLS = {
100: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/xdai-tornado-subgraph', 100: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/xdai-tornado-subgraph',
137: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/matic-tornado-subgraph', 137: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/matic-tornado-subgraph',
42161: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/arbitrum-tornado-subgraph', 42161: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/arbitrum-tornado-subgraph',
43114: 'https://api.thegraph.com/subgraphs/name/tornadocash/avalanche-tornado-subgraph', 43114: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/avalanche-tornado-subgraph',
11155111: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/sepolia-tornado-subgraph' 11155111: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/sepolia-tornado-subgraph'
} }

View File

@ -1,7 +1,6 @@
export const state = () => { export const state = () => {
return { return {
message: '', message: '',
progress: -1,
enabled: false, enabled: false,
type: null type: null
} }
@ -10,16 +9,14 @@ export const state = () => {
export const getters = {} export const getters = {}
export const mutations = { export const mutations = {
ENABLE(state, { message, progress, type }) { ENABLE(state, { message, type }) {
state.message = message state.message = message
state.enabled = true state.enabled = true
state.progress = progress
state.type = type state.type = type
}, },
DISABLE(state) { DISABLE(state) {
state.message = '' state.message = ''
state.enabled = false state.enabled = false
state.progress = -1
state.type = null state.type = null
} }
} }
@ -31,9 +28,6 @@ export const actions = {
changeText({ commit }, { message, type }) { changeText({ commit }, { message, type }) {
commit('ENABLE', { message, type }) commit('ENABLE', { message, type })
}, },
updateProgress({ commit }, { message, progress }) {
commit('ENABLE', { message, progress })
},
disable({ commit }) { disable({ commit }) {
commit('DISABLE') commit('DISABLE')
}, },