[Java] Update auto-generated bindings to 0.0.115
[ldk-java] / src / main / java / org / ldk / structs / RawInvoice.java
index e370352d91e2edf42c02c9a6d3b9b68573c59e23..002ba01bec2ddd6589f7923f8e2bad713987c527 100644 (file)
@@ -9,11 +9,11 @@ import javax.annotation.Nullable;
 
 
 /**
- * Represents an syntactically correct Invoice for a payment on the lightning network,
+ * Represents an syntactically correct [`Invoice`] for a payment on the lightning network,
  * but without the signature information.
- * De- and encoding should not lead to information loss but may lead to different hashes.
+ * Decoding and encoding should not lead to information loss but may lead to different hashes.
  * 
- * For methods without docs see the corresponding methods in `Invoice`.
+ * For methods without docs see the corresponding methods in [`Invoice`].
  */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class RawInvoice extends CommonBase {
@@ -31,18 +31,19 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_get_data(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawDataPart(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawDataPart(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
        /**
         * data part
         */
-       public void set_data(RawDataPart val) {
-               bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1);
+       public void set_data(org.ldk.structs.RawDataPart val) {
+               bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr);
                Reference.reachabilityFence(this);
                Reference.reachabilityFence(val);
+               if (this != null) { this.ptrs_to.add(val); };
        }
 
        /**
@@ -50,11 +51,11 @@ public class RawInvoice extends CommonBase {
         * This ignores pointers and is_owned flags and looks at the values in fields.
         * Two objects with NULL inner values will be considered "equal" here.
         */
-       public boolean eq(RawInvoice b) {
-               boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+       public boolean eq(org.ldk.structs.RawInvoice b) {
+               boolean ret = bindings.RawInvoice_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;
        }
 
@@ -75,16 +76,28 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_clone(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawInvoice(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawInvoice(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
        /**
-        * Calculate the hash of the encoded `RawInvoice`
+        * Generates a non-cryptographic 64-bit hash of the RawInvoice.
         */
-       public byte[] hash() {
-               byte[] ret = bindings.RawInvoice_hash(this.ptr);
+       public long hash() {
+               long ret = bindings.RawInvoice_hash(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
+       @Override public int hashCode() {
+               return (int)this.hash();
+       }
+       /**
+        * Calculate the hash of the encoded `RawInvoice` which should be signed.
+        */
+       public byte[] signable_hash() {
+               byte[] ret = bindings.RawInvoice_signable_hash(this.ptr);
                Reference.reachabilityFence(this);
                return ret;
        }
@@ -97,8 +110,8 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_payment_hash(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -110,8 +123,8 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_description(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Description(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Description(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -123,8 +136,8 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_payee_pub_key(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PayeePubKey(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PayeePubKey(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -136,8 +149,8 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_description_hash(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -149,8 +162,8 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_expiry_time(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ExpiryTime(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ExpiryTime(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -158,12 +171,12 @@ public class RawInvoice extends CommonBase {
         * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
        @Nullable
-       public MinFinalCltvExpiry min_final_cltv_expiry() {
-               long ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr);
+       public MinFinalCltvExpiryDelta min_final_cltv_expiry_delta() {
+               long ret = bindings.RawInvoice_min_final_cltv_expiry_delta(this.ptr);
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MinFinalCltvExpiry(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.MinFinalCltvExpiryDelta ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiryDelta(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -177,6 +190,15 @@ public class RawInvoice extends CommonBase {
                return ret;
        }
 
+       public Option_CVec_u8ZZ payment_metadata() {
+               long ret = bindings.RawInvoice_payment_metadata(this.ptr);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
+               return ret_hu_conv;
+       }
+
        /**
         * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
@@ -185,8 +207,8 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_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;
        }
 
@@ -197,8 +219,8 @@ public class RawInvoice 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;
@@ -208,8 +230,8 @@ public class RawInvoice extends CommonBase {
                long ret = bindings.RawInvoice_amount_pico_btc(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;
        }