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

Method rpcmethod

plugins/src/lib.rs:178–193  ·  view source on GitHub ↗

Register a custom RPC method for the RPC passthrough from the main daemon

(mut self, name: &str, description: &str, callback: C)

Source from the content-addressed store, hash-verified

176 /// Register a custom RPC method for the RPC passthrough from the
177 /// main daemon
178 pub fn rpcmethod<C, F>(mut self, name: &str, description: &str, callback: C) -> Builder<S, I, O>
179 where
180 C: Send + Sync + 'static,
181 C: Fn(Plugin<S>, Request) -> F + 'static,
182 F: Future<Output = Response> + Send + Sync + 'static,
183 {
184 self.rpcmethods.insert(
185 name.to_string(),
186 RpcMethod {
187 name: name.to_string(),
188 description: description.to_string(),
189 callback: Box::new(move |p, r| Box::pin(callback(p, r))),
190 },
191 );
192 self
193 }
194
195 /// Send true value for "dynamic" field in "getmanifest" response
196 pub fn dynamic(mut self) -> Builder<S, I, O> {

Callers 1

mainFunction · 0.80

Calls 1

to_stringMethod · 0.80

Tested by

no test coverage detected