Open mds1 opened 1 year ago
I would like to work on this
This UX is much better than manually configuring the multicall.
Motivated by this exact pain point in our already large codebase
hey @mds1, happy to report I have completed the implementation in #2684 supporting the ideal DX you describe
should probably mirror the config options here https://viem.sh/docs/clients/public.html#batch-multicall-optional
Hey, looking also for the RPC batch request feature in Rust, is there a new solution available since opening this issue/PR ? TY
Is your feature request related to a problem? Please describe. viem has a really nice feature where consecutive calls are held in a queue then automatically batched using Multicall3. As you can see from the docs, this enables really nice UX such as:
This UX is much better than manually configuring the multicall. And a multicall results in significantly better performance and reduced RPC bills compared to individual calls
The other motivation for asking this is related to upstream usage in foundry. When users write forge tests or scripts, they'll often make many view calls to fetch data from the chain. Currently each call is a single RPC request, so you quickly end up with a lot of RPC calls, resulting in throttling and slower tests.
Supporting this feature and leveraging it in forge can result in significantly faster fork tests and scripts.
Describe the solution you'd like I'm not sure how feasible a viem-like solution is in rust, but that's the ideal solution here: abstract away the need for users to worry about multicall but automatically batching calls, e.g. the below should be a single RPC call:
Describe alternatives you've considered Explicit multicall batching is the main alternative
Additional context Idea came out of a convo in foundry support telegram: https://t.me/foundry_support/40543