Commit 7e709e10 authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

fix(L2): removes network-specific polling (#3912)

parent 7389b178
import { Web3Provider } from '@ethersproject/providers'
import ms from 'ms.macro'
import { SupportedChainId } from '../constants/chains'
const NETWORK_POLLING_INTERVALS: { [chainId: number]: number } = {
[SupportedChainId.OPTIMISM]: ms`1s`,
[SupportedChainId.OPTIMISTIC_KOVAN]: ms`1s`,
}
export default function getLibrary(provider: any): Web3Provider {
const library = new Web3Provider(
provider,
......@@ -17,13 +10,6 @@ export default function getLibrary(provider: any): Web3Provider {
? parseInt(provider.chainId)
: 'any'
)
library.pollingInterval = 15_000
library.detectNetwork().then((network) => {
const networkPollingInterval = NETWORK_POLLING_INTERVALS[network.chainId]
if (networkPollingInterval) {
console.debug('Setting polling interval', networkPollingInterval)
library.pollingInterval = networkPollingInterval
}
})
library.pollingInterval = ms`15s`
return library
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment