Skip to main content

blvm_sdk/module/
traits.rs

1//! Module Traits
2//!
3//! Re-export from blvm-node for module developers.
4//!
5//! These traits define the core interfaces that modules must implement
6//! and the APIs they can use to interact with the node.
7
8pub use blvm_node::module::traits::{
9    EventType, Module, ModuleContext, ModuleError, ModuleMetadata, ModuleState, NodeAPI,
10};
11
12use crate::module::MigrationUp;
13
14/// Metadata for module bootstrap. Generated by `#[module(name, config, migrations)]`.
15///
16/// Enables `run_module_main!(MyModule)` with all params inferred from the attribute.
17pub trait ModuleMeta {
18    const MODULE_NAME: &'static str;
19    type Config: Default;
20    fn migrations() -> &'static [(u32, MigrationUp)];
21    fn __module_new(config: Self::Config) -> Self
22    where
23        Self: Sized;
24}