From f8bbdc5df596fa9e5bfb26e6022d30628113e2d6 Mon Sep 17 00:00:00 2001 From: Yash Atreya <44857776+yash-atreya@users.noreply.github.com> Date: Fri, 11 Apr 2025 10:56:06 +0530 Subject: [PATCH] feat(`multicall`): add CallItems to dynamic builder --- crates/provider/src/provider/multicall/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/provider/src/provider/multicall/mod.rs b/crates/provider/src/provider/multicall/mod.rs index 0b60d7cca56..e242dc3f395 100644 --- a/crates/provider/src/provider/multicall/mod.rs +++ b/crates/provider/src/provider/multicall/mod.rs @@ -177,6 +177,12 @@ where self } + /// Add a dynamic [`CallItem`] to the builder + pub fn add_call_dynamic(mut self, call: CallItem) -> Self { + self.calls.push(call.to_call3_value()); + self + } + /// Extend the builder with a sequence of calls pub fn extend( mut self, @@ -187,6 +193,14 @@ where } self } + + /// Extend the builder with a sequence of [`CallItem`]s + pub fn extend_calls(mut self, calls: impl IntoIterator>) -> Self { + for call in calls { + self = self.add_call_dynamic(call); + } + self + } } impl MulticallBuilder