reth_rpc_api/net.rs
1use alloy_primitives::U64;
2use jsonrpsee::{core::RpcResult, proc_macros::rpc};
3
4/// Net rpc interface.
5#[cfg_attr(not(feature = "client"), rpc(server, namespace = "net"))]
6#[cfg_attr(feature = "client", rpc(server, client, namespace = "net"))]
7pub trait NetApi {
8 /// Returns the network ID.
9 #[method(name = "version")]
10 fn version(&self) -> RpcResult<String>;
11
12 /// Returns number of peers connected to node.
13 #[method(name = "peerCount")]
14 fn peer_count(&self) -> RpcResult<U64>;
15
16 /// Returns true if client is actively listening for network connections.
17 /// Otherwise false.
18 #[method(name = "listening")]
19 fn is_listening(&self) -> RpcResult<bool>;
20}