Skip to content
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

feat(provider): expose ProviderBuilder via fn builder() #858

Merged
merged 4 commits into from
Jun 11, 2024

Conversation

yash-atreya
Copy link
Member

Motivation

Closes #450

Solution

Add fn builder() -> ProviderBuilder in the Provider trait.

@prestwich @mattsse ptal

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya requested a review from mattsse June 10, 2024 17:53
@@ -36,6 +37,12 @@ impl<T: fmt::Debug, N> fmt::Debug for RootProvider<T, N> {
}
}

/// Helper function to directly access [`ProviderBuilder`] with minimal
/// generics.
pub fn builder<N: Network>() -> ProviderBuilder<Identity, Identity, N> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be ethereum network like in ProviderBuilder::new?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would create cyclic deps

Copy link
Member

@DaniPopes DaniPopes Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? It's right there in the imports in this file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, I read that as it should be "in ethereum network", as in the network crate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be ethereum network like in ProviderBuilder::new?

Cannot set defaults in a free function.

@DaniPopes
Copy link
Member

pending @mattsse or @prestwich

@prestwich prestwich merged commit a096e6e into main Jun 11, 2024
22 checks passed
@prestwich prestwich deleted the yash/resolve_450 branch June 11, 2024 21:14
ben186 pushed a commit to ben186/alloy that referenced this pull request Jul 27, 2024
…#858)

* feat(provider): expose `ProviderBuilder` via `fn builder()`

* feat(provider): free builder<N>() fn

* nit

* AnyNetwork test for builder fn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add builder method to Provider
4 participants