cfx_rpc_eth_api/
net.rs

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