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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
pub mod error;
pub mod helpers;
use crate::helpers::Receiver;
use futures::{compat::Compat, future::BoxFuture};
use jsonrpc_derive::rpc;
use self::error::Result as SystemResult;
pub use self::{
gen_client::Client as SystemClient,
helpers::{Health, NodeRole, PeerInfo, SyncState, SystemInfo},
};
#[rpc]
pub trait SystemApi<Hash, Number> {
#[rpc(name = "system_name")]
fn system_name(&self) -> SystemResult<String>;
#[rpc(name = "system_version")]
fn system_version(&self) -> SystemResult<String>;
#[rpc(name = "system_chain")]
fn system_chain(&self) -> SystemResult<String>;
#[rpc(name = "system_chainType")]
fn system_type(&self) -> SystemResult<sc_chain_spec::ChainType>;
#[rpc(name = "system_properties")]
fn system_properties(&self) -> SystemResult<sc_chain_spec::Properties>;
#[rpc(name = "system_health", returns = "Health")]
fn system_health(&self) -> Receiver<Health>;
#[rpc(name = "system_localPeerId", returns = "String")]
fn system_local_peer_id(&self) -> Receiver<String>;
#[rpc(name = "system_localListenAddresses", returns = "Vec<String>")]
fn system_local_listen_addresses(&self) -> Receiver<Vec<String>>;
#[rpc(name = "system_peers", returns = "Vec<PeerInfo<Hash, Number>>")]
fn system_peers(
&self,
) -> Compat<BoxFuture<'static, jsonrpc_core::Result<Vec<PeerInfo<Hash, Number>>>>>;
#[rpc(name = "system_unstable_networkState", returns = "jsonrpc_core::Value")]
fn system_network_state(
&self,
) -> Compat<BoxFuture<'static, jsonrpc_core::Result<jsonrpc_core::Value>>>;
#[rpc(name = "system_addReservedPeer", returns = "()")]
fn system_add_reserved_peer(
&self,
peer: String,
) -> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
#[rpc(name = "system_removeReservedPeer", returns = "()")]
fn system_remove_reserved_peer(
&self,
peer_id: String,
) -> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
#[rpc(name = "system_reservedPeers", returns = "Vec<String>")]
fn system_reserved_peers(&self) -> Receiver<Vec<String>>;
#[rpc(name = "system_nodeRoles", returns = "Vec<NodeRole>")]
fn system_node_roles(&self) -> Receiver<Vec<NodeRole>>;
#[rpc(name = "system_syncState", returns = "SyncState<Number>")]
fn system_sync_state(&self) -> Receiver<SyncState<Number>>;
#[rpc(name = "system_addLogFilter", returns = "()")]
fn system_add_log_filter(&self, directives: String) -> Result<(), jsonrpc_core::Error>;
#[rpc(name = "system_resetLogFilter", returns = "()")]
fn system_reset_log_filter(&self) -> Result<(), jsonrpc_core::Error>;
}