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

Method send_custom_notification

plugins/src/lib.rs:1194–1216  ·  view source on GitHub ↗
(
        &self,
        method: String,
        v: serde_json::Value,
    )

Source from the content-addressed store, hash-verified

1192 S: Send + Clone,
1193{
1194 pub async fn send_custom_notification(
1195 &self,
1196 method: String,
1197 v: serde_json::Value,
1198 ) -> Result<(), Error> {
1199 // Modern has them inside object of same name.
1200 // This is deprecated, scheduled for removal 26.09.
1201 let mut params = match &v {
1202 serde_json::Value::Object(map) => map.clone(),
1203 _ => return Err(anyhow::anyhow!("params must be a JSON object")),
1204 };
1205 params.insert(method.clone(), json!(v));
1206
1207 self.sender
1208 .send(json!({
1209 "jsonrpc": "2.0",
1210 "method": method,
1211 "params": params,
1212 }))
1213 .await
1214 .context("sending custom notification")?;
1215 Ok(())
1216 }
1217
1218 /// Wait for plugin shutdown
1219 pub async fn join(&self) -> Result<(), Error> {

Callers 1

Calls 2

insertMethod · 0.45
sendMethod · 0.45

Tested by 1