Skip to content

Commit

Permalink
msggen: Add Wait method to managed API
Browse files Browse the repository at this point in the history
Fixes #6792

Changelog-Added: Cln-RPC: Add `wait` system to cln-rpc and cln-grpc.
  • Loading branch information
cdecker authored and nepet committed Nov 14, 2023
1 parent 836d71a commit 47174e7
Show file tree
Hide file tree
Showing 9 changed files with 470 additions and 89 deletions.
49 changes: 49 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,16 @@
"complete": 1,
"pending": 0
},
"WaitIndexname": {
"created": 0,
"deleted": 2,
"updated": 1
},
"WaitSubsystem": {
"forwards": 1,
"invoices": 0,
"sendpays": 2
},
"WaitanyinvoiceStatus": {
"expired": 1,
"paid": 0
Expand Down Expand Up @@ -1632,6 +1642,17 @@
"UtxoPsbt.psbt": 1,
"UtxoPsbt.reservations[]": 6
},
"WaitRequest": {
"Wait.indexname": 2,
"Wait.nextvalue": 3,
"Wait.subsystem": 1
},
"WaitResponse": {
"Wait.created": 2,
"Wait.deleted": 4,
"Wait.subsystem": 1,
"Wait.updated": 3
},
"WaitanyinvoicePaid_outpoint": {
"WaitAnyInvoice.paid_outpoint.outnum": 2,
"WaitAnyInvoice.paid_outpoint.txid": 1
Expand Down Expand Up @@ -5730,6 +5751,34 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"Wait": {
"added": "v23.08",
"deprecated": null
},
"Wait.created": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Wait.deleted": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Wait.indexname": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Wait.nextvalue": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Wait.subsystem": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Wait.updated": {
"added": "pre-v0.10.1",
"deprecated": false
},
"WaitAnyInvoice": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
32 changes: 32 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.

34 changes: 34 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 @@ -1818,6 +1818,38 @@ async fn wait_block_height(

}

async fn wait(
&self,
request: tonic::Request<pb::WaitRequest>,
) -> Result<tonic::Response<pb::WaitResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::WaitRequest = req.into();
debug!("Client asked for wait");
trace!("wait 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::Wait(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method Wait: {:?}", e)))?;
match result {
Response::Wait(r) => {
trace!("wait response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call Wait",
r
)
)),
}

}

async fn stop(
&self,
request: tonic::Request<pb::StopRequest>,
Expand Down
140 changes: 140 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.

1 change: 1 addition & 0 deletions contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def load_jsonrpc_service(schema_dir: str):
"SignMessage",
# "unreserveinputs",
"WaitBlockHeight",
"Wait",
# "ListConfigs",
# "check", # No point in mapping this one
"Stop",
Expand Down
196 changes: 107 additions & 89 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

Loading

0 comments on commit 47174e7

Please sign in to comment.