Skip to content

Commit

Permalink
msggen: Add DecodePay to the mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
cdecker committed May 3, 2023
1 parent b11d90d commit 76e3114
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 1 deletion.
149 changes: 149 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
"must-create": 0,
"must-replace": 1
},
"DecodepayFallbacksType": {
"P2PKH": 0,
"P2SH": 1,
"P2WPKH": 2,
"P2WSH": 3
},
"DelinvoiceStatus": {
"expired": 1,
"paid": 0,
Expand Down Expand Up @@ -390,6 +396,37 @@
"Datastore.key[]": 1,
"Datastore.string": 4
},
"DecodepayExtra": {
"DecodePay.extra[].data": 2,
"DecodePay.extra[].tag": 1
},
"DecodepayFallbacks": {
"DecodePay.fallbacks[].addr": 2,
"DecodePay.fallbacks[].hex": 3,
"DecodePay.fallbacks[].type": 1
},
"DecodepayRequest": {
"DecodePay.bolt11": 1,
"DecodePay.description": 2
},
"DecodepayResponse": {
"DecodePay.amount_msat": 5,
"DecodePay.created_at": 2,
"DecodePay.currency": 1,
"DecodePay.description": 8,
"DecodePay.description_hash": 9,
"DecodePay.expiry": 3,
"DecodePay.extra[]": 16,
"DecodePay.fallbacks[]": 14,
"DecodePay.features": 12,
"DecodePay.min_final_cltv_expiry": 10,
"DecodePay.payee": 4,
"DecodePay.payment_hash": 6,
"DecodePay.payment_metadata": 13,
"DecodePay.payment_secret": 11,
"DecodePay.routes[][]": 15,
"DecodePay.signature": 7
},
"DeldatastoreRequest": {
"DelDatastore.generation": 2,
"DelDatastore.key": 3,
Expand Down Expand Up @@ -1654,6 +1691,118 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay": {
"added": "v23.05",
"deprecated": null
},
"DecodePay.amount_msat": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.bolt11": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.created_at": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.currency": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.description": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.description_hash": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.expiry": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.extra[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.extra[].data": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.extra[].tag": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.fallbacks[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.fallbacks[].addr": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.fallbacks[].hex": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.fallbacks[].type": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.features": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.min_final_cltv_expiry": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.payee": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.payment_hash": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.payment_metadata": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.payment_secret": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.routes[][]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.routes[][].cltv_expiry_delta": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.routes[][].fee_base_msat": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.routes[][].fee_proportional_millionths": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.routes[][].pubkey": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.routes[][].short_channel_id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DecodePay.signature": {
"added": "pre-v0.10.1",
"deprecated": false
},
"DelDatastore": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
32 changes: 32 additions & 0 deletions cln-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,38 @@ async fn list_closed_channels(

}

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

}

async fn disconnect(
&self,
request: tonic::Request<pb::DisconnectRequest>,
Expand Down
2 changes: 1 addition & 1 deletion contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def load_jsonrpc_service(schema_dir: str):
"TxSend",
"ListPeerChannels",
"ListClosedChannels",
# "decodepay",
"DecodePay",
# "decode",
# "delpay",
# "disableoffer",
Expand Down

0 comments on commit 76e3114

Please sign in to comment.