Skip to content

feat(multicall): add CallItem to dynamic builder #2307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions crates/provider/src/provider/multicall/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ where
self
}

/// Add a dynamic [`CallItem`] to the builder
pub fn add_call_dynamic(mut self, call: CallItem<D>) -> Self {
self.calls.push(call.to_call3_value());
self
}

/// Extend the builder with a sequence of calls
pub fn extend(
mut self,
Expand All @@ -187,6 +193,14 @@ where
}
self
}

/// Extend the builder with a sequence of [`CallItem`]s
pub fn extend_calls(mut self, calls: impl IntoIterator<Item = CallItem<D>>) -> Self {
for call in calls {
self = self.add_call_dynamic(call);
}
self
}
}

impl<T, P, N> MulticallBuilder<T, &P, N>
Expand Down
Loading