referrerpolicy=no-referrer-when-downgrade

Trait sc_rpc_api::system::SystemApiServer

source ·
pub trait SystemApiServer<Hash, Number>: Sized + Send + Sync + 'static {
Show 18 methods // Required methods fn system_name(&self) -> Result<String, Error>; fn system_version(&self) -> Result<String, Error>; fn system_chain(&self) -> Result<String, Error>; fn system_type(&self) -> Result<ChainType, Error>; fn system_properties(&self) -> Result<Properties, Error>; fn system_health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Health, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn system_local_peer_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn system_local_listen_addresses<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn system_peers<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo<Hash, Number>>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn system_network_state<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, ) -> Pin<Box<dyn Future<Output = Result<JsonValue, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn system_add_reserved_peer<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, peer: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn system_remove_reserved_peer<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, peer_id: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn system_reserved_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn system_node_roles<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<NodeRole>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn system_sync_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncState<Number>, Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn system_add_log_filter( &self, ext: &Extensions, directives: String, ) -> Result<(), Error>; fn system_reset_log_filter(&self, ext: &Extensions) -> Result<(), Error>; // Provided method fn into_rpc(self) -> RpcModule<Self> where Hash: Send + Sync + 'static + Clone + Serialize, Number: Send + Sync + 'static + Clone + Serialize { ... }
}
Expand description

Server trait implementation for the SystemApi RPC API.

Required Methods§

source

fn system_name(&self) -> Result<String, Error>

Get the node’s implementation name. Plain old string.

source

fn system_version(&self) -> Result<String, Error>

Get the node implementation’s version. Should be a semver string.

source

fn system_chain(&self) -> Result<String, Error>

Get the chain’s name. Given as a string identifier.

source

fn system_type(&self) -> Result<ChainType, Error>

Get the chain’s type.

source

fn system_properties(&self) -> Result<Properties, Error>

Get a custom set of properties as a JSON object, defined in the chain spec.

source

fn system_health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Health, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return health status of the node.

Node is considered healthy if it is:

  • connected to some peers (unless running in dev mode)
  • not performing a major sync
source

fn system_local_peer_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the base58-encoded PeerId of the node.

source

fn system_local_listen_addresses<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the multi-addresses that the local node is listening on

The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example.

source

fn system_peers<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo<Hash, Number>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns currently connected peers

source

fn system_network_state<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, ) -> Pin<Box<dyn Future<Output = Result<JsonValue, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns current state of the network.

Warning: This API is not stable. Please do not programmatically interpret its output, as its format might change at any time.

source

fn system_add_reserved_peer<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, peer: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Adds a reserved peer. Returns the empty string or an error. The string parameter should encode a p2p multiaddr.

/ip4/198.51.100.19/tcp/30333/p2p/QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV is an example of a valid, passing multiaddr with PeerId attached.

source

fn system_remove_reserved_peer<'life0, 'life1, 'async_trait>( &'life0 self, ext: &'life1 Extensions, peer_id: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a reserved peer. Returns the empty string or an error. The string should encode only the PeerId e.g. QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV.

source

fn system_reserved_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the list of reserved peers

source

fn system_node_roles<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<NodeRole>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the roles the node is running as.

source

fn system_sync_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncState<Number>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the state of the syncing of the node: starting block, current best block, highest known block.

source

fn system_add_log_filter( &self, ext: &Extensions, directives: String, ) -> Result<(), Error>

Adds the supplied directives to the current log filter

The syntax is identical to the CLI <target>=<level>:

sync=debug,state=trace

source

fn system_reset_log_filter(&self, ext: &Extensions) -> Result<(), Error>

Resets the log filter to Substrate defaults

Provided Methods§

source

fn into_rpc(self) -> RpcModule<Self>
where Hash: Send + Sync + 'static + Clone + Serialize, Number: Send + Sync + 'static + Clone + Serialize,

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Object Safety§

This trait is not object safe.

Implementors§