@@ -5,8 +5,11 @@ use ldk_node::bitcoin::secp256k1::PublicKey;
5
5
use ldk_node:: config:: { ChannelConfig , MaxDustHTLCExposure } ;
6
6
use ldk_node:: lightning:: ln:: types:: ChannelId ;
7
7
use ldk_node:: lightning_invoice:: { Bolt11InvoiceDescription , Description , Sha256 } ;
8
- use ldk_node:: payment:: { PaymentDetails , PaymentDirection , PaymentKind , PaymentStatus } ;
8
+ use ldk_node:: payment:: {
9
+ ConfirmationStatus , PaymentDetails , PaymentDirection , PaymentKind , PaymentStatus ,
10
+ } ;
9
11
use ldk_node:: { ChannelDetails , LightningBalance , NodeError , PendingSweepBalance , UserChannelId } ;
12
+ use ldk_server_protos:: types:: confirmation_status:: Status :: { Confirmed , Unconfirmed } ;
10
13
use ldk_server_protos:: types:: lightning_balance:: BalanceType :: {
11
14
ClaimableAwaitingConfirmations , ClaimableOnChannelClose , ContentiousClaimable ,
12
15
CounterpartyRevokedOutputClaimable , MaybePreimageClaimableHtlc , MaybeTimeoutClaimableHtlc ,
@@ -110,8 +113,11 @@ pub(crate) fn payment_kind_to_proto(
110
113
payment_kind : PaymentKind ,
111
114
) -> ldk_server_protos:: types:: PaymentKind {
112
115
match payment_kind {
113
- PaymentKind :: Onchain => ldk_server_protos:: types:: PaymentKind {
114
- kind : Some ( Onchain ( ldk_server_protos:: types:: Onchain { } ) ) ,
116
+ PaymentKind :: Onchain { txid, status } => ldk_server_protos:: types:: PaymentKind {
117
+ kind : Some ( Onchain ( ldk_server_protos:: types:: Onchain {
118
+ txid : txid. to_string ( ) ,
119
+ status : Some ( confirmation_status_to_proto ( status) ) ,
120
+ } ) ) ,
115
121
} ,
116
122
PaymentKind :: Bolt11 { hash, preimage, secret } => ldk_server_protos:: types:: PaymentKind {
117
123
kind : Some ( Bolt11 ( ldk_server_protos:: types:: Bolt11 {
@@ -166,6 +172,25 @@ pub(crate) fn payment_kind_to_proto(
166
172
}
167
173
}
168
174
175
+ pub ( crate ) fn confirmation_status_to_proto (
176
+ confirmation_status : ConfirmationStatus ,
177
+ ) -> ldk_server_protos:: types:: ConfirmationStatus {
178
+ match confirmation_status {
179
+ ConfirmationStatus :: Confirmed { block_hash, height, timestamp } => {
180
+ ldk_server_protos:: types:: ConfirmationStatus {
181
+ status : Some ( Confirmed ( ldk_server_protos:: types:: Confirmed {
182
+ block_hash : block_hash. to_string ( ) ,
183
+ height,
184
+ timestamp,
185
+ } ) ) ,
186
+ }
187
+ } ,
188
+ ConfirmationStatus :: Unconfirmed => ldk_server_protos:: types:: ConfirmationStatus {
189
+ status : Some ( Unconfirmed ( ldk_server_protos:: types:: Unconfirmed { } ) ) ,
190
+ } ,
191
+ }
192
+ }
193
+
169
194
pub ( crate ) fn lightning_balance_to_proto (
170
195
lightning_balance : LightningBalance ,
171
196
) -> ldk_server_protos:: types:: LightningBalance {
0 commit comments