Skip to content

Commit

Permalink
msggen: add sendinvoice method
Browse files Browse the repository at this point in the history
Changelog-None
  • Loading branch information
daywalker90 authored and cdecker committed May 13, 2024
1 parent 54e1c78 commit 047faf1
Show file tree
Hide file tree
Showing 11 changed files with 461 additions and 112 deletions.
95 changes: 95 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@
"failed": 2,
"pending": 1
},
"SendinvoiceStatus": {
"expired": 2,
"paid": 1,
"unpaid": 0
},
"SendonionStatus": {
"complete": 1,
"pending": 0
Expand Down Expand Up @@ -2188,6 +2193,28 @@
"SendcustommsgResponse": {
"SendCustomMsg.status": 1
},
"SendinvoiceRequest": {
"SendInvoice.amount_msat": 3,
"SendInvoice.invreq": 1,
"SendInvoice.label": 2,
"SendInvoice.quantity": 5,
"SendInvoice.timeout": 4
},
"SendinvoiceResponse": {
"SendInvoice.amount_msat": 6,
"SendInvoice.amount_received_msat": 11,
"SendInvoice.bolt12": 7,
"SendInvoice.created_index": 8,
"SendInvoice.description": 2,
"SendInvoice.expires_at": 5,
"SendInvoice.label": 1,
"SendInvoice.paid_at": 12,
"SendInvoice.pay_index": 10,
"SendInvoice.payment_hash": 3,
"SendInvoice.payment_preimage": 13,
"SendInvoice.status": 4,
"SendInvoice.updated_index": 9
},
"SendonionFirst_hop": {
"SendOnion.first_hop.amount_msat": 2,
"SendOnion.first_hop.delay": 3,
Expand Down Expand Up @@ -7708,6 +7735,74 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice": {
"added": "pre-v0.10.1",
"deprecated": null
},
"SendInvoice.amount_msat": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.amount_received_msat": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.bolt12": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.created_index": {
"added": "v23.08",
"deprecated": false
},
"SendInvoice.description": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.expires_at": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.invreq": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.label": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.paid_at": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.pay_index": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.payment_hash": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.payment_preimage": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.quantity": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.status": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.timeout": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SendInvoice.updated_index": {
"added": "v23.08",
"deprecated": false
},
"SendOnion": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
31 changes: 31 additions & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions cln-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,38 @@ async fn send_custom_msg(

}

async fn send_invoice(
&self,
request: tonic::Request<pb::SendinvoiceRequest>,
) -> Result<tonic::Response<pb::SendinvoiceResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::SendinvoiceRequest = req.into();
debug!("Client asked for send_invoice");
trace!("send_invoice request: {:?}", req);
let mut rpc = ClnRpc::new(&self.rpc_path)
.await
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
let result = rpc.call(Request::SendInvoice(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method SendInvoice: {:?}", e)))?;
match result {
Response::SendInvoice(r) => {
trace!("send_invoice response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call SendInvoice",
r
)
)),
}

}

async fn set_channel(
&self,
request: tonic::Request<pb::SetchannelRequest>,
Expand Down
101 changes: 101 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 047faf1

Please sign in to comment.