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

[Feature] Remove reqwest prefix from http related methods #448

Closed
zerosnacks opened this issue Apr 3, 2024 · 0 comments · Fixed by #462
Closed

[Feature] Remove reqwest prefix from http related methods #448

zerosnacks opened this issue Apr 3, 2024 · 0 comments · Fixed by #462
Labels
enhancement New feature or request

Comments

@zerosnacks
Copy link
Member

Component

provider, pubsub, rpc, transports

Describe the feature you would like

Considering we default to using the reqwest crate it makes sense to have all http related methods refer to that implementation.

on_reqwest_http -> on_http (

/// Build this provider with an Reqwest HTTP transport.
#[cfg(feature = "reqwest")]
pub fn on_reqwest_http(self, url: url::Url) -> Result<L::Provider, TransportError>
where
L: ProviderLayer<crate::ReqwestProvider<N>, alloy_transport_http::Http<reqwest::Client>, N>,
N: Network,
{
let client = ClientBuilder::default().reqwest_http(url);
Ok(self.on_client(client))
}
)
reqwest_http -> http (
/// Convenience function to create a new [`RpcClient`] with a [`reqwest`]
/// HTTP transport.
#[cfg(feature = "reqwest")]
pub fn reqwest_http(self, url: url::Url) -> RpcClient<L::Service>
where
L: Layer<alloy_transport_http::Http<reqwest::Client>>,
L::Service: Transport,
{
let transport = alloy_transport_http::Http::new(url);
let is_local = transport.guess_local();
self.transport(transport, is_local)
}
)

We would keep the hyper_ prefixed methods

Alternative to renaming is that we could add a http alias for reqwest_http.

Additional context

Originally scoped in: alloy-rs/examples#43 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant