Skip to content

Commit 8861c0d

Browse files
committed
f Account for renamed lightning-liquidity types
1 parent c9546fd commit 8861c0d

File tree

3 files changed

+79
-77
lines changed

3 files changed

+79
-77
lines changed

bindings/ldk_node.udl

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ interface LSPS1Liquidity {
254254
[Throws=NodeError]
255255
LSPS1OrderStatus request_channel(u64 lsp_balance_sat, u64 client_balance_sat, u32 channel_expiry_blocks, boolean announce_channel);
256256
[Throws=NodeError]
257-
LSPS1OrderStatus check_order_status(OrderId order_id);
257+
LSPS1OrderStatus check_order_status(LSPS1OrderId order_id);
258258
};
259259

260260
[Error]
@@ -469,13 +469,13 @@ dictionary CustomTlvRecord {
469469
};
470470

471471
dictionary LSPS1OrderStatus {
472-
OrderId order_id;
473-
OrderParameters order_params;
474-
PaymentInfo payment_options;
475-
ChannelOrderInfo? channel_state;
472+
LSPS1OrderId order_id;
473+
LSPS1OrderParams order_params;
474+
LSPS1PaymentInfo payment_options;
475+
LSPS1ChannelInfo? channel_state;
476476
};
477477

478-
dictionary OrderParameters {
478+
dictionary LSPS1OrderParams {
479479
u64 lsp_balance_sat;
480480
u64 client_balance_sat;
481481
u16 required_channel_confirmations;
@@ -485,22 +485,22 @@ dictionary OrderParameters {
485485
boolean announce_channel;
486486
};
487487

488-
dictionary PaymentInfo {
489-
Bolt11PaymentInfo? bolt11;
490-
OnchainPaymentInfo? onchain;
488+
dictionary LSPS1PaymentInfo {
489+
LSPS1Bolt11PaymentInfo? bolt11;
490+
LSPS1OnchainPaymentInfo? onchain;
491491
};
492492

493-
dictionary Bolt11PaymentInfo {
494-
PaymentState state;
495-
DateTime expires_at;
493+
dictionary LSPS1Bolt11PaymentInfo {
494+
LSPS1PaymentState state;
495+
LSPSDateTime expires_at;
496496
u64 fee_total_sat;
497497
u64 order_total_sat;
498498
Bolt11Invoice invoice;
499499
};
500500

501-
dictionary OnchainPaymentInfo {
502-
PaymentState state;
503-
DateTime expires_at;
501+
dictionary LSPS1OnchainPaymentInfo {
502+
LSPS1PaymentState state;
503+
LSPSDateTime expires_at;
504504
u64 fee_total_sat;
505505
u64 order_total_sat;
506506
Address address;
@@ -509,13 +509,13 @@ dictionary OnchainPaymentInfo {
509509
Address? refund_onchain_address;
510510
};
511511

512-
dictionary ChannelOrderInfo {
513-
DateTime funded_at;
512+
dictionary LSPS1ChannelInfo {
513+
LSPSDateTime funded_at;
514514
OutPoint funding_outpoint;
515-
DateTime expires_at;
515+
LSPSDateTime expires_at;
516516
};
517517

518-
enum PaymentState {
518+
enum LSPS1PaymentState {
519519
"ExpectPayment",
520520
"Paid",
521521
"Refunded",
@@ -861,7 +861,7 @@ typedef string UntrustedString;
861861
typedef string NodeAlias;
862862

863863
[Custom]
864-
typedef string OrderId;
864+
typedef string LSPS1OrderId;
865865

866866
[Custom]
867-
typedef string DateTime;
867+
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)