Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / SpendableOutputDescriptor.java
index 5d6c5ae8519105bedb7562d456e98cba8649f0ee..236a33fe07d50fd25322a433db75599bff417dcc 100644 (file)
@@ -4,6 +4,7 @@ import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
+import javax.annotation.Nullable;
 
 
 /**
@@ -36,12 +37,18 @@ public class SpendableOutputDescriptor extends CommonBase {
        }
 
        public final static class StaticOutput extends SpendableOutputDescriptor {
+               /**
+                * The outpoint which is spendable
+               */
                public final OutPoint outpoint;
+               /**
+                * The output which is referenced by the given outpoint.
+               */
                public final TxOut output;
                private StaticOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticOutput obj) {
                        super(null, ptr);
                        long outpoint = obj.outpoint;
-                       OutPoint outpoint_hu_conv = new OutPoint(null, outpoint);
+                       OutPoint outpoint_hu_conv = null; if (outpoint < 0 || outpoint > 4096) { outpoint_hu_conv = new OutPoint(null, outpoint); }
                        outpoint_hu_conv.ptrs_to.add(this);
                        this.outpoint = outpoint_hu_conv;
                        long output = obj.output;
@@ -54,7 +61,7 @@ public class SpendableOutputDescriptor extends CommonBase {
                private DelayedPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput obj) {
                        super(null, ptr);
                        long delayed_payment_output = obj.delayed_payment_output;
-                       DelayedPaymentOutputDescriptor delayed_payment_output_hu_conv = new DelayedPaymentOutputDescriptor(null, delayed_payment_output);
+                       DelayedPaymentOutputDescriptor delayed_payment_output_hu_conv = null; if (delayed_payment_output < 0 || delayed_payment_output > 4096) { delayed_payment_output_hu_conv = new DelayedPaymentOutputDescriptor(null, delayed_payment_output); }
                        delayed_payment_output_hu_conv.ptrs_to.add(this);
                        this.delayed_payment_output = delayed_payment_output_hu_conv;
                }
@@ -64,7 +71,7 @@ public class SpendableOutputDescriptor extends CommonBase {
                private StaticPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput obj) {
                        super(null, ptr);
                        long static_payment_output = obj.static_payment_output;
-                       StaticPaymentOutputDescriptor static_payment_output_hu_conv = new StaticPaymentOutputDescriptor(null, static_payment_output);
+                       StaticPaymentOutputDescriptor static_payment_output_hu_conv = null; if (static_payment_output < 0 || static_payment_output > 4096) { static_payment_output_hu_conv = new StaticPaymentOutputDescriptor(null, static_payment_output); }
                        static_payment_output_hu_conv.ptrs_to.add(this);
                        this.static_payment_output = static_payment_output_hu_conv;
                }
@@ -74,11 +81,45 @@ public class SpendableOutputDescriptor extends CommonBase {
         */
        public SpendableOutputDescriptor clone() {
                long ret = bindings.SpendableOutputDescriptor_clone(this.ptr);
+               if (ret >= 0 && ret <= 4096) { return null; }
                SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
        }
 
+       /**
+        * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor
+        */
+       public static SpendableOutputDescriptor static_output(OutPoint outpoint, TxOut output) {
+               long ret = bindings.SpendableOutputDescriptor_static_output(outpoint == null ? 0 : outpoint.ptr & ~1, output.ptr);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor
+        */
+       public static SpendableOutputDescriptor delayed_payment_output(DelayedPaymentOutputDescriptor a) {
+               long ret = bindings.SpendableOutputDescriptor_delayed_payment_output(a == null ? 0 : a.ptr & ~1);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor
+        */
+       public static SpendableOutputDescriptor static_payment_output(StaticPaymentOutputDescriptor a) {
+               long ret = bindings.SpendableOutputDescriptor_static_payment_output(a == null ? 0 : a.ptr & ~1);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
        /**
         * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read
         */
@@ -90,8 +131,9 @@ public class SpendableOutputDescriptor extends CommonBase {
        /**
         * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write
         */
-       public static Result_SpendableOutputDescriptorDecodeErrorZ constructor_read(byte[] ser) {
+       public static Result_SpendableOutputDescriptorDecodeErrorZ read(byte[] ser) {
                long ret = bindings.SpendableOutputDescriptor_read(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
                Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }