-
We are using JsonRpcProviders and would like to reduce provider calls. We have subscriptions listening to contracts, and leaving the UI on means thousands of requests in a few minutes. Can we control the polling loop rate or anything? |
Beta Was this translation helpful? Give feedback.
Answered by
zemse
Jul 27, 2021
Replies: 1 comment
-
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:
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('eth_getfilterchanges', [filterId]); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rhlsthrm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Heya Rahul!
You can definitely update the polling interval:
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:
The downsides is that you have is you have to use the lower level API: