Properly convert 2D arrays in from_hu_conv
[ldk-java] / src / main / java / org / ldk / structs / Result_SecretKeySecpErrorZ.java
index 7df06e5dc46f18ae28894f8d79d13f55d9bc2d9e..01744beefac7dc4a02f47dee14a73d8f25a7d633 100644 (file)
@@ -9,22 +9,35 @@ import java.util.Arrays;
 public class Result_SecretKeySecpErrorZ extends CommonBase {
        private Result_SecretKeySecpErrorZ(Object _dummy, long ptr) { super(ptr); }
        protected void finalize() throws Throwable {
-               bindings.CResult_SecretKeySecpErrorZ_free(ptr); super.finalize();
+               if (ptr != 0) { bindings.CResult_SecretKeySecpErrorZ_free(ptr); } super.finalize();
        }
 
+       static Result_SecretKeySecpErrorZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_SecretKeySecpErrorZ_result_ok(ptr)) {
+                       return new Result_SecretKeySecpErrorZ_OK(null, ptr);
+               } else {
+                       return new Result_SecretKeySecpErrorZ_Err(null, ptr);
+               }
+       }
        public static final class Result_SecretKeySecpErrorZ_OK extends Result_SecretKeySecpErrorZ {
-               public byte[] res;
+               public final byte[] res;
                private Result_SecretKeySecpErrorZ_OK(Object _dummy, long ptr) {
                        super(_dummy, ptr);
                        this.res = bindings.LDKCResult_SecretKeySecpErrorZ_get_ok(ptr);
                }
-
+               public Result_SecretKeySecpErrorZ_OK(byte[] res) {
+                       this(null, bindings.CResult_SecretKeySecpErrorZ_ok(res));
+               }
        }
+
        public static final class Result_SecretKeySecpErrorZ_Err extends Result_SecretKeySecpErrorZ {
-               public LDKSecp256k1Error err;
+               public final LDKSecp256k1Error err;
                private Result_SecretKeySecpErrorZ_Err(Object _dummy, long ptr) {
                        super(_dummy, ptr);
                        this.err = bindings.LDKCResult_SecretKeySecpErrorZ_get_err(ptr);
                }
+               public Result_SecretKeySecpErrorZ_Err(LDKSecp256k1Error err) {
+                       this(null, bindings.CResult_SecretKeySecpErrorZ_err(err));
+               }
        }
 }