5142bf90b724832ae81abf72fec5253536cc00e7
[ldk-java] / src / main / java / org / ldk / structs / Event.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * An Event which you should probably take some action in response to.
13  * 
14  * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
15  * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
16  * written as it makes no sense to respond to it after reconnecting to peers).
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class Event extends CommonBase {
20         private Event(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.Event_free(ptr); }
25         }
26         static Event constr_from_ptr(long ptr) {
27                 bindings.LDKEvent raw_val = bindings.LDKEvent_ref_from_ptr(ptr);
28                 if (raw_val.getClass() == bindings.LDKEvent.FundingGenerationReady.class) {
29                         return new FundingGenerationReady(ptr, (bindings.LDKEvent.FundingGenerationReady)raw_val);
30                 }
31                 if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimable.class) {
32                         return new PaymentClaimable(ptr, (bindings.LDKEvent.PaymentClaimable)raw_val);
33                 }
34                 if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimed.class) {
35                         return new PaymentClaimed(ptr, (bindings.LDKEvent.PaymentClaimed)raw_val);
36                 }
37                 if (raw_val.getClass() == bindings.LDKEvent.PaymentSent.class) {
38                         return new PaymentSent(ptr, (bindings.LDKEvent.PaymentSent)raw_val);
39                 }
40                 if (raw_val.getClass() == bindings.LDKEvent.PaymentFailed.class) {
41                         return new PaymentFailed(ptr, (bindings.LDKEvent.PaymentFailed)raw_val);
42                 }
43                 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathSuccessful.class) {
44                         return new PaymentPathSuccessful(ptr, (bindings.LDKEvent.PaymentPathSuccessful)raw_val);
45                 }
46                 if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) {
47                         return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val);
48                 }
49                 if (raw_val.getClass() == bindings.LDKEvent.ProbeSuccessful.class) {
50                         return new ProbeSuccessful(ptr, (bindings.LDKEvent.ProbeSuccessful)raw_val);
51                 }
52                 if (raw_val.getClass() == bindings.LDKEvent.ProbeFailed.class) {
53                         return new ProbeFailed(ptr, (bindings.LDKEvent.ProbeFailed)raw_val);
54                 }
55                 if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
56                         return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
57                 }
58                 if (raw_val.getClass() == bindings.LDKEvent.HTLCIntercepted.class) {
59                         return new HTLCIntercepted(ptr, (bindings.LDKEvent.HTLCIntercepted)raw_val);
60                 }
61                 if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
62                         return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
63                 }
64                 if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
65                         return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
66                 }
67                 if (raw_val.getClass() == bindings.LDKEvent.ChannelPending.class) {
68                         return new ChannelPending(ptr, (bindings.LDKEvent.ChannelPending)raw_val);
69                 }
70                 if (raw_val.getClass() == bindings.LDKEvent.ChannelReady.class) {
71                         return new ChannelReady(ptr, (bindings.LDKEvent.ChannelReady)raw_val);
72                 }
73                 if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
74                         return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
75                 }
76                 if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) {
77                         return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val);
78                 }
79                 if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) {
80                         return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val);
81                 }
82                 if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
83                         return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
84                 }
85                 if (raw_val.getClass() == bindings.LDKEvent.BumpTransaction.class) {
86                         return new BumpTransaction(ptr, (bindings.LDKEvent.BumpTransaction)raw_val);
87                 }
88                 assert false; return null; // Unreachable without extending the (internal) bindings interface
89         }
90
91         /**
92          * Used to indicate that the client should generate a funding transaction with the given
93          * parameters and then call [`ChannelManager::funding_transaction_generated`].
94          * Generated in [`ChannelManager`] message handling.
95          * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
96          * counterparty can steal your funds!
97          * 
98          * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
99          * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
100          */
101         public final static class FundingGenerationReady extends Event {
102                 /**
103                  * The random channel_id we picked which you'll need to pass into
104                  * [`ChannelManager::funding_transaction_generated`].
105                  * 
106                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
107                 */
108                 public final byte[] temporary_channel_id;
109                 /**
110                  * The counterparty's node_id, which you'll need to pass back into
111                  * [`ChannelManager::funding_transaction_generated`].
112                  * 
113                  * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
114                 */
115                 public final byte[] counterparty_node_id;
116                 /**
117                  * The value, in satoshis, that the output should have.
118                 */
119                 public final long channel_value_satoshis;
120                 /**
121                  * The script which should be used in the transaction output.
122                 */
123                 public final byte[] output_script;
124                 /**
125                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
126                  * random value for an inbound channel. This may be zero for objects serialized with LDK
127                  * versions prior to 0.0.113.
128                  * 
129                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
130                 */
131                 public final org.ldk.util.UInt128 user_channel_id;
132                 private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) {
133                         super(null, ptr);
134                         this.temporary_channel_id = obj.temporary_channel_id;
135                         this.counterparty_node_id = obj.counterparty_node_id;
136                         this.channel_value_satoshis = obj.channel_value_satoshis;
137                         this.output_script = obj.output_script;
138                         byte[] user_channel_id = obj.user_channel_id;
139                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
140                         this.user_channel_id = user_channel_id_conv;
141                 }
142         }
143         /**
144          * Indicates that we've been offered a payment and it needs to be claimed via calling
145          * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
146          * 
147          * Note that if the preimage is not known, you should call
148          * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
149          * to free up resources for this HTLC and avoid network congestion.
150          * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
151          * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
152          * automatically failed.
153          * 
154          * # Note
155          * LDK will not stop an inbound payment from being paid multiple times, so multiple
156          * `PaymentClaimable` events may be generated for the same payment. In such a case it is
157          * polite (and required in the lightning specification) to fail the payment the second time
158          * and give the sender their money back rather than accepting double payment.
159          * 
160          * # Note
161          * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
162          * 
163          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
164          * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
165          * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
166          */
167         public final static class PaymentClaimable extends Event {
168                 /**
169                  * The node that will receive the payment after it has been claimed.
170                  * This is useful to identify payments received via [phantom nodes].
171                  * This field will always be filled in when the event was generated by LDK versions
172                  * 0.0.113 and above.
173                  * 
174                  * [phantom nodes]: crate::sign::PhantomKeysManager
175                  * 
176                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
177                 */
178                 @Nullable public final byte[] receiver_node_id;
179                 /**
180                  * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
181                  * not stop you from registering duplicate payment hashes for inbound payments.
182                 */
183                 public final byte[] payment_hash;
184                 /**
185                  * The fields in the onion which were received with each HTLC. Only fields which were
186                  * identical in each HTLC involved in the payment will be included here.
187                  * 
188                  * Payments received on LDK versions prior to 0.0.115 will have this field unset.
189                  * 
190                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
191                 */
192                 @Nullable public final org.ldk.structs.RecipientOnionFields onion_fields;
193                 /**
194                  * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater
195                  * than the invoice amount.
196                  * 
197                  * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
198                  * and the previous hop took an extra fee.
199                  * 
200                  * # Note
201                  * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
202                  * field, you may lose money!
203                  * 
204                  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
205                 */
206                 public final long amount_msat;
207                 /**
208                  * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
209                  * taken by our channel counterparty.
210                  * 
211                  * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
212                  * 
213                  * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
214                 */
215                 public final long counterparty_skimmed_fee_msat;
216                 /**
217                  * Information for claiming this received payment, based on whether the purpose of the
218                  * payment is to pay an invoice or to send a spontaneous payment.
219                 */
220                 public final org.ldk.structs.PaymentPurpose purpose;
221                 /**
222                  * The `channel_id` indicating over which channel we received the payment.
223                  * 
224                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
225                 */
226                 @Nullable public final byte[] via_channel_id;
227                 /**
228                  * The `user_channel_id` indicating over which channel we received the payment.
229                 */
230                 public final org.ldk.structs.Option_u128Z via_user_channel_id;
231                 /**
232                  * The block height at which this payment will be failed back and will no longer be
233                  * eligible for claiming.
234                  * 
235                  * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
236                  * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
237                  * 
238                  * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
239                 */
240                 public final org.ldk.structs.Option_u32Z claim_deadline;
241                 private PaymentClaimable(long ptr, bindings.LDKEvent.PaymentClaimable obj) {
242                         super(null, ptr);
243                         this.receiver_node_id = obj.receiver_node_id;
244                         this.payment_hash = obj.payment_hash;
245                         long onion_fields = obj.onion_fields;
246                         org.ldk.structs.RecipientOnionFields onion_fields_hu_conv = null; if (onion_fields < 0 || onion_fields > 4096) { onion_fields_hu_conv = new org.ldk.structs.RecipientOnionFields(null, onion_fields); }
247                         if (onion_fields_hu_conv != null) { onion_fields_hu_conv.ptrs_to.add(this); };
248                         this.onion_fields = onion_fields_hu_conv;
249                         this.amount_msat = obj.amount_msat;
250                         this.counterparty_skimmed_fee_msat = obj.counterparty_skimmed_fee_msat;
251                         long purpose = obj.purpose;
252                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
253                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
254                         this.purpose = purpose_hu_conv;
255                         this.via_channel_id = obj.via_channel_id;
256                         long via_user_channel_id = obj.via_user_channel_id;
257                         org.ldk.structs.Option_u128Z via_user_channel_id_hu_conv = org.ldk.structs.Option_u128Z.constr_from_ptr(via_user_channel_id);
258                         if (via_user_channel_id_hu_conv != null) { via_user_channel_id_hu_conv.ptrs_to.add(this); };
259                         this.via_user_channel_id = via_user_channel_id_hu_conv;
260                         long claim_deadline = obj.claim_deadline;
261                         org.ldk.structs.Option_u32Z claim_deadline_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(claim_deadline);
262                         if (claim_deadline_hu_conv != null) { claim_deadline_hu_conv.ptrs_to.add(this); };
263                         this.claim_deadline = claim_deadline_hu_conv;
264                 }
265         }
266         /**
267          * Indicates a payment has been claimed and we've received money!
268          * 
269          * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
270          * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
271          * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
272          * [`Event::PaymentClaimable`] event.
273          * 
274          * # Note
275          * LDK will not stop an inbound payment from being paid multiple times, so multiple
276          * `PaymentClaimable` events may be generated for the same payment. If you then call
277          * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
278          * multiple `PaymentClaimed` events.
279          * 
280          * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
281          */
282         public final static class PaymentClaimed extends Event {
283                 /**
284                  * The node that received the payment.
285                  * This is useful to identify payments which were received via [phantom nodes].
286                  * This field will always be filled in when the event was generated by LDK versions
287                  * 0.0.113 and above.
288                  * 
289                  * [phantom nodes]: crate::sign::PhantomKeysManager
290                  * 
291                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
292                 */
293                 @Nullable public final byte[] receiver_node_id;
294                 /**
295                  * The payment hash of the claimed payment. Note that LDK will not stop you from
296                  * registering duplicate payment hashes for inbound payments.
297                 */
298                 public final byte[] payment_hash;
299                 /**
300                  * The value, in thousandths of a satoshi, that this payment is for. May be greater than the
301                  * invoice amount.
302                 */
303                 public final long amount_msat;
304                 /**
305                  * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
306                  * spontaneous payment.
307                 */
308                 public final org.ldk.structs.PaymentPurpose purpose;
309                 private PaymentClaimed(long ptr, bindings.LDKEvent.PaymentClaimed obj) {
310                         super(null, ptr);
311                         this.receiver_node_id = obj.receiver_node_id;
312                         this.payment_hash = obj.payment_hash;
313                         this.amount_msat = obj.amount_msat;
314                         long purpose = obj.purpose;
315                         org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
316                         if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.add(this); };
317                         this.purpose = purpose_hu_conv;
318                 }
319         }
320         /**
321          * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
322          * and we got back the payment preimage for it).
323          * 
324          * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
325          * event. In this situation, you SHOULD treat this payment as having succeeded.
326          */
327         public final static class PaymentSent extends Event {
328                 /**
329                  * The `payment_id` passed to [`ChannelManager::send_payment`].
330                  * 
331                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
332                 */
333                 public final org.ldk.structs.Option_PaymentIdZ payment_id;
334                 /**
335                  * The preimage to the hash given to ChannelManager::send_payment.
336                  * Note that this serves as a payment receipt, if you wish to have such a thing, you must
337                  * store it somehow!
338                 */
339                 public final byte[] payment_preimage;
340                 /**
341                  * The hash that was given to [`ChannelManager::send_payment`].
342                  * 
343                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
344                 */
345                 public final byte[] payment_hash;
346                 /**
347                  * The total fee which was spent at intermediate hops in this payment, across all paths.
348                  * 
349                  * Note that, like [`Route::get_total_fees`] this does *not* include any potential
350                  * overpayment to the recipient node.
351                  * 
352                  * If the recipient or an intermediate node misbehaves and gives us free money, this may
353                  * overstate the amount paid, though this is unlikely.
354                  * 
355                  * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
356                 */
357                 public final org.ldk.structs.Option_u64Z fee_paid_msat;
358                 private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) {
359                         super(null, ptr);
360                         long payment_id = obj.payment_id;
361                         org.ldk.structs.Option_PaymentIdZ payment_id_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(payment_id);
362                         if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
363                         this.payment_id = payment_id_hu_conv;
364                         this.payment_preimage = obj.payment_preimage;
365                         this.payment_hash = obj.payment_hash;
366                         long fee_paid_msat = obj.fee_paid_msat;
367                         org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
368                         if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.add(this); };
369                         this.fee_paid_msat = fee_paid_msat_hu_conv;
370                 }
371         }
372         /**
373          * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
374          * provide failure information for each path attempt in the payment, including retries.
375          * 
376          * This event is provided once there are no further pending HTLCs for the payment and the
377          * payment is no longer retryable, due either to the [`Retry`] provided or
378          * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
379          * 
380          * [`Retry`]: crate::ln::channelmanager::Retry
381          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
382          */
383         public final static class PaymentFailed extends Event {
384                 /**
385                  * The `payment_id` passed to [`ChannelManager::send_payment`].
386                  * 
387                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
388                 */
389                 public final byte[] payment_id;
390                 /**
391                  * The hash that was given to [`ChannelManager::send_payment`].
392                  * 
393                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
394                 */
395                 public final byte[] payment_hash;
396                 /**
397                  * The reason the payment failed. This is only `None` for events generated or serialized
398                  * by versions prior to 0.0.115.
399                 */
400                 public final org.ldk.structs.Option_PaymentFailureReasonZ reason;
401                 private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) {
402                         super(null, ptr);
403                         this.payment_id = obj.payment_id;
404                         this.payment_hash = obj.payment_hash;
405                         long reason = obj.reason;
406                         org.ldk.structs.Option_PaymentFailureReasonZ reason_hu_conv = org.ldk.structs.Option_PaymentFailureReasonZ.constr_from_ptr(reason);
407                         if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
408                         this.reason = reason_hu_conv;
409                 }
410         }
411         /**
412          * Indicates that a path for an outbound payment was successful.
413          * 
414          * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
415          * [`Event::PaymentSent`] for obtaining the payment preimage.
416          */
417         public final static class PaymentPathSuccessful extends Event {
418                 /**
419                  * The `payment_id` passed to [`ChannelManager::send_payment`].
420                  * 
421                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
422                 */
423                 public final byte[] payment_id;
424                 /**
425                  * The hash that was given to [`ChannelManager::send_payment`].
426                  * 
427                  * This will be `Some` for all payments which completed on LDK 0.0.104 or later.
428                  * 
429                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
430                 */
431                 public final org.ldk.structs.Option_PaymentHashZ payment_hash;
432                 /**
433                  * The payment path that was successful.
434                  * 
435                  * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
436                 */
437                 public final org.ldk.structs.Path path;
438                 private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) {
439                         super(null, ptr);
440                         this.payment_id = obj.payment_id;
441                         long payment_hash = obj.payment_hash;
442                         org.ldk.structs.Option_PaymentHashZ payment_hash_hu_conv = org.ldk.structs.Option_PaymentHashZ.constr_from_ptr(payment_hash);
443                         if (payment_hash_hu_conv != null) { payment_hash_hu_conv.ptrs_to.add(this); };
444                         this.payment_hash = payment_hash_hu_conv;
445                         long path = obj.path;
446                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
447                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
448                         this.path = path_hu_conv;
449                 }
450         }
451         /**
452          * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
453          * handle the HTLC.
454          * 
455          * Note that this does *not* indicate that all paths for an MPP payment have failed, see
456          * [`Event::PaymentFailed`].
457          * 
458          * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
459          * been exhausted.
460          * 
461          * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
462          */
463         public final static class PaymentPathFailed extends Event {
464                 /**
465                  * The `payment_id` passed to [`ChannelManager::send_payment`].
466                  * 
467                  * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
468                  * 
469                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
470                  * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
471                 */
472                 public final org.ldk.structs.Option_PaymentIdZ payment_id;
473                 /**
474                  * The hash that was given to [`ChannelManager::send_payment`].
475                  * 
476                  * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
477                 */
478                 public final byte[] payment_hash;
479                 /**
480                  * Indicates the payment was rejected for some reason by the recipient. This implies that
481                  * the payment has failed, not just the route in question. If this is not set, the payment may
482                  * be retried via a different route.
483                 */
484                 public final boolean payment_failed_permanently;
485                 /**
486                  * Extra error details based on the failure type. May contain an update that needs to be
487                  * applied to the [`NetworkGraph`].
488                  * 
489                  * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
490                 */
491                 public final org.ldk.structs.PathFailure failure;
492                 /**
493                  * The payment path that failed.
494                 */
495                 public final org.ldk.structs.Path path;
496                 /**
497                  * The channel responsible for the failed payment path.
498                  * 
499                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
500                  * may not refer to a channel in the public network graph. These aliases may also collide
501                  * with channels in the public network graph.
502                  * 
503                  * If this is `Some`, then the corresponding channel should be avoided when the payment is
504                  * retried. May be `None` for older [`Event`] serializations.
505                 */
506                 public final org.ldk.structs.Option_u64Z short_channel_id;
507                 private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
508                         super(null, ptr);
509                         long payment_id = obj.payment_id;
510                         org.ldk.structs.Option_PaymentIdZ payment_id_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(payment_id);
511                         if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.add(this); };
512                         this.payment_id = payment_id_hu_conv;
513                         this.payment_hash = obj.payment_hash;
514                         this.payment_failed_permanently = obj.payment_failed_permanently;
515                         long failure = obj.failure;
516                         org.ldk.structs.PathFailure failure_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(failure);
517                         if (failure_hu_conv != null) { failure_hu_conv.ptrs_to.add(this); };
518                         this.failure = failure_hu_conv;
519                         long path = obj.path;
520                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
521                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
522                         this.path = path_hu_conv;
523                         long short_channel_id = obj.short_channel_id;
524                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
525                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
526                         this.short_channel_id = short_channel_id_hu_conv;
527                 }
528         }
529         /**
530          * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
531          */
532         public final static class ProbeSuccessful extends Event {
533                 /**
534                  * The id returned by [`ChannelManager::send_probe`].
535                  * 
536                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
537                 */
538                 public final byte[] payment_id;
539                 /**
540                  * The hash generated by [`ChannelManager::send_probe`].
541                  * 
542                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
543                 */
544                 public final byte[] payment_hash;
545                 /**
546                  * The payment path that was successful.
547                 */
548                 public final org.ldk.structs.Path path;
549                 private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful obj) {
550                         super(null, ptr);
551                         this.payment_id = obj.payment_id;
552                         this.payment_hash = obj.payment_hash;
553                         long path = obj.path;
554                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
555                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
556                         this.path = path_hu_conv;
557                 }
558         }
559         /**
560          * Indicates that a probe payment we sent failed at an intermediary node on the path.
561          */
562         public final static class ProbeFailed extends Event {
563                 /**
564                  * The id returned by [`ChannelManager::send_probe`].
565                  * 
566                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
567                 */
568                 public final byte[] payment_id;
569                 /**
570                  * The hash generated by [`ChannelManager::send_probe`].
571                  * 
572                  * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
573                 */
574                 public final byte[] payment_hash;
575                 /**
576                  * The payment path that failed.
577                 */
578                 public final org.ldk.structs.Path path;
579                 /**
580                  * The channel responsible for the failed probe.
581                  * 
582                  * Note that for route hints or for the first hop in a path this may be an SCID alias and
583                  * may not refer to a channel in the public network graph. These aliases may also collide
584                  * with channels in the public network graph.
585                 */
586                 public final org.ldk.structs.Option_u64Z short_channel_id;
587                 private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed obj) {
588                         super(null, ptr);
589                         this.payment_id = obj.payment_id;
590                         this.payment_hash = obj.payment_hash;
591                         long path = obj.path;
592                         org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
593                         if (path_hu_conv != null) { path_hu_conv.ptrs_to.add(this); };
594                         this.path = path_hu_conv;
595                         long short_channel_id = obj.short_channel_id;
596                         org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
597                         if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.add(this); };
598                         this.short_channel_id = short_channel_id_hu_conv;
599                 }
600         }
601         /**
602          * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
603          * a time in the future.
604          * 
605          * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
606          */
607         public final static class PendingHTLCsForwardable extends Event {
608                 /**
609                  * The minimum amount of time that should be waited prior to calling
610                  * process_pending_htlc_forwards. To increase the effort required to correlate payments,
611                  * you should wait a random amount of time in roughly the range (now + time_forwardable,
612                  * now + 5*time_forwardable).
613                 */
614                 public final long time_forwardable;
615                 private PendingHTLCsForwardable(long ptr, bindings.LDKEvent.PendingHTLCsForwardable obj) {
616                         super(null, ptr);
617                         this.time_forwardable = obj.time_forwardable;
618                 }
619         }
620         /**
621          * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
622          * you've encoded an intercept scid in the receiver's invoice route hints using
623          * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
624          * 
625          * [`ChannelManager::forward_intercepted_htlc`] or
626          * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
627          * their docs for more information.
628          * 
629          * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
630          * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
631          * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
632          * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
633          */
634         public final static class HTLCIntercepted extends Event {
635                 /**
636                  * An id to help LDK identify which HTLC is being forwarded or failed.
637                 */
638                 public final byte[] intercept_id;
639                 /**
640                  * The fake scid that was programmed as the next hop's scid, generated using
641                  * [`ChannelManager::get_intercept_scid`].
642                  * 
643                  * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
644                 */
645                 public final long requested_next_hop_scid;
646                 /**
647                  * The payment hash used for this HTLC.
648                 */
649                 public final byte[] payment_hash;
650                 /**
651                  * How many msats were received on the inbound edge of this HTLC.
652                 */
653                 public final long inbound_amount_msat;
654                 /**
655                  * How many msats the payer intended to route to the next node. Depending on the reason you are
656                  * intercepting this payment, you might take a fee by forwarding less than this amount.
657                  * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
658                  * 
659                  * Note that LDK will NOT check that expected fees were factored into this value. You MUST
660                  * check that whatever fee you want has been included here or subtract it as required. Further,
661                  * LDK will not stop you from forwarding more than you received.
662                 */
663                 public final long expected_outbound_amount_msat;
664                 private HTLCIntercepted(long ptr, bindings.LDKEvent.HTLCIntercepted obj) {
665                         super(null, ptr);
666                         this.intercept_id = obj.intercept_id;
667                         this.requested_next_hop_scid = obj.requested_next_hop_scid;
668                         this.payment_hash = obj.payment_hash;
669                         this.inbound_amount_msat = obj.inbound_amount_msat;
670                         this.expected_outbound_amount_msat = obj.expected_outbound_amount_msat;
671                 }
672         }
673         /**
674          * Used to indicate that an output which you should know how to spend was confirmed on chain
675          * and is now spendable.
676          * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
677          * counterparty spending them due to some kind of timeout. Thus, you need to store them
678          * somewhere and spend them when you create on-chain transactions.
679          */
680         public final static class SpendableOutputs extends Event {
681                 /**
682                  * The outputs which you should store as spendable by you.
683                 */
684                 public final SpendableOutputDescriptor[] outputs;
685                 private SpendableOutputs(long ptr, bindings.LDKEvent.SpendableOutputs obj) {
686                         super(null, ptr);
687                         long[] outputs = obj.outputs;
688                         int outputs_conv_27_len = outputs.length;
689                         SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
690                         for (int b = 0; b < outputs_conv_27_len; b++) {
691                                 long outputs_conv_27 = outputs[b];
692                                 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
693                                 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.add(this); };
694                                 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
695                         }
696                         this.outputs = outputs_conv_27_arr;
697                 }
698         }
699         /**
700          * This event is generated when a payment has been successfully forwarded through us and a
701          * forwarding fee earned.
702          */
703         public final static class PaymentForwarded extends Event {
704                 /**
705                  * The incoming channel between the previous node and us. This is only `None` for events
706                  * generated or serialized by versions prior to 0.0.107.
707                  * 
708                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
709                 */
710                 @Nullable public final byte[] prev_channel_id;
711                 /**
712                  * The outgoing channel between the next node and us. This is only `None` for events
713                  * generated or serialized by versions prior to 0.0.107.
714                  * 
715                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
716                 */
717                 @Nullable public final byte[] next_channel_id;
718                 /**
719                  * The fee, in milli-satoshis, which was earned as a result of the payment.
720                  * 
721                  * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
722                  * was pending, the amount the next hop claimed will have been rounded down to the nearest
723                  * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
724                  * claimed the full value in millisatoshis from the source. In this case,
725                  * `claim_from_onchain_tx` will be set.
726                  * 
727                  * If the channel which sent us the payment has been force-closed, we will claim the funds
728                  * via an on-chain transaction. In that case we do not yet know the on-chain transaction
729                  * fees which we will spend and will instead set this to `None`. It is possible duplicate
730                  * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
731                  * `None`.
732                 */
733                 public final org.ldk.structs.Option_u64Z fee_earned_msat;
734                 /**
735                  * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
736                  * transaction.
737                 */
738                 public final boolean claim_from_onchain_tx;
739                 /**
740                  * The final amount forwarded, in milli-satoshis, after the fee is deducted.
741                  * 
742                  * The caveat described above the `fee_earned_msat` field applies here as well.
743                 */
744                 public final org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat;
745                 private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
746                         super(null, ptr);
747                         this.prev_channel_id = obj.prev_channel_id;
748                         this.next_channel_id = obj.next_channel_id;
749                         long fee_earned_msat = obj.fee_earned_msat;
750                         org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
751                         if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.add(this); };
752                         this.fee_earned_msat = fee_earned_msat_hu_conv;
753                         this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
754                         long outbound_amount_forwarded_msat = obj.outbound_amount_forwarded_msat;
755                         org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat);
756                         if (outbound_amount_forwarded_msat_hu_conv != null) { outbound_amount_forwarded_msat_hu_conv.ptrs_to.add(this); };
757                         this.outbound_amount_forwarded_msat = outbound_amount_forwarded_msat_hu_conv;
758                 }
759         }
760         /**
761          * Used to indicate that a channel with the given `channel_id` is being opened and pending
762          * confirmation on-chain.
763          * 
764          * This event is emitted when the funding transaction has been signed and is broadcast to the
765          * network. For 0conf channels it will be immediately followed by the corresponding
766          * [`Event::ChannelReady`] event.
767          */
768         public final static class ChannelPending extends Event {
769                 /**
770                  * The `channel_id` of the channel that is pending confirmation.
771                 */
772                 public final byte[] channel_id;
773                 /**
774                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
775                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
776                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
777                  * `user_channel_id` will be randomized for an inbound channel.
778                  * 
779                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
780                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
781                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
782                 */
783                 public final org.ldk.util.UInt128 user_channel_id;
784                 /**
785                  * The `temporary_channel_id` this channel used to be known by during channel establishment.
786                  * 
787                  * Will be `None` for channels created prior to LDK version 0.0.115.
788                  * 
789                  * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
790                 */
791                 @Nullable public final byte[] former_temporary_channel_id;
792                 /**
793                  * The `node_id` of the channel counterparty.
794                 */
795                 public final byte[] counterparty_node_id;
796                 /**
797                  * The outpoint of the channel's funding transaction.
798                 */
799                 public final org.ldk.structs.OutPoint funding_txo;
800                 private ChannelPending(long ptr, bindings.LDKEvent.ChannelPending obj) {
801                         super(null, ptr);
802                         this.channel_id = obj.channel_id;
803                         byte[] user_channel_id = obj.user_channel_id;
804                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
805                         this.user_channel_id = user_channel_id_conv;
806                         this.former_temporary_channel_id = obj.former_temporary_channel_id;
807                         this.counterparty_node_id = obj.counterparty_node_id;
808                         long funding_txo = obj.funding_txo;
809                         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); }
810                         if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.add(this); };
811                         this.funding_txo = funding_txo_hu_conv;
812                 }
813         }
814         /**
815          * Used to indicate that a channel with the given `channel_id` is ready to
816          * be used. This event is emitted either when the funding transaction has been confirmed
817          * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
818          * establishment.
819          */
820         public final static class ChannelReady extends Event {
821                 /**
822                  * The `channel_id` of the channel that is ready.
823                 */
824                 public final byte[] channel_id;
825                 /**
826                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
827                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
828                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
829                  * `user_channel_id` will be randomized for an inbound channel.
830                  * 
831                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
832                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
833                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
834                 */
835                 public final org.ldk.util.UInt128 user_channel_id;
836                 /**
837                  * The `node_id` of the channel counterparty.
838                 */
839                 public final byte[] counterparty_node_id;
840                 /**
841                  * The features that this channel will operate with.
842                 */
843                 public final org.ldk.structs.ChannelTypeFeatures channel_type;
844                 private ChannelReady(long ptr, bindings.LDKEvent.ChannelReady obj) {
845                         super(null, ptr);
846                         this.channel_id = obj.channel_id;
847                         byte[] user_channel_id = obj.user_channel_id;
848                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
849                         this.user_channel_id = user_channel_id_conv;
850                         this.counterparty_node_id = obj.counterparty_node_id;
851                         long channel_type = obj.channel_type;
852                         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); }
853                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
854                         this.channel_type = channel_type_hu_conv;
855                 }
856         }
857         /**
858          * Used to indicate that a previously opened channel with the given `channel_id` is in the
859          * process of closure.
860          */
861         public final static class ChannelClosed extends Event {
862                 /**
863                  * The `channel_id` of the channel which has been closed. Note that on-chain transactions
864                  * resolving the channel are likely still awaiting confirmation.
865                 */
866                 public final byte[] channel_id;
867                 /**
868                  * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
869                  * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
870                  * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
871                  * `user_channel_id` will be randomized for inbound channels.
872                  * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
873                  * zero for objects serialized with LDK versions prior to 0.0.102.
874                  * 
875                  * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
876                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
877                  * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
878                 */
879                 public final org.ldk.util.UInt128 user_channel_id;
880                 /**
881                  * The reason the channel was closed.
882                 */
883                 public final org.ldk.structs.ClosureReason reason;
884                 private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
885                         super(null, ptr);
886                         this.channel_id = obj.channel_id;
887                         byte[] user_channel_id = obj.user_channel_id;
888                         org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
889                         this.user_channel_id = user_channel_id_conv;
890                         long reason = obj.reason;
891                         org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
892                         if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.add(this); };
893                         this.reason = reason_hu_conv;
894                 }
895         }
896         /**
897          * Used to indicate to the user that they can abandon the funding transaction and recycle the
898          * inputs for another purpose.
899          */
900         public final static class DiscardFunding extends Event {
901                 /**
902                  * The channel_id of the channel which has been closed.
903                 */
904                 public final byte[] channel_id;
905                 /**
906                  * The full transaction received from the user
907                 */
908                 public final byte[] transaction;
909                 private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) {
910                         super(null, ptr);
911                         this.channel_id = obj.channel_id;
912                         this.transaction = obj.transaction;
913                 }
914         }
915         /**
916          * Indicates a request to open a new channel by a peer.
917          * 
918          * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
919          * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
920          * 
921          * The event is only triggered when a new open channel request is received and the
922          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
923          * 
924          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
925          * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
926          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
927          */
928         public final static class OpenChannelRequest extends Event {
929                 /**
930                  * The temporary channel ID of the channel requested to be opened.
931                  * 
932                  * When responding to the request, the `temporary_channel_id` should be passed
933                  * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
934                  * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
935                  * 
936                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
937                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
938                 */
939                 public final byte[] temporary_channel_id;
940                 /**
941                  * The node_id of the counterparty requesting to open the channel.
942                  * 
943                  * When responding to the request, the `counterparty_node_id` should be passed
944                  * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
945                  * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
946                  * request.
947                  * 
948                  * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
949                  * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
950                 */
951                 public final byte[] counterparty_node_id;
952                 /**
953                  * The channel value of the requested channel.
954                 */
955                 public final long funding_satoshis;
956                 /**
957                  * Our starting balance in the channel if the request is accepted, in milli-satoshi.
958                 */
959                 public final long push_msat;
960                 /**
961                  * The features that this channel will operate with. If you reject the channel, a
962                  * well-behaved counterparty may automatically re-attempt the channel with a new set of
963                  * feature flags.
964                  * 
965                  * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
966                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
967                  * 0.0.106.
968                  * 
969                  * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
970                  * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
971                  * 0.0.107. Channels setting this type also need to get manually accepted via
972                  * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
973                  * or will be rejected otherwise.
974                  * 
975                  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
976                 */
977                 public final org.ldk.structs.ChannelTypeFeatures channel_type;
978                 private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) {
979                         super(null, ptr);
980                         this.temporary_channel_id = obj.temporary_channel_id;
981                         this.counterparty_node_id = obj.counterparty_node_id;
982                         this.funding_satoshis = obj.funding_satoshis;
983                         this.push_msat = obj.push_msat;
984                         long channel_type = obj.channel_type;
985                         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); }
986                         if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.add(this); };
987                         this.channel_type = channel_type_hu_conv;
988                 }
989         }
990         /**
991          * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
992          * forward it.
993          * 
994          * Some scenarios where this event may be sent include:
995          * Insufficient capacity in the outbound channel
996          * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
997          * When an unknown SCID is requested for forwarding a payment.
998          * Expected MPP amount has already been reached
999          * The HTLC has timed out
1000          * 
1001          * This event, however, does not get generated if an HTLC fails to meet the forwarding
1002          * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
1003          */
1004         public final static class HTLCHandlingFailed extends Event {
1005                 /**
1006                  * The channel over which the HTLC was received.
1007                 */
1008                 public final byte[] prev_channel_id;
1009                 /**
1010                  * Destination of the HTLC that failed to be processed.
1011                 */
1012                 public final org.ldk.structs.HTLCDestination failed_next_destination;
1013                 private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
1014                         super(null, ptr);
1015                         this.prev_channel_id = obj.prev_channel_id;
1016                         long failed_next_destination = obj.failed_next_destination;
1017                         org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
1018                         if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.add(this); };
1019                         this.failed_next_destination = failed_next_destination_hu_conv;
1020                 }
1021         }
1022         /**
1023          * Indicates that a transaction originating from LDK needs to have its fee bumped. This event
1024          * requires confirmed external funds to be readily available to spend.
1025          * 
1026          * LDK does not currently generate this event unless the
1027          * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true.
1028          * It is limited to the scope of channels with anchor outputs.
1029          * 
1030          * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx
1031          */
1032         public final static class BumpTransaction extends Event {
1033                 public final org.ldk.structs.BumpTransactionEvent bump_transaction;
1034                 private BumpTransaction(long ptr, bindings.LDKEvent.BumpTransaction obj) {
1035                         super(null, ptr);
1036                         long bump_transaction = obj.bump_transaction;
1037                         org.ldk.structs.BumpTransactionEvent bump_transaction_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(bump_transaction);
1038                         if (bump_transaction_hu_conv != null) { bump_transaction_hu_conv.ptrs_to.add(this); };
1039                         this.bump_transaction = bump_transaction_hu_conv;
1040                 }
1041         }
1042         long clone_ptr() {
1043                 long ret = bindings.Event_clone_ptr(this.ptr);
1044                 Reference.reachabilityFence(this);
1045                 return ret;
1046         }
1047
1048         /**
1049          * Creates a copy of the Event
1050          */
1051         public Event clone() {
1052                 long ret = bindings.Event_clone(this.ptr);
1053                 Reference.reachabilityFence(this);
1054                 if (ret >= 0 && ret <= 4096) { return null; }
1055                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1056                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
1057                 return ret_hu_conv;
1058         }
1059
1060         /**
1061          * Utility method to constructs a new FundingGenerationReady-variant Event
1062          */
1063         public static Event funding_generation_ready(byte[] temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, org.ldk.util.UInt128 user_channel_id) {
1064                 long ret = bindings.Event_funding_generation_ready(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_value_satoshis, output_script, user_channel_id.getLEBytes());
1065                 Reference.reachabilityFence(temporary_channel_id);
1066                 Reference.reachabilityFence(counterparty_node_id);
1067                 Reference.reachabilityFence(channel_value_satoshis);
1068                 Reference.reachabilityFence(output_script);
1069                 Reference.reachabilityFence(user_channel_id);
1070                 if (ret >= 0 && ret <= 4096) { return null; }
1071                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1072                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1073                 return ret_hu_conv;
1074         }
1075
1076         /**
1077          * Utility method to constructs a new PaymentClaimable-variant Event
1078          */
1079         public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, long counterparty_skimmed_fee_msat, org.ldk.structs.PaymentPurpose purpose, byte[] via_channel_id, org.ldk.structs.Option_u128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) {
1080                 long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), onion_fields == null ? 0 : onion_fields.ptr, amount_msat, counterparty_skimmed_fee_msat, purpose.ptr, InternalUtils.check_arr_len(via_channel_id, 32), via_user_channel_id.ptr, claim_deadline.ptr);
1081                 Reference.reachabilityFence(receiver_node_id);
1082                 Reference.reachabilityFence(payment_hash);
1083                 Reference.reachabilityFence(onion_fields);
1084                 Reference.reachabilityFence(amount_msat);
1085                 Reference.reachabilityFence(counterparty_skimmed_fee_msat);
1086                 Reference.reachabilityFence(purpose);
1087                 Reference.reachabilityFence(via_channel_id);
1088                 Reference.reachabilityFence(via_user_channel_id);
1089                 Reference.reachabilityFence(claim_deadline);
1090                 if (ret >= 0 && ret <= 4096) { return null; }
1091                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1092                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1093                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(onion_fields); };
1094                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1095                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(via_user_channel_id); };
1096                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(claim_deadline); };
1097                 return ret_hu_conv;
1098         }
1099
1100         /**
1101          * Utility method to constructs a new PaymentClaimed-variant Event
1102          */
1103         public static Event payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose) {
1104                 long ret = bindings.Event_payment_claimed(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
1105                 Reference.reachabilityFence(receiver_node_id);
1106                 Reference.reachabilityFence(payment_hash);
1107                 Reference.reachabilityFence(amount_msat);
1108                 Reference.reachabilityFence(purpose);
1109                 if (ret >= 0 && ret <= 4096) { return null; }
1110                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1111                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(purpose); };
1113                 return ret_hu_conv;
1114         }
1115
1116         /**
1117          * Utility method to constructs a new PaymentSent-variant Event
1118          */
1119         public static Event payment_sent(org.ldk.structs.Option_PaymentIdZ payment_id, byte[] payment_preimage, byte[] payment_hash, org.ldk.structs.Option_u64Z fee_paid_msat) {
1120                 long ret = bindings.Event_payment_sent(payment_id.ptr, InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
1121                 Reference.reachabilityFence(payment_id);
1122                 Reference.reachabilityFence(payment_preimage);
1123                 Reference.reachabilityFence(payment_hash);
1124                 Reference.reachabilityFence(fee_paid_msat);
1125                 if (ret >= 0 && ret <= 4096) { return null; }
1126                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1127                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1128                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_id); };
1129                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_paid_msat); };
1130                 return ret_hu_conv;
1131         }
1132
1133         /**
1134          * Utility method to constructs a new PaymentFailed-variant Event
1135          */
1136         public static Event payment_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Option_PaymentFailureReasonZ reason) {
1137                 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), reason.ptr);
1138                 Reference.reachabilityFence(payment_id);
1139                 Reference.reachabilityFence(payment_hash);
1140                 Reference.reachabilityFence(reason);
1141                 if (ret >= 0 && ret <= 4096) { return null; }
1142                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1143                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1144                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1145                 return ret_hu_conv;
1146         }
1147
1148         /**
1149          * Utility method to constructs a new PaymentPathSuccessful-variant Event
1150          */
1151         public static Event payment_path_successful(byte[] payment_id, org.ldk.structs.Option_PaymentHashZ payment_hash, org.ldk.structs.Path path) {
1152                 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), payment_hash.ptr, path == null ? 0 : path.ptr);
1153                 Reference.reachabilityFence(payment_id);
1154                 Reference.reachabilityFence(payment_hash);
1155                 Reference.reachabilityFence(path);
1156                 if (ret >= 0 && ret <= 4096) { return null; }
1157                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1158                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1159                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
1160                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1161                 return ret_hu_conv;
1162         }
1163
1164         /**
1165          * Utility method to constructs a new PaymentPathFailed-variant Event
1166          */
1167         public static Event payment_path_failed(org.ldk.structs.Option_PaymentIdZ payment_id, byte[] payment_hash, boolean payment_failed_permanently, org.ldk.structs.PathFailure failure, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
1168                 long ret = bindings.Event_payment_path_failed(payment_id.ptr, InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path == null ? 0 : path.ptr, short_channel_id.ptr);
1169                 Reference.reachabilityFence(payment_id);
1170                 Reference.reachabilityFence(payment_hash);
1171                 Reference.reachabilityFence(payment_failed_permanently);
1172                 Reference.reachabilityFence(failure);
1173                 Reference.reachabilityFence(path);
1174                 Reference.reachabilityFence(short_channel_id);
1175                 if (ret >= 0 && ret <= 4096) { return null; }
1176                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1177                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1178                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_id); };
1179                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); };
1180                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1181                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1182                 return ret_hu_conv;
1183         }
1184
1185         /**
1186          * Utility method to constructs a new ProbeSuccessful-variant Event
1187          */
1188         public static Event probe_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) {
1189                 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr);
1190                 Reference.reachabilityFence(payment_id);
1191                 Reference.reachabilityFence(payment_hash);
1192                 Reference.reachabilityFence(path);
1193                 if (ret >= 0 && ret <= 4096) { return null; }
1194                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1195                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1196                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1197                 return ret_hu_conv;
1198         }
1199
1200         /**
1201          * Utility method to constructs a new ProbeFailed-variant Event
1202          */
1203         public static Event probe_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
1204                 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr, short_channel_id.ptr);
1205                 Reference.reachabilityFence(payment_id);
1206                 Reference.reachabilityFence(payment_hash);
1207                 Reference.reachabilityFence(path);
1208                 Reference.reachabilityFence(short_channel_id);
1209                 if (ret >= 0 && ret <= 4096) { return null; }
1210                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1211                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1212                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
1213                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
1214                 return ret_hu_conv;
1215         }
1216
1217         /**
1218          * Utility method to constructs a new PendingHTLCsForwardable-variant Event
1219          */
1220         public static Event pending_htlcs_forwardable(long time_forwardable) {
1221                 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
1222                 Reference.reachabilityFence(time_forwardable);
1223                 if (ret >= 0 && ret <= 4096) { return null; }
1224                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1225                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1226                 return ret_hu_conv;
1227         }
1228
1229         /**
1230          * Utility method to constructs a new HTLCIntercepted-variant Event
1231          */
1232         public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
1233                 long ret = bindings.Event_htlcintercepted(InternalUtils.check_arr_len(intercept_id, 32), requested_next_hop_scid, InternalUtils.check_arr_len(payment_hash, 32), inbound_amount_msat, expected_outbound_amount_msat);
1234                 Reference.reachabilityFence(intercept_id);
1235                 Reference.reachabilityFence(requested_next_hop_scid);
1236                 Reference.reachabilityFence(payment_hash);
1237                 Reference.reachabilityFence(inbound_amount_msat);
1238                 Reference.reachabilityFence(expected_outbound_amount_msat);
1239                 if (ret >= 0 && ret <= 4096) { return null; }
1240                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1241                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1242                 return ret_hu_conv;
1243         }
1244
1245         /**
1246          * Utility method to constructs a new SpendableOutputs-variant Event
1247          */
1248         public static Event spendable_outputs(SpendableOutputDescriptor[] outputs) {
1249                 long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null);
1250                 Reference.reachabilityFence(outputs);
1251                 if (ret >= 0 && ret <= 4096) { return null; }
1252                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1253                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1254                 for (SpendableOutputDescriptor outputs_conv_27: outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outputs_conv_27); }; };
1255                 return ret_hu_conv;
1256         }
1257
1258         /**
1259          * Utility method to constructs a new PaymentForwarded-variant Event
1260          */
1261         public static Event payment_forwarded(byte[] prev_channel_id, byte[] next_channel_id, org.ldk.structs.Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) {
1262                 long ret = bindings.Event_payment_forwarded(InternalUtils.check_arr_len(prev_channel_id, 32), InternalUtils.check_arr_len(next_channel_id, 32), fee_earned_msat.ptr, claim_from_onchain_tx, outbound_amount_forwarded_msat.ptr);
1263                 Reference.reachabilityFence(prev_channel_id);
1264                 Reference.reachabilityFence(next_channel_id);
1265                 Reference.reachabilityFence(fee_earned_msat);
1266                 Reference.reachabilityFence(claim_from_onchain_tx);
1267                 Reference.reachabilityFence(outbound_amount_forwarded_msat);
1268                 if (ret >= 0 && ret <= 4096) { return null; }
1269                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1270                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1271                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_earned_msat); };
1272                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_amount_forwarded_msat); };
1273                 return ret_hu_conv;
1274         }
1275
1276         /**
1277          * Utility method to constructs a new ChannelPending-variant Event
1278          */
1279         public static Event channel_pending(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo) {
1280                 long ret = bindings.Event_channel_pending(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), InternalUtils.check_arr_len(former_temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_txo == null ? 0 : funding_txo.ptr);
1281                 Reference.reachabilityFence(channel_id);
1282                 Reference.reachabilityFence(user_channel_id);
1283                 Reference.reachabilityFence(former_temporary_channel_id);
1284                 Reference.reachabilityFence(counterparty_node_id);
1285                 Reference.reachabilityFence(funding_txo);
1286                 if (ret >= 0 && ret <= 4096) { return null; }
1287                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1288                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1289                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo); };
1290                 return ret_hu_conv;
1291         }
1292
1293         /**
1294          * Utility method to constructs a new ChannelReady-variant Event
1295          */
1296         public static Event channel_ready(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] counterparty_node_id, org.ldk.structs.ChannelTypeFeatures channel_type) {
1297                 long ret = bindings.Event_channel_ready(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_type == null ? 0 : channel_type.ptr);
1298                 Reference.reachabilityFence(channel_id);
1299                 Reference.reachabilityFence(user_channel_id);
1300                 Reference.reachabilityFence(counterparty_node_id);
1301                 Reference.reachabilityFence(channel_type);
1302                 if (ret >= 0 && ret <= 4096) { return null; }
1303                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1304                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1305                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1306                 return ret_hu_conv;
1307         }
1308
1309         /**
1310          * Utility method to constructs a new ChannelClosed-variant Event
1311          */
1312         public static Event channel_closed(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason) {
1313                 long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), reason.ptr);
1314                 Reference.reachabilityFence(channel_id);
1315                 Reference.reachabilityFence(user_channel_id);
1316                 Reference.reachabilityFence(reason);
1317                 if (ret >= 0 && ret <= 4096) { return null; }
1318                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1319                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1320                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
1321                 return ret_hu_conv;
1322         }
1323
1324         /**
1325          * Utility method to constructs a new DiscardFunding-variant Event
1326          */
1327         public static Event discard_funding(byte[] channel_id, byte[] transaction) {
1328                 long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
1329                 Reference.reachabilityFence(channel_id);
1330                 Reference.reachabilityFence(transaction);
1331                 if (ret >= 0 && ret <= 4096) { return null; }
1332                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1333                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1334                 return ret_hu_conv;
1335         }
1336
1337         /**
1338          * Utility method to constructs a new OpenChannelRequest-variant Event
1339          */
1340         public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, org.ldk.structs.ChannelTypeFeatures channel_type) {
1341                 long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat, channel_type == null ? 0 : channel_type.ptr);
1342                 Reference.reachabilityFence(temporary_channel_id);
1343                 Reference.reachabilityFence(counterparty_node_id);
1344                 Reference.reachabilityFence(funding_satoshis);
1345                 Reference.reachabilityFence(push_msat);
1346                 Reference.reachabilityFence(channel_type);
1347                 if (ret >= 0 && ret <= 4096) { return null; }
1348                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1349                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1350                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
1351                 return ret_hu_conv;
1352         }
1353
1354         /**
1355          * Utility method to constructs a new HTLCHandlingFailed-variant Event
1356          */
1357         public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
1358                 long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
1359                 Reference.reachabilityFence(prev_channel_id);
1360                 Reference.reachabilityFence(failed_next_destination);
1361                 if (ret >= 0 && ret <= 4096) { return null; }
1362                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1363                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1364                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failed_next_destination); };
1365                 return ret_hu_conv;
1366         }
1367
1368         /**
1369          * Utility method to constructs a new BumpTransaction-variant Event
1370          */
1371         public static Event bump_transaction(org.ldk.structs.BumpTransactionEvent a) {
1372                 long ret = bindings.Event_bump_transaction(a.ptr);
1373                 Reference.reachabilityFence(a);
1374                 if (ret >= 0 && ret <= 4096) { return null; }
1375                 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1376                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
1377                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
1378                 return ret_hu_conv;
1379         }
1380
1381         /**
1382          * Checks if two Events contain equal inner contents.
1383          * This ignores pointers and is_owned flags and looks at the values in fields.
1384          */
1385         public boolean eq(org.ldk.structs.Event b) {
1386                 boolean ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr);
1387                 Reference.reachabilityFence(this);
1388                 Reference.reachabilityFence(b);
1389                 return ret;
1390         }
1391
1392         @Override public boolean equals(Object o) {
1393                 if (!(o instanceof Event)) return false;
1394                 return this.eq((Event)o);
1395         }
1396         /**
1397          * Serialize the Event object into a byte array which can be read by Event_read
1398          */
1399         public byte[] write() {
1400                 byte[] ret = bindings.Event_write(this.ptr);
1401                 Reference.reachabilityFence(this);
1402                 return ret;
1403         }
1404
1405 }