6 namespace org { namespace ldk { namespace structs {
9 * An Event which you should probably take some action in response to.
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).
15 public class Event : CommonBase {
16 protected Event(object _dummy, long ptr) : base(ptr) { }
18 if (ptr != 0) { bindings.Event_free(ptr); }
21 internal static Event constr_from_ptr(long ptr) {
22 long raw_ty = bindings.LDKEvent_ty_from_ptr(ptr);
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_PaymentSent(ptr);
28 case 4: return new Event_PaymentFailed(ptr);
29 case 5: return new Event_PaymentPathSuccessful(ptr);
30 case 6: return new Event_PaymentPathFailed(ptr);
31 case 7: return new Event_ProbeSuccessful(ptr);
32 case 8: return new Event_ProbeFailed(ptr);
33 case 9: return new Event_PendingHTLCsForwardable(ptr);
34 case 10: return new Event_HTLCIntercepted(ptr);
35 case 11: return new Event_SpendableOutputs(ptr);
36 case 12: return new Event_PaymentForwarded(ptr);
37 case 13: return new Event_ChannelReady(ptr);
38 case 14: return new Event_ChannelClosed(ptr);
39 case 15: return new Event_DiscardFunding(ptr);
40 case 16: return new Event_OpenChannelRequest(ptr);
41 case 17: return new Event_HTLCHandlingFailed(ptr);
43 throw new ArgumentException("Impossible enum variant");
47 /** A Event of type FundingGenerationReady */
48 public class Event_FundingGenerationReady : Event {
50 * The random channel_id we picked which you'll need to pass into
51 * [`ChannelManager::funding_transaction_generated`].
53 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
55 public byte[] temporary_channel_id;
57 * The counterparty's node_id, which you'll need to pass back into
58 * [`ChannelManager::funding_transaction_generated`].
60 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
62 public byte[] counterparty_node_id;
64 * The value, in satoshis, that the output should have.
66 public long channel_value_satoshis;
68 * The script which should be used in the transaction output.
70 public byte[] output_script;
72 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
73 * random value for an inbound channel. This may be zero for objects serialized with LDK
74 * versions prior to 0.0.113.
76 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
78 public UInt128 user_channel_id;
79 internal Event_FundingGenerationReady(long ptr) : base(null, ptr) {
80 this.temporary_channel_id = bindings.LDKEvent_FundingGenerationReady_get_temporary_channel_id(ptr);
81 this.counterparty_node_id = bindings.LDKEvent_FundingGenerationReady_get_counterparty_node_id(ptr);
82 this.channel_value_satoshis = bindings.LDKEvent_FundingGenerationReady_get_channel_value_satoshis(ptr);
83 this.output_script = bindings.LDKEvent_FundingGenerationReady_get_output_script(ptr);
84 byte[] user_channel_id = bindings.LDKEvent_FundingGenerationReady_get_user_channel_id(ptr);
85 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
86 this.user_channel_id = user_channel_id_conv;
89 /** A Event of type PaymentClaimable */
90 public class Event_PaymentClaimable : Event {
92 * The node that will receive the payment after it has been claimed.
93 * This is useful to identify payments received via [phantom nodes].
94 * This field will always be filled in when the event was generated by LDK versions
97 * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
99 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
101 public byte[] receiver_node_id;
103 * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
104 * not stop you from registering duplicate payment hashes for inbound payments.
106 public byte[] payment_hash;
108 * The value, in thousandths of a satoshi, that this payment is for.
110 public long amount_msat;
112 * Information for claiming this received payment, based on whether the purpose of the
113 * payment is to pay an invoice or to send a spontaneous payment.
115 public PaymentPurpose purpose;
117 * The `channel_id` indicating over which channel we received the payment.
119 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
121 public byte[] via_channel_id;
123 * The `user_channel_id` indicating over which channel we received the payment.
125 public Option_u128Z via_user_channel_id;
126 internal Event_PaymentClaimable(long ptr) : base(null, ptr) {
127 this.receiver_node_id = bindings.LDKEvent_PaymentClaimable_get_receiver_node_id(ptr);
128 this.payment_hash = bindings.LDKEvent_PaymentClaimable_get_payment_hash(ptr);
129 this.amount_msat = bindings.LDKEvent_PaymentClaimable_get_amount_msat(ptr);
130 long purpose = bindings.LDKEvent_PaymentClaimable_get_purpose(ptr);
131 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
132 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.AddLast(this); };
133 this.purpose = purpose_hu_conv;
134 this.via_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_channel_id(ptr);
135 long via_user_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_user_channel_id(ptr);
136 org.ldk.structs.Option_u128Z via_user_channel_id_hu_conv = org.ldk.structs.Option_u128Z.constr_from_ptr(via_user_channel_id);
137 if (via_user_channel_id_hu_conv != null) { via_user_channel_id_hu_conv.ptrs_to.AddLast(this); };
138 this.via_user_channel_id = via_user_channel_id_hu_conv;
141 /** A Event of type PaymentClaimed */
142 public class Event_PaymentClaimed : Event {
144 * The node that received the payment.
145 * This is useful to identify payments which were received via [phantom nodes].
146 * This field will always be filled in when the event was generated by LDK versions
149 * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
151 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
153 public byte[] receiver_node_id;
155 * The payment hash of the claimed payment. Note that LDK will not stop you from
156 * registering duplicate payment hashes for inbound payments.
158 public byte[] payment_hash;
160 * The value, in thousandths of a satoshi, that this payment is for.
162 public long amount_msat;
164 * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
165 * spontaneous payment.
167 public PaymentPurpose purpose;
168 internal Event_PaymentClaimed(long ptr) : base(null, ptr) {
169 this.receiver_node_id = bindings.LDKEvent_PaymentClaimed_get_receiver_node_id(ptr);
170 this.payment_hash = bindings.LDKEvent_PaymentClaimed_get_payment_hash(ptr);
171 this.amount_msat = bindings.LDKEvent_PaymentClaimed_get_amount_msat(ptr);
172 long purpose = bindings.LDKEvent_PaymentClaimed_get_purpose(ptr);
173 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
174 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.AddLast(this); };
175 this.purpose = purpose_hu_conv;
178 /** A Event of type PaymentSent */
179 public class Event_PaymentSent : Event {
181 * The id returned by [`ChannelManager::send_payment`] and used with
182 * [`ChannelManager::retry_payment`].
184 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
185 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
187 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
189 public byte[] payment_id;
191 * The preimage to the hash given to ChannelManager::send_payment.
192 * Note that this serves as a payment receipt, if you wish to have such a thing, you must
195 public byte[] payment_preimage;
197 * The hash that was given to [`ChannelManager::send_payment`].
199 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
201 public byte[] payment_hash;
203 * The total fee which was spent at intermediate hops in this payment, across all paths.
205 * Note that, like [`Route::get_total_fees`] this does *not* include any potential
206 * overpayment to the recipient node.
208 * If the recipient or an intermediate node misbehaves and gives us free money, this may
209 * overstate the amount paid, though this is unlikely.
211 * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
213 public Option_u64Z fee_paid_msat;
214 internal Event_PaymentSent(long ptr) : base(null, ptr) {
215 this.payment_id = bindings.LDKEvent_PaymentSent_get_payment_id(ptr);
216 this.payment_preimage = bindings.LDKEvent_PaymentSent_get_payment_preimage(ptr);
217 this.payment_hash = bindings.LDKEvent_PaymentSent_get_payment_hash(ptr);
218 long fee_paid_msat = bindings.LDKEvent_PaymentSent_get_fee_paid_msat(ptr);
219 org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
220 if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.AddLast(this); };
221 this.fee_paid_msat = fee_paid_msat_hu_conv;
224 /** A Event of type PaymentFailed */
225 public class Event_PaymentFailed : Event {
227 * The id returned by [`ChannelManager::send_payment`] and used with
228 * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
230 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
231 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
232 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
234 public byte[] payment_id;
236 * The hash that was given to [`ChannelManager::send_payment`].
238 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
240 public byte[] payment_hash;
241 internal Event_PaymentFailed(long ptr) : base(null, ptr) {
242 this.payment_id = bindings.LDKEvent_PaymentFailed_get_payment_id(ptr);
243 this.payment_hash = bindings.LDKEvent_PaymentFailed_get_payment_hash(ptr);
246 /** A Event of type PaymentPathSuccessful */
247 public class Event_PaymentPathSuccessful : Event {
249 * The id returned by [`ChannelManager::send_payment`] and used with
250 * [`ChannelManager::retry_payment`].
252 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
253 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
255 public byte[] payment_id;
257 * The hash that was given to [`ChannelManager::send_payment`].
259 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
261 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
263 public byte[] payment_hash;
265 * The payment path that was successful.
267 * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
269 public RouteHop[] path;
270 internal Event_PaymentPathSuccessful(long ptr) : base(null, ptr) {
271 this.payment_id = bindings.LDKEvent_PaymentPathSuccessful_get_payment_id(ptr);
272 this.payment_hash = bindings.LDKEvent_PaymentPathSuccessful_get_payment_hash(ptr);
273 long[] path = bindings.LDKEvent_PaymentPathSuccessful_get_path(ptr);
274 int path_conv_10_len = path.Length;
275 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
276 for (int k = 0; k < path_conv_10_len; k++) {
277 long path_conv_10 = path[k];
278 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
279 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.AddLast(this); };
280 path_conv_10_arr[k] = path_conv_10_hu_conv;
282 this.path = path_conv_10_arr;
285 /** A Event of type PaymentPathFailed */
286 public class Event_PaymentPathFailed : Event {
288 * The id returned by [`ChannelManager::send_payment`] and used with
289 * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`].
291 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
292 * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment
293 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
295 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
297 public byte[] payment_id;
299 * The hash that was given to [`ChannelManager::send_payment`].
301 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
303 public byte[] payment_hash;
305 * Indicates the payment was rejected for some reason by the recipient. This implies that
306 * the payment has failed, not just the route in question. If this is not set, you may
307 * retry the payment via a different route.
309 public bool payment_failed_permanently;
311 * Any failure information conveyed via the Onion return packet by a node along the failed
314 * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
315 * account the update.
317 * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
319 public Option_NetworkUpdateZ network_update;
321 * For both single-path and multi-path payments, this is set if all paths of the payment have
322 * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
323 * larger MPP payment were still in flight when this event was generated.
325 * Note that if you are retrying individual MPP parts, using this value to determine if a
326 * payment has fully failed is race-y. Because multiple failures can happen prior to events
327 * being processed, you may retry in response to a first failure, with a second failure
328 * (with `all_paths_failed` set) still pending. Then, when the second failure is processed
329 * you will see `all_paths_failed` set even though the retry of the first failure still
330 * has an associated in-flight HTLC. See (1) for an example of such a failure.
332 * If you wish to retry individual MPP parts and learn when a payment has failed, you must
333 * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event.
335 * (1) <https://github.com/lightningdevkit/rust-lightning/issues/1164>
337 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
339 public bool all_paths_failed;
341 * The payment path that failed.
343 public RouteHop[] path;
345 * The channel responsible for the failed payment path.
347 * Note that for route hints or for the first hop in a path this may be an SCID alias and
348 * may not refer to a channel in the public network graph. These aliases may also collide
349 * with channels in the public network graph.
351 * If this is `Some`, then the corresponding channel should be avoided when the payment is
352 * retried. May be `None` for older [`Event`] serializations.
354 public Option_u64Z short_channel_id;
356 * Parameters needed to compute a new [`Route`] when retrying the failed payment path.
358 * See [`find_route`] for details.
360 * [`Route`]: crate::routing::router::Route
361 * [`find_route`]: crate::routing::router::find_route
363 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
365 public RouteParameters retry;
366 internal Event_PaymentPathFailed(long ptr) : base(null, ptr) {
367 this.payment_id = bindings.LDKEvent_PaymentPathFailed_get_payment_id(ptr);
368 this.payment_hash = bindings.LDKEvent_PaymentPathFailed_get_payment_hash(ptr);
369 this.payment_failed_permanently = bindings.LDKEvent_PaymentPathFailed_get_payment_failed_permanently(ptr);
370 long network_update = bindings.LDKEvent_PaymentPathFailed_get_network_update(ptr);
371 org.ldk.structs.Option_NetworkUpdateZ network_update_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(network_update);
372 if (network_update_hu_conv != null) { network_update_hu_conv.ptrs_to.AddLast(this); };
373 this.network_update = network_update_hu_conv;
374 this.all_paths_failed = bindings.LDKEvent_PaymentPathFailed_get_all_paths_failed(ptr);
375 long[] path = bindings.LDKEvent_PaymentPathFailed_get_path(ptr);
376 int path_conv_10_len = path.Length;
377 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
378 for (int k = 0; k < path_conv_10_len; k++) {
379 long path_conv_10 = path[k];
380 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
381 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.AddLast(this); };
382 path_conv_10_arr[k] = path_conv_10_hu_conv;
384 this.path = path_conv_10_arr;
385 long short_channel_id = bindings.LDKEvent_PaymentPathFailed_get_short_channel_id(ptr);
386 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
387 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.AddLast(this); };
388 this.short_channel_id = short_channel_id_hu_conv;
389 long retry = bindings.LDKEvent_PaymentPathFailed_get_retry(ptr);
390 org.ldk.structs.RouteParameters retry_hu_conv = null; if (retry < 0 || retry > 4096) { retry_hu_conv = new org.ldk.structs.RouteParameters(null, retry); }
391 if (retry_hu_conv != null) { retry_hu_conv.ptrs_to.AddLast(this); };
392 this.retry = retry_hu_conv;
395 /** A Event of type ProbeSuccessful */
396 public class Event_ProbeSuccessful : Event {
398 * The id returned by [`ChannelManager::send_probe`].
400 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
402 public byte[] payment_id;
404 * The hash generated by [`ChannelManager::send_probe`].
406 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
408 public byte[] payment_hash;
410 * The payment path that was successful.
412 public RouteHop[] path;
413 internal Event_ProbeSuccessful(long ptr) : base(null, ptr) {
414 this.payment_id = bindings.LDKEvent_ProbeSuccessful_get_payment_id(ptr);
415 this.payment_hash = bindings.LDKEvent_ProbeSuccessful_get_payment_hash(ptr);
416 long[] path = bindings.LDKEvent_ProbeSuccessful_get_path(ptr);
417 int path_conv_10_len = path.Length;
418 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
419 for (int k = 0; k < path_conv_10_len; k++) {
420 long path_conv_10 = path[k];
421 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
422 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.AddLast(this); };
423 path_conv_10_arr[k] = path_conv_10_hu_conv;
425 this.path = path_conv_10_arr;
428 /** A Event of type ProbeFailed */
429 public class Event_ProbeFailed : Event {
431 * The id returned by [`ChannelManager::send_probe`].
433 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
435 public byte[] payment_id;
437 * The hash generated by [`ChannelManager::send_probe`].
439 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
441 public byte[] payment_hash;
443 * The payment path that failed.
445 public RouteHop[] path;
447 * The channel responsible for the failed probe.
449 * Note that for route hints or for the first hop in a path this may be an SCID alias and
450 * may not refer to a channel in the public network graph. These aliases may also collide
451 * with channels in the public network graph.
453 public Option_u64Z short_channel_id;
454 internal Event_ProbeFailed(long ptr) : base(null, ptr) {
455 this.payment_id = bindings.LDKEvent_ProbeFailed_get_payment_id(ptr);
456 this.payment_hash = bindings.LDKEvent_ProbeFailed_get_payment_hash(ptr);
457 long[] path = bindings.LDKEvent_ProbeFailed_get_path(ptr);
458 int path_conv_10_len = path.Length;
459 RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
460 for (int k = 0; k < path_conv_10_len; k++) {
461 long path_conv_10 = path[k];
462 org.ldk.structs.RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new org.ldk.structs.RouteHop(null, path_conv_10); }
463 if (path_conv_10_hu_conv != null) { path_conv_10_hu_conv.ptrs_to.AddLast(this); };
464 path_conv_10_arr[k] = path_conv_10_hu_conv;
466 this.path = path_conv_10_arr;
467 long short_channel_id = bindings.LDKEvent_ProbeFailed_get_short_channel_id(ptr);
468 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
469 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.AddLast(this); };
470 this.short_channel_id = short_channel_id_hu_conv;
473 /** A Event of type PendingHTLCsForwardable */
474 public class Event_PendingHTLCsForwardable : Event {
476 * The minimum amount of time that should be waited prior to calling
477 * process_pending_htlc_forwards. To increase the effort required to correlate payments,
478 * you should wait a random amount of time in roughly the range (now + time_forwardable,
479 * now + 5*time_forwardable).
481 public long time_forwardable;
482 internal Event_PendingHTLCsForwardable(long ptr) : base(null, ptr) {
483 this.time_forwardable = bindings.LDKEvent_PendingHTLCsForwardable_get_time_forwardable(ptr);
486 /** A Event of type HTLCIntercepted */
487 public class Event_HTLCIntercepted : Event {
489 * An id to help LDK identify which HTLC is being forwarded or failed.
491 public byte[] intercept_id;
493 * The fake scid that was programmed as the next hop's scid, generated using
494 * [`ChannelManager::get_intercept_scid`].
496 * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
498 public long requested_next_hop_scid;
500 * The payment hash used for this HTLC.
502 public byte[] payment_hash;
504 * How many msats were received on the inbound edge of this HTLC.
506 public long inbound_amount_msat;
508 * How many msats the payer intended to route to the next node. Depending on the reason you are
509 * intercepting this payment, you might take a fee by forwarding less than this amount.
511 * Note that LDK will NOT check that expected fees were factored into this value. You MUST
512 * check that whatever fee you want has been included here or subtract it as required. Further,
513 * LDK will not stop you from forwarding more than you received.
515 public long expected_outbound_amount_msat;
516 internal Event_HTLCIntercepted(long ptr) : base(null, ptr) {
517 this.intercept_id = bindings.LDKEvent_HTLCIntercepted_get_intercept_id(ptr);
518 this.requested_next_hop_scid = bindings.LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(ptr);
519 this.payment_hash = bindings.LDKEvent_HTLCIntercepted_get_payment_hash(ptr);
520 this.inbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_inbound_amount_msat(ptr);
521 this.expected_outbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(ptr);
524 /** A Event of type SpendableOutputs */
525 public class Event_SpendableOutputs : Event {
527 * The outputs which you should store as spendable by you.
529 public SpendableOutputDescriptor[] outputs;
530 internal Event_SpendableOutputs(long ptr) : base(null, ptr) {
531 long[] outputs = bindings.LDKEvent_SpendableOutputs_get_outputs(ptr);
532 int outputs_conv_27_len = outputs.Length;
533 SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
534 for (int b = 0; b < outputs_conv_27_len; b++) {
535 long outputs_conv_27 = outputs[b];
536 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
537 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.AddLast(this); };
538 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
540 this.outputs = outputs_conv_27_arr;
543 /** A Event of type PaymentForwarded */
544 public class Event_PaymentForwarded : Event {
546 * The incoming channel between the previous node and us. This is only `None` for events
547 * generated or serialized by versions prior to 0.0.107.
549 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
551 public byte[] prev_channel_id;
553 * The outgoing channel between the next node and us. This is only `None` for events
554 * generated or serialized by versions prior to 0.0.107.
556 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
558 public byte[] next_channel_id;
560 * The fee, in milli-satoshis, which was earned as a result of the payment.
562 * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
563 * was pending, the amount the next hop claimed will have been rounded down to the nearest
564 * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
565 * claimed the full value in millisatoshis from the source. In this case,
566 * `claim_from_onchain_tx` will be set.
568 * If the channel which sent us the payment has been force-closed, we will claim the funds
569 * via an on-chain transaction. In that case we do not yet know the on-chain transaction
570 * fees which we will spend and will instead set this to `None`. It is possible duplicate
571 * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
574 public Option_u64Z fee_earned_msat;
576 * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
579 public bool claim_from_onchain_tx;
580 internal Event_PaymentForwarded(long ptr) : base(null, ptr) {
581 this.prev_channel_id = bindings.LDKEvent_PaymentForwarded_get_prev_channel_id(ptr);
582 this.next_channel_id = bindings.LDKEvent_PaymentForwarded_get_next_channel_id(ptr);
583 long fee_earned_msat = bindings.LDKEvent_PaymentForwarded_get_fee_earned_msat(ptr);
584 org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
585 if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.AddLast(this); };
586 this.fee_earned_msat = fee_earned_msat_hu_conv;
587 this.claim_from_onchain_tx = bindings.LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(ptr);
590 /** A Event of type ChannelReady */
591 public class Event_ChannelReady : Event {
593 * The channel_id of the channel that is ready.
595 public byte[] channel_id;
597 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
598 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
599 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
600 * `user_channel_id` will be randomized for an inbound channel.
602 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
603 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
604 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
606 public UInt128 user_channel_id;
608 * The node_id of the channel counterparty.
610 public byte[] counterparty_node_id;
612 * The features that this channel will operate with.
614 public ChannelTypeFeatures channel_type;
615 internal Event_ChannelReady(long ptr) : base(null, ptr) {
616 this.channel_id = bindings.LDKEvent_ChannelReady_get_channel_id(ptr);
617 byte[] user_channel_id = bindings.LDKEvent_ChannelReady_get_user_channel_id(ptr);
618 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
619 this.user_channel_id = user_channel_id_conv;
620 this.counterparty_node_id = bindings.LDKEvent_ChannelReady_get_counterparty_node_id(ptr);
621 long channel_type = bindings.LDKEvent_ChannelReady_get_channel_type(ptr);
622 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); }
623 if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.AddLast(this); };
624 this.channel_type = channel_type_hu_conv;
627 /** A Event of type ChannelClosed */
628 public class Event_ChannelClosed : Event {
630 * The channel_id of the channel which has been closed. Note that on-chain transactions
631 * resolving the channel are likely still awaiting confirmation.
633 public byte[] channel_id;
635 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
636 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
637 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
638 * `user_channel_id` will be randomized for inbound channels.
639 * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
640 * zero for objects serialized with LDK versions prior to 0.0.102.
642 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
643 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
644 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
646 public UInt128 user_channel_id;
648 * The reason the channel was closed.
650 public ClosureReason reason;
651 internal Event_ChannelClosed(long ptr) : base(null, ptr) {
652 this.channel_id = bindings.LDKEvent_ChannelClosed_get_channel_id(ptr);
653 byte[] user_channel_id = bindings.LDKEvent_ChannelClosed_get_user_channel_id(ptr);
654 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
655 this.user_channel_id = user_channel_id_conv;
656 long reason = bindings.LDKEvent_ChannelClosed_get_reason(ptr);
657 org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
658 if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.AddLast(this); };
659 this.reason = reason_hu_conv;
662 /** A Event of type DiscardFunding */
663 public class Event_DiscardFunding : Event {
665 * The channel_id of the channel which has been closed.
667 public byte[] channel_id;
669 * The full transaction received from the user
671 public byte[] transaction;
672 internal Event_DiscardFunding(long ptr) : base(null, ptr) {
673 this.channel_id = bindings.LDKEvent_DiscardFunding_get_channel_id(ptr);
674 this.transaction = bindings.LDKEvent_DiscardFunding_get_transaction(ptr);
677 /** A Event of type OpenChannelRequest */
678 public class Event_OpenChannelRequest : Event {
680 * The temporary channel ID of the channel requested to be opened.
682 * When responding to the request, the `temporary_channel_id` should be passed
683 * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
684 * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
686 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
687 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
689 public byte[] temporary_channel_id;
691 * The node_id of the counterparty requesting to open the channel.
693 * When responding to the request, the `counterparty_node_id` should be passed
694 * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
695 * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
698 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
699 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
701 public byte[] counterparty_node_id;
703 * The channel value of the requested channel.
705 public long funding_satoshis;
707 * Our starting balance in the channel if the request is accepted, in milli-satoshi.
709 public long push_msat;
711 * The features that this channel will operate with. If you reject the channel, a
712 * well-behaved counterparty may automatically re-attempt the channel with a new set of
715 * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
716 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
719 * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
720 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
721 * 0.0.107. Channels setting this type also need to get manually accepted via
722 * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
723 * or will be rejected otherwise.
725 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
727 public ChannelTypeFeatures channel_type;
728 internal Event_OpenChannelRequest(long ptr) : base(null, ptr) {
729 this.temporary_channel_id = bindings.LDKEvent_OpenChannelRequest_get_temporary_channel_id(ptr);
730 this.counterparty_node_id = bindings.LDKEvent_OpenChannelRequest_get_counterparty_node_id(ptr);
731 this.funding_satoshis = bindings.LDKEvent_OpenChannelRequest_get_funding_satoshis(ptr);
732 this.push_msat = bindings.LDKEvent_OpenChannelRequest_get_push_msat(ptr);
733 long channel_type = bindings.LDKEvent_OpenChannelRequest_get_channel_type(ptr);
734 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); }
735 if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.AddLast(this); };
736 this.channel_type = channel_type_hu_conv;
739 /** A Event of type HTLCHandlingFailed */
740 public class Event_HTLCHandlingFailed : Event {
742 * The channel over which the HTLC was received.
744 public byte[] prev_channel_id;
746 * Destination of the HTLC that failed to be processed.
748 public HTLCDestination failed_next_destination;
749 internal Event_HTLCHandlingFailed(long ptr) : base(null, ptr) {
750 this.prev_channel_id = bindings.LDKEvent_HTLCHandlingFailed_get_prev_channel_id(ptr);
751 long failed_next_destination = bindings.LDKEvent_HTLCHandlingFailed_get_failed_next_destination(ptr);
752 org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
753 if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.AddLast(this); };
754 this.failed_next_destination = failed_next_destination_hu_conv;
757 internal long clone_ptr() {
758 long ret = bindings.Event_clone_ptr(this.ptr);
764 * Creates a copy of the Event
766 public Event clone() {
767 long ret = bindings.Event_clone(this.ptr);
769 if (ret >= 0 && ret <= 4096) { return null; }
770 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
771 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
776 * Utility method to constructs a new FundingGenerationReady-variant Event
778 public static Event funding_generation_ready(byte[] temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, org.ldk.util.UInt128 user_channel_id) {
779 long ret = bindings.Event_funding_generation_ready(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_value_satoshis, output_script, user_channel_id.getLEBytes());
780 GC.KeepAlive(temporary_channel_id);
781 GC.KeepAlive(counterparty_node_id);
782 GC.KeepAlive(channel_value_satoshis);
783 GC.KeepAlive(output_script);
784 GC.KeepAlive(user_channel_id);
785 if (ret >= 0 && ret <= 4096) { return null; }
786 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
787 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
792 * Utility method to constructs a new PaymentClaimable-variant Event
794 public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose, byte[] via_channel_id, org.ldk.structs.Option_u128Z via_user_channel_id) {
795 long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr, InternalUtils.check_arr_len(via_channel_id, 32), via_user_channel_id.ptr);
796 GC.KeepAlive(receiver_node_id);
797 GC.KeepAlive(payment_hash);
798 GC.KeepAlive(amount_msat);
799 GC.KeepAlive(purpose);
800 GC.KeepAlive(via_channel_id);
801 GC.KeepAlive(via_user_channel_id);
802 if (ret >= 0 && ret <= 4096) { return null; }
803 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
804 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
809 * Utility method to constructs a new PaymentClaimed-variant Event
811 public static Event payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose) {
812 long ret = bindings.Event_payment_claimed(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), amount_msat, purpose.ptr);
813 GC.KeepAlive(receiver_node_id);
814 GC.KeepAlive(payment_hash);
815 GC.KeepAlive(amount_msat);
816 GC.KeepAlive(purpose);
817 if (ret >= 0 && ret <= 4096) { return null; }
818 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
819 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
824 * Utility method to constructs a new PaymentSent-variant Event
826 public static Event payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, org.ldk.structs.Option_u64Z fee_paid_msat) {
827 long ret = bindings.Event_payment_sent(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
828 GC.KeepAlive(payment_id);
829 GC.KeepAlive(payment_preimage);
830 GC.KeepAlive(payment_hash);
831 GC.KeepAlive(fee_paid_msat);
832 if (ret >= 0 && ret <= 4096) { return null; }
833 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
834 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
839 * Utility method to constructs a new PaymentFailed-variant Event
841 public static Event payment_failed(byte[] payment_id, byte[] payment_hash) {
842 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32));
843 GC.KeepAlive(payment_id);
844 GC.KeepAlive(payment_hash);
845 if (ret >= 0 && ret <= 4096) { return null; }
846 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
847 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
852 * Utility method to constructs a new PaymentPathSuccessful-variant Event
854 public static Event payment_path_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
855 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? InternalUtils.mapArray(path, path_conv_10 => path_conv_10 == null ? 0 : path_conv_10.ptr) : null);
856 GC.KeepAlive(payment_id);
857 GC.KeepAlive(payment_hash);
859 if (ret >= 0 && ret <= 4096) { return null; }
860 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
861 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
862 foreach (RouteHop path_conv_10 in path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path_conv_10); }; };
867 * Utility method to constructs a new PaymentPathFailed-variant Event
869 public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, bool payment_failed_permanently, org.ldk.structs.Option_NetworkUpdateZ network_update, bool all_paths_failed, RouteHop[] path, org.ldk.structs.Option_u64Z short_channel_id, org.ldk.structs.RouteParameters retry) {
870 long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, network_update.ptr, all_paths_failed, path != null ? InternalUtils.mapArray(path, path_conv_10 => path_conv_10 == null ? 0 : path_conv_10.ptr) : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr);
871 GC.KeepAlive(payment_id);
872 GC.KeepAlive(payment_hash);
873 GC.KeepAlive(payment_failed_permanently);
874 GC.KeepAlive(network_update);
875 GC.KeepAlive(all_paths_failed);
877 GC.KeepAlive(short_channel_id);
879 if (ret >= 0 && ret <= 4096) { return null; }
880 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
881 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
882 foreach (RouteHop path_conv_10 in path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path_conv_10); }; };
883 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(retry); };
888 * Utility method to constructs a new ProbeSuccessful-variant Event
890 public static Event probe_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
891 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? InternalUtils.mapArray(path, path_conv_10 => path_conv_10 == null ? 0 : path_conv_10.ptr) : null);
892 GC.KeepAlive(payment_id);
893 GC.KeepAlive(payment_hash);
895 if (ret >= 0 && ret <= 4096) { return null; }
896 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
897 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
898 foreach (RouteHop path_conv_10 in path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path_conv_10); }; };
903 * Utility method to constructs a new ProbeFailed-variant Event
905 public static Event probe_failed(byte[] payment_id, byte[] payment_hash, RouteHop[] path, org.ldk.structs.Option_u64Z short_channel_id) {
906 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? InternalUtils.mapArray(path, path_conv_10 => path_conv_10 == null ? 0 : path_conv_10.ptr) : null, short_channel_id.ptr);
907 GC.KeepAlive(payment_id);
908 GC.KeepAlive(payment_hash);
910 GC.KeepAlive(short_channel_id);
911 if (ret >= 0 && ret <= 4096) { return null; }
912 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
913 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
914 foreach (RouteHop path_conv_10 in path) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path_conv_10); }; };
919 * Utility method to constructs a new PendingHTLCsForwardable-variant Event
921 public static Event pending_htlcs_forwardable(long time_forwardable) {
922 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
923 GC.KeepAlive(time_forwardable);
924 if (ret >= 0 && ret <= 4096) { return null; }
925 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
926 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
931 * Utility method to constructs a new HTLCIntercepted-variant Event
933 public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
934 long ret = bindings.Event_htlcintercepted(InternalUtils.check_arr_len(intercept_id, 32), requested_next_hop_scid, InternalUtils.check_arr_len(payment_hash, 32), inbound_amount_msat, expected_outbound_amount_msat);
935 GC.KeepAlive(intercept_id);
936 GC.KeepAlive(requested_next_hop_scid);
937 GC.KeepAlive(payment_hash);
938 GC.KeepAlive(inbound_amount_msat);
939 GC.KeepAlive(expected_outbound_amount_msat);
940 if (ret >= 0 && ret <= 4096) { return null; }
941 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
942 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
947 * Utility method to constructs a new SpendableOutputs-variant Event
949 public static Event spendable_outputs(SpendableOutputDescriptor[] outputs) {
950 long ret = bindings.Event_spendable_outputs(outputs != null ? InternalUtils.mapArray(outputs, outputs_conv_27 => outputs_conv_27.ptr) : null);
951 GC.KeepAlive(outputs);
952 if (ret >= 0 && ret <= 4096) { return null; }
953 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
954 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
959 * Utility method to constructs a new PaymentForwarded-variant Event
961 public static Event payment_forwarded(byte[] prev_channel_id, byte[] next_channel_id, org.ldk.structs.Option_u64Z fee_earned_msat, bool claim_from_onchain_tx) {
962 long ret = bindings.Event_payment_forwarded(InternalUtils.check_arr_len(prev_channel_id, 32), InternalUtils.check_arr_len(next_channel_id, 32), fee_earned_msat.ptr, claim_from_onchain_tx);
963 GC.KeepAlive(prev_channel_id);
964 GC.KeepAlive(next_channel_id);
965 GC.KeepAlive(fee_earned_msat);
966 GC.KeepAlive(claim_from_onchain_tx);
967 if (ret >= 0 && ret <= 4096) { return null; }
968 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
969 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
974 * Utility method to constructs a new ChannelReady-variant Event
976 public static Event channel_ready(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] counterparty_node_id, org.ldk.structs.ChannelTypeFeatures channel_type) {
977 long ret = bindings.Event_channel_ready(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), InternalUtils.check_arr_len(counterparty_node_id, 33), channel_type == null ? 0 : channel_type.ptr);
978 GC.KeepAlive(channel_id);
979 GC.KeepAlive(user_channel_id);
980 GC.KeepAlive(counterparty_node_id);
981 GC.KeepAlive(channel_type);
982 if (ret >= 0 && ret <= 4096) { return null; }
983 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
984 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
985 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type); };
990 * Utility method to constructs a new ChannelClosed-variant Event
992 public static Event channel_closed(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason) {
993 long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), reason.ptr);
994 GC.KeepAlive(channel_id);
995 GC.KeepAlive(user_channel_id);
996 GC.KeepAlive(reason);
997 if (ret >= 0 && ret <= 4096) { return null; }
998 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
999 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1004 * Utility method to constructs a new DiscardFunding-variant Event
1006 public static Event discard_funding(byte[] channel_id, byte[] transaction) {
1007 long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
1008 GC.KeepAlive(channel_id);
1009 GC.KeepAlive(transaction);
1010 if (ret >= 0 && ret <= 4096) { return null; }
1011 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1012 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1017 * Utility method to constructs a new OpenChannelRequest-variant Event
1019 public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, org.ldk.structs.ChannelTypeFeatures channel_type) {
1020 long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat, channel_type == null ? 0 : channel_type.ptr);
1021 GC.KeepAlive(temporary_channel_id);
1022 GC.KeepAlive(counterparty_node_id);
1023 GC.KeepAlive(funding_satoshis);
1024 GC.KeepAlive(push_msat);
1025 GC.KeepAlive(channel_type);
1026 if (ret >= 0 && ret <= 4096) { return null; }
1027 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1028 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1029 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type); };
1034 * Utility method to constructs a new HTLCHandlingFailed-variant Event
1036 public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
1037 long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
1038 GC.KeepAlive(prev_channel_id);
1039 GC.KeepAlive(failed_next_destination);
1040 if (ret >= 0 && ret <= 4096) { return null; }
1041 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1042 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1047 * Serialize the Event object into a byte array which can be read by Event_read
1049 public byte[] write() {
1050 byte[] ret = bindings.Event_write(this.ptr);