[Java] Update auto-generated Java bindings to LDK 0.0.110
[ldk-java] / src / main / java / org / ldk / structs / Event.java
index edcaea73cff1b4cb14989f4726f12fc13b1685f2..7327c2a366d5dbc7a808ceea8fc335abfd3ff0a6 100644 (file)
@@ -46,6 +46,12 @@ public class Event extends CommonBase {
                if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) {
                        return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val);
                }
+               if (raw_val.getClass() == bindings.LDKEvent.ProbeSuccessful.class) {
+                       return new ProbeSuccessful(ptr, (bindings.LDKEvent.ProbeSuccessful)raw_val);
+               }
+               if (raw_val.getClass() == bindings.LDKEvent.ProbeFailed.class) {
+                       return new ProbeFailed(ptr, (bindings.LDKEvent.ProbeFailed)raw_val);
+               }
                if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
                        return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
                }
@@ -64,6 +70,9 @@ public class Event extends CommonBase {
                if (raw_val.getClass() == bindings.LDKEvent.OpenChannelRequest.class) {
                        return new OpenChannelRequest(ptr, (bindings.LDKEvent.OpenChannelRequest)raw_val);
                }
+               if (raw_val.getClass() == bindings.LDKEvent.HTLCHandlingFailed.class) {
+                       return new HTLCHandlingFailed(ptr, (bindings.LDKEvent.HTLCHandlingFailed)raw_val);
+               }
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
@@ -449,6 +458,90 @@ public class Event extends CommonBase {
                        this.retry = retry_hu_conv;
                }
        }
+       /**
+        * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
+        */
+       public final static class ProbeSuccessful extends Event {
+               /**
+                * The id returned by [`ChannelManager::send_probe`].
+                * 
+                * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+               */
+               public final byte[] payment_id;
+               /**
+                * The hash generated by [`ChannelManager::send_probe`].
+                * 
+                * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+               */
+               public final byte[] payment_hash;
+               /**
+                * The payment path that was successful.
+               */
+               public final RouteHop[] path;
+               private ProbeSuccessful(long ptr, bindings.LDKEvent.ProbeSuccessful obj) {
+                       super(null, ptr);
+                       this.payment_id = obj.payment_id;
+                       this.payment_hash = obj.payment_hash;
+                       long[] path = obj.path;
+                       int path_conv_10_len = path.length;
+                       RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
+                       for (int k = 0; k < path_conv_10_len; k++) {
+                               long path_conv_10 = path[k];
+                               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); }
+                               path_conv_10_hu_conv.ptrs_to.add(this);
+                               path_conv_10_arr[k] = path_conv_10_hu_conv;
+                       }
+                       this.path = path_conv_10_arr;
+               }
+       }
+       /**
+        * Indicates that a probe payment we sent failed at an intermediary node on the path.
+        */
+       public final static class ProbeFailed extends Event {
+               /**
+                * The id returned by [`ChannelManager::send_probe`].
+                * 
+                * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+               */
+               public final byte[] payment_id;
+               /**
+                * The hash generated by [`ChannelManager::send_probe`].
+                * 
+                * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+               */
+               public final byte[] payment_hash;
+               /**
+                * The payment path that failed.
+               */
+               public final RouteHop[] path;
+               /**
+                * The channel responsible for the failed probe.
+                * 
+                * Note that for route hints or for the first hop in a path this may be an SCID alias and
+                * may not refer to a channel in the public network graph. These aliases may also collide
+                * with channels in the public network graph.
+               */
+               public final org.ldk.structs.Option_u64Z short_channel_id;
+               private ProbeFailed(long ptr, bindings.LDKEvent.ProbeFailed obj) {
+                       super(null, ptr);
+                       this.payment_id = obj.payment_id;
+                       this.payment_hash = obj.payment_hash;
+                       long[] path = obj.path;
+                       int path_conv_10_len = path.length;
+                       RouteHop[] path_conv_10_arr = new RouteHop[path_conv_10_len];
+                       for (int k = 0; k < path_conv_10_len; k++) {
+                               long path_conv_10 = path[k];
+                               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); }
+                               path_conv_10_hu_conv.ptrs_to.add(this);
+                               path_conv_10_arr[k] = path_conv_10_hu_conv;
+                       }
+                       this.path = path_conv_10_arr;
+                       long short_channel_id = obj.short_channel_id;
+                       org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id);
+                       short_channel_id_hu_conv.ptrs_to.add(this);
+                       this.short_channel_id = short_channel_id_hu_conv;
+               }
+       }
        /**
         * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
         * a time in the future.
@@ -675,6 +768,38 @@ public class Event extends CommonBase {
                        this.channel_type = channel_type_hu_conv;
                }
        }
+       /**
+        * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
+        * forward it.
+        * 
+        * Some scenarios where this event may be sent include:
+        * Insufficient capacity in the outbound channel
+        * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
+        * When an unknown SCID is requested for forwarding a payment.
+        * Claiming an amount for an MPP payment that exceeds the HTLC total
+        * The HTLC has timed out
+        * 
+        * This event, however, does not get generated if an HTLC fails to meet the forwarding
+        * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
+        */
+       public final static class HTLCHandlingFailed extends Event {
+               /**
+                * The channel over which the HTLC was received.
+               */
+               public final byte[] prev_channel_id;
+               /**
+                * Destination of the HTLC that failed to be processed.
+               */
+               public final org.ldk.structs.HTLCDestination failed_next_destination;
+               private HTLCHandlingFailed(long ptr, bindings.LDKEvent.HTLCHandlingFailed obj) {
+                       super(null, ptr);
+                       this.prev_channel_id = obj.prev_channel_id;
+                       long failed_next_destination = obj.failed_next_destination;
+                       org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination);
+                       failed_next_destination_hu_conv.ptrs_to.add(this);
+                       this.failed_next_destination = failed_next_destination_hu_conv;
+               }
+       }
        long clone_ptr() {
                long ret = bindings.Event_clone_ptr(this.ptr);
                Reference.reachabilityFence(this);
@@ -798,6 +923,35 @@ public class Event extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Utility method to constructs a new ProbeSuccessful-variant Event
+        */
+       public static Event probe_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) {
+               long ret = bindings.Event_probe_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null);
+               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);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Utility method to constructs a new ProbeFailed-variant Event
+        */
+       public static Event probe_failed(byte[] payment_id, byte[] payment_hash, RouteHop[] path, 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 ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null, 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);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
        /**
         * Utility method to constructs a new PendingHTLCsForwardable-variant Event
         */
@@ -880,6 +1034,19 @@ public class Event extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Utility method to constructs a new HTLCHandlingFailed-variant Event
+        */
+       public static Event htlchandling_failed(byte[] prev_channel_id, 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);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
        /**
         * Serialize the Event object into a byte array which can be read by Event_read
         */