From dfd6d4015a14138a4950d8ec0f7b5fe811633bdd Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Thu, 18 Jul 2024 17:18:33 -0300 Subject: [PATCH 1/2] chore: add `get_account` method in `EthApi` trait --- crates/rpc/rpc-eth-api/src/core.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 3ba0a59e1000..296ee1437c5f 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -3,7 +3,7 @@ use alloy_dyn_abi::TypedData; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; -use reth_primitives::{Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64}; +use reth_primitives::{Account, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64}; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; use reth_rpc_types::{ serde_helpers::JsonStorageKey, @@ -245,6 +245,14 @@ pub trait EthApi { #[method(name = "gasPrice")] async fn gas_price(&self) -> RpcResult; + /// Returns the account details by specifying an address and a block number/tag + #[method(name = "getAccount")] + async fn get_account( + &self, + address: Address, + block_reference: BlockNumberOrTag, + ) -> RpcResult; + /// Introduced in EIP-1559, returns suggestion for the priority for dynamic fee transactions. #[method(name = "maxPriorityFeePerGas")] async fn max_priority_fee_per_gas(&self) -> RpcResult; @@ -621,6 +629,15 @@ where return Ok(EthFees::gas_price(self).await?) } + /// Handler for: `eth_getAccount` + async fn get_account( + &self, + _address: Address, + _block_reference: BlockNumberOrTag, + ) -> RpcResult { + unimplemented!(); + } + /// Handler for: `eth_maxPriorityFeePerGas` async fn max_priority_fee_per_gas(&self) -> RpcResult { trace!(target: "rpc::eth", "Serving eth_maxPriorityFeePerGas"); From 7c1713d9e09af5734484a0b25f5b68fc83c5c04d Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 19 Jul 2024 09:19:00 +0200 Subject: [PATCH 2/2] return unimplemented --- crates/rpc/rpc-eth-api/src/core.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 296ee1437c5f..a0c40490aaaa 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -247,11 +247,7 @@ pub trait EthApi { /// Returns the account details by specifying an address and a block number/tag #[method(name = "getAccount")] - async fn get_account( - &self, - address: Address, - block_reference: BlockNumberOrTag, - ) -> RpcResult; + async fn get_account(&self, address: Address, block: BlockId) -> RpcResult; /// Introduced in EIP-1559, returns suggestion for the priority for dynamic fee transactions. #[method(name = "maxPriorityFeePerGas")] @@ -630,12 +626,8 @@ where } /// Handler for: `eth_getAccount` - async fn get_account( - &self, - _address: Address, - _block_reference: BlockNumberOrTag, - ) -> RpcResult { - unimplemented!(); + async fn get_account(&self, _address: Address, _block: BlockId) -> RpcResult { + Err(internal_rpc_err("unimplemented")) } /// Handler for: `eth_maxPriorityFeePerGas`