Queue huge multicall to avoid rate limit from rpcs #1305
Unanswered
oxSaturn
asked this question in
Idea / Feature Request
Replies: 2 comments
-
Also running into this issue currently, would be great to see this handled better. Does anyone have any workarounds they are using for the time being? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Not sure if OP has resolved this, but one approach might be to use Bluebird map (http://bluebirdjs.com/docs/getting-started.html) and cap the concurrency limit. |
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
-
I don't know if anyone ran into a similar issue before, but when you pass a huge array to
contracts
ofmulticall
, you'll likely get rate limited by rpcs:Due to the implementation of
Promise.allSettled
here https://github.com/wagmi-dev/viem/blob/47fcd4404153def3d5dc91086cac018e312ce8a4/src/actions/public/multicall.ts#L201-L212.Thus I'm wondering if viem itself can have something built-in mechanism to split and queue that huge
chunkedCalls
, for instance, we can allow users to customize amulticall.handleChunkedCalls
function and uses it when defined:In
handleChunkedCalls
users will implement the queue system to split the hugechunkedCalls
to avoid rate limit.Beta Was this translation helpful? Give feedback.
All reactions