Skip to content

Commit e1a514b

Browse files
committed
f Account for renamed lightning-liquidity types
1 parent 328bfcc commit e1a514b

File tree

3 files changed

+81
-79
lines changed

3 files changed

+81
-79
lines changed

bindings/ldk_node.udl

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ interface Node {
160160

161161
[Enum]
162162
interface Bolt11InvoiceDescription {
163-
Hash(string hash);
164-
Direct(string description);
163+
Hash(string hash);
164+
Direct(string description);
165165
};
166166

167167
interface Bolt11Payment {
@@ -245,7 +245,7 @@ interface LSPS1Liquidity {
245245
[Throws=NodeError]
246246
LSPS1OrderStatus request_channel(u64 lsp_balance_sat, u64 client_balance_sat, u32 channel_expiry_blocks, boolean announce_channel);
247247
[Throws=NodeError]
248-
LSPS1OrderStatus check_order_status(OrderId order_id);
248+
LSPS1OrderStatus check_order_status(LSPS1OrderId order_id);
249249
};
250250

251251
[Error]
@@ -459,13 +459,13 @@ dictionary CustomTlvRecord {
459459
};
460460

461461
dictionary LSPS1OrderStatus {
462-
OrderId order_id;
463-
OrderParameters order_params;
464-
PaymentInfo payment_options;
465-
ChannelOrderInfo? channel_state;
462+
LSPS1OrderId order_id;
463+
LSPS1OrderParams order_params;
464+
LSPS1PaymentInfo payment_options;
465+
LSPS1ChannelInfo? channel_state;
466466
};
467467

468-
dictionary OrderParameters {
468+
dictionary LSPS1OrderParams {
469469
u64 lsp_balance_sat;
470470
u64 client_balance_sat;
471471
u16 required_channel_confirmations;
@@ -475,22 +475,22 @@ dictionary OrderParameters {
475475
boolean announce_channel;
476476
};
477477

478-
dictionary PaymentInfo {
479-
Bolt11PaymentInfo? bolt11;
480-
OnchainPaymentInfo? onchain;
478+
dictionary LSPS1PaymentInfo {
479+
LSPS1Bolt11PaymentInfo? bolt11;
480+
LSPS1OnchainPaymentInfo? onchain;
481481
};
482482

483-
dictionary Bolt11PaymentInfo {
484-
PaymentState state;
485-
DateTime expires_at;
483+
dictionary LSPS1Bolt11PaymentInfo {
484+
LSPS1PaymentState state;
485+
LSPSDateTime expires_at;
486486
u64 fee_total_sat;
487487
u64 order_total_sat;
488488
Bolt11Invoice invoice;
489489
};
490490

491-
dictionary OnchainPaymentInfo {
492-
PaymentState state;
493-
DateTime expires_at;
491+
dictionary LSPS1OnchainPaymentInfo {
492+
LSPS1PaymentState state;
493+
LSPSDateTime expires_at;
494494
u64 fee_total_sat;
495495
u64 order_total_sat;
496496
Address address;
@@ -499,13 +499,13 @@ dictionary OnchainPaymentInfo {
499499
Address? refund_onchain_address;
500500
};
501501

502-
dictionary ChannelOrderInfo {
503-
DateTime funded_at;
502+
dictionary LSPS1ChannelInfo {
503+
LSPSDateTime funded_at;
504504
OutPoint funding_outpoint;
505-
DateTime expires_at;
505+
LSPSDateTime expires_at;
506506
};
507507

508-
enum PaymentState {
508+
enum LSPS1PaymentState {
509509
"ExpectPayment",
510510
"Paid",
511511
"Refunded",
@@ -851,7 +851,7 @@ typedef string UntrustedString;
851851
typedef string NodeAlias;
852852

853853
[Custom]
854-
typedef string OrderId;
854+
typedef string LSPS1OrderId;
855855

856856
[Custom]
857-
typedef string DateTime;
857+
typedef string LSPSDateTime;

src/ffi/types.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ pub use crate::config::{
1515
EsploraSyncConfig, MaxDustHTLCExposure,
1616
};
1717
pub use crate::graph::{ChannelInfo, ChannelUpdateInfo, NodeAnnouncementInfo, NodeInfo};
18-
pub use crate::liquidity::{LSPS1OrderStatus, LSPS2ServiceConfig, OnchainPaymentInfo, PaymentInfo};
18+
pub use crate::liquidity::{
19+
LSPS1OnchainPaymentInfo, LSPS1OrderStatus, LSPS1PaymentInfo, LSPS2ServiceConfig,
20+
};
1921
pub use crate::logger::{LogLevel, LogRecord, LogWriter};
2022
pub use crate::payment::store::{
2123
ConfirmationStatus, LSPFeeLimits, PaymentDirection, PaymentKind, PaymentStatus,
@@ -33,17 +35,17 @@ pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret};
3335

3436
pub use lightning_invoice::{Description, SignedRawBolt11Invoice};
3537

36-
pub use lightning_liquidity::lsps1::msgs::ChannelInfo as ChannelOrderInfo;
37-
pub use lightning_liquidity::lsps1::msgs::{OrderId, OrderParameters, PaymentState};
38+
pub use lightning_liquidity::lsps0::ser::LSPSDateTime;
39+
pub use lightning_liquidity::lsps1::msgs::{
40+
LSPS1ChannelInfo, LSPS1OrderId, LSPS1OrderParams, LSPS1PaymentState,
41+
};
3842

3943
pub use bitcoin::{Address, BlockHash, FeeRate, Network, OutPoint, Txid};
4044

4145
pub use bip39::Mnemonic;
4246

4347
pub use vss_client::headers::{VssHeaderProvider, VssHeaderProviderError};
4448

45-
pub type DateTime = chrono::DateTime<chrono::Utc>;
46-
4749
use crate::UniffiCustomTypeConverter;
4850

4951
use crate::builder::sanitize_alias;
@@ -1068,11 +1070,11 @@ impl std::fmt::Display for Bolt11Invoice {
10681070

10691071
/// A Lightning payment using BOLT 11.
10701072
#[derive(Clone, Debug, PartialEq, Eq)]
1071-
pub struct Bolt11PaymentInfo {
1073+
pub struct LSPS1Bolt11PaymentInfo {
10721074
/// Indicates the current state of the payment.
1073-
pub state: PaymentState,
1075+
pub state: LSPS1PaymentState,
10741076
/// The datetime when the payment option expires.
1075-
pub expires_at: chrono::DateTime<chrono::Utc>,
1077+
pub expires_at: LSPSDateTime,
10761078
/// The total fee the LSP will charge to open this channel in satoshi.
10771079
pub fee_total_sat: u64,
10781080
/// The amount the client needs to pay to have the requested channel openend.
@@ -1081,8 +1083,8 @@ pub struct Bolt11PaymentInfo {
10811083
pub invoice: Arc<Bolt11Invoice>,
10821084
}
10831085

1084-
impl From<lightning_liquidity::lsps1::msgs::Bolt11PaymentInfo> for Bolt11PaymentInfo {
1085-
fn from(info: lightning_liquidity::lsps1::msgs::Bolt11PaymentInfo) -> Self {
1086+
impl From<lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo> for LSPS1Bolt11PaymentInfo {
1087+
fn from(info: lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo) -> Self {
10861088
Self {
10871089
state: info.state,
10881090
expires_at: info.expires_at,
@@ -1093,7 +1095,7 @@ impl From<lightning_liquidity::lsps1::msgs::Bolt11PaymentInfo> for Bolt11Payment
10931095
}
10941096
}
10951097

1096-
impl UniffiCustomTypeConverter for OrderId {
1098+
impl UniffiCustomTypeConverter for LSPS1OrderId {
10971099
type Builtin = String;
10981100

10991101
fn into_custom(val: Self::Builtin) -> uniffi::Result<Self> {
@@ -1105,11 +1107,11 @@ impl UniffiCustomTypeConverter for OrderId {
11051107
}
11061108
}
11071109

1108-
impl UniffiCustomTypeConverter for DateTime {
1110+
impl UniffiCustomTypeConverter for LSPSDateTime {
11091111
type Builtin = String;
11101112

11111113
fn into_custom(val: Self::Builtin) -> uniffi::Result<Self> {
1112-
Ok(DateTime::from_str(&val).map_err(|_| Error::InvalidDateTime)?)
1114+
Ok(LSPSDateTime::from_str(&val).map_err(|_| Error::InvalidDateTime)?)
11131115
}
11141116

11151117
fn from_custom(obj: Self) -> Self::Builtin {

0 commit comments

Comments
 (0)