mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 22:31:48 +01:00
msggen: add setconfig method
Changelog-None
This commit is contained in:
parent
5ed04c9788
commit
ad31a18b1d
10 changed files with 396 additions and 108 deletions
66
.msggen.json
66
.msggen.json
|
@ -2350,6 +2350,24 @@
|
|||
"SetchannelResponse": {
|
||||
"SetChannel.channels[]": 1
|
||||
},
|
||||
"SetconfigConfig": {
|
||||
"SetConfig.config.config": 1,
|
||||
"SetConfig.config.dynamic": 4,
|
||||
"SetConfig.config.plugin": 3,
|
||||
"SetConfig.config.set": 5,
|
||||
"SetConfig.config.source": 2,
|
||||
"SetConfig.config.value_bool": 9,
|
||||
"SetConfig.config.value_int": 8,
|
||||
"SetConfig.config.value_msat": 7,
|
||||
"SetConfig.config.value_str": 6
|
||||
},
|
||||
"SetconfigRequest": {
|
||||
"SetConfig.config": 1,
|
||||
"SetConfig.val": 2
|
||||
},
|
||||
"SetconfigResponse": {
|
||||
"SetConfig.config": 1
|
||||
},
|
||||
"SigninvoiceRequest": {
|
||||
"SignInvoice.invstring": 1
|
||||
},
|
||||
|
@ -8236,6 +8254,54 @@
|
|||
"added": "v23.08",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
},
|
||||
"SetConfig.config": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.config": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.dynamic": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.plugin": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.set": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.source": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.value_bool": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.value_int": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.value_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.config.value_str": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SetConfig.val": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"SignInvoice": {
|
||||
"added": "v23.02",
|
||||
"deprecated": null
|
||||
|
|
22
cln-grpc/proto/node.proto
generated
22
cln-grpc/proto/node.proto
generated
|
@ -83,6 +83,7 @@ service Node {
|
|||
rpc SendInvoice(SendinvoiceRequest) returns (SendinvoiceResponse) {}
|
||||
rpc SendOnionMessage(SendonionmessageRequest) returns (SendonionmessageResponse) {}
|
||||
rpc SetChannel(SetchannelRequest) returns (SetchannelResponse) {}
|
||||
rpc SetConfig(SetconfigRequest) returns (SetconfigResponse) {}
|
||||
rpc SignInvoice(SigninvoiceRequest) returns (SigninvoiceResponse) {}
|
||||
rpc SignMessage(SignmessageRequest) returns (SignmessageResponse) {}
|
||||
rpc Splice_Init(Splice_initRequest) returns (Splice_initResponse) {}
|
||||
|
@ -2394,6 +2395,27 @@ message SetchannelChannels {
|
|||
optional bool ignore_fee_limits = 10;
|
||||
}
|
||||
|
||||
message SetconfigRequest {
|
||||
string config = 1;
|
||||
optional string val = 2;
|
||||
}
|
||||
|
||||
message SetconfigResponse {
|
||||
SetconfigConfig config = 1;
|
||||
}
|
||||
|
||||
message SetconfigConfig {
|
||||
string config = 1;
|
||||
string source = 2;
|
||||
optional string plugin = 3;
|
||||
bool dynamic = 4;
|
||||
optional bool set = 5;
|
||||
optional string value_str = 6;
|
||||
optional Amount value_msat = 7;
|
||||
optional sint64 value_int = 8;
|
||||
optional bool value_bool = 9;
|
||||
}
|
||||
|
||||
message SigninvoiceRequest {
|
||||
string invstring = 1;
|
||||
}
|
||||
|
|
46
cln-grpc/src/convert.rs
generated
46
cln-grpc/src/convert.rs
generated
|
@ -2267,6 +2267,32 @@ impl From<responses::SetchannelResponse> for pb::SetchannelResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::SetconfigConfig> for pb::SetconfigConfig {
|
||||
fn from(c: responses::SetconfigConfig) -> Self {
|
||||
Self {
|
||||
config: c.config, // Rule #2 for type string
|
||||
dynamic: c.dynamic, // Rule #2 for type boolean
|
||||
plugin: c.plugin, // Rule #2 for type string?
|
||||
set: c.set, // Rule #2 for type boolean?
|
||||
source: c.source, // Rule #2 for type string
|
||||
value_bool: c.value_bool, // Rule #2 for type boolean?
|
||||
value_int: c.value_int, // Rule #2 for type integer?
|
||||
value_msat: c.value_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
value_str: c.value_str, // Rule #2 for type string?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::SetconfigResponse> for pb::SetconfigResponse {
|
||||
fn from(c: responses::SetconfigResponse) -> Self {
|
||||
Self {
|
||||
config: Some(c.config.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::SigninvoiceResponse> for pb::SigninvoiceResponse {
|
||||
fn from(c: responses::SigninvoiceResponse) -> Self {
|
||||
|
@ -3586,6 +3612,16 @@ impl From<requests::SetchannelRequest> for pb::SetchannelRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::SetconfigRequest> for pb::SetconfigRequest {
|
||||
fn from(c: requests::SetconfigRequest) -> Self {
|
||||
Self {
|
||||
config: c.config, // Rule #2 for type string
|
||||
val: c.val, // Rule #2 for type string?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::SigninvoiceRequest> for pb::SigninvoiceRequest {
|
||||
fn from(c: requests::SigninvoiceRequest) -> Self {
|
||||
|
@ -4722,6 +4758,16 @@ impl From<pb::SetchannelRequest> for requests::SetchannelRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::SetconfigRequest> for requests::SetconfigRequest {
|
||||
fn from(c: pb::SetconfigRequest) -> Self {
|
||||
Self {
|
||||
config: c.config, // Rule #1 for type string
|
||||
val: c.val, // Rule #1 for type string?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::SigninvoiceRequest> for requests::SigninvoiceRequest {
|
||||
fn from(c: pb::SigninvoiceRequest) -> Self {
|
||||
|
|
|
@ -2426,6 +2426,38 @@ async fn set_channel(
|
|||
|
||||
}
|
||||
|
||||
async fn set_config(
|
||||
&self,
|
||||
request: tonic::Request<pb::SetconfigRequest>,
|
||||
) -> Result<tonic::Response<pb::SetconfigResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::SetconfigRequest = req.into();
|
||||
debug!("Client asked for set_config");
|
||||
trace!("set_config 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::SetConfig(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method SetConfig: {:?}", e)))?;
|
||||
match result {
|
||||
Response::SetConfig(r) => {
|
||||
trace!("set_config response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call SetConfig",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn sign_invoice(
|
||||
&self,
|
||||
request: tonic::Request<pb::SigninvoiceRequest>,
|
||||
|
|
61
cln-rpc/src/model.rs
generated
61
cln-rpc/src/model.rs
generated
|
@ -94,6 +94,7 @@ pub enum Request {
|
|||
SendInvoice(requests::SendinvoiceRequest),
|
||||
SendOnionMessage(requests::SendonionmessageRequest),
|
||||
SetChannel(requests::SetchannelRequest),
|
||||
SetConfig(requests::SetconfigRequest),
|
||||
SignInvoice(requests::SigninvoiceRequest),
|
||||
SignMessage(requests::SignmessageRequest),
|
||||
Splice_Init(requests::Splice_initRequest),
|
||||
|
@ -201,6 +202,7 @@ pub enum Response {
|
|||
SendInvoice(responses::SendinvoiceResponse),
|
||||
SendOnionMessage(responses::SendonionmessageResponse),
|
||||
SetChannel(responses::SetchannelResponse),
|
||||
SetConfig(responses::SetconfigResponse),
|
||||
SignInvoice(responses::SigninvoiceResponse),
|
||||
SignMessage(responses::SignmessageResponse),
|
||||
Splice_Init(responses::Splice_initResponse),
|
||||
|
@ -2853,6 +2855,30 @@ pub mod requests {
|
|||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SetconfigRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub val: Option<String>,
|
||||
pub config: String,
|
||||
}
|
||||
|
||||
impl From<SetconfigRequest> for Request {
|
||||
fn from(r: SetconfigRequest) -> Self {
|
||||
Request::SetConfig(r)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRequest for SetconfigRequest {
|
||||
type Response = super::responses::SetconfigResponse;
|
||||
}
|
||||
|
||||
impl TypedRequest for SetconfigRequest {
|
||||
type Response = super::responses::SetconfigResponse;
|
||||
|
||||
fn method(&self) -> &str {
|
||||
"setconfig"
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SigninvoiceRequest {
|
||||
pub invstring: String,
|
||||
}
|
||||
|
@ -7610,6 +7636,41 @@ pub mod responses {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SetconfigConfig {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub plugin: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub set: Option<bool>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub value_bool: Option<bool>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub value_int: Option<i64>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub value_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub value_str: Option<String>,
|
||||
pub config: String,
|
||||
pub dynamic: bool,
|
||||
pub source: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SetconfigResponse {
|
||||
pub config: SetconfigConfig,
|
||||
}
|
||||
|
||||
impl TryFrom<Response> for SetconfigResponse {
|
||||
type Error = super::TryFromResponseError;
|
||||
|
||||
fn try_from(response: Response) -> Result<Self, Self::Error> {
|
||||
match response {
|
||||
Response::SetConfig(response) => Ok(response),
|
||||
_ => Err(TryFromResponseError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SigninvoiceResponse {
|
||||
pub bolt11: String,
|
||||
|
|
|
@ -488,6 +488,7 @@ RoutehintListField = PrimitiveField(
|
|||
added=None,
|
||||
deprecated=None
|
||||
)
|
||||
SetConfigValField = PrimitiveField("string", None, None, added=None, deprecated=None)
|
||||
|
||||
# TlvStreams are special, they don't have preset dict-keys, rather
|
||||
# they can specify `u64` keys pointing to hex payloads. So the schema
|
||||
|
@ -516,7 +517,8 @@ overrides = {
|
|||
'DatastoreUsage.key': DatastoreUsageKeyField,
|
||||
'WaitInvoice.label': InvoiceLabelField,
|
||||
'Offer.recurrence_base': OfferStringField,
|
||||
'Offer.amount': OfferStringField
|
||||
'Offer.amount': OfferStringField,
|
||||
'SetConfig.val': SetConfigValField
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ def load_jsonrpc_service():
|
|||
"SendInvoice",
|
||||
"SendOnionMessage",
|
||||
"SetChannel",
|
||||
"SetConfig",
|
||||
"SignInvoice",
|
||||
"SignMessage",
|
||||
"Splice_Init",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -389,6 +389,11 @@ class NodeStub(object):
|
|||
request_serializer=node__pb2.SetchannelRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.SetchannelResponse.FromString,
|
||||
)
|
||||
self.SetConfig = channel.unary_unary(
|
||||
'/cln.Node/SetConfig',
|
||||
request_serializer=node__pb2.SetconfigRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.SetconfigResponse.FromString,
|
||||
)
|
||||
self.SignInvoice = channel.unary_unary(
|
||||
'/cln.Node/SignInvoice',
|
||||
request_serializer=node__pb2.SigninvoiceRequest.SerializeToString,
|
||||
|
@ -934,6 +939,12 @@ class NodeServicer(object):
|
|||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def SetConfig(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 SignInvoice(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
|
@ -1420,6 +1431,11 @@ def add_NodeServicer_to_server(servicer, server):
|
|||
request_deserializer=node__pb2.SetchannelRequest.FromString,
|
||||
response_serializer=node__pb2.SetchannelResponse.SerializeToString,
|
||||
),
|
||||
'SetConfig': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SetConfig,
|
||||
request_deserializer=node__pb2.SetconfigRequest.FromString,
|
||||
response_serializer=node__pb2.SetconfigResponse.SerializeToString,
|
||||
),
|
||||
'SignInvoice': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SignInvoice,
|
||||
request_deserializer=node__pb2.SigninvoiceRequest.FromString,
|
||||
|
@ -2795,6 +2811,23 @@ class Node(object):
|
|||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def SetConfig(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/SetConfig',
|
||||
node__pb2.SetconfigRequest.SerializeToString,
|
||||
node__pb2.SetconfigResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def SignInvoice(request,
|
||||
target,
|
||||
|
|
|
@ -1816,6 +1816,25 @@ def setchannel2py(m):
|
|||
})
|
||||
|
||||
|
||||
def setconfig_config2py(m):
|
||||
return remove_default({
|
||||
"config": m.config, # PrimitiveField in generate_composite
|
||||
"dynamic": m.dynamic, # PrimitiveField in generate_composite
|
||||
"plugin": m.plugin, # PrimitiveField in generate_composite
|
||||
"set": m.set, # PrimitiveField in generate_composite
|
||||
"source": m.source, # PrimitiveField in generate_composite
|
||||
"value_bool": m.value_bool, # PrimitiveField in generate_composite
|
||||
"value_int": m.value_int, # PrimitiveField in generate_composite
|
||||
"value_msat": amount2msat(m.value_msat), # PrimitiveField in generate_composite
|
||||
"value_str": m.value_str, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def setconfig2py(m):
|
||||
return remove_default({
|
||||
})
|
||||
|
||||
|
||||
def signinvoice2py(m):
|
||||
return remove_default({
|
||||
"bolt11": m.bolt11, # PrimitiveField in generate_composite
|
||||
|
|
Loading…
Add table
Reference in a new issue