forked from tornadocash/classic-ui
Compare commits
No commits in common. "33e3026cd19b0156d76db88d06ef79a7a91df26c" and "57d3ba5ac5ea8bab6e24b30630c933568dddbec9" have entirely different histories.
33e3026cd1
...
57d3ba5ac5
@ -1,6 +1,8 @@
|
||||
PINATA_API_KEY=
|
||||
PINATA_SECRET_API_KEY=
|
||||
|
||||
CHAINNODES_KEY=
|
||||
|
||||
WC_BRIDGE=
|
||||
|
||||
STORE_NAME=
|
||||
|
1
.github/workflows/nodejs.yml
vendored
1
.github/workflows/nodejs.yml
vendored
@ -32,6 +32,7 @@ jobs:
|
||||
- name: Build
|
||||
run: yarn generate
|
||||
env:
|
||||
CHAINNODES_KEY: ${{ secrets.CHAINNODES_KEY }}
|
||||
WC_BRIDGE: ${{ secrets.WC_BRIDGE }}
|
||||
OLD_STORE_NAME: ${{ secrets.OLD_STORE_NAME }}
|
||||
STORE_NAME: ${{ secrets.STORE_NAME }}
|
||||
|
@ -3,15 +3,14 @@
|
||||
<div class="loading-container">
|
||||
<div class="loading-tornado" data-test="tornado_loader"></div>
|
||||
<div class="loading-message">{{ message }}...</div>
|
||||
<div v-if="progress >= 0" class="loading-message">{{ progress }}%</div>
|
||||
<approve-loader v-if="isApprove" />
|
||||
</div>
|
||||
</b-loading>
|
||||
</template>
|
||||
<script>
|
||||
import { mapState, mapGetters } from 'vuex'
|
||||
|
||||
import ApproveLoader from './ApproveLoader'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ApproveLoader
|
||||
@ -19,7 +18,7 @@ export default {
|
||||
computed: {
|
||||
...mapGetters('metamask', ['isWalletConnect']),
|
||||
...mapState('metamask', ['providerName']),
|
||||
...mapState('loading', ['enabled', 'message', 'type']),
|
||||
...mapState('loading', ['enabled', 'message', 'progress', 'type']),
|
||||
isApprove() {
|
||||
return this.type === 'approve'
|
||||
}
|
||||
|
@ -338,6 +338,7 @@ export default {
|
||||
}
|
||||
this.$store.dispatch('application/setAndUpdateStatistic', { currency, amount: Number(amount) })
|
||||
this.$store.dispatch('fees/calculateWithdrawalFeeViaRelayer', {})
|
||||
this.$store.dispatch('loading/updateProgress', { progress: -1 })
|
||||
this.depositsPast = Number(depositsPast) <= 0 ? 0 : depositsPast
|
||||
this.depositTxHash = txHash
|
||||
this.depositTimestamp = timestamp
|
||||
|
@ -25,6 +25,10 @@ export default {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/mainnet'
|
||||
},
|
||||
chainnodes: {
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
},
|
||||
mevblockerRPC: {
|
||||
name: 'MevblockerRPC',
|
||||
url: 'https://rpc.mevblocker.io'
|
||||
@ -148,6 +152,10 @@ export default {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/bsc'
|
||||
},
|
||||
chainnodes: {
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://bsc-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
},
|
||||
oneRPC: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/bnb'
|
||||
@ -195,6 +203,10 @@ export default {
|
||||
multicall: '0x11ce4B23bD875D7F5C6a31084f55fDe1e9A87507',
|
||||
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
},
|
||||
oneRpc: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/matic'
|
||||
@ -247,6 +259,10 @@ export default {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/op'
|
||||
},
|
||||
chainnodes: {
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://optimism-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
},
|
||||
oneRpc: {
|
||||
name: '1RPC',
|
||||
url: 'https://1rpc.io/op'
|
||||
@ -294,6 +310,14 @@ export default {
|
||||
multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2',
|
||||
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
|
||||
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: {
|
||||
name: '1rpc',
|
||||
url: 'https://1rpc.io/arb'
|
||||
@ -349,6 +373,10 @@ export default {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/gnosis'
|
||||
},
|
||||
chainnodes: {
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://gnosis-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
},
|
||||
blockPi: {
|
||||
name: 'BlockPi',
|
||||
url: 'https://gnosis.blockpi.network/v1/rpc/public'
|
||||
@ -458,6 +486,10 @@ export default {
|
||||
sepolia: {
|
||||
name: 'Sepolia RPC',
|
||||
url: 'https://rpc.sepolia.org'
|
||||
},
|
||||
chainnodes: {
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://sepolia.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
}
|
||||
},
|
||||
tokens: {
|
||||
|
@ -187,6 +187,7 @@ export default {
|
||||
new webpack.IgnorePlugin(/worker_threads/),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': JSON.stringify({
|
||||
CHAINNODES_KEY: process.env.CHAINNODES_KEY,
|
||||
WC_BRIDGE: process.env.WC_BRIDGE,
|
||||
OLD_STORE_NAME: process.env.OLD_STORE_NAME,
|
||||
STORE_NAME: process.env.STORE_NAME,
|
||||
@ -224,7 +225,7 @@ export default {
|
||||
},
|
||||
|
||||
provider: {
|
||||
rpcUrl: 'https://tornadocash-rpc.com'
|
||||
rpcUrl: `https://mainnet.chainnodes.org/${process.env.CHAINNODES_KEY}`
|
||||
},
|
||||
|
||||
// todo make custom loading page
|
||||
|
@ -7,6 +7,13 @@ import InstanceABI from '@/abis/Instance.abi.json'
|
||||
import { CONTRACT_INSTANCES, eventsType, httpConfig } from '@/constants'
|
||||
import { sleep, flattenNArray, formatEvents, capitalizeFirstLetter } from '@/utils'
|
||||
|
||||
let store
|
||||
if (process.browser) {
|
||||
window.onNuxtReady(({ $store }) => {
|
||||
store = $store
|
||||
})
|
||||
}
|
||||
|
||||
class EventService {
|
||||
constructor({ netId, amount, currency, factoryMethods }) {
|
||||
this.idb = window.$nuxt.$indexedDB(netId)
|
||||
@ -29,6 +36,15 @@ class EventService {
|
||||
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) {
|
||||
let cachedEvents = await this.getEventsFromDB(type)
|
||||
|
||||
@ -329,6 +345,8 @@ class EventService {
|
||||
const batchCount = Math.ceil(batchDigest / batchSize)
|
||||
|
||||
if (fromBlock < currentBlockNumber) {
|
||||
this.updateEventProgress(0, type)
|
||||
|
||||
for (let batchIndex = 0; batchIndex < batchCount; batchIndex++) {
|
||||
const isLastBatch = batchIndex === batchCount - 1
|
||||
const params = new Array(batchSize).fill('').map((_, i) => {
|
||||
@ -343,6 +361,8 @@ class EventService {
|
||||
failed = failed.concat(requests.filter((e) => e.isFailedBatch))
|
||||
lastBlock = params[batchSize - 1].toBlock
|
||||
|
||||
const progressIndex = batchIndex - failed.length / batchSize
|
||||
|
||||
if (isLastBatch && failed.length !== 0) {
|
||||
const failedBatch = await Promise.all(this.createBatchRequest(failed))
|
||||
const failedReqs = flattenNArray(failedBatch)
|
||||
@ -354,6 +374,7 @@ class EventService {
|
||||
throw new Error('Failed to batch events')
|
||||
}
|
||||
}
|
||||
this.updateEventProgress(progressIndex / batchCount, type)
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -26,7 +26,7 @@ const CHAIN_GRAPH_URLS = {
|
||||
100: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/xdai-tornado-subgraph',
|
||||
137: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/matic-tornado-subgraph',
|
||||
42161: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/arbitrum-tornado-subgraph',
|
||||
43114: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/avalanche-tornado-subgraph',
|
||||
43114: 'https://api.thegraph.com/subgraphs/name/tornadocash/avalanche-tornado-subgraph',
|
||||
11155111: 'https://tornadocash-rpc.com/subgraphs/name/tornadocash/sepolia-tornado-subgraph'
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
export const state = () => {
|
||||
return {
|
||||
message: '',
|
||||
progress: -1,
|
||||
enabled: false,
|
||||
type: null
|
||||
}
|
||||
@ -9,14 +10,16 @@ export const state = () => {
|
||||
export const getters = {}
|
||||
|
||||
export const mutations = {
|
||||
ENABLE(state, { message, type }) {
|
||||
ENABLE(state, { message, progress, type }) {
|
||||
state.message = message
|
||||
state.enabled = true
|
||||
state.progress = progress
|
||||
state.type = type
|
||||
},
|
||||
DISABLE(state) {
|
||||
state.message = ''
|
||||
state.enabled = false
|
||||
state.progress = -1
|
||||
state.type = null
|
||||
}
|
||||
}
|
||||
@ -28,6 +31,9 @@ export const actions = {
|
||||
changeText({ commit }, { message, type }) {
|
||||
commit('ENABLE', { message, type })
|
||||
},
|
||||
updateProgress({ commit }, { message, progress }) {
|
||||
commit('ENABLE', { message, progress })
|
||||
},
|
||||
disable({ commit }) {
|
||||
commit('DISABLE')
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user