diff --git a/crates/net/rpc/src/eth/api/mod.rs b/crates/net/rpc/src/eth/api/mod.rs index 847eef925a..2dd681e5cb 100644 --- a/crates/net/rpc/src/eth/api/mod.rs +++ b/crates/net/rpc/src/eth/api/mod.rs @@ -7,7 +7,7 @@ use crate::eth::signer::EthSigner; use async_trait::async_trait; use reth_interfaces::Result; use reth_network_api::NetworkInfo; -use reth_primitives::{ChainInfo, U64}; +use reth_primitives::{Address, ChainInfo, U64}; use reth_provider::{BlockProvider, StateProviderFactory}; use reth_rpc_types::Transaction; use reth_transaction_pool::TransactionPool; @@ -29,6 +29,9 @@ pub trait EthApiSpec: Send + Sync { /// Returns client chain info fn chain_info(&self) -> Result; + + /// Returns a list of addresses owned by client. + fn accounts(&self) -> Vec
; } /// `Eth` API implementation. @@ -93,6 +96,10 @@ where fn chain_info(&self) -> Result { self.client().chain_info() } + + fn accounts(&self) -> Vec
{ + self.inner.signers.iter().flat_map(|s| s.accounts()).collect() + } } /// Container type `EthApi` diff --git a/crates/net/rpc/src/eth/api/server.rs b/crates/net/rpc/src/eth/api/server.rs index c7a7236948..c91944b8ab 100644 --- a/crates/net/rpc/src/eth/api/server.rs +++ b/crates/net/rpc/src/eth/api/server.rs @@ -42,7 +42,7 @@ where } async fn accounts(&self) -> Result> { - Err(internal_rpc_err("unimplemented")) + Ok(EthApiSpec::accounts(self)) } fn block_number(&self) -> Result {