Skip to content

Commit ab62c11

Browse files
committed
f Account for Invoice being renamed to Bolt11Invoice
1 parent 23a64aa commit ab62c11

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

bindings/ldk_node.udl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ 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-
Invoice receive_payment(u64 amount_msat, [ByRef]string description, u32 expiry_secs);
75+
Bolt11Invoice receive_payment(u64 amount_msat, [ByRef]string description, u32 expiry_secs);
7676
[Throws=NodeError]
77-
Invoice receive_variable_amount_payment([ByRef]string description, u32 expiry_secs);
77+
Bolt11Invoice receive_variable_amount_payment([ByRef]string description, u32 expiry_secs);
7878
PaymentDetails? payment([ByRef]PaymentHash payment_hash);
7979
[Throws=NodeError]
8080
boolean remove_payment([ByRef]PaymentHash payment_hash);
@@ -230,7 +230,7 @@ typedef string PublicKey;
230230
typedef string Address;
231231

232232
[Custom]
233-
typedef string Invoice;
233+
typedef string Bolt11Invoice;
234234

235235
[Custom]
236236
typedef string PaymentHash;

src/lib.rs

Lines changed: 8 additions & 8 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};
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;
@@ -1036,7 +1036,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
10361036
}
10371037

10381038
/// Send a payement given an invoice.
1039-
pub fn send_payment(&self, invoice: &Invoice) -> Result<PaymentHash, Error> {
1039+
pub fn send_payment(&self, invoice: &Bolt11Invoice) -> Result<PaymentHash, Error> {
10401040
let rt_lock = self.runtime.read().unwrap();
10411041
if rt_lock.is_none() {
10421042
return Err(Error::NotRunning);
@@ -1112,7 +1112,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
11121112
/// This can be used to pay a so-called "zero-amount" invoice, i.e., an invoice that leaves the
11131113
/// amount paid to be determined by the user.
11141114
pub fn send_payment_using_amount(
1115-
&self, invoice: &Invoice, amount_msat: u64,
1115+
&self, invoice: &Bolt11Invoice, amount_msat: u64,
11161116
) -> Result<PaymentHash, Error> {
11171117
let rt_lock = self.runtime.read().unwrap();
11181118
if rt_lock.is_none() {
@@ -1294,21 +1294,21 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
12941294
/// given.
12951295
pub fn receive_payment(
12961296
&self, amount_msat: u64, description: &str, expiry_secs: u32,
1297-
) -> Result<Invoice, Error> {
1297+
) -> Result<Bolt11Invoice, Error> {
12981298
self.receive_payment_inner(Some(amount_msat), description, expiry_secs)
12991299
}
13001300

13011301
/// Returns a payable invoice that can be used to request and receive a payment for which the
13021302
/// amount is to be determined by the user, also known as a "zero-amount" invoice.
13031303
pub fn receive_variable_amount_payment(
13041304
&self, description: &str, expiry_secs: u32,
1305-
) -> Result<Invoice, Error> {
1305+
) -> Result<Bolt11Invoice, Error> {
13061306
self.receive_payment_inner(None, description, expiry_secs)
13071307
}
13081308

13091309
fn receive_payment_inner(
13101310
&self, amount_msat: Option<u64>, description: &str, expiry_secs: u32,
1311-
) -> Result<Invoice, Error> {
1311+
) -> Result<Bolt11Invoice, Error> {
13121312
let currency = Currency::from(self.config.network);
13131313
let keys_manager = Arc::clone(&self.keys_manager);
13141314
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)