-
Notifications
You must be signed in to change notification settings - Fork 247
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
Conversation
/// [`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> { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already exists
alloy/crates/provider/src/builder.rs
Lines 114 to 125 in 9a33128
/// 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 } | |
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes Ethereum by default
Ref #263