Skip to content

Commit

Permalink
msggen: Include AddPsbtOutput to RPC list and meta field map; regener…
Browse files Browse the repository at this point in the history
…ate libraries
  • Loading branch information
s373nZ committed Apr 24, 2024
1 parent 9ae5c04 commit 03eb6cf
Show file tree
Hide file tree
Showing 11 changed files with 744 additions and 525 deletions.
43 changes: 43 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,17 @@
"AddgossipRequest": {
"AddGossip.message": 1
},
"AddpsbtoutputRequest": {
"AddPsbtOutput.destination": 4,
"AddPsbtOutput.initialpsbt": 3,
"AddPsbtOutput.locktime": 2,
"AddPsbtOutput.satoshi": 1
},
"AddpsbtoutputResponse": {
"AddPsbtOutput.estimated_added_weight": 2,
"AddPsbtOutput.outnum": 3,
"AddPsbtOutput.psbt": 1
},
"Autoclean-onceAutoclean": {
"AutoClean-Once.autoclean.expiredinvoices": 6,
"AutoClean-Once.autoclean.failedforwards": 2,
Expand Down Expand Up @@ -2266,6 +2277,38 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"AddPsbtOutput": {
"added": "v24.05",
"deprecated": false
},
"AddPsbtOutput.destination": {
"added": "v24.05",
"deprecated": false
},
"AddPsbtOutput.estimated_added_weight": {
"added": "v24.05",
"deprecated": false
},
"AddPsbtOutput.initialpsbt": {
"added": "v24.05",
"deprecated": false
},
"AddPsbtOutput.locktime": {
"added": "v24.05",
"deprecated": false
},
"AddPsbtOutput.outnum": {
"added": "v24.05",
"deprecated": false
},
"AddPsbtOutput.psbt": {
"added": "v24.05",
"deprecated": false
},
"AddPsbtOutput.satoshi": {
"added": "v24.05",
"deprecated": false
},
"AutoClean-Once": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
13 changes: 13 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.

33 changes: 33 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 @@ -218,6 +218,38 @@ async fn add_gossip(

}

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

}

async fn auto_clean_invoice(
&self,
request: tonic::Request<pb::AutocleaninvoiceRequest>,
Expand Down
50 changes: 50 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.

2 changes: 1 addition & 1 deletion contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"$schema": "../rpc-schema-draft.json",
"type": "object",
"additionalProperties": false,
"added": "v23.11",
"added": "v24.05",
"rpc": "addpsbtoutput",
"title": "Command to populate PSBT outputs from the wallet",
"description": [
Expand Down
3 changes: 3 additions & 0 deletions contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ def load_jsonrpc_method(name):


def load_jsonrpc_service():
# FIXME: Maybe this list should be located somewhere other than utils so
# it's more intuitive to remember to update when new RPC calls are added?
method_names = [
"Getinfo",
"ListPeers",
"ListFunds",
"SendPay",
"ListChannels",
"AddGossip",
"AddPsbtOutput",
"AutoCleanInvoice",
"AutoClean-Once",
"AutoClean-Status",
Expand Down
1,050 changes: 527 additions & 523 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ def __init__(self, channel):
request_serializer=node__pb2.AddgossipRequest.SerializeToString,
response_deserializer=node__pb2.AddgossipResponse.FromString,
)
self.AddPsbtOutput = channel.unary_unary(
'/cln.Node/AddPsbtOutput',
request_serializer=node__pb2.AddpsbtoutputRequest.SerializeToString,
response_deserializer=node__pb2.AddpsbtoutputResponse.FromString,
)
self.AutoCleanInvoice = channel.unary_unary(
'/cln.Node/AutoCleanInvoice',
request_serializer=node__pb2.AutocleaninvoiceRequest.SerializeToString,
Expand Down Expand Up @@ -430,6 +435,12 @@ def AddGossip(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def AddPsbtOutput(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def AutoCleanInvoice(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -877,6 +888,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.AddgossipRequest.FromString,
response_serializer=node__pb2.AddgossipResponse.SerializeToString,
),
'AddPsbtOutput': grpc.unary_unary_rpc_method_handler(
servicer.AddPsbtOutput,
request_deserializer=node__pb2.AddpsbtoutputRequest.FromString,
response_serializer=node__pb2.AddpsbtoutputResponse.SerializeToString,
),
'AutoCleanInvoice': grpc.unary_unary_rpc_method_handler(
servicer.AutoCleanInvoice,
request_deserializer=node__pb2.AutocleaninvoiceRequest.FromString,
Expand Down Expand Up @@ -1334,6 +1350,23 @@ def AddGossip(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def AddPsbtOutput(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/cln.Node/AddPsbtOutput',
node__pb2.AddpsbtoutputRequest.SerializeToString,
node__pb2.AddpsbtoutputResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def AutoCleanInvoice(request,
target,
Expand Down
8 changes: 8 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ def addgossip2py(m):
})


def addpsbtoutput2py(m):
return remove_default({
"estimated_added_weight": m.estimated_added_weight, # PrimitiveField in generate_composite
"outnum": m.outnum, # PrimitiveField in generate_composite
"psbt": m.psbt, # PrimitiveField in generate_composite
})


def autocleaninvoice2py(m):
return remove_default({
"cycle_seconds": m.cycle_seconds, # PrimitiveField in generate_composite
Expand Down
2 changes: 1 addition & 1 deletion doc/schemas/lightning-addpsbtoutput.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "../rpc-schema-draft.json",
"type": "object",
"additionalProperties": false,
"added": "v23.11",
"added": "v24.05",
"rpc": "addpsbtoutput",
"title": "Command to populate PSBT outputs from the wallet",
"description": [
Expand Down

0 comments on commit 03eb6cf

Please sign in to comment.