Skip to content

Commit 4b53eb9

Browse files
committed
f Account for Invoice being renamed to Bolt11Invoice
1 parent 4b6aa1a commit 4b53eb9

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

bindings/ldk_node.udl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ interface LDKNode {
6666
[Throws=NodeError]
6767
void sync_wallets();
6868
[Throws=NodeError]
69-
PaymentHash send_payment([ByRef]Invoice invoice);
69+
PaymentHash send_payment([ByRef]Bolt11Invoice invoice);
7070
[Throws=NodeError]
71-
PaymentHash send_payment_using_amount([ByRef]Invoice invoice, u64 amount_msat);
71+
PaymentHash send_payment_using_amount([ByRef]Bolt11Invoice invoice, u64 amount_msat);
7272
[Throws=NodeError]
7373
PaymentHash send_spontaneous_payment(u64 amount_msat, PublicKey node_id);
7474
[Throws=NodeError]
75-
void send_payment_probe([ByRef]Invoice invoice);
75+
void send_payment_probe([ByRef]Bolt11Invoice invoice);
7676
[Throws=NodeError]
7777
void send_spontaneous_payment_probe(u64 amount_msat, PublicKey node_id);
7878
[Throws=NodeError]
79-
Invoice receive_payment(u64 amount_msat, [ByRef]string description, u32 expiry_secs);
79+
Bolt11Invoice receive_payment(u64 amount_msat, [ByRef]string description, u32 expiry_secs);
8080
[Throws=NodeError]
81-
Invoice receive_variable_amount_payment([ByRef]string description, u32 expiry_secs);
81+
Bolt11Invoice receive_variable_amount_payment([ByRef]string description, u32 expiry_secs);
8282
PaymentDetails? payment([ByRef]PaymentHash payment_hash);
8383
[Throws=NodeError]
8484
boolean remove_payment([ByRef]PaymentHash payment_hash);
@@ -235,7 +235,7 @@ typedef string PublicKey;
235235
typedef string Address;
236236

237237
[Custom]
238-
typedef string Invoice;
238+
typedef string Bolt11Invoice;
239239

240240
[Custom]
241241
typedef string PaymentHash;

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//!
2828
//! ```no_run
2929
//! use ldk_node::{Builder, NetAddress};
30-
//! use ldk_node::lightning_invoice::Invoice;
30+
//! use ldk_node::lightning_invoice::Bolt11Invoice;
3131
//! use ldk_node::bitcoin::secp256k1::PublicKey;
3232
//! use ldk_node::bitcoin::Network;
3333
//! use std::str::FromStr;
@@ -54,7 +54,7 @@
5454
//! println!("EVENT: {:?}", event);
5555
//! node.event_handled();
5656
//!
57-
//! let invoice = Invoice::from_str("INVOICE_STR").unwrap();
57+
//! let invoice = Bolt11Invoice::from_str("INVOICE_STR").unwrap();
5858
//! node.send_payment(&invoice).unwrap();
5959
//!
6060
//! node.stop().unwrap();
@@ -137,7 +137,7 @@ use lightning_background_processor::process_events_async;
137137
use lightning_transaction_sync::EsploraSyncClient;
138138

139139
use lightning::routing::router::{PaymentParameters, RouteParameters, Router as LdkRouter};
140-
use lightning_invoice::{payment, Currency, Invoice};
140+
use lightning_invoice::{payment, Bolt11Invoice, Currency};
141141

142142
use bitcoin::hashes::sha256::Hash as Sha256;
143143
use bitcoin::hashes::Hash;
@@ -1037,7 +1037,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
10371037
}
10381038

10391039
/// Send a payment given an invoice.
1040-
pub fn send_payment(&self, invoice: &Invoice) -> Result<PaymentHash, Error> {
1040+
pub fn send_payment(&self, invoice: &Bolt11Invoice) -> Result<PaymentHash, Error> {
10411041
let rt_lock = self.runtime.read().unwrap();
10421042
if rt_lock.is_none() {
10431043
return Err(Error::NotRunning);
@@ -1113,7 +1113,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
11131113
/// This can be used to pay a so-called "zero-amount" invoice, i.e., an invoice that leaves the
11141114
/// amount paid to be determined by the user.
11151115
pub fn send_payment_using_amount(
1116-
&self, invoice: &Invoice, amount_msat: u64,
1116+
&self, invoice: &Bolt11Invoice, amount_msat: u64,
11171117
) -> Result<PaymentHash, Error> {
11181118
let rt_lock = self.runtime.read().unwrap();
11191119
if rt_lock.is_none() {
@@ -1297,7 +1297,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
12971297
/// the actual payment. Note this is only useful if there likely is sufficient time for the
12981298
/// probe to settle before sending out the actual payment, e.g., when waiting for user
12991299
/// confirmation in a wallet UI.
1300-
pub fn send_payment_probe(&self, invoice: &Invoice) -> Result<(), Error> {
1300+
pub fn send_payment_probe(&self, invoice: &Bolt11Invoice) -> Result<(), Error> {
13011301
let rt_lock = self.runtime.read().unwrap();
13021302
if rt_lock.is_none() {
13031303
return Err(Error::NotRunning);
@@ -1391,21 +1391,21 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
13911391
/// given.
13921392
pub fn receive_payment(
13931393
&self, amount_msat: u64, description: &str, expiry_secs: u32,
1394-
) -> Result<Invoice, Error> {
1394+
) -> Result<Bolt11Invoice, Error> {
13951395
self.receive_payment_inner(Some(amount_msat), description, expiry_secs)
13961396
}
13971397

13981398
/// Returns a payable invoice that can be used to request and receive a payment for which the
13991399
/// amount is to be determined by the user, also known as a "zero-amount" invoice.
14001400
pub fn receive_variable_amount_payment(
14011401
&self, description: &str, expiry_secs: u32,
1402-
) -> Result<Invoice, Error> {
1402+
) -> Result<Bolt11Invoice, Error> {
14031403
self.receive_payment_inner(None, description, expiry_secs)
14041404
}
14051405

14061406
fn receive_payment_inner(
14071407
&self, amount_msat: Option<u64>, description: &str, expiry_secs: u32,
1408-
) -> Result<Invoice, Error> {
1408+
) -> Result<Bolt11Invoice, Error> {
14091409
let currency = Currency::from(self.config.network);
14101410
let keys_manager = Arc::clone(&self.keys_manager);
14111411
let invoice = match lightning_invoice::utils::create_invoice_from_channelmanager(

src/uniffi_types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bitcoin::hashes::Hash;
1010
use bitcoin::secp256k1::PublicKey;
1111
use bitcoin::{Address, Txid};
1212
use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret};
13-
use lightning_invoice::{Invoice, SignedRawInvoice};
13+
use lightning_invoice::{Bolt11Invoice, SignedRawBolt11Invoice};
1414

1515
use bip39::Mnemonic;
1616

@@ -53,12 +53,12 @@ impl UniffiCustomTypeConverter for Address {
5353
}
5454
}
5555

56-
impl UniffiCustomTypeConverter for Invoice {
56+
impl UniffiCustomTypeConverter for Bolt11Invoice {
5757
type Builtin = String;
5858

5959
fn into_custom(val: Self::Builtin) -> uniffi::Result<Self> {
60-
if let Ok(signed) = val.parse::<SignedRawInvoice>() {
61-
if let Ok(invoice) = Invoice::from_signed(signed) {
60+
if let Ok(signed) = val.parse::<SignedRawBolt11Invoice>() {
61+
if let Ok(invoice) = Bolt11Invoice::from_signed(signed) {
6262
return Ok(invoice);
6363
}
6464
}

0 commit comments

Comments
 (0)