+ /**
+ * Utility method to constructs a new PaymentFailed-variant Event
+ */
+ public static Event payment_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Option_PaymentFailureReasonZ reason) {
+ long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), reason.ptr);
+ Reference.reachabilityFence(payment_id);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(reason);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new PaymentPathSuccessful-variant Event
+ */
+ public static Event payment_path_successful(byte[] payment_id, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, org.ldk.structs.Path path) {
+ long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), payment_hash.ptr, path == null ? 0 : path.ptr);
+ Reference.reachabilityFence(payment_id);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(path);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new PaymentPathFailed-variant Event
+ */
+ public static Event payment_path_failed(org.ldk.structs.Option_ThirtyTwoBytesZ payment_id, byte[] payment_hash, boolean payment_failed_permanently, org.ldk.structs.PathFailure failure, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
+ 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);
+ Reference.reachabilityFence(payment_id);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(payment_failed_permanently);
+ Reference.reachabilityFence(failure);
+ Reference.reachabilityFence(path);
+ Reference.reachabilityFence(short_channel_id);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_id); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failure); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ProbeSuccessful-variant Event
+ */
+ public static Event probe_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) {
+ 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);
+ Reference.reachabilityFence(payment_id);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(path);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ProbeFailed-variant Event
+ */
+ public static Event probe_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) {
+ 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);
+ Reference.reachabilityFence(payment_id);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(path);
+ Reference.reachabilityFence(short_channel_id);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new PendingHTLCsForwardable-variant Event
+ */
+ public static Event pending_htlcs_forwardable(long time_forwardable) {
+ long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable);
+ Reference.reachabilityFence(time_forwardable);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new HTLCIntercepted-variant Event
+ */
+ public static Event htlcintercepted(byte[] intercept_id, long requested_next_hop_scid, byte[] payment_hash, long inbound_amount_msat, long expected_outbound_amount_msat) {
+ 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);
+ Reference.reachabilityFence(intercept_id);
+ Reference.reachabilityFence(requested_next_hop_scid);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(inbound_amount_msat);
+ Reference.reachabilityFence(expected_outbound_amount_msat);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new SpendableOutputs-variant Event
+ */
+ public static Event spendable_outputs(SpendableOutputDescriptor[] outputs, org.ldk.structs.Option_ThirtyTwoBytesZ channel_id) {
+ long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null, channel_id.ptr);
+ Reference.reachabilityFence(outputs);
+ Reference.reachabilityFence(channel_id);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ for (SpendableOutputDescriptor outputs_conv_27: outputs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outputs_conv_27); }; };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new PaymentForwarded-variant Event
+ */
+ public static Event payment_forwarded(org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id, org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id, org.ldk.structs.Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) {
+ long ret = bindings.Event_payment_forwarded(prev_channel_id.ptr, next_channel_id.ptr, fee_earned_msat.ptr, claim_from_onchain_tx, outbound_amount_forwarded_msat.ptr);
+ Reference.reachabilityFence(prev_channel_id);
+ Reference.reachabilityFence(next_channel_id);
+ Reference.reachabilityFence(fee_earned_msat);
+ Reference.reachabilityFence(claim_from_onchain_tx);
+ Reference.reachabilityFence(outbound_amount_forwarded_msat);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(prev_channel_id); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(next_channel_id); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_earned_msat); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_amount_forwarded_msat); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ChannelPending-variant Event
+ */
+ public static Event channel_pending(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo) {
+ long ret = bindings.Event_channel_pending(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), former_temporary_channel_id.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), funding_txo == null ? 0 : funding_txo.ptr);
+ Reference.reachabilityFence(channel_id);
+ Reference.reachabilityFence(user_channel_id);
+ Reference.reachabilityFence(former_temporary_channel_id);
+ Reference.reachabilityFence(counterparty_node_id);
+ Reference.reachabilityFence(funding_txo);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(former_temporary_channel_id); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ChannelReady-variant Event
+ */
+ 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) {
+ 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);
+ Reference.reachabilityFence(channel_id);
+ Reference.reachabilityFence(user_channel_id);
+ Reference.reachabilityFence(counterparty_node_id);
+ Reference.reachabilityFence(channel_type);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ChannelClosed-variant Event
+ */
+ public static Event channel_closed(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason, byte[] counterparty_node_id, org.ldk.structs.Option_u64Z channel_capacity_sats) {
+ long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id.getLEBytes(), reason.ptr, InternalUtils.check_arr_len(counterparty_node_id, 33), channel_capacity_sats.ptr);
+ Reference.reachabilityFence(channel_id);
+ Reference.reachabilityFence(user_channel_id);
+ Reference.reachabilityFence(reason);
+ Reference.reachabilityFence(counterparty_node_id);
+ Reference.reachabilityFence(channel_capacity_sats);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reason); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_capacity_sats); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new DiscardFunding-variant Event
+ */
+ public static Event discard_funding(byte[] channel_id, byte[] transaction) {
+ long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
+ Reference.reachabilityFence(channel_id);
+ Reference.reachabilityFence(transaction);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new OpenChannelRequest-variant Event
+ */
+ 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) {
+ 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);
+ Reference.reachabilityFence(temporary_channel_id);
+ Reference.reachabilityFence(counterparty_node_id);
+ Reference.reachabilityFence(funding_satoshis);
+ Reference.reachabilityFence(push_msat);
+ Reference.reachabilityFence(channel_type);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new HTLCHandlingFailed-variant Event
+ */
+ public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) {
+ long ret = bindings.Event_htlchandling_failed(InternalUtils.check_arr_len(prev_channel_id, 32), failed_next_destination.ptr);
+ Reference.reachabilityFence(prev_channel_id);
+ Reference.reachabilityFence(failed_next_destination);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(failed_next_destination); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new BumpTransaction-variant Event
+ */
+ public static Event bump_transaction(org.ldk.structs.BumpTransactionEvent a) {
+ long ret = bindings.Event_bump_transaction(a.ptr);
+ Reference.reachabilityFence(a);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret);
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+ if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
+ return ret_hu_conv;
+ }
+
+ /**
+ * Checks if two Events contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+ public boolean eq(org.ldk.structs.Event b) {
+ boolean ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(b);
+ return ret;
+ }
+
+ @Override public boolean equals(Object o) {
+ if (!(o instanceof Event)) return false;
+ return this.eq((Event)o);
+ }