forked from tornadocash/classic-ui
Compare commits
3 Commits
b288ce9356
...
780ccdc44c
Author | SHA1 | Date | |
---|---|---|---|
780ccdc44c | |||
5ebf55204d | |||
2cf3b33b62 |
@ -21,8 +21,12 @@ export default {
|
||||
networkName: 'Ethereum Mainnet',
|
||||
deployedBlock: 9116966,
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
tornadoRPC: {
|
||||
name: 'Tornado RPC',
|
||||
url: 'https://tornadocash-rpc.com/mainnet'
|
||||
},
|
||||
chainnodes: {
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
},
|
||||
mevblockerRPC: {
|
||||
@ -141,8 +145,12 @@ export default {
|
||||
multicall: '0x41263cba59eb80dc200f3e2544eda4ed6a90e76c',
|
||||
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
tornadoRPC: {
|
||||
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: {
|
||||
@ -193,7 +201,7 @@ export default {
|
||||
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
name: 'Tornado RPC',
|
||||
name: 'Chainnodes RPC',
|
||||
url: 'https://polygon-mainnet.chainnodes.org/d692ae63-0a7e-43e0-9da9-fe4f4cc6c607'
|
||||
},
|
||||
oneRpc: {
|
||||
@ -244,8 +252,12 @@ export default {
|
||||
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
|
||||
ovmGasPriceOracleContract: '0x420000000000000000000000000000000000000F',
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
tornadoRPC: {
|
||||
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: {
|
||||
@ -295,8 +307,12 @@ export default {
|
||||
multicall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2',
|
||||
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
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: {
|
||||
@ -350,8 +366,12 @@ export default {
|
||||
multicall: '0xb5b692a88bdfc81ca69dcb1d924f59f0413a602a',
|
||||
echoContractAccount: '0xa75BF2815618872f155b7C4B0C81bF990f5245E4',
|
||||
rpcUrls: {
|
||||
chainnodes: {
|
||||
tornadoRPC: {
|
||||
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: {
|
||||
|
@ -412,10 +412,11 @@ class EventService {
|
||||
async getEventsFromBlock({ fromBlock, graphMethod, type }) {
|
||||
try {
|
||||
// ToDo think about undefined
|
||||
const rpcEvents = await this.getEventsFromRpc({ fromBlock, type })
|
||||
|
||||
const allEvents = [].concat(rpcEvents || [])
|
||||
const graphEvents = await this.getEventsFromGraph({ fromBlock, methodName: graphMethod })
|
||||
const lastSyncBlock = fromBlock > graphEvents?.lastBlock ? fromBlock : graphEvents?.lastBlock
|
||||
const rpcEvents = await this.getEventsFromRpc({ fromBlock: lastSyncBlock, type })
|
||||
|
||||
const allEvents = [].concat(graphEvents?.events || [], rpcEvents || [])
|
||||
if (allEvents.length) {
|
||||
return {
|
||||
events: allEvents,
|
||||
|
@ -3,6 +3,7 @@ import namehash from 'eth-ens-namehash'
|
||||
import { BigNumber as BN } from 'bignumber.js'
|
||||
import { toChecksumAddress, isAddress } from 'web3-utils'
|
||||
|
||||
import { graph } from '@/services'
|
||||
import networkConfig from '@/networkConfig'
|
||||
import { REGISTRY_DEPLOYED_BLOCK } from '@/constants'
|
||||
import { sleep, flattenNArray } from '@/utils'
|
||||
@ -169,9 +170,21 @@ class RelayerRegister {
|
||||
fetchRelayers = async () => {
|
||||
const blockRange = 10000
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { blockTo, cachedEvents } = await this.getCachedData()
|
||||
let { blockFrom, blockTo, cachedEvents } = await this.getCachedData()
|
||||
let allRelayers = cachedEvents
|
||||
|
||||
if (!cachedEvents || !cachedEvents.length) {
|
||||
const { lastSyncBlock, events } = await graph.getAllRegisters(blockFrom)
|
||||
|
||||
if (events.length) {
|
||||
blockTo = lastSyncBlock + 1
|
||||
cachedEvents = events.map((el) => ({
|
||||
ensName: el.ensName,
|
||||
relayerAddress: toChecksumAddress(el.address)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
const currentBlockNumber = await this.provider.getBlockNumber()
|
||||
const fromBlock = cachedEvents.length === 0 ? REGISTRY_DEPLOYED_BLOCK[1] : blockTo
|
||||
const blockDifference = currentBlockNumber - fromBlock
|
||||
@ -181,7 +194,7 @@ class RelayerRegister {
|
||||
let registerRelayerEvents
|
||||
let lastSyncBlock = blockTo
|
||||
|
||||
if (cachedEvents.length > 0 || blockDifference === 0) {
|
||||
if (blockDifference <= 0) {
|
||||
return cachedEvents
|
||||
} else if (blockDifference >= blockRange) {
|
||||
toBlock = currentBlockNumber
|
||||
|
Loading…
Reference in New Issue
Block a user