diff --git a/crates/provider/src/provider.rs b/crates/provider/src/provider.rs index 6c4dc15819e5..3f4f45dacf34 100644 --- a/crates/provider/src/provider.rs +++ b/crates/provider/src/provider.rs @@ -1028,6 +1028,24 @@ pub trait Provider: /* ---------------------------------------- raw calls --------------------------------------- */ /// Sends a raw JSON-RPC request. + /// + /// # Examples + /// + /// ```no_run + /// # async fn example(provider: impl alloy_provider::Provider) -> Result<(), Box> { + /// use alloy_rpc_types::BlockNumberOrTag; + /// + /// // No parameters: `()` + /// let block_number = provider.raw_request("eth_blockNumber".into(), ()).await?; + /// + /// // One param: `(param,)` or `[param]` + /// let block = provider.raw_request("eth_getBlockByNumber".into(), (BlockNumberOrTag::Latest,)).await?; + /// + /// // Two or more parameters: `(param1, param2, ...)` or `[param1, param2, ...]` + /// let full_block = provider.raw_request("eth_getBlockByNumber".into(), (BlockNumberOrTag::Latest, true)).await?; + /// # Ok(()) + /// # } + /// ``` async fn raw_request(&self, method: Cow<'static, str>, params: P) -> TransportResult where P: RpcParam, @@ -1038,6 +1056,27 @@ pub trait Provider: } /// Sends a raw JSON-RPC request with type-erased parameters and return. + /// + /// # Examples + /// + /// ```no_run + /// # async fn example(provider: impl alloy_provider::Provider) -> Result<(), Box> { + /// use alloy_rpc_types::BlockNumberOrTag; + /// + /// // No parameters: `()` + /// let params = serde_json::value::to_raw_value(&())?; + /// let block_number = provider.raw_request_dyn("eth_blockNumber".into(), ¶ms).await?; + /// + /// // One param: `(param,)` or `[param]` + /// let params = serde_json::value::to_raw_value(&(BlockNumberOrTag::Latest,))?; + /// let block = provider.raw_request_dyn("eth_getBlockByNumber".into(), ¶ms).await?; + /// + /// // Two or more parameters: `(param1, param2, ...)` or `[param1, param2, ...]` + /// let params = serde_json::value::to_raw_value(&(BlockNumberOrTag::Latest, true))?; + /// let full_block = provider.raw_request_dyn("eth_getBlockByNumber".into(), ¶ms).await?; + /// # Ok(()) + /// # } + /// ``` async fn raw_request_dyn( &self, method: Cow<'static, str>, diff --git a/crates/rpc-types/src/eth/log.rs b/crates/rpc-types/src/eth/log.rs index 985b87a4e955..49fca005161f 100644 --- a/crates/rpc-types/src/eth/log.rs +++ b/crates/rpc-types/src/eth/log.rs @@ -1,3 +1,5 @@ +#![allow(unknown_lints, non_local_definitions)] + use alloy_primitives::{LogData, B256}; use serde::{Deserialize, Serialize}; diff --git a/crates/rpc-types/src/eth/transaction/receipt.rs b/crates/rpc-types/src/eth/transaction/receipt.rs index b51cd8c2e0e2..9cf0beab4660 100644 --- a/crates/rpc-types/src/eth/transaction/receipt.rs +++ b/crates/rpc-types/src/eth/transaction/receipt.rs @@ -1,3 +1,5 @@ +#![allow(unknown_lints, non_local_definitions)] + use crate::{Log, WithOtherFields}; use alloy_consensus::{AnyReceiptEnvelope, ReceiptEnvelope, TxType}; use alloy_primitives::{Address, B256};