msggen: add showrunes method

Changelog-None
This commit is contained in:
daywalker90 2024-04-24 21:37:38 +02:00 committed by Christian Decker
parent 21446c3401
commit 19646f93c6
11 changed files with 407 additions and 31 deletions

View file

@ -3008,6 +3008,32 @@
"SetpsbtversionResponse": {
"SetPsbtVersion.psbt": 1
},
"ShowrunesRequest": {
"ShowRunes.rune": 1
},
"ShowrunesResponse": {
"ShowRunes.runes[]": 1
},
"ShowrunesRunes": {
"ShowRunes.runes[].blacklisted": 6,
"ShowRunes.runes[].last_used": 7,
"ShowRunes.runes[].our_rune": 8,
"ShowRunes.runes[].restrictions[]": 3,
"ShowRunes.runes[].restrictions_as_english": 4,
"ShowRunes.runes[].rune": 1,
"ShowRunes.runes[].stored": 5,
"ShowRunes.runes[].unique_id": 2
},
"ShowrunesRunesRestrictions": {
"ShowRunes.runes[].restrictions[].alternatives[]": 1,
"ShowRunes.runes[].restrictions[].english": 2
},
"ShowrunesRunesRestrictionsAlternatives": {
"ShowRunes.runes[].restrictions[].alternatives[].condition": 3,
"ShowRunes.runes[].restrictions[].alternatives[].english": 4,
"ShowRunes.runes[].restrictions[].alternatives[].fieldname": 1,
"ShowRunes.runes[].restrictions[].alternatives[].value": 2
},
"SigninvoiceRequest": {
"SignInvoice.invstring": 1
},
@ -10460,6 +10486,74 @@
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes": {
"added": "pre-v0.10.1",
"deprecated": null
},
"ShowRunes.rune": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].blacklisted": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].last_used": {
"added": "v23.11",
"deprecated": false
},
"ShowRunes.runes[].our_rune": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions[].alternatives[]": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions[].alternatives[].condition": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions[].alternatives[].english": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions[].alternatives[].fieldname": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions[].alternatives[].value": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions[].english": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].restrictions_as_english": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].rune": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].stored": {
"added": "pre-v0.10.1",
"deprecated": false
},
"ShowRunes.runes[].unique_id": {
"added": "pre-v0.10.1",
"deprecated": false
},
"SignInvoice": {
"added": "v23.02",
"deprecated": null

View file

@ -116,6 +116,7 @@ service Node {
rpc BkprListAccountEvents(BkprlistaccounteventsRequest) returns (BkprlistaccounteventsResponse) {}
rpc BkprListBalances(BkprlistbalancesRequest) returns (BkprlistbalancesResponse) {}
rpc BkprListIncome(BkprlistincomeRequest) returns (BkprlistincomeResponse) {}
rpc ShowRunes(ShowrunesRequest) returns (ShowrunesResponse) {}
rpc SubscribeBlockAdded(StreamBlockAddedRequest) returns (stream BlockAddedNotification) {}
rpc SubscribeChannelOpenFailed(StreamChannelOpenFailedRequest) returns (stream ChannelOpenFailedNotification) {}
@ -3502,6 +3503,37 @@ message BkprlistincomeIncome_events {
optional bytes payment_id = 10;
}
message ShowrunesRequest {
optional string rune = 1;
}
message ShowrunesResponse {
repeated ShowrunesRunes runes = 1;
}
message ShowrunesRunes {
string rune = 1;
string unique_id = 2;
repeated ShowrunesRunesRestrictions restrictions = 3;
string restrictions_as_english = 4;
optional bool stored = 5;
optional bool blacklisted = 6;
optional double last_used = 7;
optional bool our_rune = 8;
}
message ShowrunesRunesRestrictions {
repeated ShowrunesRunesRestrictionsAlternatives alternatives = 1;
string english = 2;
}
message ShowrunesRunesRestrictionsAlternatives {
string fieldname = 1;
string value = 2;
string condition = 3;
string english = 4;
}
message StreamBlockAddedRequest {
}

View file

@ -3794,6 +3794,56 @@ impl From<responses::BkprlistincomeResponse> for pb::BkprlistincomeResponse {
}
}
#[allow(unused_variables)]
impl From<responses::ShowrunesRunesRestrictionsAlternatives> for pb::ShowrunesRunesRestrictionsAlternatives {
fn from(c: responses::ShowrunesRunesRestrictionsAlternatives) -> Self {
Self {
condition: c.condition, // Rule #2 for type string
english: c.english, // Rule #2 for type string
fieldname: c.fieldname, // Rule #2 for type string
value: c.value, // Rule #2 for type string
}
}
}
#[allow(unused_variables)]
impl From<responses::ShowrunesRunesRestrictions> for pb::ShowrunesRunesRestrictions {
fn from(c: responses::ShowrunesRunesRestrictions) -> Self {
Self {
// Field: ShowRunes.runes[].restrictions[].alternatives[]
alternatives: c.alternatives.into_iter().map(|i| i.into()).collect(), // Rule #3 for type ShowrunesRunesRestrictionsAlternatives
english: c.english, // Rule #2 for type string
}
}
}
#[allow(unused_variables)]
impl From<responses::ShowrunesRunes> for pb::ShowrunesRunes {
fn from(c: responses::ShowrunesRunes) -> Self {
Self {
blacklisted: c.blacklisted, // Rule #2 for type boolean?
last_used: c.last_used, // Rule #2 for type number?
our_rune: c.our_rune, // Rule #2 for type boolean?
// Field: ShowRunes.runes[].restrictions[]
restrictions: c.restrictions.into_iter().map(|i| i.into()).collect(), // Rule #3 for type ShowrunesRunesRestrictions
restrictions_as_english: c.restrictions_as_english, // Rule #2 for type string
rune: c.rune, // Rule #2 for type string
stored: c.stored, // Rule #2 for type boolean?
unique_id: c.unique_id, // Rule #2 for type string
}
}
}
#[allow(unused_variables)]
impl From<responses::ShowrunesResponse> for pb::ShowrunesResponse {
fn from(c: responses::ShowrunesResponse) -> Self {
Self {
// Field: ShowRunes.runes[]
runes: c.runes.into_iter().map(|i| i.into()).collect(), // Rule #3 for type ShowrunesRunes
}
}
}
#[allow(unused_variables)]
impl From<notifications::BlockAddedNotification> for pb::BlockAddedNotification {
fn from(c: notifications::BlockAddedNotification) -> Self {
@ -5187,6 +5237,15 @@ impl From<requests::BkprlistincomeRequest> for pb::BkprlistincomeRequest {
}
}
#[allow(unused_variables)]
impl From<requests::ShowrunesRequest> for pb::ShowrunesRequest {
fn from(c: requests::ShowrunesRequest) -> Self {
Self {
rune: c.rune, // Rule #2 for type string?
}
}
}
#[allow(unused_variables)]
impl From<notifications::requests::StreamBlockAddedRequest> for pb::StreamBlockAddedRequest {
fn from(c: notifications::requests::StreamBlockAddedRequest) -> Self {
@ -6529,6 +6588,15 @@ impl From<pb::BkprlistincomeRequest> for requests::BkprlistincomeRequest {
}
}
#[allow(unused_variables)]
impl From<pb::ShowrunesRequest> for requests::ShowrunesRequest {
fn from(c: pb::ShowrunesRequest) -> Self {
Self {
rune: c.rune, // Rule #1 for type string?
}
}
}
#[allow(unused_variables)]
impl From<pb::StreamBlockAddedRequest> for notifications::requests::StreamBlockAddedRequest {
fn from(c: pb::StreamBlockAddedRequest) -> Self {

View file

@ -3538,6 +3538,38 @@ impl Node for Server
}
async fn show_runes(
&self,
request: tonic::Request<pb::ShowrunesRequest>,
) -> Result<tonic::Response<pb::ShowrunesResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::ShowrunesRequest = req.into();
debug!("Client asked for show_runes");
trace!("show_runes 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::ShowRunes(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method ShowRunes: {:?}", e)))?;
match result {
Response::ShowRunes(r) => {
trace!("show_runes response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call ShowRunes",
r
)
)),
}
}
type SubscribeBlockAddedStream = NotificationStream<pb::BlockAddedNotification>;

71
cln-rpc/src/model.rs generated
View file

@ -134,6 +134,7 @@ pub enum Request {
BkprListBalances(requests::BkprlistbalancesRequest),
#[serde(rename = "bkpr-listincome")]
BkprListIncome(requests::BkprlistincomeRequest),
ShowRunes(requests::ShowrunesRequest),
}
#[derive(Clone, Debug, Serialize, Deserialize)]
@ -257,6 +258,7 @@ pub enum Response {
BkprListBalances(responses::BkprlistbalancesResponse),
#[serde(rename = "bkpr-listincome")]
BkprListIncome(responses::BkprlistincomeResponse),
ShowRunes(responses::ShowrunesResponse),
}
@ -3811,6 +3813,29 @@ pub mod requests {
"bkpr-listincome"
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ShowrunesRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub rune: Option<String>,
}
impl From<ShowrunesRequest> for Request {
fn from(r: ShowrunesRequest) -> Self {
Request::ShowRunes(r)
}
}
impl IntoRequest for ShowrunesRequest {
type Response = super::responses::ShowrunesResponse;
}
impl TypedRequest for ShowrunesRequest {
type Response = super::responses::ShowrunesResponse;
fn method(&self) -> &str {
"showrunes"
}
}
}
@ -10044,5 +10069,51 @@ pub mod responses {
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ShowrunesRunesRestrictionsAlternatives {
pub condition: String,
pub english: String,
pub fieldname: String,
pub value: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ShowrunesRunesRestrictions {
pub alternatives: Vec<ShowrunesRunesRestrictionsAlternatives>,
pub english: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ShowrunesRunes {
#[serde(skip_serializing_if = "Option::is_none")]
pub blacklisted: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub last_used: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub our_rune: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub stored: Option<bool>,
pub restrictions: Vec<ShowrunesRunesRestrictions>,
pub restrictions_as_english: String,
pub rune: String,
pub unique_id: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ShowrunesResponse {
pub runes: Vec<ShowrunesRunes>,
}
impl TryFrom<Response> for ShowrunesResponse {
type Error = super::TryFromResponseError;
fn try_from(response: Response) -> Result<Self, Self::Error> {
match response {
Response::ShowRunes(response) => Ok(response),
_ => Err(TryFromResponseError)
}
}
}
}

View file

@ -27700,7 +27700,7 @@
"description": [
"The last time this rune was successfully used."
],
"added": "23.11"
"added": "v23.11"
},
"our_rune": {
"type": "boolean",

View file

@ -201,6 +201,7 @@ def load_jsonrpc_service():
"Bkpr-ListAccountEvents",
"Bkpr-ListBalances",
"Bkpr-ListIncome",
"ShowRunes",
]
notification_names = [

File diff suppressed because one or more lines are too long

View file

@ -554,6 +554,11 @@ class NodeStub(object):
request_serializer=node__pb2.BkprlistincomeRequest.SerializeToString,
response_deserializer=node__pb2.BkprlistincomeResponse.FromString,
)
self.ShowRunes = channel.unary_unary(
'/cln.Node/ShowRunes',
request_serializer=node__pb2.ShowrunesRequest.SerializeToString,
response_deserializer=node__pb2.ShowrunesResponse.FromString,
)
self.SubscribeBlockAdded = channel.unary_stream(
'/cln.Node/SubscribeBlockAdded',
request_serializer=node__pb2.StreamBlockAddedRequest.SerializeToString,
@ -1232,6 +1237,12 @@ class NodeServicer(object):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def ShowRunes(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 SubscribeBlockAdded(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@ -1805,6 +1816,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.BkprlistincomeRequest.FromString,
response_serializer=node__pb2.BkprlistincomeResponse.SerializeToString,
),
'ShowRunes': grpc.unary_unary_rpc_method_handler(
servicer.ShowRunes,
request_deserializer=node__pb2.ShowrunesRequest.FromString,
response_serializer=node__pb2.ShowrunesResponse.SerializeToString,
),
'SubscribeBlockAdded': grpc.unary_stream_rpc_method_handler(
servicer.SubscribeBlockAdded,
request_deserializer=node__pb2.StreamBlockAddedRequest.FromString,
@ -3676,6 +3692,23 @@ class Node(object):
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def ShowRunes(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/ShowRunes',
node__pb2.ShowrunesRequest.SerializeToString,
node__pb2.ShowrunesResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SubscribeBlockAdded(request,
target,

View file

@ -2790,6 +2790,41 @@ def bkpr_listincome2py(m):
})
def showrunes_runes_restrictions_alternatives2py(m):
return remove_default({
"condition": m.condition, # PrimitiveField in generate_composite
"english": m.english, # PrimitiveField in generate_composite
"fieldname": m.fieldname, # PrimitiveField in generate_composite
"value": m.value, # PrimitiveField in generate_composite
})
def showrunes_runes_restrictions2py(m):
return remove_default({
"alternatives": [showrunes_runes_restrictions_alternatives2py(i) for i in m.alternatives], # ArrayField[composite] in generate_composite
"english": m.english, # PrimitiveField in generate_composite
})
def showrunes_runes2py(m):
return remove_default({
"restrictions": [showrunes_runes_restrictions2py(i) for i in m.restrictions], # ArrayField[composite] in generate_composite
"blacklisted": m.blacklisted, # PrimitiveField in generate_composite
"last_used": m.last_used, # PrimitiveField in generate_composite
"our_rune": m.our_rune, # PrimitiveField in generate_composite
"restrictions_as_english": m.restrictions_as_english, # PrimitiveField in generate_composite
"rune": m.rune, # PrimitiveField in generate_composite
"stored": m.stored, # PrimitiveField in generate_composite
"unique_id": m.unique_id, # PrimitiveField in generate_composite
})
def showrunes2py(m):
return remove_default({
"runes": [showrunes_runes2py(i) for i in m.runes], # ArrayField[composite] in generate_composite
})
def decodekeysend_routes2py(m): # manual override
return remove_default({
"expirydelta": m.expirydelta,

View file

@ -138,7 +138,7 @@
"description": [
"The last time this rune was successfully used."
],
"added": "23.11"
"added": "v23.11"
},
"our_rune": {
"type": "boolean",