mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
msggen: add low level fundchannel methods
Changelog-None
This commit is contained in:
parent
c80a70de25
commit
448f4c0cfb
12 changed files with 942 additions and 170 deletions
214
.msggen.json
214
.msggen.json
|
@ -952,6 +952,60 @@
|
|||
"FundChannel.tx": 1,
|
||||
"FundChannel.txid": 2
|
||||
},
|
||||
"Fundchannel_cancelRequest": {
|
||||
"FundChannel_Cancel.id": 1
|
||||
},
|
||||
"Fundchannel_cancelResponse": {
|
||||
"FundChannel_Cancel.cancelled": 1
|
||||
},
|
||||
"Fundchannel_completeRequest": {
|
||||
"FundChannel_Complete.id": 1,
|
||||
"FundChannel_Complete.psbt": 2
|
||||
},
|
||||
"Fundchannel_completeResponse": {
|
||||
"FundChannel_Complete.channel_id": 1,
|
||||
"FundChannel_Complete.commitments_secured": 2
|
||||
},
|
||||
"Fundchannel_startChannel_type": {
|
||||
"FundChannel_Start.channel_type.bits[]": 1,
|
||||
"FundChannel_Start.channel_type.names[]": 2,
|
||||
"Fundchannel_Start.channel_type.bits[]": 1,
|
||||
"Fundchannel_Start.channel_type.names[]": 2
|
||||
},
|
||||
"Fundchannel_startRequest": {
|
||||
"FundChannel_Start.amount": 2,
|
||||
"FundChannel_Start.announce": 4,
|
||||
"FundChannel_Start.channel_type[]": 9,
|
||||
"FundChannel_Start.close_to": 5,
|
||||
"FundChannel_Start.feerate": 3,
|
||||
"FundChannel_Start.id": 1,
|
||||
"FundChannel_Start.mindepth": 7,
|
||||
"FundChannel_Start.push_msat": 6,
|
||||
"FundChannel_Start.reserve": 8,
|
||||
"Fundchannel_Start.amount": 9,
|
||||
"Fundchannel_Start.announce": 3,
|
||||
"Fundchannel_Start.channel_type[]": 8,
|
||||
"Fundchannel_Start.close_to": 4,
|
||||
"Fundchannel_Start.feerate": 2,
|
||||
"Fundchannel_Start.id": 1,
|
||||
"Fundchannel_Start.mindepth": 6,
|
||||
"Fundchannel_Start.push_msat": 5,
|
||||
"Fundchannel_Start.reserve": 7
|
||||
},
|
||||
"Fundchannel_startResponse": {
|
||||
"FundChannel_Start.channel_type": 3,
|
||||
"FundChannel_Start.close_to": 4,
|
||||
"FundChannel_Start.funding_address": 1,
|
||||
"FundChannel_Start.mindepth": 6,
|
||||
"FundChannel_Start.scriptpubkey": 2,
|
||||
"FundChannel_Start.warning_usage": 5,
|
||||
"Fundchannel_Start.channel_type": 3,
|
||||
"Fundchannel_Start.close_to": 4,
|
||||
"Fundchannel_Start.funding_address": 1,
|
||||
"Fundchannel_Start.mindepth": 6,
|
||||
"Fundchannel_Start.scriptpubkey": 2,
|
||||
"Fundchannel_Start.warning_usage": 5
|
||||
},
|
||||
"FundpsbtRequest": {
|
||||
"FundPsbt.excess_as_change": 8,
|
||||
"FundPsbt.feerate": 2,
|
||||
|
@ -3932,6 +3986,102 @@
|
|||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Cancel": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
},
|
||||
"FundChannel_Cancel.cancelled": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Cancel.id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Complete": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
},
|
||||
"FundChannel_Complete.channel_id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Complete.commitments_secured": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Complete.id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Complete.psbt": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
},
|
||||
"FundChannel_Start.amount": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.announce": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.channel_type": {
|
||||
"added": "v24.02",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.channel_type.bits[]": {
|
||||
"added": "v24.02",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.channel_type.names[]": {
|
||||
"added": "v24.02",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.channel_type[]": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.close_to": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.feerate": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.funding_address": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.mindepth": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.push_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.reserve": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.scriptpubkey": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundChannel_Start.warning_usage": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"FundPsbt": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
|
@ -4020,6 +4170,70 @@
|
|||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
},
|
||||
"Fundchannel_Start.amount": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.announce": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.channel_type": {
|
||||
"added": "v24.02",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.channel_type.bits[]": {
|
||||
"added": "v24.02",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.channel_type.names[]": {
|
||||
"added": "v24.02",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.channel_type[]": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.close_to": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.feerate": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.funding_address": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.id": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.mindepth": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.push_msat": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.reserve": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.scriptpubkey": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"Fundchannel_Start.warning_usage": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": false
|
||||
},
|
||||
"GetRoute": {
|
||||
"added": "pre-v0.10.1",
|
||||
"deprecated": null
|
||||
|
|
47
cln-grpc/proto/node.proto
generated
47
cln-grpc/proto/node.proto
generated
|
@ -55,7 +55,10 @@ service Node {
|
|||
rpc Disconnect(DisconnectRequest) returns (DisconnectResponse) {}
|
||||
rpc Feerates(FeeratesRequest) returns (FeeratesResponse) {}
|
||||
rpc FetchInvoice(FetchinvoiceRequest) returns (FetchinvoiceResponse) {}
|
||||
rpc FundChannel_Cancel(Fundchannel_cancelRequest) returns (Fundchannel_cancelResponse) {}
|
||||
rpc FundChannel_Complete(Fundchannel_completeRequest) returns (Fundchannel_completeResponse) {}
|
||||
rpc FundChannel(FundchannelRequest) returns (FundchannelResponse) {}
|
||||
rpc FundChannel_Start(Fundchannel_startRequest) returns (Fundchannel_startResponse) {}
|
||||
rpc GetRoute(GetrouteRequest) returns (GetrouteResponse) {}
|
||||
rpc ListForwards(ListforwardsRequest) returns (ListforwardsResponse) {}
|
||||
rpc ListOffers(ListoffersRequest) returns (ListoffersResponse) {}
|
||||
|
@ -1707,6 +1710,24 @@ message FetchinvoiceNext_period {
|
|||
uint64 paywindow_end = 5;
|
||||
}
|
||||
|
||||
message Fundchannel_cancelRequest {
|
||||
bytes id = 1;
|
||||
}
|
||||
|
||||
message Fundchannel_cancelResponse {
|
||||
string cancelled = 1;
|
||||
}
|
||||
|
||||
message Fundchannel_completeRequest {
|
||||
bytes id = 1;
|
||||
string psbt = 2;
|
||||
}
|
||||
|
||||
message Fundchannel_completeResponse {
|
||||
bytes channel_id = 1;
|
||||
bool commitments_secured = 2;
|
||||
}
|
||||
|
||||
message FundchannelRequest {
|
||||
AmountOrAll amount = 1;
|
||||
optional Feerate feerate = 2;
|
||||
|
@ -1738,6 +1759,32 @@ message FundchannelChannel_type {
|
|||
repeated ChannelTypeName names = 2;
|
||||
}
|
||||
|
||||
message Fundchannel_startRequest {
|
||||
bytes id = 1;
|
||||
Amount amount = 2;
|
||||
optional Feerate feerate = 3;
|
||||
optional bool announce = 4;
|
||||
optional string close_to = 5;
|
||||
optional Amount push_msat = 6;
|
||||
optional uint32 mindepth = 7;
|
||||
optional Amount reserve = 8;
|
||||
repeated uint32 channel_type = 9;
|
||||
}
|
||||
|
||||
message Fundchannel_startResponse {
|
||||
string funding_address = 1;
|
||||
bytes scriptpubkey = 2;
|
||||
optional Fundchannel_startChannel_type channel_type = 3;
|
||||
optional bytes close_to = 4;
|
||||
string warning_usage = 5;
|
||||
optional uint32 mindepth = 6;
|
||||
}
|
||||
|
||||
message Fundchannel_startChannel_type {
|
||||
repeated uint32 bits = 1;
|
||||
repeated ChannelTypeName names = 2;
|
||||
}
|
||||
|
||||
message GetrouteRequest {
|
||||
bytes id = 1;
|
||||
uint64 riskfactor = 3;
|
||||
|
|
118
cln-grpc/src/convert.rs
generated
118
cln-grpc/src/convert.rs
generated
|
@ -1662,6 +1662,25 @@ impl From<responses::FetchinvoiceResponse> for pb::FetchinvoiceResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::Fundchannel_cancelResponse> for pb::FundchannelCancelResponse {
|
||||
fn from(c: responses::Fundchannel_cancelResponse) -> Self {
|
||||
Self {
|
||||
cancelled: c.cancelled, // Rule #2 for type string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::Fundchannel_completeResponse> for pb::FundchannelCompleteResponse {
|
||||
fn from(c: responses::Fundchannel_completeResponse) -> Self {
|
||||
Self {
|
||||
channel_id: <Sha256 as AsRef<[u8]>>::as_ref(&c.channel_id).to_vec(), // Rule #2 for type hash
|
||||
commitments_secured: c.commitments_secured, // Rule #2 for type boolean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::FundchannelChannel_type> for pb::FundchannelChannelType {
|
||||
fn from(c: responses::FundchannelChannel_type) -> Self {
|
||||
|
@ -1689,6 +1708,32 @@ impl From<responses::FundchannelResponse> for pb::FundchannelResponse {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::Fundchannel_startChannel_type> for pb::FundchannelStartChannelType {
|
||||
fn from(c: responses::Fundchannel_startChannel_type) -> Self {
|
||||
Self {
|
||||
// Field: FundChannel_Start.channel_type.bits[]
|
||||
bits: c.bits.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
// Field: FundChannel_Start.channel_type.names[]
|
||||
names: c.names.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::Fundchannel_startResponse> for pb::FundchannelStartResponse {
|
||||
fn from(c: responses::Fundchannel_startResponse) -> Self {
|
||||
Self {
|
||||
channel_type: c.channel_type.map(|v| v.into()),
|
||||
close_to: c.close_to.map(|v| hex::decode(v).unwrap()), // Rule #2 for type hex?
|
||||
funding_address: c.funding_address, // Rule #2 for type string
|
||||
mindepth: c.mindepth, // Rule #2 for type u32?
|
||||
scriptpubkey: hex::decode(&c.scriptpubkey).unwrap(), // Rule #2 for type hex
|
||||
warning_usage: c.warning_usage, // Rule #2 for type string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<responses::GetrouteRoute> for pb::GetrouteRoute {
|
||||
fn from(c: responses::GetrouteRoute) -> Self {
|
||||
|
@ -2772,6 +2817,25 @@ impl From<requests::FetchinvoiceRequest> for pb::FetchinvoiceRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::Fundchannel_cancelRequest> for pb::FundchannelCancelRequest {
|
||||
fn from(c: requests::Fundchannel_cancelRequest) -> Self {
|
||||
Self {
|
||||
id: c.id.serialize().to_vec(), // Rule #2 for type pubkey
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::Fundchannel_completeRequest> for pb::FundchannelCompleteRequest {
|
||||
fn from(c: requests::Fundchannel_completeRequest) -> Self {
|
||||
Self {
|
||||
id: c.id.serialize().to_vec(), // Rule #2 for type pubkey
|
||||
psbt: c.psbt, // Rule #2 for type string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::FundchannelRequest> for pb::FundchannelRequest {
|
||||
fn from(c: requests::FundchannelRequest) -> Self {
|
||||
|
@ -2795,6 +2859,24 @@ impl From<requests::FundchannelRequest> for pb::FundchannelRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::Fundchannel_startRequest> for pb::FundchannelStartRequest {
|
||||
fn from(c: requests::Fundchannel_startRequest) -> Self {
|
||||
Self {
|
||||
amount: Some(c.amount.into()), // Rule #2 for type msat
|
||||
announce: c.announce, // Rule #2 for type boolean?
|
||||
// Field: FundChannel_Start.channel_type[]
|
||||
channel_type: c.channel_type.map(|arr| arr.into_iter().map(|i| i.into()).collect()).unwrap_or(vec![]), // Rule #3
|
||||
close_to: c.close_to, // Rule #2 for type string?
|
||||
feerate: c.feerate.map(|o|o.into()), // Rule #2 for type feerate?
|
||||
id: c.id.serialize().to_vec(), // Rule #2 for type pubkey
|
||||
mindepth: c.mindepth, // Rule #2 for type u32?
|
||||
push_msat: c.push_msat.map(|f| f.into()), // Rule #2 for type msat?
|
||||
reserve: c.reserve.map(|f| f.into()), // Rule #2 for type msat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<requests::GetrouteRequest> for pb::GetrouteRequest {
|
||||
fn from(c: requests::GetrouteRequest) -> Self {
|
||||
|
@ -3674,6 +3756,25 @@ impl From<pb::FetchinvoiceRequest> for requests::FetchinvoiceRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::FundchannelCancelRequest> for requests::Fundchannel_cancelRequest {
|
||||
fn from(c: pb::FundchannelCancelRequest) -> Self {
|
||||
Self {
|
||||
id: PublicKey::from_slice(&c.id).unwrap(), // Rule #1 for type pubkey
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::FundchannelCompleteRequest> for requests::Fundchannel_completeRequest {
|
||||
fn from(c: pb::FundchannelCompleteRequest) -> Self {
|
||||
Self {
|
||||
id: PublicKey::from_slice(&c.id).unwrap(), // Rule #1 for type pubkey
|
||||
psbt: c.psbt, // Rule #1 for type string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::FundchannelRequest> for requests::FundchannelRequest {
|
||||
fn from(c: pb::FundchannelRequest) -> Self {
|
||||
|
@ -3695,6 +3796,23 @@ impl From<pb::FundchannelRequest> for requests::FundchannelRequest {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::FundchannelStartRequest> for requests::Fundchannel_startRequest {
|
||||
fn from(c: pb::FundchannelStartRequest) -> Self {
|
||||
Self {
|
||||
amount: c.amount.unwrap().into(), // Rule #1 for type msat
|
||||
announce: c.announce, // Rule #1 for type boolean?
|
||||
channel_type: Some(c.channel_type.into_iter().map(|s| s).collect()), // Rule #4
|
||||
close_to: c.close_to, // Rule #1 for type string?
|
||||
feerate: c.feerate.map(|a| a.into()), // Rule #1 for type feerate?
|
||||
id: PublicKey::from_slice(&c.id).unwrap(), // Rule #1 for type pubkey
|
||||
mindepth: c.mindepth, // Rule #1 for type u32?
|
||||
push_msat: c.push_msat.map(|a| a.into()), // Rule #1 for type msat?
|
||||
reserve: c.reserve.map(|a| a.into()), // Rule #1 for type msat?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
impl From<pb::GetrouteRequest> for requests::GetrouteRequest {
|
||||
fn from(c: pb::GetrouteRequest) -> Self {
|
||||
|
|
|
@ -1530,6 +1530,70 @@ async fn fetch_invoice(
|
|||
|
||||
}
|
||||
|
||||
async fn fund_channel_cancel(
|
||||
&self,
|
||||
request: tonic::Request<pb::FundchannelCancelRequest>,
|
||||
) -> Result<tonic::Response<pb::FundchannelCancelResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::Fundchannel_cancelRequest = req.into();
|
||||
debug!("Client asked for fund_channel_cancel");
|
||||
trace!("fund_channel_cancel 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::FundChannel_Cancel(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method FundChannel_Cancel: {:?}", e)))?;
|
||||
match result {
|
||||
Response::FundChannel_Cancel(r) => {
|
||||
trace!("fund_channel_cancel response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call FundChannel_Cancel",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn fund_channel_complete(
|
||||
&self,
|
||||
request: tonic::Request<pb::FundchannelCompleteRequest>,
|
||||
) -> Result<tonic::Response<pb::FundchannelCompleteResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::Fundchannel_completeRequest = req.into();
|
||||
debug!("Client asked for fund_channel_complete");
|
||||
trace!("fund_channel_complete 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::FundChannel_Complete(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method FundChannel_Complete: {:?}", e)))?;
|
||||
match result {
|
||||
Response::FundChannel_Complete(r) => {
|
||||
trace!("fund_channel_complete response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call FundChannel_Complete",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn fund_channel(
|
||||
&self,
|
||||
request: tonic::Request<pb::FundchannelRequest>,
|
||||
|
@ -1562,6 +1626,38 @@ async fn fund_channel(
|
|||
|
||||
}
|
||||
|
||||
async fn fund_channel_start(
|
||||
&self,
|
||||
request: tonic::Request<pb::FundchannelStartRequest>,
|
||||
) -> Result<tonic::Response<pb::FundchannelStartResponse>, tonic::Status> {
|
||||
let req = request.into_inner();
|
||||
let req: requests::Fundchannel_startRequest = req.into();
|
||||
debug!("Client asked for fund_channel_start");
|
||||
trace!("fund_channel_start 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::FundChannel_Start(req))
|
||||
.await
|
||||
.map_err(|e| Status::new(
|
||||
Code::Unknown,
|
||||
format!("Error calling method FundChannel_Start: {:?}", e)))?;
|
||||
match result {
|
||||
Response::FundChannel_Start(r) => {
|
||||
trace!("fund_channel_start response: {:?}", r);
|
||||
Ok(tonic::Response::new(r.into()))
|
||||
},
|
||||
r => Err(Status::new(
|
||||
Code::Internal,
|
||||
format!(
|
||||
"Unexpected result {:?} to method call FundChannel_Start",
|
||||
r
|
||||
)
|
||||
)),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async fn get_route(
|
||||
&self,
|
||||
request: tonic::Request<pb::GetrouteRequest>,
|
||||
|
|
153
cln-rpc/src/model.rs
generated
153
cln-rpc/src/model.rs
generated
|
@ -66,7 +66,10 @@ pub enum Request {
|
|||
Disconnect(requests::DisconnectRequest),
|
||||
Feerates(requests::FeeratesRequest),
|
||||
FetchInvoice(requests::FetchinvoiceRequest),
|
||||
FundChannel_Cancel(requests::Fundchannel_cancelRequest),
|
||||
FundChannel_Complete(requests::Fundchannel_completeRequest),
|
||||
FundChannel(requests::FundchannelRequest),
|
||||
FundChannel_Start(requests::Fundchannel_startRequest),
|
||||
GetRoute(requests::GetrouteRequest),
|
||||
ListForwards(requests::ListforwardsRequest),
|
||||
ListOffers(requests::ListoffersRequest),
|
||||
|
@ -147,7 +150,10 @@ pub enum Response {
|
|||
Disconnect(responses::DisconnectResponse),
|
||||
Feerates(responses::FeeratesResponse),
|
||||
FetchInvoice(responses::FetchinvoiceResponse),
|
||||
FundChannel_Cancel(responses::Fundchannel_cancelResponse),
|
||||
FundChannel_Complete(responses::Fundchannel_completeResponse),
|
||||
FundChannel(responses::FundchannelResponse),
|
||||
FundChannel_Start(responses::Fundchannel_startResponse),
|
||||
GetRoute(responses::GetrouteResponse),
|
||||
ListForwards(responses::ListforwardsResponse),
|
||||
ListOffers(responses::ListoffersResponse),
|
||||
|
@ -1800,6 +1806,51 @@ pub mod requests {
|
|||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Fundchannel_cancelRequest {
|
||||
pub id: PublicKey,
|
||||
}
|
||||
|
||||
impl From<Fundchannel_cancelRequest> for Request {
|
||||
fn from(r: Fundchannel_cancelRequest) -> Self {
|
||||
Request::FundChannel_Cancel(r)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRequest for Fundchannel_cancelRequest {
|
||||
type Response = super::responses::Fundchannel_cancelResponse;
|
||||
}
|
||||
|
||||
impl TypedRequest for Fundchannel_cancelRequest {
|
||||
type Response = super::responses::Fundchannel_cancelResponse;
|
||||
|
||||
fn method(&self) -> &str {
|
||||
"fundchannel_cancel"
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Fundchannel_completeRequest {
|
||||
pub id: PublicKey,
|
||||
pub psbt: String,
|
||||
}
|
||||
|
||||
impl From<Fundchannel_completeRequest> for Request {
|
||||
fn from(r: Fundchannel_completeRequest) -> Self {
|
||||
Request::FundChannel_Complete(r)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRequest for Fundchannel_completeRequest {
|
||||
type Response = super::responses::Fundchannel_completeResponse;
|
||||
}
|
||||
|
||||
impl TypedRequest for Fundchannel_completeRequest {
|
||||
type Response = super::responses::Fundchannel_completeResponse;
|
||||
|
||||
fn method(&self) -> &str {
|
||||
"fundchannel_complete"
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct FundchannelRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub announce: Option<bool>,
|
||||
|
@ -1845,6 +1896,43 @@ pub mod requests {
|
|||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Fundchannel_startRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub announce: Option<bool>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub close_to: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub feerate: Option<Feerate>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mindepth: Option<u32>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub push_msat: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reserve: Option<Amount>,
|
||||
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
|
||||
pub channel_type: Option<Vec<u32>>,
|
||||
pub amount: Amount,
|
||||
pub id: PublicKey,
|
||||
}
|
||||
|
||||
impl From<Fundchannel_startRequest> for Request {
|
||||
fn from(r: Fundchannel_startRequest) -> Self {
|
||||
Request::FundChannel_Start(r)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRequest for Fundchannel_startRequest {
|
||||
type Response = super::responses::Fundchannel_startResponse;
|
||||
}
|
||||
|
||||
impl TypedRequest for Fundchannel_startRequest {
|
||||
type Response = super::responses::Fundchannel_startResponse;
|
||||
|
||||
fn method(&self) -> &str {
|
||||
"fundchannel_start"
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct GetrouteRequest {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cltv: Option<u32>,
|
||||
|
@ -5791,6 +5879,39 @@ pub mod responses {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Fundchannel_cancelResponse {
|
||||
pub cancelled: String,
|
||||
}
|
||||
|
||||
impl TryFrom<Response> for Fundchannel_cancelResponse {
|
||||
type Error = super::TryFromResponseError;
|
||||
|
||||
fn try_from(response: Response) -> Result<Self, Self::Error> {
|
||||
match response {
|
||||
Response::FundChannel_Cancel(response) => Ok(response),
|
||||
_ => Err(TryFromResponseError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Fundchannel_completeResponse {
|
||||
pub channel_id: Sha256,
|
||||
pub commitments_secured: bool,
|
||||
}
|
||||
|
||||
impl TryFrom<Response> for Fundchannel_completeResponse {
|
||||
type Error = super::TryFromResponseError;
|
||||
|
||||
fn try_from(response: Response) -> Result<Self, Self::Error> {
|
||||
match response {
|
||||
Response::FundChannel_Complete(response) => Ok(response),
|
||||
_ => Err(TryFromResponseError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct FundchannelChannel_type {
|
||||
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
|
||||
|
@ -5824,6 +5945,38 @@ pub mod responses {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Fundchannel_startChannel_type {
|
||||
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
|
||||
pub bits: Option<Vec<u32>>,
|
||||
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
|
||||
pub names: Option<Vec<ChannelTypeName>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Fundchannel_startResponse {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub channel_type: Option<Fundchannel_startChannel_type>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub close_to: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mindepth: Option<u32>,
|
||||
pub funding_address: String,
|
||||
pub scriptpubkey: String,
|
||||
pub warning_usage: String,
|
||||
}
|
||||
|
||||
impl TryFrom<Response> for Fundchannel_startResponse {
|
||||
type Error = super::TryFromResponseError;
|
||||
|
||||
fn try_from(response: Response) -> Result<Self, Self::Error> {
|
||||
match response {
|
||||
Response::FundChannel_Start(response) => Ok(response),
|
||||
_ => Err(TryFromResponseError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// ['The features understood by the destination node.']
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub enum GetrouteRouteStyle {
|
||||
|
|
|
@ -182,6 +182,7 @@ class OverridePatch(Patch):
|
|||
'ListPeerChannels.channels[].htlcs[].state': "HtlcState",
|
||||
'ListHtlcs.htlcs[].state': "HtlcState",
|
||||
'FundChannel.channel_type.names[]': 'ChannelTypeName',
|
||||
'FundChannel_Start.channel_type.names[]': 'ChannelTypeName',
|
||||
'MultiFundChannel.channel_ids[].channel_type.names[]': 'ChannelTypeName',
|
||||
'OpenChannel_Init.channel_type.names[]': 'ChannelTypeName',
|
||||
'OpenChannel_Bump.channel_type.names[]': 'ChannelTypeName',
|
||||
|
|
|
@ -10507,7 +10507,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "sat",
|
||||
"type": "msat",
|
||||
"description": [
|
||||
"Satoshi value that the channel will be funded at. This value MUST be accurate, otherwise the negotiated commitment transactions will not encompass the correct channel value."
|
||||
]
|
||||
|
|
|
@ -106,10 +106,10 @@ def load_jsonrpc_service():
|
|||
"Disconnect",
|
||||
"Feerates",
|
||||
"FetchInvoice",
|
||||
# "fundchannel_cancel",
|
||||
# "fundchannel_complete",
|
||||
"FundChannel_Cancel",
|
||||
"FundChannel_Complete",
|
||||
"FundChannel",
|
||||
# "fundchannel_start",
|
||||
"FundChannel_Start",
|
||||
# "funderupdate",
|
||||
# "getlog",
|
||||
"GetRoute",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -249,11 +249,26 @@ class NodeStub(object):
|
|||
request_serializer=node__pb2.FetchinvoiceRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.FetchinvoiceResponse.FromString,
|
||||
)
|
||||
self.FundChannel_Cancel = channel.unary_unary(
|
||||
'/cln.Node/FundChannel_Cancel',
|
||||
request_serializer=node__pb2.Fundchannel_cancelRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.Fundchannel_cancelResponse.FromString,
|
||||
)
|
||||
self.FundChannel_Complete = channel.unary_unary(
|
||||
'/cln.Node/FundChannel_Complete',
|
||||
request_serializer=node__pb2.Fundchannel_completeRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.Fundchannel_completeResponse.FromString,
|
||||
)
|
||||
self.FundChannel = channel.unary_unary(
|
||||
'/cln.Node/FundChannel',
|
||||
request_serializer=node__pb2.FundchannelRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.FundchannelResponse.FromString,
|
||||
)
|
||||
self.FundChannel_Start = channel.unary_unary(
|
||||
'/cln.Node/FundChannel_Start',
|
||||
request_serializer=node__pb2.Fundchannel_startRequest.SerializeToString,
|
||||
response_deserializer=node__pb2.Fundchannel_startResponse.FromString,
|
||||
)
|
||||
self.GetRoute = channel.unary_unary(
|
||||
'/cln.Node/GetRoute',
|
||||
request_serializer=node__pb2.GetrouteRequest.SerializeToString,
|
||||
|
@ -661,12 +676,30 @@ class NodeServicer(object):
|
|||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def FundChannel_Cancel(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 FundChannel_Complete(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 FundChannel(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 FundChannel_Start(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 GetRoute(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
|
@ -1049,11 +1082,26 @@ def add_NodeServicer_to_server(servicer, server):
|
|||
request_deserializer=node__pb2.FetchinvoiceRequest.FromString,
|
||||
response_serializer=node__pb2.FetchinvoiceResponse.SerializeToString,
|
||||
),
|
||||
'FundChannel_Cancel': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.FundChannel_Cancel,
|
||||
request_deserializer=node__pb2.Fundchannel_cancelRequest.FromString,
|
||||
response_serializer=node__pb2.Fundchannel_cancelResponse.SerializeToString,
|
||||
),
|
||||
'FundChannel_Complete': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.FundChannel_Complete,
|
||||
request_deserializer=node__pb2.Fundchannel_completeRequest.FromString,
|
||||
response_serializer=node__pb2.Fundchannel_completeResponse.SerializeToString,
|
||||
),
|
||||
'FundChannel': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.FundChannel,
|
||||
request_deserializer=node__pb2.FundchannelRequest.FromString,
|
||||
response_serializer=node__pb2.FundchannelResponse.SerializeToString,
|
||||
),
|
||||
'FundChannel_Start': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.FundChannel_Start,
|
||||
request_deserializer=node__pb2.Fundchannel_startRequest.FromString,
|
||||
response_serializer=node__pb2.Fundchannel_startResponse.SerializeToString,
|
||||
),
|
||||
'GetRoute': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetRoute,
|
||||
request_deserializer=node__pb2.GetrouteRequest.FromString,
|
||||
|
@ -1983,6 +2031,40 @@ class Node(object):
|
|||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def FundChannel_Cancel(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/FundChannel_Cancel',
|
||||
node__pb2.Fundchannel_cancelRequest.SerializeToString,
|
||||
node__pb2.Fundchannel_cancelResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def FundChannel_Complete(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/FundChannel_Complete',
|
||||
node__pb2.Fundchannel_completeRequest.SerializeToString,
|
||||
node__pb2.Fundchannel_completeResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def FundChannel(request,
|
||||
target,
|
||||
|
@ -2000,6 +2082,23 @@ class Node(object):
|
|||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def FundChannel_Start(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/FundChannel_Start',
|
||||
node__pb2.Fundchannel_startRequest.SerializeToString,
|
||||
node__pb2.Fundchannel_startResponse.FromString,
|
||||
options, channel_credentials,
|
||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
||||
|
||||
@staticmethod
|
||||
def GetRoute(request,
|
||||
target,
|
||||
|
|
|
@ -1382,6 +1382,19 @@ def fetchinvoice2py(m):
|
|||
})
|
||||
|
||||
|
||||
def fundchannel_cancel2py(m):
|
||||
return remove_default({
|
||||
"cancelled": m.cancelled, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def fundchannel_complete2py(m):
|
||||
return remove_default({
|
||||
"channel_id": hexlify(m.channel_id), # PrimitiveField in generate_composite
|
||||
"commitments_secured": m.commitments_secured, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def fundchannel_channel_type2py(m):
|
||||
return remove_default({
|
||||
"bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
|
||||
|
@ -1400,6 +1413,23 @@ def fundchannel2py(m):
|
|||
})
|
||||
|
||||
|
||||
def fundchannel_start_channel_type2py(m):
|
||||
return remove_default({
|
||||
"bits": [m.bits for i in m.bits], # ArrayField[primitive] in generate_composite
|
||||
"names": [str(i) for i in m.names], # ArrayField[composite] in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def fundchannel_start2py(m):
|
||||
return remove_default({
|
||||
"close_to": hexlify(m.close_to), # PrimitiveField in generate_composite
|
||||
"funding_address": m.funding_address, # PrimitiveField in generate_composite
|
||||
"mindepth": m.mindepth, # PrimitiveField in generate_composite
|
||||
"scriptpubkey": hexlify(m.scriptpubkey), # PrimitiveField in generate_composite
|
||||
"warning_usage": m.warning_usage, # PrimitiveField in generate_composite
|
||||
})
|
||||
|
||||
|
||||
def getroute_route2py(m):
|
||||
return remove_default({
|
||||
"style": str(m.style), # EnumField in generate_composite
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
]
|
||||
},
|
||||
"amount": {
|
||||
"type": "sat",
|
||||
"type": "msat",
|
||||
"description": [
|
||||
"Satoshi value that the channel will be funded at. This value MUST be accurate, otherwise the negotiated commitment transactions will not encompass the correct channel value."
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue