Skip to content

Commit 9f24d6d

Browse files
fixup: fix bindings
1 parent c9d0c96 commit 9f24d6d

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

bindings/ldk_node.udl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ dictionary LSPS2ServiceConfig {
4444
u32 max_client_to_self_delay;
4545
u64 min_payment_size_msat;
4646
u64 max_payment_size_msat;
47+
boolean client_trusts_lsp;
4748
};
4849

4950
enum LogLevel {
@@ -194,6 +195,13 @@ interface Bolt11Payment {
194195
Bolt11Invoice receive_variable_amount_via_jit_channel([ByRef]Bolt11InvoiceDescription description, u32 expiry_secs, u64? max_proportional_lsp_fee_limit_ppm_msat);
195196
[Throws=NodeError]
196197
Bolt11Invoice receive_variable_amount_via_jit_channel_for_hash([ByRef]Bolt11InvoiceDescription description, u32 expiry_secs, u64? max_proportional_lsp_fee_limit_ppm_msat, PaymentHash payment_hash);
198+
[Throws=NodeError]
199+
JitChannelManualClaim receive_via_jit_channel_manual_claim(u64 amount_msat, [ByRef]Bolt11InvoiceDescription description, u32 expiry_secs, u64? max_total_lsp_fee_limit_msat);
200+
};
201+
202+
dictionary JitChannelManualClaim {
203+
Bolt11Invoice invoice;
204+
PaymentPreimage preimage;
197205
};
198206

199207
interface Bolt12Payment {

src/ffi/types.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,22 @@ impl UniffiCustomTypeConverter for LSPSDateTime {
11751175
}
11761176
}
11771177

1178+
/// A payable invoice and its corresponding preimage for manual claiming via a JIT channel.
1179+
#[derive(Debug, Clone)]
1180+
pub struct JitChannelManualClaim {
1181+
/// The payable invoice.
1182+
pub invoice: Arc<Bolt11Invoice>,
1183+
/// The payment preimage.
1184+
pub preimage: PaymentPreimage,
1185+
}
1186+
1187+
impl From<(Arc<Bolt11Invoice>, PaymentPreimage)> for JitChannelManualClaim {
1188+
fn from(value: (Arc<Bolt11Invoice>, PaymentPreimage)) -> Self {
1189+
let (invoice, preimage) = value;
1190+
JitChannelManualClaim { invoice, preimage }
1191+
}
1192+
}
1193+
11781194
#[cfg(test)]
11791195
mod tests {
11801196
use std::{

src/payment/bolt11.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ type Bolt11InvoiceDescription = LdkBolt11InvoiceDescription;
4949
#[cfg(feature = "uniffi")]
5050
type Bolt11InvoiceDescription = crate::ffi::Bolt11InvoiceDescription;
5151

52+
#[cfg(not(feature = "uniffi"))]
53+
type JitChannelManualClaim = (Bolt11Invoice, PaymentPreimage);
54+
#[cfg(feature = "uniffi")]
55+
type JitChannelManualClaim = crate::ffi::JitChannelManualClaim;
56+
5257
/// A payment handler allowing to create and pay [BOLT 11] invoices.
5358
///
5459
/// Should be retrieved by calling [`Node::bolt11_payment`].
@@ -602,19 +607,19 @@ impl Bolt11Payment {
602607
pub fn receive_via_jit_channel_manual_claim(
603608
&self, amount_msat: u64, description: &Bolt11InvoiceDescription, expiry_secs: u32,
604609
max_total_lsp_fee_limit_msat: Option<u64>,
605-
) -> Result<(Bolt11Invoice, PaymentPreimage), Error> {
610+
) -> Result<JitChannelManualClaim, Error> {
606611
let description = maybe_try_convert_enum(description)?;
607612
let (invoice, preimage) = self.receive_via_jit_channel_inner(
608613
Some(amount_msat),
609-
description,
614+
&description,
610615
expiry_secs,
611616
max_total_lsp_fee_limit_msat,
612617
None,
613618
None,
614619
false,
615620
)?;
616621
let preimage = preimage.ok_or(Error::InvoiceCreationFailed)?;
617-
Ok((maybe_wrap(invoice), preimage))
622+
Ok((maybe_wrap(invoice), preimage).into())
618623
}
619624

620625
/// Returns a payable invoice that can be used to request a variable amount payment (also known

0 commit comments

Comments
 (0)