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

Method create_invoice

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

Source from the content-addressed store, hash-verified

467 }
468
469 async fn create_invoice(
470 &self,
471 request: tonic::Request<pb::CreateinvoiceRequest>,
472 ) -> Result<tonic::Response<pb::CreateinvoiceResponse>, tonic::Status> {
473 let req = request.into_inner();
474 let req: requests::CreateinvoiceRequest = req.try_into()?;
475 debug!("Client asked for create_invoice");
476 trace!("create_invoice request: {:?}", req);
477 let mut rpc = ClnRpc::new(&self.rpc_path)
478 .await
479 .map_err(|e| Status::new(Code::Internal, e.to_string()))?;
480 let result = rpc.call(Request::CreateInvoice(req))
481 .await
482 .map_err(|e| Status::new(
483 Code::Unknown,
484 format!("Error calling method CreateInvoice: {:?}", e)))?;
485 match result {
486 Response::CreateInvoice(r) => {
487 trace!("create_invoice response: {:?}", r);
488 Ok(tonic::Response::new(r.into()))
489 },
490 r => Err(Status::new(
491 Code::Internal,
492 format!(
493 "Unexpected result {:?} to method call CreateInvoice",
494 r
495 )
496 )),
497 }
498
499 }
500
501 async fn datastore(
502 &self,

Callers

nothing calls this directly

Calls 3

into_innerMethod · 0.80
to_stringMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected