From b381543f0756b1c24b700137144fd6537f3a93d8 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:17:21 +0200 Subject: [PATCH 1/5] fix(provider): replace unit with empty array in `ChainStreamPoller` --- crates/provider/src/chain.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/provider/src/chain.rs b/crates/provider/src/chain.rs index d0149ba328a..db8cb5a8b6f 100644 --- a/crates/provider/src/chain.rs +++ b/crates/provider/src/chain.rs @@ -19,7 +19,7 @@ const NO_BLOCK_NUMBER: BlockNumber = BlockNumber::MAX; pub(crate) struct ChainStreamPoller { client: WeakClient, - poll_task: PollerBuilder, + poll_task: PollerBuilder, next_yield: BlockNumber, known_blocks: LruCache, _phantom: PhantomData, @@ -39,7 +39,7 @@ impl ChainStreamPoller { fn with_next_yield(client: WeakClient, next_yield: BlockNumber) -> Self { Self { client: client.clone(), - poll_task: PollerBuilder::new(client, "eth_blockNumber", ()), + poll_task: PollerBuilder::new(client, "eth_blockNumber", []), next_yield, known_blocks: LruCache::new(BLOCK_CACHE_SIZE), _phantom: PhantomData, From 594d51eaf58572fad328b98bbdd399e737c2dac9 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:28:17 +0200 Subject: [PATCH 2/5] fix: everywhere --- crates/provider/src/ext/admin.rs | 6 ++--- crates/provider/src/ext/anvil.rs | 14 +++++------ crates/provider/src/ext/debug.rs | 2 +- crates/provider/src/ext/net.rs | 6 ++--- crates/provider/src/ext/rpc.rs | 2 +- crates/provider/src/ext/txpool.rs | 6 ++--- crates/provider/src/provider/trait.rs | 35 ++++++++++++++------------- crates/rpc-client/README.md | 2 +- crates/rpc-client/src/client.rs | 13 ++++++++++ crates/rpc-client/src/lib.rs | 2 +- crates/rpc-client/tests/it/http.rs | 4 +-- crates/rpc-client/tests/it/ipc.rs | 4 +-- crates/rpc-client/tests/it/ws.rs | 4 +-- 13 files changed, 57 insertions(+), 43 deletions(-) diff --git a/crates/provider/src/ext/admin.rs b/crates/provider/src/ext/admin.rs index b81d4701111..c1872f8e9ec 100644 --- a/crates/provider/src/ext/admin.rs +++ b/crates/provider/src/ext/admin.rs @@ -64,11 +64,11 @@ where } async fn peers(&self) -> TransportResult> { - self.client().request("admin_peers", ()).await + self.client().request_noparams("admin_peers").await } async fn node_info(&self) -> TransportResult { - self.client().request("admin_nodeInfo", ()).await + self.client().request_noparams("admin_nodeInfo").await } #[cfg(feature = "pubsub")] @@ -76,7 +76,7 @@ where &self, ) -> TransportResult> { self.root().pubsub_frontend()?; - let mut call = self.client().request("admin_peerEvents_subscribe", ()); + let mut call = self.client().request_noparams("admin_peerEvents_subscribe"); call.set_is_subscription(); let id = call.await?; self.root().get_subscription(id).await diff --git a/crates/provider/src/ext/anvil.rs b/crates/provider/src/ext/anvil.rs index 05a0dff61b3..9349e1eb8cd 100644 --- a/crates/provider/src/ext/anvil.rs +++ b/crates/provider/src/ext/anvil.rs @@ -166,7 +166,7 @@ where } async fn anvil_get_auto_mine(&self) -> TransportResult { - self.client().request("anvil_getAutomine", ()).await + self.client().request_noparams("anvil_getAutomine").await } async fn anvil_set_auto_mine(&self, enabled: bool) -> TransportResult<()> { @@ -190,7 +190,7 @@ where } async fn anvil_drop_all_transactions(&self) -> TransportResult<()> { - self.client().request("anvil_dropAllTransactions", ()).await + self.client().request_noparams("anvil_dropAllTransactions").await } async fn anvil_reset(&self, forking: Option) -> TransportResult<()> { @@ -239,7 +239,7 @@ where } async fn anvil_dump_state(&self) -> TransportResult { - self.client().request("anvil_dumpState", ()).await + self.client().request_noparams("anvil_dumpState").await } async fn anvil_load_state(&self, buf: Bytes) -> TransportResult { @@ -247,11 +247,11 @@ where } async fn anvil_node_info(&self) -> TransportResult { - self.client().request("anvil_nodeInfo", ()).await + self.client().request_noparams("anvil_nodeInfo").await } async fn anvil_metadata(&self) -> TransportResult { - self.client().request("anvil_metadata", ()).await + self.client().request_noparams("anvil_metadata").await } async fn anvil_remove_pool_transactions(&self, address: Address) -> TransportResult<()> { @@ -259,7 +259,7 @@ where } async fn anvil_snapshot(&self) -> TransportResult { - self.client().request("evm_snapshot", ()).await + self.client().request_noparams("evm_snapshot").await } async fn anvil_revert(&self, id: U256) -> TransportResult { @@ -287,7 +287,7 @@ where } async fn anvil_remove_block_timestamp_interval(&self) -> TransportResult { - self.client().request("anvil_removeBlockTimestampInterval", ()).await + self.client().request_noparams("anvil_removeBlockTimestampInterval").await } async fn evm_mine(&self, opts: Option) -> TransportResult { diff --git a/crates/provider/src/ext/debug.rs b/crates/provider/src/ext/debug.rs index d3252972299..07005ae5a20 100644 --- a/crates/provider/src/ext/debug.rs +++ b/crates/provider/src/ext/debug.rs @@ -153,7 +153,7 @@ where } async fn debug_get_bad_blocks(&self) -> TransportResult> { - self.client().request("debug_getBadBlocks", ()).await + self.client().request_noparams("debug_getBadBlocks").await } async fn debug_trace_chain( diff --git a/crates/provider/src/ext/net.rs b/crates/provider/src/ext/net.rs index 241dd58ac16..f1d962629ae 100644 --- a/crates/provider/src/ext/net.rs +++ b/crates/provider/src/ext/net.rs @@ -24,15 +24,15 @@ where P: Provider, { async fn net_listening(&self) -> TransportResult { - self.client().request("net_listening", ()).await + self.client().request_noparams("net_listening").await } async fn net_peer_count(&self) -> TransportResult { - self.client().request("net_peerCount", ()).map_resp(crate::utils::convert_u64).await + self.client().request_noparams("net_peerCount").map_resp(crate::utils::convert_u64).await } async fn net_version(&self) -> TransportResult { - self.client().request("net_version", ()).map_resp(crate::utils::convert_u64).await + self.client().request_noparams("net_version").map_resp(crate::utils::convert_u64).await } } diff --git a/crates/provider/src/ext/rpc.rs b/crates/provider/src/ext/rpc.rs index 317a603e807..aea6828fd6e 100644 --- a/crates/provider/src/ext/rpc.rs +++ b/crates/provider/src/ext/rpc.rs @@ -22,6 +22,6 @@ where P: Provider, { async fn rpc_modules(&self) -> TransportResult { - self.client().request("rpc_modules", ()).await + self.client().request_noparams("rpc_modules").await } } diff --git a/crates/provider/src/ext/txpool.rs b/crates/provider/src/ext/txpool.rs index 83b1d64f73e..34e497c2190 100644 --- a/crates/provider/src/ext/txpool.rs +++ b/crates/provider/src/ext/txpool.rs @@ -54,7 +54,7 @@ where N: Network, { async fn txpool_content(&self) -> TransportResult> { - self.client().request("txpool_content", ()).await + self.client().request_noparams("txpool_content").await } async fn txpool_content_from( @@ -65,11 +65,11 @@ where } async fn txpool_inspect(&self) -> TransportResult { - self.client().request("txpool_inspect", ()).await + self.client().request_noparams("txpool_inspect").await } async fn txpool_status(&self) -> TransportResult { - self.client().request("txpool_status", ()).await + self.client().request_noparams("txpool_status").await } } diff --git a/crates/provider/src/provider/trait.rs b/crates/provider/src/provider/trait.rs index 039cd9268aa..05f01eb4b87 100644 --- a/crates/provider/src/provider/trait.rs +++ b/crates/provider/src/provider/trait.rs @@ -16,7 +16,7 @@ use alloy_primitives::{ hex, Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, B256, U128, U256, U64, }; -use alloy_rpc_client::{ClientRef, PollerBuilder, RpcCall, WeakClient}; +use alloy_rpc_client::{ClientRef, NoParams, PollerBuilder, RpcCall, WeakClient}; use alloy_rpc_types_eth::{ AccessListResult, BlockId, BlockNumberOrTag, EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Log, SyncStatus, @@ -101,17 +101,17 @@ pub trait Provider: /// Gets the accounts in the remote node. This is usually empty unless you're using a local /// node. async fn get_accounts(&self) -> TransportResult> { - self.client().request("eth_accounts", ()).await + self.client().request_noparams("eth_accounts").await } /// Returns the base fee per blob gas (blob gas price) in wei. async fn get_blob_base_fee(&self) -> TransportResult { - self.client().request("eth_blobBaseFee", ()).await.map(|fee: U128| fee.to::()) + self.client().request_noparams("eth_blobBaseFee").await.map(|fee: U128| fee.to::()) } /// Get the last block number available. - fn get_block_number(&self) -> RpcCall { - self.client().request("eth_blockNumber", ()).map_resp(crate::utils::convert_u64) + fn get_block_number(&self) -> RpcCall { + self.client().request_noparams("eth_blockNumber").map_resp(crate::utils::convert_u64) } /// Execute a smart contract call with a transaction request and state @@ -159,8 +159,8 @@ pub trait Provider: } /// Gets the chain ID. - fn get_chain_id(&self) -> RpcCall { - self.client().request("eth_chainId", ()).map_resp(crate::utils::convert_u64) + fn get_chain_id(&self) -> RpcCall { + self.client().request_noparams("eth_chainId").map_resp(crate::utils::convert_u64) } /// Create an [EIP-2930] access list. @@ -242,8 +242,8 @@ pub trait Provider: } /// Gets the current gas price in wei. - fn get_gas_price(&self) -> RpcCall { - self.client().request("eth_gasPrice", ()).map_resp(crate::utils::convert_u128) + fn get_gas_price(&self) -> RpcCall { + self.client().request_noparams("eth_gasPrice").map_resp(crate::utils::convert_u128) } /// Retrieves account information ([Account](alloy_consensus::Account)) for the given [Address] @@ -583,7 +583,7 @@ pub trait Provider: /// Returns a suggestion for the current `maxPriorityFeePerGas` in wei. async fn get_max_priority_fee_per_gas(&self) -> TransportResult { self.client() - .request("eth_maxPriorityFeePerGas", ()) + .request_noparams("eth_maxPriorityFeePerGas") .await .map(|fee: U128| fee.to::()) } @@ -594,7 +594,7 @@ pub trait Provider: /// /// See also [`watch_blocks`](Self::watch_blocks) to configure a poller. async fn new_block_filter(&self) -> TransportResult { - self.client().request("eth_newBlockFilter", ()).await + self.client().request_noparams("eth_newBlockFilter").await } /// Notify the provider that we are interested in logs that match the given filter. @@ -870,13 +870,13 @@ pub trait Provider: /// Gets syncing info. async fn syncing(&self) -> TransportResult { - self.client().request("eth_syncing", ()).await + self.client().request_noparams("eth_syncing").await } /// Gets the client version. #[doc(alias = "web3_client_version")] async fn get_client_version(&self) -> TransportResult { - self.client().request("web3_clientVersion", ()).await + self.client().request_noparams("web3_clientVersion").await } /// Gets the `Keccak-256` hash of the given data. @@ -886,8 +886,8 @@ pub trait Provider: } /// Gets the network ID. Same as `eth_chainId`. - fn get_net_version(&self) -> RpcCall { - self.client().request("net_version", ()).map_resp(crate::utils::convert_u64) + fn get_net_version(&self) -> RpcCall { + self.client().request_noparams("net_version").map_resp(crate::utils::convert_u64) } /* ---------------------------------------- raw calls --------------------------------------- */ @@ -901,7 +901,7 @@ pub trait Provider: /// use alloy_rpc_types_eth::BlockNumberOrTag; /// /// // No parameters: `()` - /// let block_number = provider.raw_request("eth_blockNumber".into(), ()).await?; + /// let block_number = provider.raw_request_noparams("eth_blockNumber".into()).await?; /// /// // One parameter: `(param,)` or `[param]` /// let block = provider.raw_request("eth_getBlockByNumber".into(), (BlockNumberOrTag::Latest,)).await?; @@ -1253,7 +1253,8 @@ mod tests { async fn gets_block_number_with_raw_req() { init_tracing(); let provider = ProviderBuilder::new().on_anvil(); - let num: U64 = provider.raw_request("eth_blockNumber".into(), ()).await.unwrap(); + let num: U64 = + provider.raw_request("eth_blockNumber".into(), NoParams::default()).await.unwrap(); assert_eq!(0, num.to::()) } diff --git a/crates/rpc-client/README.md b/crates/rpc-client/README.md index 3c1ed3c5386..f1034ffc06c 100644 --- a/crates/rpc-client/README.md +++ b/crates/rpc-client/README.md @@ -16,7 +16,7 @@ For example, to make a simple request: let client: ReqwestClient = ClientBuilder::default().http(url); // Prepare a request to the server. -let request = client.request("eth_blockNumber", ()); +let request = client.request_noparams("eth_blockNumber"); // Poll the request to completion. let block_number = request.await.unwrap(); diff --git a/crates/rpc-client/src/client.rs b/crates/rpc-client/src/client.rs index a32e08950b2..b960239e35e 100644 --- a/crates/rpc-client/src/client.rs +++ b/crates/rpc-client/src/client.rs @@ -19,6 +19,9 @@ pub type WeakClient = Weak>; /// A borrowed [`RpcClient`]. pub type ClientRef<'a, T> = &'a RpcClientInner; +/// Parameter type of a JSON-RPC request with no parameters. +pub type NoParams = [(); 0]; + /// A JSON-RPC client. /// /// [`RpcClient`] should never be instantiated directly. Instead, use @@ -280,6 +283,16 @@ impl RpcClientInner { RpcCall::new(request, self.transport.clone()) } + /// Prepares an [`RpcCall`] with no parameters. + /// + /// See [`request`](Self::request) for more details. + pub fn request_noparams( + &self, + method: impl Into>, + ) -> RpcCall { + self.request(method, []) + } + /// Type erase the service in the transport, allowing it to be used in a /// generic context. /// diff --git a/crates/rpc-client/src/lib.rs b/crates/rpc-client/src/lib.rs index 10cab0096ab..ed98fab1702 100644 --- a/crates/rpc-client/src/lib.rs +++ b/crates/rpc-client/src/lib.rs @@ -22,7 +22,7 @@ mod call; pub use call::RpcCall; mod client; -pub use client::{ClientRef, RpcClient, RpcClientInner, WeakClient}; +pub use client::{ClientRef, NoParams, RpcClient, RpcClientInner, WeakClient}; mod poller; pub use poller::{PollChannel, PollerBuilder}; diff --git a/crates/rpc-client/tests/it/http.rs b/crates/rpc-client/tests/it/http.rs index c7432939452..28dea3bb451 100644 --- a/crates/rpc-client/tests/it/http.rs +++ b/crates/rpc-client/tests/it/http.rs @@ -1,13 +1,13 @@ use alloy_node_bindings::Anvil; use alloy_primitives::U64; -use alloy_rpc_client::{ClientBuilder, RpcCall}; +use alloy_rpc_client::{ClientBuilder, NoParams, RpcCall}; #[tokio::test] async fn it_makes_a_request() { let anvil = Anvil::new().spawn(); let url = anvil.endpoint(); let client = ClientBuilder::default().http(url.parse().unwrap()); - let req: RpcCall<_, (), U64> = client.request("eth_blockNumber", ()); + let req: RpcCall<_, NoParams, U64> = client.request_noparams("eth_blockNumber"); let timeout = tokio::time::timeout(std::time::Duration::from_secs(2), req); let res = timeout.await.unwrap().unwrap(); assert_eq!(res.to::(), 0); diff --git a/crates/rpc-client/tests/it/ipc.rs b/crates/rpc-client/tests/it/ipc.rs index bd13520455a..44772e1d1d0 100644 --- a/crates/rpc-client/tests/it/ipc.rs +++ b/crates/rpc-client/tests/it/ipc.rs @@ -1,6 +1,6 @@ use alloy_node_bindings::Geth; use alloy_primitives::U64; -use alloy_rpc_client::{ClientBuilder, RpcCall}; +use alloy_rpc_client::{ClientBuilder, NoParams, RpcCall}; use alloy_transport_ipc::IpcConnect; #[tokio::test] @@ -17,7 +17,7 @@ async fn it_makes_a_request() { let connect = IpcConnect::new(geth.ipc_endpoint()); let client = ClientBuilder::default().pubsub(connect).await.unwrap(); - let req: RpcCall<_, (), U64> = client.request("eth_blockNumber", ()); + let req: RpcCall<_, NoParams, U64> = client.request_noparams("eth_blockNumber"); let timeout = tokio::time::timeout(std::time::Duration::from_secs(2), req); let res = timeout.await.unwrap().unwrap(); assert!(res.to::() <= 3); diff --git a/crates/rpc-client/tests/it/ws.rs b/crates/rpc-client/tests/it/ws.rs index 5ce7e70c99a..7075ffce35a 100644 --- a/crates/rpc-client/tests/it/ws.rs +++ b/crates/rpc-client/tests/it/ws.rs @@ -1,6 +1,6 @@ use alloy_node_bindings::Anvil; use alloy_primitives::U64; -use alloy_rpc_client::{ClientBuilder, RpcCall}; +use alloy_rpc_client::{ClientBuilder, NoParams, RpcCall}; use alloy_transport_ws::WsConnect; #[tokio::test] @@ -9,7 +9,7 @@ async fn it_makes_a_request() { let url = anvil.ws_endpoint(); let connector = WsConnect { url: url.parse().unwrap(), auth: None }; let client = ClientBuilder::default().pubsub(connector).await.unwrap(); - let req: RpcCall<_, (), U64> = client.request("eth_blockNumber", ()); + let req: RpcCall<_, NoParams, U64> = client.request_noparams("eth_blockNumber"); let timeout = tokio::time::timeout(std::time::Duration::from_secs(2), req); let res = timeout.await.unwrap().unwrap(); assert_eq!(res.to::(), 0); From 01886c5504c8099df9aad03cf987d99e64d3f843 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:31:00 +0200 Subject: [PATCH 3/5] doctest --- crates/provider/src/provider/trait.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/provider/src/provider/trait.rs b/crates/provider/src/provider/trait.rs index 05f01eb4b87..b3a86ff9431 100644 --- a/crates/provider/src/provider/trait.rs +++ b/crates/provider/src/provider/trait.rs @@ -899,9 +899,10 @@ pub trait Provider: /// ```no_run /// # async fn example(provider: impl alloy_provider::Provider) -> Result<(), Box> { /// use alloy_rpc_types_eth::BlockNumberOrTag; + /// use alloy_rpc_client::NoParams; /// /// // No parameters: `()` - /// let block_number = provider.raw_request_noparams("eth_blockNumber".into()).await?; + /// let block_number = provider.raw_request("eth_blockNumber".into(), NoParams::default()).await?; /// /// // One parameter: `(param,)` or `[param]` /// let block = provider.raw_request("eth_getBlockByNumber".into(), (BlockNumberOrTag::Latest,)).await?; From 00d427656527e51b77e8f4d3a60c91eec03b34df Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:31:32 +0200 Subject: [PATCH 4/5] alias --- crates/provider/src/chain.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/provider/src/chain.rs b/crates/provider/src/chain.rs index db8cb5a8b6f..b69c0f6b700 100644 --- a/crates/provider/src/chain.rs +++ b/crates/provider/src/chain.rs @@ -1,6 +1,6 @@ use alloy_network::{Ethereum, Network}; use alloy_primitives::{BlockNumber, U64}; -use alloy_rpc_client::{PollerBuilder, WeakClient}; +use alloy_rpc_client::{NoParams, PollerBuilder, WeakClient}; use alloy_rpc_types_eth::Block; use alloy_transport::{RpcError, Transport}; use async_stream::stream; @@ -19,7 +19,7 @@ const NO_BLOCK_NUMBER: BlockNumber = BlockNumber::MAX; pub(crate) struct ChainStreamPoller { client: WeakClient, - poll_task: PollerBuilder, + poll_task: PollerBuilder, next_yield: BlockNumber, known_blocks: LruCache, _phantom: PhantomData, From 2beca628d3aec7bb09d3db193a12d2f79bbb7d2f Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:47:25 +0200 Subject: [PATCH 5/5] simpler --- crates/rpc-client/tests/it/http.rs | 4 ++-- crates/rpc-client/tests/it/ipc.rs | 4 ++-- crates/rpc-client/tests/it/ws.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/rpc-client/tests/it/http.rs b/crates/rpc-client/tests/it/http.rs index 28dea3bb451..bc399ca3dfc 100644 --- a/crates/rpc-client/tests/it/http.rs +++ b/crates/rpc-client/tests/it/http.rs @@ -1,13 +1,13 @@ use alloy_node_bindings::Anvil; use alloy_primitives::U64; -use alloy_rpc_client::{ClientBuilder, NoParams, RpcCall}; +use alloy_rpc_client::{ClientBuilder, RpcCall}; #[tokio::test] async fn it_makes_a_request() { let anvil = Anvil::new().spawn(); let url = anvil.endpoint(); let client = ClientBuilder::default().http(url.parse().unwrap()); - let req: RpcCall<_, NoParams, U64> = client.request_noparams("eth_blockNumber"); + let req: RpcCall<_, _, U64> = client.request_noparams("eth_blockNumber"); let timeout = tokio::time::timeout(std::time::Duration::from_secs(2), req); let res = timeout.await.unwrap().unwrap(); assert_eq!(res.to::(), 0); diff --git a/crates/rpc-client/tests/it/ipc.rs b/crates/rpc-client/tests/it/ipc.rs index 44772e1d1d0..a34484e7ea4 100644 --- a/crates/rpc-client/tests/it/ipc.rs +++ b/crates/rpc-client/tests/it/ipc.rs @@ -1,6 +1,6 @@ use alloy_node_bindings::Geth; use alloy_primitives::U64; -use alloy_rpc_client::{ClientBuilder, NoParams, RpcCall}; +use alloy_rpc_client::{ClientBuilder, RpcCall}; use alloy_transport_ipc::IpcConnect; #[tokio::test] @@ -17,7 +17,7 @@ async fn it_makes_a_request() { let connect = IpcConnect::new(geth.ipc_endpoint()); let client = ClientBuilder::default().pubsub(connect).await.unwrap(); - let req: RpcCall<_, NoParams, U64> = client.request_noparams("eth_blockNumber"); + let req: RpcCall<_, _, U64> = client.request_noparams("eth_blockNumber"); let timeout = tokio::time::timeout(std::time::Duration::from_secs(2), req); let res = timeout.await.unwrap().unwrap(); assert!(res.to::() <= 3); diff --git a/crates/rpc-client/tests/it/ws.rs b/crates/rpc-client/tests/it/ws.rs index 7075ffce35a..d1286b44180 100644 --- a/crates/rpc-client/tests/it/ws.rs +++ b/crates/rpc-client/tests/it/ws.rs @@ -1,6 +1,6 @@ use alloy_node_bindings::Anvil; use alloy_primitives::U64; -use alloy_rpc_client::{ClientBuilder, NoParams, RpcCall}; +use alloy_rpc_client::{ClientBuilder, RpcCall}; use alloy_transport_ws::WsConnect; #[tokio::test] @@ -9,7 +9,7 @@ async fn it_makes_a_request() { let url = anvil.ws_endpoint(); let connector = WsConnect { url: url.parse().unwrap(), auth: None }; let client = ClientBuilder::default().pubsub(connector).await.unwrap(); - let req: RpcCall<_, NoParams, U64> = client.request_noparams("eth_blockNumber"); + let req: RpcCall<_, _, U64> = client.request_noparams("eth_blockNumber"); let timeout = tokio::time::timeout(std::time::Duration::from_secs(2), req); let res = timeout.await.unwrap().unwrap(); assert_eq!(res.to::(), 0);