-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
enhancementNew feature or improvement.New feature or improvement.fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v6Issues regarding v6Issues regarding v6
Description
Ethers Version
6.8.0
Search Terms
WebSocketProvider, eth_chainId
Describe the Problem
eth_chainId is being called on every eth_call type rpc call with WebSocketProvider. This is very wasteful on third-party node provider. Running in NodeJS environment. I have read all the eth_chainId related issues in ethersjs but no luck.
Code Snippet
import { Contract, WebSocketProvider } from "ethers";
const provider = new WebSocketProvider(
`THIRD_PARTY_WSS_URL`,
1
);
const ct = new Contract(
"0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc",
abi,
provider
);
await ct.getReserves();
// An example of an eth_call method call.
// Third-party node provider registers both eth_chainId and eth_call
// every time the method is called. I only want eth_call to be registered.Contract ABI
[
{
"constant": true,
"inputs": [],
"name": "getReserves",
"outputs": [
{ "internalType": "uint112", "name": "_reserve0", "type": "uint112" },
{ "internalType": "uint112", "name": "_reserve1", "type": "uint112" },
{
"internalType": "uint32",
"name": "_blockTimestampLast",
"type": "uint32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
]Errors
No response
Environment
Ethereum (mainnet/ropsten/rinkeby/goerli), node.js (v12 or newer)
Environment (Other)
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or improvement.New feature or improvement.fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v6Issues regarding v6Issues regarding v6