[][src]Trait sc_rpc_api::system::SystemApi

pub trait SystemApi<Hash, Number>: Sized + Send + Sync + 'static {
    fn system_name(&self) -> SystemResult<String>;
fn system_version(&self) -> SystemResult<String>;
fn system_chain(&self) -> SystemResult<String>;
fn system_type(&self) -> SystemResult<ChainType>;
fn system_properties(&self) -> SystemResult<Properties>;
fn system_health(&self) -> Receiver<Health>;
fn system_local_peer_id(&self) -> Receiver<String>;
fn system_local_listen_addresses(&self) -> Receiver<Vec<String>>;
fn system_peers(
        &self
    ) -> Compat<BoxFuture<'static, Result<Vec<PeerInfo<Hash, Number>>>>>;
fn system_network_state(&self) -> Compat<BoxFuture<'static, Result<Value>>>;
fn system_add_reserved_peer(
        &self,
        peer: String
    ) -> Compat<BoxFuture<'static, Result<(), Error>>>;
fn system_remove_reserved_peer(
        &self,
        peer_id: String
    ) -> Compat<BoxFuture<'static, Result<(), Error>>>;
fn system_node_roles(&self) -> Receiver<Vec<NodeRole>>; fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M>
    where
        Hash: Send + Sync + 'static + Serialize,
        Number: Send + Sync + 'static + Serialize
, { ... } }

Substrate system RPC API

Required methods

fn system_name(&self) -> SystemResult<String>

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

fn system_version(&self) -> SystemResult<String>

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

fn system_chain(&self) -> SystemResult<String>

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

fn system_type(&self) -> SystemResult<ChainType>

Get the chain's type.

fn system_properties(&self) -> SystemResult<Properties>

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

fn system_health(&self) -> Receiver<Health>

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

fn system_local_peer_id(&self) -> Receiver<String>

Returns the base58-encoded PeerId of the node.

fn system_local_listen_addresses(&self) -> Receiver<Vec<String>>

Returns the multiaddresses 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 system_addReservedPeer or as a bootnode address for example.

fn system_peers(
    &self
) -> Compat<BoxFuture<'static, Result<Vec<PeerInfo<Hash, Number>>>>>

Returns currently connected peers

fn system_network_state(&self) -> Compat<BoxFuture<'static, Result<Value>>>

Returns current state of the network.

Warning: This API is not stable.

fn system_add_reserved_peer(
    &self,
    peer: String
) -> Compat<BoxFuture<'static, Result<(), Error>>>

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.

fn system_remove_reserved_peer(
    &self,
    peer_id: String
) -> Compat<BoxFuture<'static, Result<(), Error>>>

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

fn system_node_roles(&self) -> Receiver<Vec<NodeRole>>

Returns the roles the node is running as.

Loading content...

Provided methods

fn to_delegate<M: Metadata>(self) -> IoDelegate<Self, M> where
    Hash: Send + Sync + 'static + Serialize,
    Number: Send + Sync + 'static + Serialize

Create an IoDelegate, wiring rpc calls to the trait methods.

Loading content...

Implementors

Loading content...