hub_methods

Attribute Macro hub_methods 

Source
#[hub_methods]
Expand description

Attribute macro for impl blocks containing hub methods.

Generates:

  • Method enum for schema extraction
  • Activation trait implementation
  • RPC server trait and implementation

§Attributes

  • namespace = "..." (required) - The activation namespace
  • version = "..." (optional, default: “1.0.0”) - Version string
  • description = "..." (optional) - Activation description
  • crate_path = "..." (optional, default: “crate”) - Path to substrate crate

§Example

#[hub_methods(namespace = "bash", version = "1.0.0", description = "Execute bash commands")]
impl Bash {
    /// Execute a bash command and stream output
    #[hub_method]
    async fn execute(&self, command: String) -> impl Stream<Item = BashEvent> + Send + 'static {
        self.executor.execute(&command).await
    }
}