Skip to content

Any way to reduce provider calls for subscriptions? #1801

Answered by zemse
rhlsthrm asked this question in Q&A
Discussion options

You must be logged in to vote

Heya Rahul!

You can definitely update the polling interval:

provider.pollingInterval = 10000 // default 4000

If you're having a lot of polling, you might leverage using the JSON RPC API directly. There is a eth_getfilterchanges which has the following benefits:

  • You can combine filters into the single filter in some cases, which might help you reduce calls (e.g. listening to ERC20 transfers from various contract addresses)
  • You get reorg handeling

The downsides is that you have is you have to use the lower level API:

const filterId = await provider.send('eth_newFilter', [{topics: ['..'], address: ['0x123', '0x456'], fromBlock: '', toBlock: 'latest'}]);

const logs = await provider.send('e…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rhlsthrm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants