msggen: add delpay method

This commit is contained in:
daywalker90 2024-04-17 11:58:52 +02:00 committed by Christian Decker
parent c8337aaf7f
commit 2d0778ec38
9 changed files with 426 additions and 194 deletions

View File

@ -55,6 +55,15 @@
"paid": 0, "paid": 0,
"unpaid": 2 "unpaid": 2
}, },
"DelpayPaymentsStatus": {
"complete": 2,
"failed": 1,
"pending": 0
},
"DelpayStatus": {
"complete": 0,
"failed": 1
},
"FeeratesStyle": { "FeeratesStyle": {
"perkb": 0, "perkb": 0,
"perkw": 1 "perkw": 1
@ -717,6 +726,34 @@
"DelInvoice.status": 7, "DelInvoice.status": 7,
"DelInvoice.updated_index": 13 "DelInvoice.updated_index": 13
}, },
"DelpayPayments": {
"DelPay.payments[].amount_msat": 8,
"DelPay.payments[].amount_sent_msat": 5,
"DelPay.payments[].bolt11": 15,
"DelPay.payments[].bolt12": 16,
"DelPay.payments[].completed_at": 11,
"DelPay.payments[].created_at": 9,
"DelPay.payments[].created_index": 1,
"DelPay.payments[].destination": 7,
"DelPay.payments[].erroronion": 17,
"DelPay.payments[].groupid": 12,
"DelPay.payments[].id": 2,
"DelPay.payments[].label": 14,
"DelPay.payments[].partid": 6,
"DelPay.payments[].payment_hash": 3,
"DelPay.payments[].payment_preimage": 13,
"DelPay.payments[].status": 4,
"DelPay.payments[].updated_index": 10
},
"DelpayRequest": {
"DelPay.groupid": 4,
"DelPay.partid": 3,
"DelPay.payment_hash": 1,
"DelPay.status": 2
},
"DelpayResponse": {
"DelPay.payments[]": 1
},
"DisconnectRequest": { "DisconnectRequest": {
"Disconnect.force": 2, "Disconnect.force": 2,
"Disconnect.id": 1 "Disconnect.id": 1
@ -3180,6 +3217,98 @@
"added": "v23.08", "added": "v23.08",
"deprecated": false "deprecated": false
}, },
"DelPay": {
"added": "pre-v0.10.1",
"deprecated": null
},
"DelPay.groupid": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.partid": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payment_hash": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].amount_msat": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].amount_sent_msat": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].bolt11": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].bolt12": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].completed_at": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].created_at": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].created_index": {
"added": "v23.11",
"deprecated": false
},
"DelPay.payments[].destination": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].erroronion": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].groupid": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].label": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].partid": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].payment_hash": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].payment_preimage": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].status": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelPay.payments[].updated_index": {
"added": "v23.11",
"deprecated": false
},
"DelPay.status": {
"added": "pre-v0.10.1",
"deprecated": false
},
"Disconnect": { "Disconnect": {
"added": "pre-v0.10.1", "added": "pre-v0.10.1",
"deprecated": null "deprecated": null

Binary file not shown.

BIN
cln-grpc/src/convert.rs generated

Binary file not shown.

View File

@ -1338,6 +1338,38 @@ async fn decode(
} }
async fn del_pay(
&self,
request: tonic::Request<pb::DelpayRequest>,
) -> Result<tonic::Response<pb::DelpayResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::DelpayRequest = req.into();
debug!("Client asked for del_pay");
trace!("del_pay 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::DelPay(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method DelPay: {:?}", e)))?;
match result {
Response::DelPay(r) => {
trace!("del_pay response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call DelPay",
r
)
)),
}
}
async fn disconnect( async fn disconnect(
&self, &self,
request: tonic::Request<pb::DisconnectRequest>, request: tonic::Request<pb::DisconnectRequest>,

BIN
cln-rpc/src/model.rs generated

Binary file not shown.

View File

@ -99,7 +99,7 @@ def load_jsonrpc_service():
"ListClosedChannels", "ListClosedChannels",
"DecodePay", "DecodePay",
"Decode", "Decode",
# "delpay", "DelPay",
# "disableoffer", # "disableoffer",
"Disconnect", "Disconnect",
"Feerates", "Feerates",

File diff suppressed because one or more lines are too long

View File

@ -219,6 +219,11 @@ class NodeStub(object):
request_serializer=node__pb2.DecodeRequest.SerializeToString, request_serializer=node__pb2.DecodeRequest.SerializeToString,
response_deserializer=node__pb2.DecodeResponse.FromString, response_deserializer=node__pb2.DecodeResponse.FromString,
) )
self.DelPay = channel.unary_unary(
'/cln.Node/DelPay',
request_serializer=node__pb2.DelpayRequest.SerializeToString,
response_deserializer=node__pb2.DelpayResponse.FromString,
)
self.Disconnect = channel.unary_unary( self.Disconnect = channel.unary_unary(
'/cln.Node/Disconnect', '/cln.Node/Disconnect',
request_serializer=node__pb2.DisconnectRequest.SerializeToString, request_serializer=node__pb2.DisconnectRequest.SerializeToString,
@ -610,6 +615,12 @@ class NodeServicer(object):
context.set_details('Method not implemented!') context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') raise NotImplementedError('Method not implemented!')
def DelPay(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 Disconnect(self, request, context): def Disconnect(self, request, context):
"""Missing associated documentation comment in .proto file.""" """Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@ -986,6 +997,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.DecodeRequest.FromString, request_deserializer=node__pb2.DecodeRequest.FromString,
response_serializer=node__pb2.DecodeResponse.SerializeToString, response_serializer=node__pb2.DecodeResponse.SerializeToString,
), ),
'DelPay': grpc.unary_unary_rpc_method_handler(
servicer.DelPay,
request_deserializer=node__pb2.DelpayRequest.FromString,
response_serializer=node__pb2.DelpayResponse.SerializeToString,
),
'Disconnect': grpc.unary_unary_rpc_method_handler( 'Disconnect': grpc.unary_unary_rpc_method_handler(
servicer.Disconnect, servicer.Disconnect,
request_deserializer=node__pb2.DisconnectRequest.FromString, request_deserializer=node__pb2.DisconnectRequest.FromString,
@ -1833,6 +1849,23 @@ class Node(object):
options, channel_credentials, options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata) insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def DelPay(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/DelPay',
node__pb2.DelpayRequest.SerializeToString,
node__pb2.DelpayResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod @staticmethod
def Disconnect(request, def Disconnect(request,
target, target,

View File

@ -1148,6 +1148,34 @@ def decode2py(m):
}) })
def delpay_payments2py(m):
return remove_default({
"status": str(m.status), # EnumField in generate_composite
"amount_msat": amount2msat(m.amount_msat), # PrimitiveField in generate_composite
"amount_sent_msat": amount2msat(m.amount_sent_msat), # PrimitiveField in generate_composite
"bolt11": m.bolt11, # PrimitiveField in generate_composite
"bolt12": m.bolt12, # PrimitiveField in generate_composite
"completed_at": m.completed_at, # PrimitiveField in generate_composite
"created_at": m.created_at, # PrimitiveField in generate_composite
"created_index": m.created_index, # PrimitiveField in generate_composite
"destination": hexlify(m.destination), # PrimitiveField in generate_composite
"erroronion": hexlify(m.erroronion), # PrimitiveField in generate_composite
"groupid": m.groupid, # PrimitiveField in generate_composite
"id": m.id, # PrimitiveField in generate_composite
"label": m.label, # PrimitiveField in generate_composite
"partid": m.partid, # PrimitiveField in generate_composite
"payment_hash": hexlify(m.payment_hash), # PrimitiveField in generate_composite
"payment_preimage": hexlify(m.payment_preimage), # PrimitiveField in generate_composite
"updated_index": m.updated_index, # PrimitiveField in generate_composite
})
def delpay2py(m):
return remove_default({
"payments": [delpay_payments2py(i) for i in m.payments], # ArrayField[composite] in generate_composite
})
def disconnect2py(m): def disconnect2py(m):
return remove_default({ return remove_default({
}) })