X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FResult_SecretKeyErrorZ.java;h=f0aeae17f31afbd2ba14c71916021da2e3157cfe;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=f643ad9a4cf3865fd9de221fac3738721c331c55;hpb=1b870a3ffab1c0024411e30102bc6d198300f095;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java index f643ad9a..f0aeae17 100644 --- a/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java @@ -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; public class Result_SecretKeyErrorZ extends CommonBase { private Result_SecretKeyErrorZ(Object _dummy, long ptr) { super(ptr); } @@ -12,7 +13,7 @@ public class Result_SecretKeyErrorZ extends CommonBase { } static Result_SecretKeyErrorZ constr_from_ptr(long ptr) { - if (bindings.LDKCResult_SecretKeyErrorZ_result_ok(ptr)) { + if (bindings.CResult_SecretKeyErrorZ_is_ok(ptr)) { return new Result_SecretKeyErrorZ_OK(null, ptr); } else { return new Result_SecretKeyErrorZ_Err(null, ptr); @@ -24,19 +25,42 @@ public class Result_SecretKeyErrorZ extends CommonBase { super(_dummy, ptr); this.res = bindings.LDKCResult_SecretKeyErrorZ_get_ok(ptr); } - public Result_SecretKeyErrorZ_OK(byte[] res) { - this(null, bindings.CResult_SecretKeyErrorZ_ok(res)); - } } public static final class Result_SecretKeyErrorZ_Err extends Result_SecretKeyErrorZ { - public final LDKSecp256k1Error err; + public final Secp256k1Error err; private Result_SecretKeyErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); this.err = bindings.LDKCResult_SecretKeyErrorZ_get_err(ptr); } - public Result_SecretKeyErrorZ_Err(LDKSecp256k1Error err) { - this(null, bindings.CResult_SecretKeyErrorZ_err(err)); - } } + + /** + * Creates a new CResult_SecretKeyErrorZ in the success state. + */ + public static Result_SecretKeyErrorZ ok(byte[] o) { + long ret = bindings.CResult_SecretKeyErrorZ_ok(InternalUtils.check_arr_len(o, 32)); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_SecretKeyErrorZ in the error state. + */ + public static Result_SecretKeyErrorZ err(org.ldk.enums.Secp256k1Error e) { + long ret = bindings.CResult_SecretKeyErrorZ_err(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_SecretKeyErrorZ_is_ok(this.ptr); + return ret; + } + }