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

Method create_invoice

cln-grpc/src/server.rs:349–379  ·  view source on GitHub ↗
(
    &self,
    request: tonic::Request<pb::CreateinvoiceRequest>,
)

Source from the content-addressed store, hash-verified

347}
348
349async fn create_invoice(
350 &self,
351 request: tonic::Request<pb::CreateinvoiceRequest>,
352) -> Result<tonic::Response<pb::CreateinvoiceResponse>, tonic::Status> {
353 let req = request.into_inner();
354 let req: requests::CreateinvoiceRequest = req.into();
355 debug!("Client asked for create_invoice");
356 trace!("create_invoice request: {:?}", req);
357 let mut rpc = ClnRpc::new(&self.rpc_path)
358 .await
359 .map_err(|e| Status::new(Code::Internal, e.to_string()))?;
360 let result = rpc.call(Request::CreateInvoice(req))
361 .await
362 .map_err(|e| Status::new(
363 Code::Unknown,
364 format!("Error calling method CreateInvoice: {:?}", e)))?;
365 match result {
366 Response::CreateInvoice(r) => {
367 trace!("create_invoice response: {:?}", r);
368 Ok(tonic::Response::new(r.into()))
369 },
370 r => Err(Status::new(
371 Code::Internal,
372 format!(
373 "Unexpected result {:?} to method call CreateInvoice",
374 r
375 )
376 )),
377 }
378
379}
380
381async fn datastore(
382 &self,

Callers

nothing calls this directly

Calls 2

to_stringMethod · 0.80
callMethod · 0.45

Tested by

no test coverage detected