-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathnet.rs
38 lines (29 loc) · 850 Bytes
/
net.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Built-in uses
// External uses
use jsonrpc_core::Result;
use jsonrpc_derive::rpc;
// Workspace uses
use zksync_types::U256;
// Local uses
use crate::web3::namespaces::NetNamespace;
use crate::node::TEST_NODE_NETWORK_ID;
#[rpc]
pub trait NetNamespaceT {
#[rpc(name = "net_version", returns = "String")]
fn net_version(&self) -> Result<String>;
#[rpc(name = "net_peerCount", returns = "U256")]
fn net_peer_count(&self) -> Result<U256>;
#[rpc(name = "net_listening", returns = "bool")]
fn net_listening(&self) -> Result<bool>;
}
impl NetNamespaceT for NetNamespace {
fn net_version(&self) -> Result<String> {
Ok(String::From(TEST_NODE_NETWORK_ID))
}
fn net_peer_count(&self) -> Result<U256> {
Ok(U256::From(0))
}
fn net_listening(&self) -> Result<bool> {
Ok(false)
}
}