mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
msggen: Regenerate for addition of SignInvoice
Performed using: PYTHONPATH=contrib/msggen python3 contrib/msggen/msggen/__main__.py
This commit is contained in:
parent
11227d37ba
commit
dc4ae9deb4
6 changed files with 104 additions and 0 deletions
|
@ -1006,6 +1006,12 @@
|
|||
"SetchannelResponse": {
|
||||
"SetChannel.channels[]": 1
|
||||
},
|
||||
"SigninvoiceRequest": {
|
||||
"SignInvoice.invstring": 1
|
||||
},
|
||||
"SigninvoiceResponse": {
|
||||
"SignInvoice.bolt11": 1
|
||||
},
|
||||
"SignmessageRequest": {
|
||||
"SignMessage.message": 1
|
||||
},
|
||||
|
|
9
cln-grpc/proto/node.proto
generated
9
cln-grpc/proto/node.proto
generated
|
@ -53,6 +53,7 @@ service Node {
|
|||
rpc ListPays(ListpaysRequest) returns (ListpaysResponse) {}
|
||||
rpc Ping(PingRequest) returns (PingResponse) {}
|
||||
rpc SetChannel(SetchannelRequest) returns (SetchannelResponse) {}
|
||||
rpc SignInvoice(SigninvoiceRequest) returns (SigninvoiceResponse) {}
|
||||
rpc SignMessage(SignmessageRequest) returns (SignmessageResponse) {}
|
||||
rpc Stop(StopRequest) returns (StopResponse) {}
|
||||
}
|
||||
|
@ -1323,6 +1324,14 @@ message SetchannelChannels {
|
|||
optional string warning_htlcmax_too_high = 9;
|
||||
}
|
||||
|
||||
message SigninvoiceRequest {
|
||||
string invstring = 1;
|
||||
}
|
||||
|
||||
message SigninvoiceResponse {
|
||||
string bolt11 = 1;
|
||||
}
|
||||
|
||||
message SignmessageRequest {
|
||||
string message = 1;
|
||||
}
|
||||
|
|
18
cln-grpc/src/convert.rs
generated
18
cln-grpc/src/convert.rs
generated
|
@ -1101,6 +1101,15 @@ impl From<responses::SetchannelResponse> for pb::SetchannelResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::SigninvoiceResponse> for pb::SigninvoiceResponse {
|
||||
fn from(c: responses::SigninvoiceResponse) -> Self {
|
||||
Self {
|
||||
bolt11: c.bolt11, // Rule #2 for type string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::SignmessageResponse> for pb::SignmessageResponse {
|
||||
fn from(c: responses::SignmessageResponse) -> Self {
|
||||
|
@ -1690,6 +1699,15 @@ impl From<pb::SetchannelRequest> for requests::SetchannelRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::SigninvoiceRequest> for requests::SigninvoiceRequest {
|
||||
fn from(c: pb::SigninvoiceRequest) -> Self {
|
||||
Self {
|
||||
invstring: c.invstring, // Rule #1 for type string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::SignmessageRequest> for requests::SignmessageRequest {
|
||||
fn from(c: pb::SignmessageRequest) -> Self {
|
||||
|
|
|
@ -1466,6 +1466,38 @@ async fn set_channel(
|
|||
|
||||
}
|
||||
|
||||
async fn sign_invoice(
|
||||
&self,
|
||||
request: tonic::Request<pb::SigninvoiceRequest>,
|
||||
) -> Result<tonic::Response<pb::SigninvoiceResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::SigninvoiceRequest = req.into();
|
||||
debug!("Client asked for sign_invoice");
|
||||
trace!("sign_invoice 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::SignInvoice(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method SignInvoice: {:?}", e)))?;
|
||||
match result {
|
||||
Response::SignInvoice(r) => {
|
||||
trace!("sign_invoice response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call SignInvoice",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn sign_message(
|
||||
&self,
|
||||
request: tonic::Request<pb::SignmessageRequest>,
|
||||
|
|
33
cln-rpc/src/model.rs
generated
33
cln-rpc/src/model.rs
generated
|
@ -61,6 +61,7 @@ pub enum Request {
|
|||
ListPays(requests::ListpaysRequest),
|
||||
Ping(requests::PingRequest),
|
||||
SetChannel(requests::SetchannelRequest),
|
||||
SignInvoice(requests::SigninvoiceRequest),
|
||||
SignMessage(requests::SignmessageRequest),
|
||||
Stop(requests::StopRequest),
|
||||
}
|
||||
|
@ -114,6 +115,7 @@ pub enum Response {
|
|||
ListPays(responses::ListpaysResponse),
|
||||
Ping(responses::PingResponse),
|
||||
SetChannel(responses::SetchannelResponse),
|
||||
SignInvoice(responses::SigninvoiceResponse),
|
||||
SignMessage(responses::SignmessageResponse),
|
||||
Stop(responses::StopResponse),
|
||||
}
|
||||
|
@ -1241,6 +1243,21 @@ pub mod requests {
|
|||
type Response = super::responses::SetchannelResponse;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SigninvoiceRequest {
|
||||
pub invstring: String,
|
||||
}
|
||||
|
||||
impl From<SigninvoiceRequest> for Request {
|
||||
fn from(r: SigninvoiceRequest) -> Self {
|
||||
Request::SignInvoice(r)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRequest for SigninvoiceRequest {
|
||||
type Response = super::responses::SigninvoiceResponse;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SignmessageRequest {
|
||||
pub message: String,
|
||||
|
@ -3517,6 +3534,22 @@ pub mod responses {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SigninvoiceResponse {
|
||||
pub bolt11: String,
|
||||
}
|
||||
|
||||
impl TryFrom<Response> for SigninvoiceResponse {
|
||||
type Error = super::TryFromResponseError;
|
||||
|
||||
fn try_from(response: Response) -> Result<Self, Self::Error> {
|
||||
match response {
|
||||
Response::SignInvoice(response) => Ok(response),
|
||||
_ => Err(TryFromResponseError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct SignmessageResponse {
|
||||
pub signature: String,
|
||||
|
|
|
@ -871,6 +871,12 @@ def setchannel2py(m):
|
|||
})
|
||||
|
||||
|
||||
def signinvoice2py(m):
|
||||
return remove_default({
|
||||
"bolt11": m.bolt11, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def signmessage2py(m):
|
||||
return remove_default({
|
||||
"signature": hexlify(m.signature), # PrimitiveField in generate_composite
|
||||
|
|
Loading…
Add table
Reference in a new issue