@@ -7,10 +7,11 @@ use crate::error::LdkServerErrorCode::{
77use ldk_server_protos:: api:: {
88 Bolt11ReceiveRequest , Bolt11ReceiveResponse , Bolt11SendRequest , Bolt11SendResponse ,
99 Bolt12ReceiveRequest , Bolt12ReceiveResponse , Bolt12SendRequest , Bolt12SendResponse ,
10- CloseChannelRequest , CloseChannelResponse , GetBalancesRequest , GetBalancesResponse ,
11- GetNodeInfoRequest , GetNodeInfoResponse , ListChannelsRequest , ListChannelsResponse ,
12- ListPaymentsRequest , ListPaymentsResponse , OnchainReceiveRequest , OnchainReceiveResponse ,
13- OnchainSendRequest , OnchainSendResponse , OpenChannelRequest , OpenChannelResponse ,
10+ CloseChannelRequest , CloseChannelResponse , ForceCloseChannelRequest , ForceCloseChannelResponse ,
11+ GetBalancesRequest , GetBalancesResponse , GetNodeInfoRequest , GetNodeInfoResponse ,
12+ ListChannelsRequest , ListChannelsResponse , ListPaymentsRequest , ListPaymentsResponse ,
13+ OnchainReceiveRequest , OnchainReceiveResponse , OnchainSendRequest , OnchainSendResponse ,
14+ OpenChannelRequest , OpenChannelResponse ,
1415} ;
1516use ldk_server_protos:: error:: { ErrorCode , ErrorResponse } ;
1617use reqwest:: header:: CONTENT_TYPE ;
@@ -28,6 +29,7 @@ const BOLT12_RECEIVE_PATH: &str = "Bolt12Receive";
2829const BOLT12_SEND_PATH : & str = "Bolt12Send" ;
2930const OPEN_CHANNEL_PATH : & str = "OpenChannel" ;
3031const CLOSE_CHANNEL_PATH : & str = "CloseChannel" ;
32+ const FORCE_CLOSE_CHANNEL_PATH : & str = "ForceCloseChannel" ;
3133const LIST_CHANNELS_PATH : & str = "ListChannels" ;
3234const LIST_PAYMENTS_PATH : & str = "ListPayments" ;
3335
@@ -134,6 +136,15 @@ impl LdkServerClient {
134136 self . post_request ( & request, & url) . await
135137 }
136138
139+ /// Force closes the channel specified by given request.
140+ /// For API contract/usage, refer to docs for [`ForceCloseChannelRequest`] and [`ForceCloseChannelResponse`].
141+ pub async fn force_close_channel (
142+ & self , request : ForceCloseChannelRequest ,
143+ ) -> Result < ForceCloseChannelResponse , LdkServerError > {
144+ let url = format ! ( "http://{}/{FORCE_CLOSE_CHANNEL_PATH}" , self . base_url) ;
145+ self . post_request ( & request, & url) . await
146+ }
147+
137148 /// Retrieves list of known channels.
138149 /// For API contract/usage, refer to docs for [`ListChannelsRequest`] and [`ListChannelsResponse`].
139150 pub async fn list_channels (
0 commit comments