Commit b669ec69 authored by Moody Salem's avatar Moody Salem

workaround for detectNetwork on our custom provider

parent 2d4b60b9
......@@ -28,7 +28,7 @@ interface BatchItem {
reject: (error: Error) => void
}
class MiniRpcProvider implements AsyncSendable {
export class MiniRpcProvider implements AsyncSendable {
public readonly isMetaMask: false = false
public readonly chainId: number
public readonly url: string
......
import { Web3Provider } from '@ethersproject/providers'
import { MiniRpcProvider } from '../connectors/NetworkConnector'
export default function getLibrary(provider: any): Web3Provider {
// ethers tries to detect the network which fails and is unnecessary with our mini rpc provider if we do not pass the correct network id
if (provider instanceof MiniRpcProvider) {
return new Web3Provider(provider as any, provider.chainId)
}
const library = new Web3Provider(provider, 'any')
library.pollingInterval = 15000
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