#![warn(
missing_debug_implementations,
missing_docs,
unsafe_code,
bare_trait_objects
)]
#![warn(clippy::pedantic)]
#![allow(
// Next `cast_*` lints don't give alternatives.
clippy::cast_possible_wrap, clippy::cast_possible_truncation, clippy::cast_sign_loss,
// Next lints produce too much noise/false positives.
clippy::module_name_repetitions, clippy::similar_names, clippy::must_use_candidate,
clippy::pub_enum_variant_names,
// '... may panic' lints.
clippy::indexing_slicing,
// Too much work to fix.
clippy::missing_errors_doc
)]
pub mod private;
use exonum::blockchain::{ApiSender, Blockchain};
use exonum_api::ApiBuilder;
use exonum_node::{ExternalMessage, NodePlugin, PluginApiContext, SharedNodeState};
use crate::private::SystemApi;
fn system_api(
blockchain: Blockchain,
sender: ApiSender<ExternalMessage>,
shared_api_state: SharedNodeState,
) -> ApiBuilder {
let mut builder = ApiBuilder::new();
SystemApi::new(blockchain, sender, shared_api_state).wire(builder.private_scope());
builder
}
#[derive(Debug, Clone, Copy)]
pub struct SystemApiPlugin;
impl NodePlugin for SystemApiPlugin {
fn wire_api(&self, context: PluginApiContext<'_>) -> Vec<(String, ApiBuilder)> {
let api_builder = system_api(
context.blockchain().to_owned(),
context.api_sender(),
context.node_state().to_owned(),
);
vec![("system".to_owned(), api_builder)]
}
}