[][src]Crate exonum_system_api

System API of an Exonum node, packaged as a node plugin.

HTTP API

REST API of the service is documented in the corresponding modules:

Examples

Use with the real node builder:

use exonum::{
    blockchain::config::GenesisConfig,
    keys::Keys,
    merkledb::TemporaryDB,
};
use exonum_node::{NodeBuilder, NodeConfig};
use exonum_system_api::SystemApiPlugin;

let node_config: NodeConfig = // ...
let node_keys = Keys::random();
let genesis_config: GenesisConfig = // ...
let db = TemporaryDB::new();
let node = NodeBuilder::new(db, node_config, node_keys)
    .with_genesis_config(genesis_config)
    .with_plugin(SystemApiPlugin)
    // Add runtimes etc...
    .build();
node.run().unwrap();

Use with the testkit:

use exonum_system_api::{private::NodeInfo, SystemApiPlugin};
use exonum_testkit::{ApiKind, TestKitBuilder};

let mut testkit = TestKitBuilder::validator()
    .with_plugin(SystemApiPlugin)
    .build();
let api = testkit.api();
let info: NodeInfo = api.private(ApiKind::System).get("v1/network").unwrap();
assert!(info.core_version.is_some());

Note that the testkit does not emulate the functionality of the node completely; it does not update the SharedNodeState.

Modules

private

Private part of the node REST API.

public

Public part of the node REST API.

Structs

SystemApiPlugin

Plugin responsible for adding system API to the Exonum node.