alloy icon indicating copy to clipboard operation
alloy copied to clipboard

feat: multicall

Open nhtyy opened this issue 5 months ago • 3 comments

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

nhtyy avatar Aug 29 '24 19:08 nhtyy