Skip to content

Commit 0c6caf4

Browse files
committed
WIP
1 parent db26840 commit 0c6caf4

3 files changed

Lines changed: 41 additions & 34 deletions

File tree

bindings/ldk_node.udl

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -414,21 +414,6 @@ enum VssHeaderProviderError {
414414
"InternalError",
415415
};
416416

417-
[Enum]
418-
interface Event {
419-
PaymentSuccessful(PaymentId? payment_id, PaymentHash payment_hash, PaymentPreimage? payment_preimage, u64? fee_paid_msat);
420-
PaymentFailed(PaymentId? payment_id, PaymentHash? payment_hash, PaymentFailureReason? reason);
421-
PaymentReceived(PaymentId? payment_id, PaymentHash payment_hash, u64 amount_msat, sequence<CustomTlvRecord> custom_records);
422-
PaymentClaimable(PaymentId payment_id, PaymentHash payment_hash, u64 claimable_amount_msat, u32? claim_deadline, sequence<CustomTlvRecord> custom_records);
423-
PaymentForwarded(ChannelId prev_channel_id, ChannelId next_channel_id, UserChannelId?
424-
prev_user_channel_id, UserChannelId? next_user_channel_id, PublicKey? prev_node_id, PublicKey? next_node_id, u64? total_fee_earned_msat, u64? skimmed_fee_msat, boolean claim_from_onchain_tx, u64? outbound_amount_forwarded_msat);
425-
ChannelPending(ChannelId channel_id, UserChannelId user_channel_id, ChannelId former_temporary_channel_id, PublicKey counterparty_node_id, OutPoint funding_txo);
426-
ChannelReady(ChannelId channel_id, UserChannelId user_channel_id, PublicKey? counterparty_node_id, OutPoint? funding_txo);
427-
ChannelClosed(ChannelId channel_id, UserChannelId user_channel_id, PublicKey? counterparty_node_id, ClosureReason? reason);
428-
SplicePending(ChannelId channel_id, UserChannelId user_channel_id, PublicKey counterparty_node_id, OutPoint new_funding_txo);
429-
SpliceFailed(ChannelId channel_id, UserChannelId user_channel_id, PublicKey counterparty_node_id, OutPoint? abandoned_funding_txo);
430-
};
431-
432417
[Remote]
433418
enum PaymentFailureReason {
434419
"RecipientRejected",
@@ -443,25 +428,6 @@ enum PaymentFailureReason {
443428
"BlindedPathCreationFailed",
444429
};
445430

446-
[Enum]
447-
interface ClosureReason {
448-
CounterpartyForceClosed(UntrustedString peer_msg);
449-
HolderForceClosed(boolean? broadcasted_latest_txn, string message);
450-
LegacyCooperativeClosure();
451-
CounterpartyInitiatedCooperativeClosure();
452-
LocallyInitiatedCooperativeClosure();
453-
CommitmentTxConfirmed();
454-
FundingTimedOut();
455-
ProcessingError(string err);
456-
DisconnectedPeer();
457-
OutdatedChannelManager();
458-
CounterpartyCoopClosedUnfundedChannel();
459-
LocallyCoopClosedUnfundedChannel();
460-
FundingBatchClosure();
461-
HTLCsTimedOut( PaymentHash? payment_hash );
462-
PeerFeerateTooLow(u32 peer_feerate_sat_per_kw, u32 required_feerate_sat_per_kw);
463-
};
464-
465431
[Enum]
466432
interface PaymentKind {
467433
Onchain(Txid txid, ConfirmationStatus status);
@@ -939,3 +905,6 @@ typedef string LSPSDateTime;
939905

940906
[Custom]
941907
typedef string ScriptBuf;
908+
909+
typedef interface ClosureReason;
910+
typedef enum Event;

src/event.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ use crate::{
5858
///
5959
/// [`Node`]: [`crate::Node`]
6060
#[derive(Debug, Clone, PartialEq, Eq)]
61+
#[cfg_attr(feature = "uniffi", derive(uniffi::Enum))]
6162
pub enum Event {
6263
/// A sent payment was successful.
6364
PaymentSuccessful {

src/ffi/types.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,43 @@ uniffi::custom_type!(LSPSDateTime, String, {
12151215
},
12161216
});
12171217

1218+
/// The reason the channel was closed. See individual variants for more details.
1219+
#[uniffi::remote(Enum)]
1220+
#[derive(Clone, Debug, PartialEq, Eq)]
1221+
pub enum ClosureReason {
1222+
CounterpartyForceClosed {
1223+
peer_msg: UntrustedString,
1224+
},
1225+
HolderForceClosed {
1226+
broadcasted_latest_txn: Option<bool>,
1227+
message: String,
1228+
},
1229+
LegacyCooperativeClosure,
1230+
CounterpartyInitiatedCooperativeClosure,
1231+
LocallyInitiatedCooperativeClosure,
1232+
CommitmentTxConfirmed,
1233+
FundingTimedOut,
1234+
ProcessingError {
1235+
err: String,
1236+
},
1237+
DisconnectedPeer,
1238+
OutdatedChannelManager,
1239+
CounterpartyCoopClosedUnfundedChannel,
1240+
LocallyCoopClosedUnfundedChannel,
1241+
FundingBatchClosure,
1242+
HTLCsTimedOut {
1243+
payment_hash: Option<PaymentHash>,
1244+
},
1245+
PeerFeerateTooLow {
1246+
/// The feerate on our channel set by our peer.
1247+
peer_feerate_sat_per_kw: u32,
1248+
/// The required feerate we enforce, from our [`FeeEstimator`].
1249+
///
1250+
/// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator
1251+
required_feerate_sat_per_kw: u32,
1252+
},
1253+
}
1254+
12181255
#[cfg(test)]
12191256
mod tests {
12201257
use std::num::NonZeroU64;

0 commit comments

Comments
 (0)