Replies: 3 comments
-
in the mean time I use this. import * as ethers from 'ethers';
export class OptimizedJsonRpcBatchProvider extends ethers.providers.JsonRpcBatchProvider {
private skipChainIdCheck: boolean = false;
disableChainIdCheck() {
this.skipChainIdCheck = true;
}
override async getNetwork(): Promise<ethers.ethers.providers.Network> {
if (this.skipChainIdCheck)
return await this._ready();
return await super.getNetwork();
}
}
export class OptimizedJsonRpcProvider extends ethers.providers.JsonRpcProvider {
private skipChainIdCheck: boolean = false;
disableChainIdCheck() {
this.skipChainIdCheck = true;
}
override async getNetwork(): Promise<ethers.ethers.providers.Network> {
if (this.skipChainIdCheck)
return await this._ready();
return await super.getNetwork();
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can use the In v6, passing a config with |
Beta Was this translation helpful? Give feedback.
0 replies
-
(moving to discussions) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ethers Version
5.7.0
Search Terms
getNetwork() skip chain id
Describe the Problem
I want to be able to create a JsonRpcProvider and it not query eth_chainId all the time, but i noticed the method
getNetwork() of the provider always checks for the chain id has potentially changed in the rpc response from the one provided it the constructor.
Could it be possible to add a skip on that condition without me having to do the following.
Code Snippet
any call example this one. provider.getGasPrice()
Contract ABI
Errors
Environment
node.js (older than v12)
Environment (Other)
all environments behave the same.
Beta Was this translation helpful? Give feedback.
All reactions