You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would allow for any transport to be used (ws, ipc, http), instead of currently being constrained to http.
I wonder if it's possible to make this generic over the `Provider` and `Transport` (the `Network` should be hard coded to `Scroll`). This would allow us to use different providers/transport protocols to interact with the node (ws / HTTP). I think it should be possible something like this but I haven't got it working yet:
/// An authenticated [`alloy_provider::Provider`] to the [`super::ScrollEngineApi`].#[derive(Debug,Clone,Deref)]pubstructScrollAuthEngineApiProvider<ProviderT,TransportT>{#[deref]provider:ProviderT,_marker: std::marker::PhantomData<TransportT>,}impl<ProviderT,TransportT>ScrollAuthEngineApiProvider<ProviderT,TransportT>whereProviderT:Provider<TransportT,Scroll>,TransportT:Transport + Clone,{/// Returns a new [`ScrollAuthEngineApiProvider`], authenticated for interfacing with the Engine/// API server at the provided URL using the passed JWT secret.pubfnnew(jwt_secret:JwtSecret,url:Url) -> Self{let auth_layer = AuthLayer::new(jwt_secret);let hyper_client = hyper_util::client::legacy::Client::builder(TokioExecutor::new()).build_http::<Full<Bytes>>();let service = tower::ServiceBuilder::new().layer(auth_layer).service(hyper_client);let transport = HyperClient::<Full<Bytes>,_>::with_service(service);let is_url_local = guess_local_url(&url);let http = Http::with_client(transport, url);let client = RpcClient::new(http, is_url_local);let provider = ProviderBuilder::new().network::<Scroll>().on_client(client);Self{ provider,_marker:Default::default()}}}
I suggest you timebox this to an hour to see if you can get it working. If not then we will merge as is.
This would allow for any transport to be used (ws, ipc, http), instead of currently being constrained to http.
Originally posted by @frisitano in #147 (comment)
The text was updated successfully, but these errors were encountered: