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