[Java] Update auto-generated Java files
[ldk-java] / src / main / java / org / ldk / structs / Invoice.java
index 80a987eb146d57d241ff6d009b18241891f97da7..5bc61db4056b895b4fd35f03c5c2be39e9f545aa 100644 (file)
@@ -31,10 +31,10 @@ public class Invoice extends CommonBase {
         * Two objects with NULL inner values will be considered "equal" here.
         */
        public boolean eq(Invoice b) {
-               boolean ret = bindings.Invoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+               boolean ret = bindings.Invoice_eq(this.ptr, b == null ? 0 : b.ptr);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(b);
-               this.ptrs_to.add(b);
+               if (this != null) { this.ptrs_to.add(b); };
                return ret;
        }
 
@@ -55,11 +55,23 @@ public class Invoice extends CommonBase {
                long ret = bindings.Invoice_clone(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Invoice(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Invoice(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
+       /**
+        * Checks if two Invoices contain equal inner contents.
+        */
+       public long hash() {
+               long ret = bindings.Invoice_hash(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
+       @Override public int hashCode() {
+               return (int)this.hash();
+       }
        /**
         * Transform the `Invoice` into it's unchecked version
         */
@@ -67,9 +79,9 @@ public class Invoice extends CommonBase {
                long ret = bindings.Invoice_into_signed_raw(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               SignedRawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new SignedRawInvoice(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
-               ;
+               org.ldk.structs.SignedRawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SignedRawInvoice(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+               if (this != null) { this.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -107,15 +119,16 @@ public class Invoice extends CommonBase {
         * ```
         */
        public static Result_InvoiceSemanticErrorZ from_signed(SignedRawInvoice signed_invoice) {
-               long ret = bindings.Invoice_from_signed(signed_invoice == null ? 0 : signed_invoice.ptr & ~1);
+               long ret = bindings.Invoice_from_signed(signed_invoice == null ? 0 : signed_invoice.ptr);
                Reference.reachabilityFence(signed_invoice);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(signed_invoice); };
                return ret_hu_conv;
        }
 
        /**
-        * Returns the `Invoice`'s timestamp (should equal it's creation time)
+        * Returns the `Invoice`'s timestamp (should equal its creation time)
         */
        public long timestamp() {
                long ret = bindings.Invoice_timestamp(this.ptr);
@@ -123,6 +136,15 @@ public class Invoice extends CommonBase {
                return ret;
        }
 
+       /**
+        * Returns the `Invoice`'s timestamp as a duration since the Unix epoch
+        */
+       public long duration_since_epoch() {
+               long ret = bindings.Invoice_duration_since_epoch(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Returns the hash to which we will receive the preimage on completion of the payment
         */
@@ -163,8 +185,8 @@ public class Invoice extends CommonBase {
                long ret = bindings.Invoice_features(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceFeatures(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -195,6 +217,17 @@ public class Invoice extends CommonBase {
                return ret;
        }
 
+       /**
+        * Returns whether the expiry time would pass at the given point in time.
+        * `at_time` is the timestamp as a duration since the Unix epoch.
+        */
+       public boolean would_expire(long at_time) {
+               boolean ret = bindings.Invoice_would_expire(this.ptr, at_time);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(at_time);
+               return ret;
+       }
+
        /**
         * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise
         * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`].
@@ -215,8 +248,8 @@ public class Invoice extends CommonBase {
                PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret_conv_14_len];
                for (int o = 0; o < ret_conv_14_len; o++) {
                        long ret_conv_14 = ret[o];
-                       PrivateRoute ret_conv_14_hu_conv = null; if (ret_conv_14 < 0 || ret_conv_14 > 4096) { ret_conv_14_hu_conv = new PrivateRoute(null, ret_conv_14); }
-                       ret_conv_14_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.PrivateRoute ret_conv_14_hu_conv = null; if (ret_conv_14 < 0 || ret_conv_14 > 4096) { ret_conv_14_hu_conv = new org.ldk.structs.PrivateRoute(null, ret_conv_14); }
+                       if (ret_conv_14_hu_conv != null) { ret_conv_14_hu_conv.ptrs_to.add(this); };
                        ret_conv_14_arr[o] = ret_conv_14_hu_conv;
                }
                return ret_conv_14_arr;
@@ -232,8 +265,8 @@ public class Invoice extends CommonBase {
                RouteHint[] ret_conv_11_arr = new RouteHint[ret_conv_11_len];
                for (int l = 0; l < ret_conv_11_len; l++) {
                        long ret_conv_11 = ret[l];
-                       RouteHint ret_conv_11_hu_conv = null; if (ret_conv_11 < 0 || ret_conv_11 > 4096) { ret_conv_11_hu_conv = new RouteHint(null, ret_conv_11); }
-                       ret_conv_11_hu_conv.ptrs_to.add(this);
+                       org.ldk.structs.RouteHint ret_conv_11_hu_conv = null; if (ret_conv_11 < 0 || ret_conv_11 > 4096) { ret_conv_11_hu_conv = new org.ldk.structs.RouteHint(null, ret_conv_11); }
+                       if (ret_conv_11_hu_conv != null) { ret_conv_11_hu_conv.ptrs_to.add(this); };
                        ret_conv_11_arr[l] = ret_conv_11_hu_conv;
                }
                return ret_conv_11_arr;
@@ -255,19 +288,19 @@ public class Invoice extends CommonBase {
                long ret = bindings.Invoice_amount_milli_satoshis(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
        /**
         * Read a Invoice object from a string
         */
-       public static Result_InvoiceNoneZ from_str(java.lang.String s) {
+       public static Result_InvoiceParseOrSemanticErrorZ from_str(java.lang.String s) {
                long ret = bindings.Invoice_from_str(s);
                Reference.reachabilityFence(s);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret);
+               Result_InvoiceParseOrSemanticErrorZ ret_hu_conv = Result_InvoiceParseOrSemanticErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }