MCPcopy Create free account
hub / github.com/ElementsProject/lightning / dispatch_custom_request

Method dispatch_custom_request

plugins/src/lib.rs:595–621  ·  view source on GitHub ↗
(
        &self,
        _id: serde_json::Value,
        request: serde_json::Value,
        plugin: &Plugin<S>,
    )

Source from the content-addressed store, hash-verified

593 }
594
595 async fn dispatch_custom_request(
596 &self,
597 _id: serde_json::Value,
598 request: serde_json::Value,
599 plugin: &Plugin<S>,
600 ) -> Result<serde_json::Value, Error> {
601 let method = request
602 .get("method")
603 .context("Missing 'method' in request")?
604 .as_str()
605 .context("'method' is not a string")?;
606
607 let params = request
608 .get("params")
609 .context("Missing 'params' field in request")?;
610 let callback = self
611 .rpcmethods
612 .get(method)
613 .with_context(|| anyhow!("No handler for method '{}' registered", method))?;
614
615 trace!(
616 "Dispatching custom request: method={}, params={}",
617 method,
618 params
619 );
620 callback(plugin.clone(), params.clone()).await
621 }
622
623 async fn dispatch_custom_notification(
624 &self,

Callers 1

dispatch_oneMethod · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected