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_ChannelPending(ptr);
38 case 14: return new Event_ChannelReady(ptr);
39 case 15: return new Event_ChannelClosed(ptr);
40 case 16: return new Event_DiscardFunding(ptr);
41 case 17: return new Event_OpenChannelRequest(ptr);
42 case 18: return new Event_HTLCHandlingFailed(ptr);
43 case 19: return new Event_BumpTransaction(ptr);
45 throw new ArgumentException("Impossible enum variant");
49 /** A Event of type FundingGenerationReady */
50 public class Event_FundingGenerationReady : Event {
52 * The random channel_id we picked which you'll need to pass into
53 * [`ChannelManager::funding_transaction_generated`].
55 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
57 public byte[] temporary_channel_id;
59 * The counterparty's node_id, which you'll need to pass back into
60 * [`ChannelManager::funding_transaction_generated`].
62 * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
64 public byte[] counterparty_node_id;
66 * The value, in satoshis, that the output should have.
68 public long channel_value_satoshis;
70 * The script which should be used in the transaction output.
72 public byte[] output_script;
74 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
75 * random value for an inbound channel. This may be zero for objects serialized with LDK
76 * versions prior to 0.0.113.
78 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
80 public UInt128 user_channel_id;
81 internal Event_FundingGenerationReady(long ptr) : base(null, ptr) {
82 this.temporary_channel_id = bindings.LDKEvent_FundingGenerationReady_get_temporary_channel_id(ptr);
83 this.counterparty_node_id = bindings.LDKEvent_FundingGenerationReady_get_counterparty_node_id(ptr);
84 this.channel_value_satoshis = bindings.LDKEvent_FundingGenerationReady_get_channel_value_satoshis(ptr);
85 this.output_script = bindings.LDKEvent_FundingGenerationReady_get_output_script(ptr);
86 byte[] user_channel_id = bindings.LDKEvent_FundingGenerationReady_get_user_channel_id(ptr);
87 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
88 this.user_channel_id = user_channel_id_conv;
91 /** A Event of type PaymentClaimable */
92 public class Event_PaymentClaimable : Event {
94 * The node that will receive the payment after it has been claimed.
95 * This is useful to identify payments received via [phantom nodes].
96 * This field will always be filled in when the event was generated by LDK versions
99 * [phantom nodes]: crate::sign::PhantomKeysManager
101 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
103 public byte[] receiver_node_id;
105 * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
106 * not stop you from registering duplicate payment hashes for inbound payments.
108 public byte[] payment_hash;
110 * The fields in the onion which were received with each HTLC. Only fields which were
111 * identical in each HTLC involved in the payment will be included here.
113 * Payments received on LDK versions prior to 0.0.115 will have this field unset.
115 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
117 public RecipientOnionFields onion_fields;
119 * The value, in thousandths of a satoshi, that this payment is claimable for. May be greater
120 * than the invoice amount.
122 * May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
123 * and the previous hop took an extra fee.
126 * If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
127 * field, you may lose money!
129 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
131 public long amount_msat;
133 * The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
134 * taken by our channel counterparty.
136 * Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
138 * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
140 public long counterparty_skimmed_fee_msat;
142 * Information for claiming this received payment, based on whether the purpose of the
143 * payment is to pay an invoice or to send a spontaneous payment.
145 public PaymentPurpose purpose;
147 * The `channel_id` indicating over which channel we received the payment.
149 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
151 public byte[] via_channel_id;
153 * The `user_channel_id` indicating over which channel we received the payment.
155 public Option_u128Z via_user_channel_id;
157 * The block height at which this payment will be failed back and will no longer be
158 * eligible for claiming.
160 * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
161 * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
163 * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
165 public Option_u32Z claim_deadline;
166 internal Event_PaymentClaimable(long ptr) : base(null, ptr) {
167 this.receiver_node_id = bindings.LDKEvent_PaymentClaimable_get_receiver_node_id(ptr);
168 this.payment_hash = bindings.LDKEvent_PaymentClaimable_get_payment_hash(ptr);
169 long onion_fields = bindings.LDKEvent_PaymentClaimable_get_onion_fields(ptr);
170 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); }
171 if (onion_fields_hu_conv != null) { onion_fields_hu_conv.ptrs_to.AddLast(this); };
172 this.onion_fields = onion_fields_hu_conv;
173 this.amount_msat = bindings.LDKEvent_PaymentClaimable_get_amount_msat(ptr);
174 this.counterparty_skimmed_fee_msat = bindings.LDKEvent_PaymentClaimable_get_counterparty_skimmed_fee_msat(ptr);
175 long purpose = bindings.LDKEvent_PaymentClaimable_get_purpose(ptr);
176 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
177 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.AddLast(this); };
178 this.purpose = purpose_hu_conv;
179 this.via_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_channel_id(ptr);
180 long via_user_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_user_channel_id(ptr);
181 org.ldk.structs.Option_u128Z via_user_channel_id_hu_conv = org.ldk.structs.Option_u128Z.constr_from_ptr(via_user_channel_id);
182 if (via_user_channel_id_hu_conv != null) { via_user_channel_id_hu_conv.ptrs_to.AddLast(this); };
183 this.via_user_channel_id = via_user_channel_id_hu_conv;
184 long claim_deadline = bindings.LDKEvent_PaymentClaimable_get_claim_deadline(ptr);
185 org.ldk.structs.Option_u32Z claim_deadline_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(claim_deadline);
186 if (claim_deadline_hu_conv != null) { claim_deadline_hu_conv.ptrs_to.AddLast(this); };
187 this.claim_deadline = claim_deadline_hu_conv;
190 /** A Event of type PaymentClaimed */
191 public class Event_PaymentClaimed : Event {
193 * The node that received the payment.
194 * This is useful to identify payments which were received via [phantom nodes].
195 * This field will always be filled in when the event was generated by LDK versions
198 * [phantom nodes]: crate::sign::PhantomKeysManager
200 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
202 public byte[] receiver_node_id;
204 * The payment hash of the claimed payment. Note that LDK will not stop you from
205 * registering duplicate payment hashes for inbound payments.
207 public byte[] payment_hash;
209 * The value, in thousandths of a satoshi, that this payment is for. May be greater than the
212 public long amount_msat;
214 * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
215 * spontaneous payment.
217 public PaymentPurpose purpose;
218 internal Event_PaymentClaimed(long ptr) : base(null, ptr) {
219 this.receiver_node_id = bindings.LDKEvent_PaymentClaimed_get_receiver_node_id(ptr);
220 this.payment_hash = bindings.LDKEvent_PaymentClaimed_get_payment_hash(ptr);
221 this.amount_msat = bindings.LDKEvent_PaymentClaimed_get_amount_msat(ptr);
222 long purpose = bindings.LDKEvent_PaymentClaimed_get_purpose(ptr);
223 org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose);
224 if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.AddLast(this); };
225 this.purpose = purpose_hu_conv;
228 /** A Event of type PaymentSent */
229 public class Event_PaymentSent : Event {
231 * The `payment_id` passed to [`ChannelManager::send_payment`].
233 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
235 public Option_PaymentIdZ payment_id;
237 * The preimage to the hash given to ChannelManager::send_payment.
238 * Note that this serves as a payment receipt, if you wish to have such a thing, you must
241 public byte[] payment_preimage;
243 * The hash that was given to [`ChannelManager::send_payment`].
245 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
247 public byte[] payment_hash;
249 * The total fee which was spent at intermediate hops in this payment, across all paths.
251 * Note that, like [`Route::get_total_fees`] this does *not* include any potential
252 * overpayment to the recipient node.
254 * If the recipient or an intermediate node misbehaves and gives us free money, this may
255 * overstate the amount paid, though this is unlikely.
257 * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
259 public Option_u64Z fee_paid_msat;
260 internal Event_PaymentSent(long ptr) : base(null, ptr) {
261 long payment_id = bindings.LDKEvent_PaymentSent_get_payment_id(ptr);
262 org.ldk.structs.Option_PaymentIdZ payment_id_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(payment_id);
263 if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.AddLast(this); };
264 this.payment_id = payment_id_hu_conv;
265 this.payment_preimage = bindings.LDKEvent_PaymentSent_get_payment_preimage(ptr);
266 this.payment_hash = bindings.LDKEvent_PaymentSent_get_payment_hash(ptr);
267 long fee_paid_msat = bindings.LDKEvent_PaymentSent_get_fee_paid_msat(ptr);
268 org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat);
269 if (fee_paid_msat_hu_conv != null) { fee_paid_msat_hu_conv.ptrs_to.AddLast(this); };
270 this.fee_paid_msat = fee_paid_msat_hu_conv;
273 /** A Event of type PaymentFailed */
274 public class Event_PaymentFailed : Event {
276 * The `payment_id` passed to [`ChannelManager::send_payment`].
278 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
280 public byte[] payment_id;
282 * The hash that was given to [`ChannelManager::send_payment`].
284 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
286 public byte[] payment_hash;
288 * The reason the payment failed. This is only `None` for events generated or serialized
289 * by versions prior to 0.0.115.
291 public Option_PaymentFailureReasonZ reason;
292 internal Event_PaymentFailed(long ptr) : base(null, ptr) {
293 this.payment_id = bindings.LDKEvent_PaymentFailed_get_payment_id(ptr);
294 this.payment_hash = bindings.LDKEvent_PaymentFailed_get_payment_hash(ptr);
295 long reason = bindings.LDKEvent_PaymentFailed_get_reason(ptr);
296 org.ldk.structs.Option_PaymentFailureReasonZ reason_hu_conv = org.ldk.structs.Option_PaymentFailureReasonZ.constr_from_ptr(reason);
297 if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.AddLast(this); };
298 this.reason = reason_hu_conv;
301 /** A Event of type PaymentPathSuccessful */
302 public class Event_PaymentPathSuccessful : Event {
304 * The `payment_id` passed to [`ChannelManager::send_payment`].
306 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
308 public byte[] payment_id;
310 * The hash that was given to [`ChannelManager::send_payment`].
312 * This will be `Some` for all payments which completed on LDK 0.0.104 or later.
314 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
316 public Option_PaymentHashZ payment_hash;
318 * The payment path that was successful.
320 * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
323 internal Event_PaymentPathSuccessful(long ptr) : base(null, ptr) {
324 this.payment_id = bindings.LDKEvent_PaymentPathSuccessful_get_payment_id(ptr);
325 long payment_hash = bindings.LDKEvent_PaymentPathSuccessful_get_payment_hash(ptr);
326 org.ldk.structs.Option_PaymentHashZ payment_hash_hu_conv = org.ldk.structs.Option_PaymentHashZ.constr_from_ptr(payment_hash);
327 if (payment_hash_hu_conv != null) { payment_hash_hu_conv.ptrs_to.AddLast(this); };
328 this.payment_hash = payment_hash_hu_conv;
329 long path = bindings.LDKEvent_PaymentPathSuccessful_get_path(ptr);
330 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
331 if (path_hu_conv != null) { path_hu_conv.ptrs_to.AddLast(this); };
332 this.path = path_hu_conv;
335 /** A Event of type PaymentPathFailed */
336 public class Event_PaymentPathFailed : Event {
338 * The `payment_id` passed to [`ChannelManager::send_payment`].
340 * This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
342 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
343 * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
345 public Option_PaymentIdZ payment_id;
347 * The hash that was given to [`ChannelManager::send_payment`].
349 * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
351 public byte[] payment_hash;
353 * Indicates the payment was rejected for some reason by the recipient. This implies that
354 * the payment has failed, not just the route in question. If this is not set, the payment may
355 * be retried via a different route.
357 public bool payment_failed_permanently;
359 * Extra error details based on the failure type. May contain an update that needs to be
360 * applied to the [`NetworkGraph`].
362 * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
364 public PathFailure failure;
366 * The payment path that failed.
370 * The channel responsible for the failed payment path.
372 * Note that for route hints or for the first hop in a path this may be an SCID alias and
373 * may not refer to a channel in the public network graph. These aliases may also collide
374 * with channels in the public network graph.
376 * If this is `Some`, then the corresponding channel should be avoided when the payment is
377 * retried. May be `None` for older [`Event`] serializations.
379 public Option_u64Z short_channel_id;
380 internal Event_PaymentPathFailed(long ptr) : base(null, ptr) {
381 long payment_id = bindings.LDKEvent_PaymentPathFailed_get_payment_id(ptr);
382 org.ldk.structs.Option_PaymentIdZ payment_id_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(payment_id);
383 if (payment_id_hu_conv != null) { payment_id_hu_conv.ptrs_to.AddLast(this); };
384 this.payment_id = payment_id_hu_conv;
385 this.payment_hash = bindings.LDKEvent_PaymentPathFailed_get_payment_hash(ptr);
386 this.payment_failed_permanently = bindings.LDKEvent_PaymentPathFailed_get_payment_failed_permanently(ptr);
387 long failure = bindings.LDKEvent_PaymentPathFailed_get_failure(ptr);
388 org.ldk.structs.PathFailure failure_hu_conv = org.ldk.structs.PathFailure.constr_from_ptr(failure);
389 if (failure_hu_conv != null) { failure_hu_conv.ptrs_to.AddLast(this); };
390 this.failure = failure_hu_conv;
391 long path = bindings.LDKEvent_PaymentPathFailed_get_path(ptr);
392 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
393 if (path_hu_conv != null) { path_hu_conv.ptrs_to.AddLast(this); };
394 this.path = path_hu_conv;
395 long short_channel_id = bindings.LDKEvent_PaymentPathFailed_get_short_channel_id(ptr);
396 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
397 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.AddLast(this); };
398 this.short_channel_id = short_channel_id_hu_conv;
401 /** A Event of type ProbeSuccessful */
402 public class Event_ProbeSuccessful : Event {
404 * The id returned by [`ChannelManager::send_probe`].
406 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
408 public byte[] payment_id;
410 * The hash generated by [`ChannelManager::send_probe`].
412 * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
414 public byte[] payment_hash;
416 * The payment path that was successful.
419 internal Event_ProbeSuccessful(long ptr) : base(null, ptr) {
420 this.payment_id = bindings.LDKEvent_ProbeSuccessful_get_payment_id(ptr);
421 this.payment_hash = bindings.LDKEvent_ProbeSuccessful_get_payment_hash(ptr);
422 long path = bindings.LDKEvent_ProbeSuccessful_get_path(ptr);
423 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
424 if (path_hu_conv != null) { path_hu_conv.ptrs_to.AddLast(this); };
425 this.path = path_hu_conv;
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.
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 org.ldk.structs.Path path_hu_conv = null; if (path < 0 || path > 4096) { path_hu_conv = new org.ldk.structs.Path(null, path); }
459 if (path_hu_conv != null) { path_hu_conv.ptrs_to.AddLast(this); };
460 this.path = path_hu_conv;
461 long short_channel_id = bindings.LDKEvent_ProbeFailed_get_short_channel_id(ptr);
462 org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
463 if (short_channel_id_hu_conv != null) { short_channel_id_hu_conv.ptrs_to.AddLast(this); };
464 this.short_channel_id = short_channel_id_hu_conv;
467 /** A Event of type PendingHTLCsForwardable */
468 public class Event_PendingHTLCsForwardable : Event {
470 * The minimum amount of time that should be waited prior to calling
471 * process_pending_htlc_forwards. To increase the effort required to correlate payments,
472 * you should wait a random amount of time in roughly the range (now + time_forwardable,
473 * now + 5*time_forwardable).
475 public long time_forwardable;
476 internal Event_PendingHTLCsForwardable(long ptr) : base(null, ptr) {
477 this.time_forwardable = bindings.LDKEvent_PendingHTLCsForwardable_get_time_forwardable(ptr);
480 /** A Event of type HTLCIntercepted */
481 public class Event_HTLCIntercepted : Event {
483 * An id to help LDK identify which HTLC is being forwarded or failed.
485 public byte[] intercept_id;
487 * The fake scid that was programmed as the next hop's scid, generated using
488 * [`ChannelManager::get_intercept_scid`].
490 * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
492 public long requested_next_hop_scid;
494 * The payment hash used for this HTLC.
496 public byte[] payment_hash;
498 * How many msats were received on the inbound edge of this HTLC.
500 public long inbound_amount_msat;
502 * How many msats the payer intended to route to the next node. Depending on the reason you are
503 * intercepting this payment, you might take a fee by forwarding less than this amount.
504 * Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
506 * Note that LDK will NOT check that expected fees were factored into this value. You MUST
507 * check that whatever fee you want has been included here or subtract it as required. Further,
508 * LDK will not stop you from forwarding more than you received.
510 public long expected_outbound_amount_msat;
511 internal Event_HTLCIntercepted(long ptr) : base(null, ptr) {
512 this.intercept_id = bindings.LDKEvent_HTLCIntercepted_get_intercept_id(ptr);
513 this.requested_next_hop_scid = bindings.LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(ptr);
514 this.payment_hash = bindings.LDKEvent_HTLCIntercepted_get_payment_hash(ptr);
515 this.inbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_inbound_amount_msat(ptr);
516 this.expected_outbound_amount_msat = bindings.LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(ptr);
519 /** A Event of type SpendableOutputs */
520 public class Event_SpendableOutputs : Event {
522 * The outputs which you should store as spendable by you.
524 public SpendableOutputDescriptor[] outputs;
525 internal Event_SpendableOutputs(long ptr) : base(null, ptr) {
526 long[] outputs = bindings.LDKEvent_SpendableOutputs_get_outputs(ptr);
527 int outputs_conv_27_len = outputs.Length;
528 SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len];
529 for (int b = 0; b < outputs_conv_27_len; b++) {
530 long outputs_conv_27 = outputs[b];
531 org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27);
532 if (outputs_conv_27_hu_conv != null) { outputs_conv_27_hu_conv.ptrs_to.AddLast(this); };
533 outputs_conv_27_arr[b] = outputs_conv_27_hu_conv;
535 this.outputs = outputs_conv_27_arr;
538 /** A Event of type PaymentForwarded */
539 public class Event_PaymentForwarded : Event {
541 * The incoming channel between the previous node and us. This is only `None` for events
542 * generated or serialized by versions prior to 0.0.107.
544 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
546 public byte[] prev_channel_id;
548 * The outgoing channel between the next node and us. This is only `None` for events
549 * generated or serialized by versions prior to 0.0.107.
551 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
553 public byte[] next_channel_id;
555 * The fee, in milli-satoshis, which was earned as a result of the payment.
557 * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
558 * was pending, the amount the next hop claimed will have been rounded down to the nearest
559 * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
560 * claimed the full value in millisatoshis from the source. In this case,
561 * `claim_from_onchain_tx` will be set.
563 * If the channel which sent us the payment has been force-closed, we will claim the funds
564 * via an on-chain transaction. In that case we do not yet know the on-chain transaction
565 * fees which we will spend and will instead set this to `None`. It is possible duplicate
566 * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
569 public Option_u64Z fee_earned_msat;
571 * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
574 public bool claim_from_onchain_tx;
576 * The final amount forwarded, in milli-satoshis, after the fee is deducted.
578 * The caveat described above the `fee_earned_msat` field applies here as well.
580 public Option_u64Z outbound_amount_forwarded_msat;
581 internal Event_PaymentForwarded(long ptr) : base(null, ptr) {
582 this.prev_channel_id = bindings.LDKEvent_PaymentForwarded_get_prev_channel_id(ptr);
583 this.next_channel_id = bindings.LDKEvent_PaymentForwarded_get_next_channel_id(ptr);
584 long fee_earned_msat = bindings.LDKEvent_PaymentForwarded_get_fee_earned_msat(ptr);
585 org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat);
586 if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.AddLast(this); };
587 this.fee_earned_msat = fee_earned_msat_hu_conv;
588 this.claim_from_onchain_tx = bindings.LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(ptr);
589 long outbound_amount_forwarded_msat = bindings.LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(ptr);
590 org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat);
591 if (outbound_amount_forwarded_msat_hu_conv != null) { outbound_amount_forwarded_msat_hu_conv.ptrs_to.AddLast(this); };
592 this.outbound_amount_forwarded_msat = outbound_amount_forwarded_msat_hu_conv;
595 /** A Event of type ChannelPending */
596 public class Event_ChannelPending : Event {
598 * The `channel_id` of the channel that is pending confirmation.
600 public byte[] channel_id;
602 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
603 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
604 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
605 * `user_channel_id` will be randomized for an inbound channel.
607 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
608 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
609 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
611 public UInt128 user_channel_id;
613 * The `temporary_channel_id` this channel used to be known by during channel establishment.
615 * Will be `None` for channels created prior to LDK version 0.0.115.
617 * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
619 public byte[] former_temporary_channel_id;
621 * The `node_id` of the channel counterparty.
623 public byte[] counterparty_node_id;
625 * The outpoint of the channel's funding transaction.
627 public OutPoint funding_txo;
628 internal Event_ChannelPending(long ptr) : base(null, ptr) {
629 this.channel_id = bindings.LDKEvent_ChannelPending_get_channel_id(ptr);
630 byte[] user_channel_id = bindings.LDKEvent_ChannelPending_get_user_channel_id(ptr);
631 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
632 this.user_channel_id = user_channel_id_conv;
633 this.former_temporary_channel_id = bindings.LDKEvent_ChannelPending_get_former_temporary_channel_id(ptr);
634 this.counterparty_node_id = bindings.LDKEvent_ChannelPending_get_counterparty_node_id(ptr);
635 long funding_txo = bindings.LDKEvent_ChannelPending_get_funding_txo(ptr);
636 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); }
637 if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.AddLast(this); };
638 this.funding_txo = funding_txo_hu_conv;
641 /** A Event of type ChannelReady */
642 public class Event_ChannelReady : Event {
644 * The `channel_id` of the channel that is ready.
646 public byte[] channel_id;
648 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
649 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
650 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
651 * `user_channel_id` will be randomized for an inbound channel.
653 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
654 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
655 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
657 public UInt128 user_channel_id;
659 * The `node_id` of the channel counterparty.
661 public byte[] counterparty_node_id;
663 * The features that this channel will operate with.
665 public ChannelTypeFeatures channel_type;
666 internal Event_ChannelReady(long ptr) : base(null, ptr) {
667 this.channel_id = bindings.LDKEvent_ChannelReady_get_channel_id(ptr);
668 byte[] user_channel_id = bindings.LDKEvent_ChannelReady_get_user_channel_id(ptr);
669 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
670 this.user_channel_id = user_channel_id_conv;
671 this.counterparty_node_id = bindings.LDKEvent_ChannelReady_get_counterparty_node_id(ptr);
672 long channel_type = bindings.LDKEvent_ChannelReady_get_channel_type(ptr);
673 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); }
674 if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.AddLast(this); };
675 this.channel_type = channel_type_hu_conv;
678 /** A Event of type ChannelClosed */
679 public class Event_ChannelClosed : Event {
681 * The `channel_id` of the channel which has been closed. Note that on-chain transactions
682 * resolving the channel are likely still awaiting confirmation.
684 public byte[] channel_id;
686 * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
687 * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
688 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
689 * `user_channel_id` will be randomized for inbound channels.
690 * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
691 * zero for objects serialized with LDK versions prior to 0.0.102.
693 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
694 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
695 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
697 public UInt128 user_channel_id;
699 * The reason the channel was closed.
701 public ClosureReason reason;
702 internal Event_ChannelClosed(long ptr) : base(null, ptr) {
703 this.channel_id = bindings.LDKEvent_ChannelClosed_get_channel_id(ptr);
704 byte[] user_channel_id = bindings.LDKEvent_ChannelClosed_get_user_channel_id(ptr);
705 org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id);
706 this.user_channel_id = user_channel_id_conv;
707 long reason = bindings.LDKEvent_ChannelClosed_get_reason(ptr);
708 org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason);
709 if (reason_hu_conv != null) { reason_hu_conv.ptrs_to.AddLast(this); };
710 this.reason = reason_hu_conv;
713 /** A Event of type DiscardFunding */
714 public class Event_DiscardFunding : Event {
716 * The channel_id of the channel which has been closed.
718 public byte[] channel_id;
720 * The full transaction received from the user
722 public byte[] transaction;
723 internal Event_DiscardFunding(long ptr) : base(null, ptr) {
724 this.channel_id = bindings.LDKEvent_DiscardFunding_get_channel_id(ptr);
725 this.transaction = bindings.LDKEvent_DiscardFunding_get_transaction(ptr);
728 /** A Event of type OpenChannelRequest */
729 public class Event_OpenChannelRequest : Event {
731 * The temporary channel ID of the channel requested to be opened.
733 * When responding to the request, the `temporary_channel_id` should be passed
734 * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
735 * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
737 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
738 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
740 public byte[] temporary_channel_id;
742 * The node_id of the counterparty requesting to open the channel.
744 * When responding to the request, the `counterparty_node_id` should be passed
745 * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
746 * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
749 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
750 * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
752 public byte[] counterparty_node_id;
754 * The channel value of the requested channel.
756 public long funding_satoshis;
758 * Our starting balance in the channel if the request is accepted, in milli-satoshi.
760 public long push_msat;
762 * The features that this channel will operate with. If you reject the channel, a
763 * well-behaved counterparty may automatically re-attempt the channel with a new set of
766 * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
767 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
770 * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
771 * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
772 * 0.0.107. Channels setting this type also need to get manually accepted via
773 * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
774 * or will be rejected otherwise.
776 * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
778 public ChannelTypeFeatures channel_type;
779 internal Event_OpenChannelRequest(long ptr) : base(null, ptr) {
780 this.temporary_channel_id = bindings.LDKEvent_OpenChannelRequest_get_temporary_channel_id(ptr);
781 this.counterparty_node_id = bindings.LDKEvent_OpenChannelRequest_get_counterparty_node_id(ptr);
782 this.funding_satoshis = bindings.LDKEvent_OpenChannelRequest_get_funding_satoshis(ptr);
783 this.push_msat = bindings.LDKEvent_OpenChannelRequest_get_push_msat(ptr);
784 long channel_type = bindings.LDKEvent_OpenChannelRequest_get_channel_type(ptr);
785 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); }
786 if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.AddLast(this); };
787 this.channel_type = channel_type_hu_conv;
790 /** A Event of type HTLCHandlingFailed */
791 public class Event_HTLCHandlingFailed : Event {
793 * The channel over which the HTLC was received.
795 public byte[] prev_channel_id;
797 * Destination of the HTLC that failed to be processed.
799 public HTLCDestination failed_next_destination;
800 internal Event_HTLCHandlingFailed(long ptr) : base(null, ptr) {
801 this.prev_channel_id = bindings.LDKEvent_HTLCHandlingFailed_get_prev_channel_id(ptr);
802 long failed_next_destination = bindings.LDKEvent_HTLCHandlingFailed_get_failed_next_destination(ptr);
803 org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
804 if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.AddLast(this); };
805 this.failed_next_destination = failed_next_destination_hu_conv;
808 /** A Event of type BumpTransaction */
809 public class Event_BumpTransaction : Event {
810 public BumpTransactionEvent bump_transaction;
811 internal Event_BumpTransaction(long ptr) : base(null, ptr) {
812 long bump_transaction = bindings.LDKEvent_BumpTransaction_get_bump_transaction(ptr);
813 org.ldk.structs.BumpTransactionEvent bump_transaction_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(bump_transaction);
814 if (bump_transaction_hu_conv != null) { bump_transaction_hu_conv.ptrs_to.AddLast(this); };
815 this.bump_transaction = bump_transaction_hu_conv;
818 internal long clone_ptr() {
819 long ret = bindings.Event_clone_ptr(this.ptr);
825 * Creates a copy of the Event
827 public Event clone() {
828 long ret = bindings.Event_clone(this.ptr);
830 if (ret >= 0 && ret <= 4096) { return null; }
831 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
832 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
837 * Utility method to constructs a new FundingGenerationReady-variant Event
839 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) {
840 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());
841 GC.KeepAlive(temporary_channel_id);
842 GC.KeepAlive(counterparty_node_id);
843 GC.KeepAlive(channel_value_satoshis);
844 GC.KeepAlive(output_script);
845 GC.KeepAlive(user_channel_id);
846 if (ret >= 0 && ret <= 4096) { return null; }
847 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
848 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
853 * Utility method to constructs a new PaymentClaimable-variant Event
855 public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, long counterparty_skimmed_fee_msat, org.ldk.structs.PaymentPurpose purpose, byte[] via_channel_id, org.ldk.structs.Option_u128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) {
856 long ret = bindings.Event_payment_claimable(InternalUtils.check_arr_len(receiver_node_id, 33), InternalUtils.check_arr_len(payment_hash, 32), onion_fields == null ? 0 : onion_fields.ptr, amount_msat, counterparty_skimmed_fee_msat, purpose.ptr, InternalUtils.check_arr_len(via_channel_id, 32), via_user_channel_id.ptr, claim_deadline.ptr);
857 GC.KeepAlive(receiver_node_id);
858 GC.KeepAlive(payment_hash);
859 GC.KeepAlive(onion_fields);
860 GC.KeepAlive(amount_msat);
861 GC.KeepAlive(counterparty_skimmed_fee_msat);
862 GC.KeepAlive(purpose);
863 GC.KeepAlive(via_channel_id);
864 GC.KeepAlive(via_user_channel_id);
865 GC.KeepAlive(claim_deadline);
866 if (ret >= 0 && ret <= 4096) { return null; }
867 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
868 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
869 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(onion_fields); };
870 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(purpose); };
871 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(via_user_channel_id); };
872 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(claim_deadline); };
877 * Utility method to constructs a new PaymentClaimed-variant Event
879 public static Event payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose) {
880 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);
881 GC.KeepAlive(receiver_node_id);
882 GC.KeepAlive(payment_hash);
883 GC.KeepAlive(amount_msat);
884 GC.KeepAlive(purpose);
885 if (ret >= 0 && ret <= 4096) { return null; }
886 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
887 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
888 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(purpose); };
893 * Utility method to constructs a new PaymentSent-variant Event
895 public static Event payment_sent(org.ldk.structs.Option_PaymentIdZ payment_id, byte[] payment_preimage, byte[] payment_hash, org.ldk.structs.Option_u64Z fee_paid_msat) {
896 long ret = bindings.Event_payment_sent(payment_id.ptr, InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
897 GC.KeepAlive(payment_id);
898 GC.KeepAlive(payment_preimage);
899 GC.KeepAlive(payment_hash);
900 GC.KeepAlive(fee_paid_msat);
901 if (ret >= 0 && ret <= 4096) { return null; }
902 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
903 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
904 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_id); };
905 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fee_paid_msat); };
910 * Utility method to constructs a new PaymentFailed-variant Event
912 public static Event payment_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Option_PaymentFailureReasonZ reason) {
913 long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), reason.ptr);
914 GC.KeepAlive(payment_id);
915 GC.KeepAlive(payment_hash);
916 GC.KeepAlive(reason);
917 if (ret >= 0 && ret <= 4096) { return null; }
918 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
919 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
920 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(reason); };
925 * Utility method to constructs a new PaymentPathSuccessful-variant Event
927 public static Event payment_path_successful(byte[] payment_id, org.ldk.structs.Option_PaymentHashZ payment_hash, org.ldk.structs.Path path) {
928 long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), payment_hash.ptr, path == null ? 0 : path.ptr);
929 GC.KeepAlive(payment_id);
930 GC.KeepAlive(payment_hash);
932 if (ret >= 0 && ret <= 4096) { return null; }
933 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
934 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
935 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_hash); };
936 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path); };
941 * Utility method to constructs a new PaymentPathFailed-variant Event
943 public static Event payment_path_failed(org.ldk.structs.Option_PaymentIdZ 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) {
944 long ret = bindings.Event_payment_path_failed(payment_id.ptr, InternalUtils.check_arr_len(payment_hash, 32), payment_failed_permanently, failure.ptr, path == null ? 0 : path.ptr, short_channel_id.ptr);
945 GC.KeepAlive(payment_id);
946 GC.KeepAlive(payment_hash);
947 GC.KeepAlive(payment_failed_permanently);
948 GC.KeepAlive(failure);
950 GC.KeepAlive(short_channel_id);
951 if (ret >= 0 && ret <= 4096) { return null; }
952 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
953 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
954 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_id); };
955 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(failure); };
956 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path); };
957 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id); };
962 * Utility method to constructs a new ProbeSuccessful-variant Event
964 public static Event probe_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) {
965 long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr);
966 GC.KeepAlive(payment_id);
967 GC.KeepAlive(payment_hash);
969 if (ret >= 0 && ret <= 4096) { return null; }
970 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
971 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
972 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path); };
977 * Utility method to constructs a new ProbeFailed-variant Event
979 public static Event probe_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
980 long ret = bindings.Event_probe_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path == null ? 0 : path.ptr, short_channel_id.ptr);
981 GC.KeepAlive(payment_id);
982 GC.KeepAlive(payment_hash);
984 GC.KeepAlive(short_channel_id);
985 if (ret >= 0 && ret <= 4096) { return null; }
986 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
987 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
988 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path); };
989 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id); };
994 * Utility method to constructs a new PendingHTLCsForwardable-variant Event
996 public static Event pending_htlcs_forwardable(long time_forwardable) {
997 long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
998 GC.KeepAlive(time_forwardable);
999 if (ret >= 0 && ret <= 4096) { return null; }
1000 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1001 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1006 * Utility method to constructs a new HTLCIntercepted-variant Event
1008 public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
1009 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);
1010 GC.KeepAlive(intercept_id);
1011 GC.KeepAlive(requested_next_hop_scid);
1012 GC.KeepAlive(payment_hash);
1013 GC.KeepAlive(inbound_amount_msat);
1014 GC.KeepAlive(expected_outbound_amount_msat);
1015 if (ret >= 0 && ret <= 4096) { return null; }
1016 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1017 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1022 * Utility method to constructs a new SpendableOutputs-variant Event
1024 public static Event spendable_outputs(SpendableOutputDescriptor[] outputs) {
1025 long ret = bindings.Event_spendable_outputs(outputs != null ? InternalUtils.mapArray(outputs, outputs_conv_27 => outputs_conv_27.ptr) : null);
1026 GC.KeepAlive(outputs);
1027 if (ret >= 0 && ret <= 4096) { return null; }
1028 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1029 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1030 foreach (SpendableOutputDescriptor outputs_conv_27 in outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outputs_conv_27); }; };
1035 * Utility method to constructs a new PaymentForwarded-variant Event
1037 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, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) {
1038 long ret = bindings.Event_payment_forwarded(InternalUtils.check_arr_len(prev_channel_id, 32), InternalUtils.check_arr_len(next_channel_id, 32), fee_earned_msat.ptr, claim_from_onchain_tx, outbound_amount_forwarded_msat.ptr);
1039 GC.KeepAlive(prev_channel_id);
1040 GC.KeepAlive(next_channel_id);
1041 GC.KeepAlive(fee_earned_msat);
1042 GC.KeepAlive(claim_from_onchain_tx);
1043 GC.KeepAlive(outbound_amount_forwarded_msat);
1044 if (ret >= 0 && ret <= 4096) { return null; }
1045 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1046 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1047 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fee_earned_msat); };
1048 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outbound_amount_forwarded_msat); };
1053 * Utility method to constructs a new ChannelPending-variant Event
1055 public static Event channel_pending(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo) {
1056 long ret = bindings.Event_channel_pending(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), InternalUtils.check_arr_len(former_temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_txo == null ? 0 : funding_txo.ptr);
1057 GC.KeepAlive(channel_id);
1058 GC.KeepAlive(user_channel_id);
1059 GC.KeepAlive(former_temporary_channel_id);
1060 GC.KeepAlive(counterparty_node_id);
1061 GC.KeepAlive(funding_txo);
1062 if (ret >= 0 && ret <= 4096) { return null; }
1063 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1064 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1065 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_txo); };
1070 * Utility method to constructs a new ChannelReady-variant Event
1072 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) {
1073 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);
1074 GC.KeepAlive(channel_id);
1075 GC.KeepAlive(user_channel_id);
1076 GC.KeepAlive(counterparty_node_id);
1077 GC.KeepAlive(channel_type);
1078 if (ret >= 0 && ret <= 4096) { return null; }
1079 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1080 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1081 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type); };
1086 * Utility method to constructs a new ChannelClosed-variant Event
1088 public static Event channel_closed(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason) {
1089 long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), reason.ptr);
1090 GC.KeepAlive(channel_id);
1091 GC.KeepAlive(user_channel_id);
1092 GC.KeepAlive(reason);
1093 if (ret >= 0 && ret <= 4096) { return null; }
1094 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1095 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1096 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(reason); };
1101 * Utility method to constructs a new DiscardFunding-variant Event
1103 public static Event discard_funding(byte[] channel_id, byte[] transaction) {
1104 long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
1105 GC.KeepAlive(channel_id);
1106 GC.KeepAlive(transaction);
1107 if (ret >= 0 && ret <= 4096) { return null; }
1108 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1109 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1114 * Utility method to constructs a new OpenChannelRequest-variant Event
1116 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) {
1117 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);
1118 GC.KeepAlive(temporary_channel_id);
1119 GC.KeepAlive(counterparty_node_id);
1120 GC.KeepAlive(funding_satoshis);
1121 GC.KeepAlive(push_msat);
1122 GC.KeepAlive(channel_type);
1123 if (ret >= 0 && ret <= 4096) { return null; }
1124 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1125 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1126 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type); };
1131 * Utility method to constructs a new HTLCHandlingFailed-variant Event
1133 public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
1134 long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
1135 GC.KeepAlive(prev_channel_id);
1136 GC.KeepAlive(failed_next_destination);
1137 if (ret >= 0 && ret <= 4096) { return null; }
1138 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1139 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1140 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(failed_next_destination); };
1145 * Utility method to constructs a new BumpTransaction-variant Event
1147 public static Event bump_transaction(org.ldk.structs.BumpTransactionEvent a) {
1148 long ret = bindings.Event_bump_transaction(a.ptr);
1150 if (ret >= 0 && ret <= 4096) { return null; }
1151 org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
1152 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
1153 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(a); };
1158 * Checks if two Events contain equal inner contents.
1159 * This ignores pointers and is_owned flags and looks at the values in fields.
1161 public bool eq(org.ldk.structs.Event b) {
1162 bool ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr);
1168 public override bool Equals(object o) {
1169 if (!(o is Event)) return false;
1170 return this.eq((Event)o);
1173 * Serialize the Event object into a byte array which can be read by Event_read
1175 public byte[] write() {
1176 byte[] ret = bindings.Event_write(this.ptr);