Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / MonitorEvent.java
index 2b2acb8381d37cdde18794584f3fbb87f0a0fcd1..da40b184d900a8d90979bfa5e506dd087a2eab34 100644 (file)
@@ -26,6 +26,12 @@ public class MonitorEvent extends CommonBase {
                if (raw_val.getClass() == bindings.LDKMonitorEvent.CommitmentTxConfirmed.class) {
                        return new CommitmentTxConfirmed(ptr, (bindings.LDKMonitorEvent.CommitmentTxConfirmed)raw_val);
                }
+               if (raw_val.getClass() == bindings.LDKMonitorEvent.UpdateCompleted.class) {
+                       return new UpdateCompleted(ptr, (bindings.LDKMonitorEvent.UpdateCompleted)raw_val);
+               }
+               if (raw_val.getClass() == bindings.LDKMonitorEvent.UpdateFailed.class) {
+                       return new UpdateFailed(ptr, (bindings.LDKMonitorEvent.UpdateFailed)raw_val);
+               }
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
@@ -34,7 +40,7 @@ public class MonitorEvent extends CommonBase {
                private HTLCEvent(long ptr, bindings.LDKMonitorEvent.HTLCEvent obj) {
                        super(null, ptr);
                        long htlc_event = obj.htlc_event;
-                       HTLCUpdate htlc_event_hu_conv = new HTLCUpdate(null, htlc_event);
+                       HTLCUpdate htlc_event_hu_conv = null; if (htlc_event < 0 || htlc_event > 4096) { htlc_event_hu_conv = new HTLCUpdate(null, htlc_event); }
                        htlc_event_hu_conv.ptrs_to.add(this);
                        this.htlc_event = htlc_event_hu_conv;
                }
@@ -44,17 +50,49 @@ public class MonitorEvent extends CommonBase {
                private CommitmentTxConfirmed(long ptr, bindings.LDKMonitorEvent.CommitmentTxConfirmed obj) {
                        super(null, ptr);
                        long commitment_tx_confirmed = obj.commitment_tx_confirmed;
-                       OutPoint commitment_tx_confirmed_hu_conv = new OutPoint(null, commitment_tx_confirmed);
+                       OutPoint commitment_tx_confirmed_hu_conv = null; if (commitment_tx_confirmed < 0 || commitment_tx_confirmed > 4096) { commitment_tx_confirmed_hu_conv = new OutPoint(null, commitment_tx_confirmed); }
                        commitment_tx_confirmed_hu_conv.ptrs_to.add(this);
                        this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv;
                }
        }
+       public final static class UpdateCompleted extends MonitorEvent {
+               /**
+                * The funding outpoint of the [`ChannelMonitor`] that was updated
+               */
+               public final OutPoint funding_txo;
+               /**
+                * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
+                * [`ChannelMonitor::get_latest_update_id`].
+                * 
+                * Note that this should only be set to a given update's ID if all previous updates for the
+                * same [`ChannelMonitor`] have been applied and persisted.
+               */
+               public final long monitor_update_id;
+               private UpdateCompleted(long ptr, bindings.LDKMonitorEvent.UpdateCompleted obj) {
+                       super(null, ptr);
+                       long funding_txo = obj.funding_txo;
+                       OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new OutPoint(null, funding_txo); }
+                       funding_txo_hu_conv.ptrs_to.add(this);
+                       this.funding_txo = funding_txo_hu_conv;
+                       this.monitor_update_id = obj.monitor_update_id;
+               }
+       }
+       public final static class UpdateFailed extends MonitorEvent {
+               public final OutPoint update_failed;
+               private UpdateFailed(long ptr, bindings.LDKMonitorEvent.UpdateFailed obj) {
+                       super(null, ptr);
+                       long update_failed = obj.update_failed;
+                       OutPoint update_failed_hu_conv = null; if (update_failed < 0 || update_failed > 4096) { update_failed_hu_conv = new OutPoint(null, update_failed); }
+                       update_failed_hu_conv.ptrs_to.add(this);
+                       this.update_failed = update_failed_hu_conv;
+               }
+       }
        /**
         * Creates a copy of the MonitorEvent
         */
        public MonitorEvent clone() {
                long ret = bindings.MonitorEvent_clone(this.ptr);
-               if (ret >= 0 && ret < 1024) { return null; }
+               if (ret >= 0 && ret <= 4096) { return null; }
                MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
@@ -65,7 +103,7 @@ public class MonitorEvent extends CommonBase {
         */
        public static MonitorEvent htlcevent(HTLCUpdate a) {
                long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr & ~1);
-               if (ret >= 0 && ret < 1024) { return null; }
+               if (ret >= 0 && ret <= 4096) { return null; }
                MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
@@ -76,10 +114,40 @@ public class MonitorEvent extends CommonBase {
         */
        public static MonitorEvent commitment_tx_confirmed(OutPoint a) {
                long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1);
-               if (ret >= 0 && ret < 1024) { return null; }
+               if (ret >= 0 && ret <= 4096) { return null; }
+               MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
+        */
+       public static MonitorEvent update_completed(OutPoint funding_txo, long monitor_update_id) {
+               long ret = bindings.MonitorEvent_update_completed(funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor_update_id);
+               if (ret >= 0 && ret <= 4096) { return null; }
                MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
        }
 
+       /**
+        * Utility method to constructs a new UpdateFailed-variant MonitorEvent
+        */
+       public static MonitorEvent update_failed(OutPoint a) {
+               long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr & ~1);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.MonitorEvent_write(this.ptr);
+               return ret;
+       }
+
 }