From: Matt Corallo Date: Fri, 11 Jun 2021 21:20:59 +0000 (+0000) Subject: Update auto-generated bindings with missed files and v0.0.98 tags X-Git-Tag: v0.0.98^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=46bbb80f28ce77aaca1a3ebbf79c3c768c40f25b;p=ldk-java Update auto-generated bindings with missed files and v0.0.98 tags --- diff --git a/liblightningjni_debug.so b/liblightningjni_debug.so index 6ed01c09..5807add4 100755 Binary files a/liblightningjni_debug.so and b/liblightningjni_debug.so differ diff --git a/liblightningjni_release.so b/liblightningjni_release.so index 068013b1..437f17eb 100755 Binary files a/liblightningjni_release.so and b/liblightningjni_release.so differ diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index f8840495..1eb28ec3 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -25,7 +25,7 @@ public class bindings { static native String get_lib_version_string(); public static String get_ldk_java_bindings_version() { - return "v0.0.13-26-gfb06c6a"; + return "v0.0.98"; } public static native String get_ldk_c_bindings_version(); public static native String get_ldk_version(); diff --git a/src/main/java/org/ldk/structs/PrivateRoute.java b/src/main/java/org/ldk/structs/PrivateRoute.java new file mode 100644 index 00000000..74c1bbb9 --- /dev/null +++ b/src/main/java/org/ldk/structs/PrivateRoute.java @@ -0,0 +1,66 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + + +/** + * Private routing information + * + * # Invariants + * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class PrivateRoute extends CommonBase { + PrivateRoute(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.PrivateRoute_free(ptr); } + } + + /** + * Checks if two PrivateRoutes contain equal inner contents. + * 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(PrivateRoute b) { + boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + + /** + * Creates a copy of the PrivateRoute + */ + public PrivateRoute clone() { + long ret = bindings.PrivateRoute_clone(this.ptr); + PrivateRoute ret_hu_conv = new PrivateRoute(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Creates a new (partial) route from a list of hops + */ + public static Result_PrivateRouteCreationErrorZ of(RouteHint hops) { + long ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(hops); + return ret_hu_conv; + } + + /** + * Returns the underlying list of hops + */ + public RouteHint into_inner() { + long ret = bindings.PrivateRoute_into_inner(this.ptr); + RouteHint ret_hu_conv = new RouteHint(null, ret); + ret_hu_conv.ptrs_to.add(this); + this.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PrivateRouteCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_PrivateRouteCreationErrorZ.java new file mode 100644 index 00000000..c6d50d9d --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PrivateRouteCreationErrorZ.java @@ -0,0 +1,69 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +public class Result_PrivateRouteCreationErrorZ extends CommonBase { + private Result_PrivateRouteCreationErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PrivateRouteCreationErrorZ_free(ptr); } super.finalize(); + } + + static Result_PrivateRouteCreationErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PrivateRouteCreationErrorZ_result_ok(ptr)) { + return new Result_PrivateRouteCreationErrorZ_OK(null, ptr); + } else { + return new Result_PrivateRouteCreationErrorZ_Err(null, ptr); + } + } + public static final class Result_PrivateRouteCreationErrorZ_OK extends Result_PrivateRouteCreationErrorZ { + public final PrivateRoute res; + private Result_PrivateRouteCreationErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_PrivateRouteCreationErrorZ_get_ok(ptr); + PrivateRoute res_hu_conv = new PrivateRoute(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PrivateRouteCreationErrorZ_Err extends Result_PrivateRouteCreationErrorZ { + public final CreationError err; + private Result_PrivateRouteCreationErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_PrivateRouteCreationErrorZ_get_err(ptr); + } + } + + /** + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + */ + public static Result_PrivateRouteCreationErrorZ ok(PrivateRoute o) { + long ret = bindings.CResult_PrivateRouteCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(o); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + */ + public static Result_PrivateRouteCreationErrorZ err(CreationError e) { + long ret = bindings.CResult_PrivateRouteCreationErrorZ_err(e); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PrivateRouteCreationErrorZ clone() { + long ret = bindings.CResult_PrivateRouteCreationErrorZ_clone(this.ptr); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index f6825d0f..3dc78c9d 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -130,7 +130,7 @@ static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) { } JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) { - return str_ref_to_java(env, "v0.0.13-26-gfb06c6a", strlen("v0.0.13-26-gfb06c6a")); + return str_ref_to_java(env, "v0.0.98", strlen("v0.0.98")); } JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) { return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version())); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index 9811c87a..768139ee 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -128,7 +128,7 @@ static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) { } JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) { - return str_ref_to_java(env, "v0.0.13-26-gfb06c6a", strlen("v0.0.13-26-gfb06c6a")); + return str_ref_to_java(env, "v0.0.98", strlen("v0.0.98")); } JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) { return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version())); diff --git a/ts/structs/PrivateRoute.ts b/ts/structs/PrivateRoute.ts new file mode 100644 index 00000000..cead3cdd --- /dev/null +++ b/ts/structs/PrivateRoute.ts @@ -0,0 +1,48 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class PrivateRoute extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.PrivateRoute_free(this.ptr); + } + } + public boolean eq(PrivateRoute b) { + boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + + public PrivateRoute clone() { + number ret = bindings.PrivateRoute_clone(this.ptr); + const ret_hu_conv: PrivateRoute = new PrivateRoute(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public static Result_PrivateRouteCreationErrorZ constructor_new(RouteHint hops) { + number ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(hops); + return ret_hu_conv; + } + + public RouteHint into_inner() { + number ret = bindings.PrivateRoute_into_inner(this.ptr); + const ret_hu_conv: RouteHint = new RouteHint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_PrivateRouteCreationErrorZ.ts b/ts/structs/Result_PrivateRouteCreationErrorZ.ts new file mode 100644 index 00000000..1ec6b284 --- /dev/null +++ b/ts/structs/Result_PrivateRouteCreationErrorZ.ts @@ -0,0 +1,56 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_PrivateRouteCreationErrorZ extends CommonBase { + private Result_PrivateRouteCreationErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PrivateRouteCreationErrorZ_free(ptr); } super.finalize(); + } + + static Result_PrivateRouteCreationErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PrivateRouteCreationErrorZ_result_ok(ptr)) { + return new Result_PrivateRouteCreationErrorZ_OK(null, ptr); + } else { + return new Result_PrivateRouteCreationErrorZ_Err(null, ptr); + } + } + public static final class Result_PrivateRouteCreationErrorZ_OK extends Result_PrivateRouteCreationErrorZ { + public final PrivateRoute res; + private Result_PrivateRouteCreationErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_PrivateRouteCreationErrorZ_get_ok(ptr); + const res_hu_conv: PrivateRoute = new PrivateRoute(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PrivateRouteCreationErrorZ_Err extends Result_PrivateRouteCreationErrorZ { + public final CreationError err; + private Result_PrivateRouteCreationErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_PrivateRouteCreationErrorZ_get_err(ptr); + } + } + + public static Result_PrivateRouteCreationErrorZ constructor__ok(PrivateRoute o) { + number ret = bindings.CResult_PrivateRouteCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(o); + return ret_hu_conv; + } + + public static Result_PrivateRouteCreationErrorZ constructor__err(CreationError e) { + number ret = bindings.CResult_PrivateRouteCreationErrorZ_err(e); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_PrivateRouteCreationErrorZ _clone() { + number ret = bindings.CResult_PrivateRouteCreationErrorZ_clone(this.ptr); + Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +}