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