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: default to Ethereum network in ProviderBuilder #304

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

DaniPopes
Copy link
Member

Ref #263

/// [`tower::ServiceBuilder::layer`]: https://docs.rs/tower/latest/tower/struct.ServiceBuilder.html#method.layer
/// [`tower::ServiceBuilder`]: https://docs.rs/tower/latest/tower/struct.ServiceBuilder.html
pub fn layer<Inner>(self, layer: Inner) -> ProviderBuilder<Stack<Inner, L>> {
pub fn layer<Inner>(self, layer: Inner) -> ProviderBuilder<Stack<Inner, L>, N> {
Copy link
Member Author

Choose a reason for hiding this comment

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

need to be careful here not to ignore N, previously this would reset it back to ()

@@ -99,17 +98,16 @@ impl<L, N> ProviderBuilder<L, N> {
/// [`tower::ServiceBuilder`]. The first layer added will be the first to
Copy link
Member

Choose a reason for hiding this comment

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

maybe add pub fn network<Other: Network>(self) -> ProviderBuilder<Stack<Inner, L>, Other> for lazy users or programmatic switching?

Copy link
Member Author

Choose a reason for hiding this comment

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

Already exists

/// Change the network.
///
/// By default, the network is invalid, and contains the unit type `()`.
/// This method MUST be called before the provider is built. The `client`
/// and `provider` methods only exist when the network is valid.
///
/// ```rust,ignore
/// builder.network::<Arbitrum>()
/// ```
pub fn network<Net: Network>(self) -> ProviderBuilder<L, Net> {
ProviderBuilder { layer: self.layer, network: PhantomData }
}

Copy link
Member Author

@DaniPopes DaniPopes Mar 13, 2024

Choose a reason for hiding this comment

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

Just noticed docs need an update. cc @onbjerg we want Ethereum here by default right?

Copy link
Member

Choose a reason for hiding this comment

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

yes Ethereum by default

@DaniPopes DaniPopes merged commit 818b3e9 into main Mar 13, 2024
15 checks passed
@DaniPopes DaniPopes deleted the dani/default-provider-builder branch March 13, 2024 23:40
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.

3 participants