Skip to content

Commit becf364

Browse files
committed
f Account for renamed lightning-liquidity types
1 parent b0e0332 commit becf364

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
@@ -161,8 +161,8 @@ interface Node {
161161

162162
[Enum]
163163
interface Bolt11InvoiceDescription {
164-
Hash(string hash);
165-
Direct(string description);
164+
Hash(string hash);
165+
Direct(string description);
166166
};
167167

168168
interface Bolt11Payment {
@@ -246,7 +246,7 @@ interface LSPS1Liquidity {
246246
[Throws=NodeError]
247247
LSPS1OrderStatus request_channel(u64 lsp_balance_sat, u64 client_balance_sat, u32 channel_expiry_blocks, boolean announce_channel);
248248
[Throws=NodeError]
249-
LSPS1OrderStatus check_order_status(OrderId order_id);
249+
LSPS1OrderStatus check_order_status(LSPS1OrderId order_id);
250250
};
251251

252252
[Error]
@@ -460,13 +460,13 @@ dictionary CustomTlvRecord {
460460
};
461461

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

469-
dictionary OrderParameters {
469+
dictionary LSPS1OrderParams {
470470
u64 lsp_balance_sat;
471471
u64 client_balance_sat;
472472
u16 required_channel_confirmations;
@@ -476,22 +476,22 @@ dictionary OrderParameters {
476476
boolean announce_channel;
477477
};
478478

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

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

492-
dictionary OnchainPaymentInfo {
493-
PaymentState state;
494-
DateTime expires_at;
492+
dictionary LSPS1OnchainPaymentInfo {
493+
LSPS1PaymentState state;
494+
LSPSDateTime expires_at;
495495
u64 fee_total_sat;
496496
u64 order_total_sat;
497497
Address address;
@@ -500,13 +500,13 @@ dictionary OnchainPaymentInfo {
500500
Address? refund_onchain_address;
501501
};
502502

503-
dictionary ChannelOrderInfo {
504-
DateTime funded_at;
503+
dictionary LSPS1ChannelInfo {
504+
LSPSDateTime funded_at;
505505
OutPoint funding_outpoint;
506-
DateTime expires_at;
506+
LSPSDateTime expires_at;
507507
};
508508

509-
enum PaymentState {
509+
enum LSPS1PaymentState {
510510
"ExpectPayment",
511511
"Paid",
512512
"Refunded",
@@ -852,7 +852,7 @@ typedef string UntrustedString;
852852
typedef string NodeAlias;
853853

854854
[Custom]
855-
typedef string OrderId;
855+
typedef string LSPS1OrderId;
856856

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