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