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

Function setconfig_callback

plugins/examples/cln-plugin-startup.rs:98–114  ·  view source on GitHub ↗
(
    plugin: Plugin<()>,
    args: serde_json::Value,
)

Source from the content-addressed store, hash-verified

96}
97
98async fn setconfig_callback(
99 plugin: Plugin<()>,
100 args: serde_json::Value,
101) -> Result<serde_json::Value, Error> {
102 let name = args.get("config").unwrap().as_str().unwrap();
103 let value = args.get("val").unwrap();
104
105 let opt_value = options::Value::String(value.to_string());
106
107 plugin.set_option_str(name, opt_value)?;
108 log::info!(
109 "cln-plugin-startup: Got dynamic option change: {} {}",
110 name,
111 plugin.option_str(name).unwrap().unwrap().as_str().unwrap()
112 );
113 Ok(json!({}))
114}
115
116async fn testoptions(p: Plugin<()>, _v: serde_json::Value) -> Result<serde_json::Value, Error> {
117 let test_option = p.option(&TEST_OPTION)?;

Callers 1

setconfig_callbackMethod · 0.85

Calls 6

StringClass · 0.85
as_strMethod · 0.80
set_option_strMethod · 0.80
unwrapMethod · 0.45
getMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected