+ long channel_id = obj.channel_id;
+ org.ldk.structs.Option_ThirtyTwoBytesZ channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(channel_id);
+ if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.add(this); };
+ this.channel_id = channel_id_hu_conv;
+ }
+ }
+ /**
+ * This event is generated when a payment has been successfully forwarded through us and a
+ * forwarding fee earned.
+ */
+ public final static class PaymentForwarded extends Event {
+ /**
+ * The incoming channel between the previous node and us. This is only `None` for events
+ * generated or serialized by versions prior to 0.0.107.
+ */
+ public final org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id;
+ /**
+ * The outgoing channel between the next node and us. This is only `None` for events
+ * generated or serialized by versions prior to 0.0.107.
+ */
+ public final org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id;
+ /**
+ * The fee, in milli-satoshis, which was earned as a result of the payment.
+ *
+ * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
+ * was pending, the amount the next hop claimed will have been rounded down to the nearest
+ * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
+ * claimed the full value in millisatoshis from the source. In this case,
+ * `claim_from_onchain_tx` will be set.
+ *
+ * If the channel which sent us the payment has been force-closed, we will claim the funds
+ * via an on-chain transaction. In that case we do not yet know the on-chain transaction
+ * fees which we will spend and will instead set this to `None`. It is possible duplicate
+ * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
+ * `None`.
+ */
+ public final org.ldk.structs.Option_u64Z fee_earned_msat;
+ /**
+ * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
+ * transaction.
+ */
+ public final boolean claim_from_onchain_tx;
+ /**
+ * The final amount forwarded, in milli-satoshis, after the fee is deducted.
+ *
+ * The caveat described above the `fee_earned_msat` field applies here as well.
+ */
+ public final org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat;
+ private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
+ super(null, ptr);
+ long prev_channel_id = obj.prev_channel_id;
+ org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(prev_channel_id);
+ if (prev_channel_id_hu_conv != null) { prev_channel_id_hu_conv.ptrs_to.add(this); };
+ this.prev_channel_id = prev_channel_id_hu_conv;
+ long next_channel_id = obj.next_channel_id;
+ org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(next_channel_id);
+ if (next_channel_id_hu_conv != null) { next_channel_id_hu_conv.ptrs_to.add(this); };
+ this.next_channel_id = next_channel_id_hu_conv;
+ long fee_earned_msat = obj.fee_earned_msat;
+ org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
+ if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.add(this); };
+ this.fee_earned_msat = fee_earned_msat_hu_conv;
+ this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
+ long outbound_amount_forwarded_msat = obj.outbound_amount_forwarded_msat;
+ org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat);
+ if (outbound_amount_forwarded_msat_hu_conv != null) { outbound_amount_forwarded_msat_hu_conv.ptrs_to.add(this); };
+ this.outbound_amount_forwarded_msat = outbound_amount_forwarded_msat_hu_conv;
+ }
+ }
+ /**
+ * Used to indicate that a channel with the given `channel_id` is being opened and pending
+ * confirmation on-chain.
+ *
+ * This event is emitted when the funding transaction has been signed and is broadcast to the
+ * network. For 0conf channels it will be immediately followed by the corresponding
+ * [`Event::ChannelReady`] event.
+ */
+ public final static class ChannelPending extends Event {
+ /**
+ * The `channel_id` of the channel that is pending confirmation.
+ */
+ public final byte[] channel_id;
+ /**
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be randomized for an inbound channel.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ public final org.ldk.util.UInt128 user_channel_id;
+ /**
+ * The `temporary_channel_id` this channel used to be known by during channel establishment.
+ *
+ * Will be `None` for channels created prior to LDK version 0.0.115.
+ */
+ public final org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id;
+ /**
+ * The `node_id` of the channel counterparty.
+ */
+ public final byte[] counterparty_node_id;
+ /**
+ * The outpoint of the channel's funding transaction.
+ */
+ public final org.ldk.structs.OutPoint funding_txo;
+ private ChannelPending(long ptr, bindings.LDKEvent.ChannelPending obj) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ byte[] user_channel_id = obj.user_channel_id;
+ org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
+ this.user_channel_id = user_channel_id_conv;
+ long former_temporary_channel_id = obj.former_temporary_channel_id;
+ org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(former_temporary_channel_id);
+ if (former_temporary_channel_id_hu_conv != null) { former_temporary_channel_id_hu_conv.ptrs_to.add(this); };
+ this.former_temporary_channel_id = former_temporary_channel_id_hu_conv;
+ this.counterparty_node_id = obj.counterparty_node_id;
+ long funding_txo = obj.funding_txo;
+ org.ldk.structs.OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, funding_txo); }
+ if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); };
+ this.funding_txo = funding_txo_hu_conv;
+ }
+ }
+ /**
+ * Used to indicate that a channel with the given `channel_id` is ready to
+ * be used. This event is emitted either when the funding transaction has been confirmed
+ * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
+ * establishment.
+ */
+ public final static class ChannelReady extends Event {
+ /**
+ * The `channel_id` of the channel that is ready.
+ */
+ public final byte[] channel_id;
+ /**
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be randomized for an inbound channel.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ public final org.ldk.util.UInt128 user_channel_id;
+ /**
+ * The `node_id` of the channel counterparty.
+ */
+ public final byte[] counterparty_node_id;
+ /**
+ * The features that this channel will operate with.
+ */
+ public final org.ldk.structs.ChannelTypeFeatures channel_type;
+ private ChannelReady(long ptr, bindings.LDKEvent.ChannelReady obj) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ byte[] user_channel_id = obj.user_channel_id;
+ org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
+ this.user_channel_id = user_channel_id_conv;
+ this.counterparty_node_id = obj.counterparty_node_id;
+ long channel_type = obj.channel_type;
+ org.ldk.structs.ChannelTypeFeatures channel_type_hu_conv = null; if (channel_type < 0 || channel_type > 4096) { channel_type_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, channel_type); }
+ if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
+ this.channel_type = channel_type_hu_conv;
+ }
+ }
+ /**
+ * Used to indicate that a previously opened channel with the given `channel_id` is in the
+ * process of closure.
+ *
+ * Note that this event is only triggered for accepted channels: if the
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true and the channel is
+ * rejected, no `ChannelClosed` event will be sent.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ public final static class ChannelClosed extends Event {
+ /**
+ * The `channel_id` of the channel which has been closed. Note that on-chain transactions
+ * resolving the channel are likely still awaiting confirmation.
+ */
+ public final byte[] channel_id;
+ /**
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be randomized for inbound channels.
+ * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
+ * zero for objects serialized with LDK versions prior to 0.0.102.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ public final org.ldk.util.UInt128 user_channel_id;
+ /**
+ * The reason the channel was closed.
+ */
+ public final org.ldk.structs.ClosureReason reason;
+ /**
+ * Counterparty in the closed channel.
+ *
+ * This field will be `None` for objects serialized prior to LDK 0.0.117.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ @Nullable public final byte[] counterparty_node_id;
+ /**
+ * Channel capacity of the closing channel (sats).
+ *
+ * This field will be `None` for objects serialized prior to LDK 0.0.117.
+ */
+ public final org.ldk.structs.Option_u64Z channel_capacity_sats;
+ private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ byte[] user_channel_id = obj.user_channel_id;
+ org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
+ this.user_channel_id = user_channel_id_conv;
+ long reason = obj.reason;
+ org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
+ if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
+ this.reason = reason_hu_conv;
+ this.counterparty_node_id = obj.counterparty_node_id;
+ long channel_capacity_sats = obj.channel_capacity_sats;
+ org.ldk.structs.Option_u64Z channel_capacity_sats_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(channel_capacity_sats);
+ if (channel_capacity_sats_hu_conv != null) { channel_capacity_sats_hu_conv.ptrs_to.add(this); };
+ this.channel_capacity_sats = channel_capacity_sats_hu_conv;
+ }
+ }
+ /**
+ * Used to indicate to the user that they can abandon the funding transaction and recycle the
+ * inputs for another purpose.
+ *
+ * This event is not guaranteed to be generated for channels that are closed due to a restart.
+ */
+ public final static class DiscardFunding extends Event {
+ /**
+ * The channel_id of the channel which has been closed.
+ */
+ public final byte[] channel_id;
+ /**
+ * The full transaction received from the user
+ */
+ public final byte[] transaction;
+ private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ this.transaction = obj.transaction;
+ }
+ }
+ /**
+ * Indicates a request to open a new channel by a peer.
+ *
+ * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request,
+ * call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`]
+ * event will _not_ be triggered if the channel is rejected.
+ *
+ * The event is only triggered when a new open channel request is received and the
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ public final static class OpenChannelRequest extends Event {
+ /**
+ * The temporary channel ID of the channel requested to be opened.
+ *
+ * When responding to the request, the `temporary_channel_id` should be passed
+ * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
+ * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
+ */
+ public final byte[] temporary_channel_id;
+ /**
+ * The node_id of the counterparty requesting to open the channel.
+ *
+ * When responding to the request, the `counterparty_node_id` should be passed
+ * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
+ * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
+ * request.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
+ */
+ public final byte[] counterparty_node_id;
+ /**
+ * The channel value of the requested channel.
+ */
+ public final long funding_satoshis;
+ /**
+ * Our starting balance in the channel if the request is accepted, in milli-satoshi.
+ */
+ public final long push_msat;
+ /**
+ * The features that this channel will operate with. If you reject the channel, a
+ * well-behaved counterparty may automatically re-attempt the channel with a new set of
+ * feature flags.
+ *
+ * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
+ * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
+ * 0.0.106.
+ *
+ * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
+ * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
+ * 0.0.107. Channels setting this type also need to get manually accepted via
+ * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
+ * or will be rejected otherwise.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ */
+ public final org.ldk.structs.ChannelTypeFeatures channel_type;
+ private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) {
+ super(null, ptr);
+ this.temporary_channel_id = obj.temporary_channel_id;
+ this.counterparty_node_id = obj.counterparty_node_id;
+ this.funding_satoshis = obj.funding_satoshis;
+ this.push_msat = obj.push_msat;
+ long channel_type = obj.channel_type;
+ org.ldk.structs.ChannelTypeFeatures channel_type_hu_conv = null; if (channel_type < 0 || channel_type > 4096) { channel_type_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, channel_type); }
+ if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
+ this.channel_type = channel_type_hu_conv;
+ }
+ }
+ /**
+ * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
+ * forward it.
+ *
+ * Some scenarios where this event may be sent include:
+ * Insufficient capacity in the outbound channel
+ * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
+ * When an unknown SCID is requested for forwarding a payment.
+ * Expected MPP amount has already been reached
+ * The HTLC has timed out
+ *
+ * This event, however, does not get generated if an HTLC fails to meet the forwarding
+ * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
+ */
+ public final static class HTLCHandlingFailed extends Event {
+ /**
+ * The channel over which the HTLC was received.
+ */
+ public final byte[] prev_channel_id;
+ /**
+ * Destination of the HTLC that failed to be processed.
+ */
+ public final org.ldk.structs.HTLCDestination failed_next_destination;
+ private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
+ super(null, ptr);
+ this.prev_channel_id = obj.prev_channel_id;
+ long failed_next_destination = obj.failed_next_destination;
+ org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
+ if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
+ this.failed_next_destination = failed_next_destination_hu_conv;
+ }
+ }
+ /**
+ * Indicates that a transaction originating from LDK needs to have its fee bumped. This event
+ * requires confirmed external funds to be readily available to spend.
+ *
+ * LDK does not currently generate this event unless the
+ * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
+ * It is limited to the scope of channels with anchor outputs.
+ *
+ * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
+ */
+ public final static class BumpTransaction extends Event {
+ public final org.ldk.structs.BumpTransactionEvent bump_transaction;
+ private BumpTransaction(long ptr, bindings.LDKEvent.BumpTransaction obj) {
+ super(null, ptr);
+ long bump_transaction = obj.bump_transaction;
+ org.ldk.structs.BumpTransactionEvent bump_transaction_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(bump_transaction);
+ if (bump_transaction_hu_conv != null) { bump_transaction_hu_conv.ptrs_to.add(this); };
+ this.bump_transaction = bump_transaction_hu_conv;