@@ -31,7 +31,8 @@ use std::{net::SocketAddr, path::PathBuf};
3131use base64:: Engine ;
3232use http:: { header, HeaderValue } ;
3333use jsonrpsee:: {
34- http_client:: { transport:: HttpBackend , HttpClient , HttpClientBuilder } ,
34+ core:: middleware:: RpcServiceBuilder ,
35+ http_client:: { transport:: HttpBackend , HttpClient , HttpClientBuilder , RpcService } ,
3536 server:: { ServerBuilder , ServerHandle } ,
3637} ;
3738
@@ -109,7 +110,9 @@ impl Builder {
109110 } ;
110111
111112 let mut module = jsonrpsee:: RpcModule :: new ( ( ) ) ;
112- module. register_method ( method_list_name, move |_params, & ( ) | method_names. clone ( ) ) ?;
113+ module. register_method ( method_list_name, move |_params, & ( ) , _extensions| {
114+ method_names. clone ( )
115+ } ) ?;
113116 Ok ( module)
114117 }
115118}
@@ -223,7 +226,7 @@ impl<T> MakeHeaderValue<T> for RpcAuthData {
223226 }
224227}
225228
226- pub type RpcHttpClient = HttpClient < SetRequestHeader < HttpBackend , RpcAuthData > > ;
229+ pub type RpcHttpClient = HttpClient < RpcService < SetRequestHeader < HttpBackend , RpcAuthData > > > ;
227230
228231pub fn new_http_client (
229232 host : impl AsRef < str > ,
@@ -234,7 +237,12 @@ pub fn new_http_client(
234237 rpc_auth,
235238 ) ) ;
236239
237- HttpClientBuilder :: default ( ) . set_http_middleware ( middleware) . build ( host)
240+ HttpClientBuilder :: default ( )
241+ // Note: by default (i.e. without calling `set_rpc_middleware`) `HttpClientBuilder` wraps
242+ // the produced `RpcService` into `RpcLogger`, which we don't need.
243+ . set_rpc_middleware ( RpcServiceBuilder :: default ( ) )
244+ . set_http_middleware ( middleware)
245+ . build ( host)
238246}
239247
240248pub type RpcWsClient = jsonrpsee:: ws_client:: WsClient ;
0 commit comments