alloy
alloy copied to clipboard
feat: multicall
Motivation
https://github.com/alloy-rs/alloy/issues/1119 https://github.com/alloy-rs/alloy/issues/328
Solution
Introduce a new type for each Multicall Type (aggregate
, try_aggregate
. aggreagte3
) that holds an R: AsRef<MultiCall>
When a users creates a multicall for the first time we put it in an arc internally
when a users wants to make a multicall we give them a wrapper with an &Arc<_> to start, users can mutate this wrapper that holds the ref to add calls and set other options.
You can execute the call from here, or convert it into an "Owned" version of the call (thru the From trait) which clones the arc and you can name the batch of calls without lifetime
PR Checklist
- [ ] Added Tests
- [x] Added Documentation
- [?] Breaking changes: I think this breaks any downstream implementors of
TransactionRequest