From: Matt Corallo Date: Mon, 12 Oct 2020 20:56:10 +0000 (-0400) Subject: Create structs and traits that are (a bit) more human-friendly! X-Git-Tag: v0.0.1~112 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=3d559f3266fde7c6a21248c10d9a7145125b5e69;p=ldk-java Create structs and traits that are (a bit) more human-friendly! --- diff --git a/genbindings.py b/genbindings.py index 24d3df59..5ba69e6d 100755 --- a/genbindings.py +++ b/genbindings.py @@ -2,7 +2,7 @@ import sys, re if len(sys.argv) != 6: - print("USAGE: /path/to/lightning.h /path/to/bindings/output.java /path/to/bindings/enums/ /path/to/bindings/output.c debug") + print("USAGE: /path/to/lightning.h /path/to/bindings/output.java /path/to/bindings/ /path/to/bindings/output.c debug") print("debug should be true or false and indicates whether to track allocations and ensure we don't leak") sys.exit(1) @@ -347,8 +347,12 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_java.write("\tpublic static native ") out_c.write("JNIEXPORT ") + is_free = re_match.group(2).endswith("_free") + struct_meth = re_match.group(2).split("_")[0] + ret_info = map_type(re_match.group(1), True, ret_arr_len, False) ret_info.print_ty() + if ret_info.ret_conv is not None: ret_conv_pfx, ret_conv_sfx = ret_info.ret_conv @@ -356,19 +360,59 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_c.write(" JNICALL Java_org_ldk_impl_bindings_" + re_match.group(2).replace('_', '_1') + "(JNIEnv * _env, jclass _b") arg_names = [] + takes_self = False + args_known = not ret_info.passed_as_ptr or ret_info.rust_obj in opaque_structs or ret_info.rust_obj in trait_structs for idx, arg in enumerate(re_match.group(3).split(',')): if idx != 0: out_java.write(", ") if arg != "void": out_c.write(", ") - arg_conv_info = map_type(arg, False, None, re_match.group(2).endswith("_free")) + arg_conv_info = map_type(arg, False, None, is_free) if arg_conv_info.c_ty != "void": arg_conv_info.print_ty() arg_conv_info.print_name() + if arg_conv_info.arg_name == "this_arg": + takes_self = True + if arg_conv_info.passed_as_ptr and not arg_conv_info.rust_obj in opaque_structs: + if not arg_conv_info.rust_obj in trait_structs and not arg_conv_info.rust_obj in unitary_enums: + print(re_match.group(2) + " bad - " + arg_conv_info.rust_obj) + args_known = False arg_names.append(arg_conv_info) + out_java_struct = None + if "LDK" + struct_meth in opaque_structs and not is_free: + out_java_struct = open(sys.argv[3] + "/structs/" + struct_meth + ".java", "a") + if not args_known: + out_java_struct.write("\t// Skipped " + re_match.group(2) + "\n") + out_java_struct.close() + out_java_struct = None + else: + out_java_struct.write("\tpublic ") + meth_n = re_match.group(2)[len(struct_meth) + 1:] + if ret_info.rust_obj == "LDK" + struct_meth: + out_java_struct.write(struct_meth + "(") + elif ret_info.rust_obj in opaque_structs or ret_info.rust_obj in trait_structs: + out_java_struct.write(ret_info.rust_obj.replace("LDK", "") + " " + meth_n + "(") + else: + out_java_struct.write(ret_info.java_ty + " " + meth_n + "(") + for idx, arg in enumerate(arg_names): + if idx != 0: + if not takes_self or idx > 1: + out_java_struct.write(", ") + if arg.java_ty != "void" and arg.arg_name != "this_arg": + if arg.passed_as_ptr: + if arg.rust_obj in opaque_structs or arg.rust_obj in trait_structs: + out_java_struct.write(arg.rust_obj.replace("LDK", "") + " " + arg.arg_name) + else: + out_java_struct.write(arg.rust_obj + " " + arg.arg_name) + else: + out_java_struct.write(arg.java_ty + " " + arg.arg_name) + + out_java.write(");\n") out_c.write(") {\n") + if out_java_struct is not None: + out_java_struct.write(") {\n") for info in arg_names: if info.arg_conv is not None: @@ -397,9 +441,51 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg else: out_c.write(";") out_c.write("\n}\n\n") + if out_java_struct is not None: + out_java_struct.write("\t\t") + if ret_info.rust_obj == "LDK" + struct_meth: + out_java_struct.write("super(") + elif ret_info.java_ty != "void" and not ret_info.passed_as_ptr: + out_java_struct.write(ret_info.java_ty + " ret = ") + elif ret_info.java_ty != "void": + out_java_struct.write(ret_info.rust_obj.replace("LDK", "") + " ret = ") + if ret_info.rust_obj in opaque_structs or ret_info.rust_obj in trait_structs: + out_java_struct.write("new " + ret_info.rust_obj.replace("LDK", "") + "(null, ") + out_java_struct.write("bindings." + re_match.group(2) + "(") + for idx, info in enumerate(arg_names): + if idx != 0: + out_java_struct.write(", ") + if info.arg_name == "this_arg": + out_java_struct.write("this.ptr") + elif info.passed_as_ptr and info.rust_obj in opaque_structs: + out_java_struct.write(info.arg_name + ".ptr & ~1") + elif info.passed_as_ptr and info.rust_obj in trait_structs: + out_java_struct.write(info.arg_name + ".ptr") + else: + out_java_struct.write(info.arg_name) + out_java_struct.write(")") + if ret_info.rust_obj == "LDK" + struct_meth: + out_java_struct.write(");\n") + elif ret_info.rust_obj in opaque_structs: + out_java_struct.write(");\n") + elif ret_info.rust_obj in trait_structs: + out_java_struct.write(");\n\t\tret.ptrs_to.add(this);\n") + else: + out_java_struct.write(";\n") + + for info in arg_names: + if info.arg_name == "this_arg": + pass + elif info.passed_as_ptr and (info.rust_obj in opaque_structs or info.rust_obj in trait_structs): + out_java_struct.write("\t\tthis.ptrs_to.add(" + info.arg_name + ");\n") + + if ret_info.java_ty != "void" and ret_info.rust_obj != "LDK" + struct_meth: + out_java_struct.write("\t\treturn ret;\n") + out_java_struct.write("\t}\n\n") + out_java_struct.close() def map_unitary_enum(struct_name, field_lines): - with open(sys.argv[3] + "/" + struct_name + ".java", "w") as out_java_enum: + with open(sys.argv[3] + "/enums/" + struct_name + ".java", "w") as out_java_enum: out_java_enum.write("package org.ldk.enums;\n\n") unitary_enums.add(struct_name) out_c.write("static inline " + struct_name + " " + struct_name + "_from_java(JNIEnv *env, jclass val) {\n") @@ -529,172 +615,195 @@ with open(sys.argv[1]) as in_h, open(sys.argv[2], "w") as out_java, open(sys.arg out_c.write("\t}\n}\n") def map_trait(struct_name, field_var_lines, trait_fn_lines): - out_c.write("typedef struct " + struct_name + "_JCalls {\n") - out_c.write("\tatomic_size_t refcnt;\n") - out_c.write("\tJavaVM *vm;\n") - out_c.write("\tjweak o;\n") - for var_line in field_var_lines: - if var_line.group(1) in trait_structs: - out_c.write("\t" + var_line.group(1) + "_JCalls* " + var_line.group(2) + ";\n") - for fn_line in trait_fn_lines: - if fn_line.group(2) != "free" and fn_line.group(2) != "clone": - out_c.write("\tjmethodID " + fn_line.group(2) + "_meth;\n") - out_c.write("} " + struct_name + "_JCalls;\n") - - out_java.write("\tpublic interface " + struct_name + " {\n") - java_meths = [] - for fn_line in trait_fn_lines: - java_meth_descr = "(" - if fn_line.group(2) != "free" and fn_line.group(2) != "clone": - ret_ty_info = java_c_types(fn_line.group(1), None) - - out_java.write("\t\t " + ret_ty_info.java_ty + " " + fn_line.group(2) + "(") - is_const = fn_line.group(3) is not None - out_c.write(fn_line.group(1) + fn_line.group(2) + "_jcall(") - if is_const: - out_c.write("const void* this_arg") - else: - out_c.write("void* this_arg") - - arg_names = [] - for idx, arg in enumerate(fn_line.group(4).split(',')): - if arg == "": - continue - if idx >= 2: - out_java.write(", ") - out_c.write(", ") - arg_conv_info = map_type(arg, True, None, False) - out_c.write(arg.strip()) - out_java.write(arg_conv_info.java_ty + " " + arg_conv_info.arg_name) - arg_names.append(arg_conv_info) - java_meth_descr = java_meth_descr + arg_conv_info.java_fn_ty_arg - java_meth_descr = java_meth_descr + ")" + ret_ty_info.java_fn_ty_arg - java_meths.append(java_meth_descr) - - out_java.write(");\n") - out_c.write(") {\n") - out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") - out_c.write("\tJNIEnv *env;\n") - out_c.write("\tDO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);\n") - - for arg_info in arg_names: - if arg_info.ret_conv is not None: - out_c.write("\t" + arg_info.ret_conv[0].replace('\n', '\n\t').replace("_env", "env")); - out_c.write(arg_info.arg_name) - out_c.write(arg_info.ret_conv[1].replace('\n', '\n\t').replace("_env", "env") + "\n") - - out_c.write("\tjobject obj = (*env)->NewLocalRef(env, j_calls->o);\n\tDO_ASSERT(obj != NULL);\n") - if ret_ty_info.c_ty.endswith("Array"): - assert(ret_ty_info.c_ty == "jbyteArray") - out_c.write("\tjbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->" + fn_line.group(2) + "_meth") - elif not ret_ty_info.passed_as_ptr: - out_c.write("\treturn (*env)->Call" + ret_ty_info.java_ty.title() + "Method(env, obj, j_calls->" + fn_line.group(2) + "_meth") - else: - out_c.write("\t" + fn_line.group(1).strip() + "* ret = (" + fn_line.group(1).strip() + "*)(*env)->CallLongMethod(env, obj, j_calls->" + fn_line.group(2) + "_meth"); + with open(sys.argv[3] + "/structs/" + struct_name.replace("LDK","") + ".java", "w") as out_java_trait: + out_c.write("typedef struct " + struct_name + "_JCalls {\n") + out_c.write("\tatomic_size_t refcnt;\n") + out_c.write("\tJavaVM *vm;\n") + out_c.write("\tjweak o;\n") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_c.write("\t" + var_line.group(1) + "_JCalls* " + var_line.group(2) + ";\n") + for fn_line in trait_fn_lines: + if fn_line.group(2) != "free" and fn_line.group(2) != "clone": + out_c.write("\tjmethodID " + fn_line.group(2) + "_meth;\n") + out_c.write("} " + struct_name + "_JCalls;\n") + + out_java_trait.write("package org.ldk.structs;\n\n") + out_java_trait.write("import org.ldk.impl.bindings;\n\n") + out_java_trait.write("public class " + struct_name.replace("LDK","") + " extends CommonBase {\n") + out_java_trait.write("\t" + struct_name.replace("LDK", "") + "(Object _dummy, long ptr) { super(ptr); }\n") + out_java_trait.write("\tpublic " + struct_name.replace("LDK", "") + "(bindings." + struct_name + " arg") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_java_trait.write(", bindings." + var_line.group(1) + " " + var_line.group(2)) + out_java_trait.write(") {\n") + out_java_trait.write("\t\tsuper(bindings." + struct_name + "_new(arg") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_java_trait.write(", " + var_line.group(2)) + out_java_trait.write("));\n") + out_java_trait.write("\t\tthis.ptrs_to.add(arg);\n") + out_java_trait.write("\t}\n") + out_java_trait.write("\t@Override @SuppressWarnings(\"deprecation\")\n") + out_java_trait.write("\tprotected void finalize() throws Throwable {\n") + out_java_trait.write("\t\tbindings." + struct_name.replace("LDK","") + "_free(ptr); super.finalize();\n") + out_java_trait.write("\t}\n\n") + out_java_trait.write("}\n") + + out_java.write("\tpublic interface " + struct_name + " {\n") + java_meths = [] + for fn_line in trait_fn_lines: + java_meth_descr = "(" + if fn_line.group(2) != "free" and fn_line.group(2) != "clone": + ret_ty_info = java_c_types(fn_line.group(1), None) + + out_java.write("\t\t " + ret_ty_info.java_ty + " " + fn_line.group(2) + "(") + is_const = fn_line.group(3) is not None + out_c.write(fn_line.group(1) + fn_line.group(2) + "_jcall(") + if is_const: + out_c.write("const void* this_arg") + else: + out_c.write("void* this_arg") + + arg_names = [] + for idx, arg in enumerate(fn_line.group(4).split(',')): + if arg == "": + continue + if idx >= 2: + out_java.write(", ") + out_c.write(", ") + arg_conv_info = map_type(arg, True, None, False) + out_c.write(arg.strip()) + out_java.write(arg_conv_info.java_ty + " " + arg_conv_info.arg_name) + arg_names.append(arg_conv_info) + java_meth_descr = java_meth_descr + arg_conv_info.java_fn_ty_arg + java_meth_descr = java_meth_descr + ")" + ret_ty_info.java_fn_ty_arg + java_meths.append(java_meth_descr) - for arg_info in arg_names: - if arg_info.ret_conv is not None: - out_c.write(", " + arg_info.ret_conv_name) + out_java.write(");\n") + out_c.write(") {\n") + out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") + out_c.write("\tJNIEnv *env;\n") + out_c.write("\tDO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);\n") + + for arg_info in arg_names: + if arg_info.ret_conv is not None: + out_c.write("\t" + arg_info.ret_conv[0].replace('\n', '\n\t').replace("_env", "env")); + out_c.write(arg_info.arg_name) + out_c.write(arg_info.ret_conv[1].replace('\n', '\n\t').replace("_env", "env") + "\n") + + out_c.write("\tjobject obj = (*env)->NewLocalRef(env, j_calls->o);\n\tDO_ASSERT(obj != NULL);\n") + if ret_ty_info.c_ty.endswith("Array"): + assert(ret_ty_info.c_ty == "jbyteArray") + out_c.write("\tjbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->" + fn_line.group(2) + "_meth") + elif not ret_ty_info.passed_as_ptr: + out_c.write("\treturn (*env)->Call" + ret_ty_info.java_ty.title() + "Method(env, obj, j_calls->" + fn_line.group(2) + "_meth") else: - out_c.write(", " + arg_info.arg_name) - out_c.write(");\n"); - if ret_ty_info.c_ty.endswith("Array"): - out_c.write("\t" + ret_ty_info.rust_obj + " ret;\n") - out_c.write("\t(*env)->GetByteArrayRegion(env, jret, 0, " + ret_ty_info.arr_len + ", ret." + ret_ty_info.arr_access + ");\n") - out_c.write("\treturn ret;\n") - - if ret_ty_info.passed_as_ptr: - out_c.write("\t" + fn_line.group(1).strip() + " res = *ret;\n") - out_c.write("\tFREE(ret);\n") - out_c.write("\treturn res;\n") - out_c.write("}\n") - elif fn_line.group(2) == "free": - out_c.write("static void " + struct_name + "_JCalls_free(void* this_arg) {\n") - out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") - out_c.write("\tif (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {\n") - out_c.write("\t\tJNIEnv *env;\n") - out_c.write("\t\tDO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);\n") - out_c.write("\t\t(*env)->DeleteWeakGlobalRef(env, j_calls->o);\n") - out_c.write("\t\tFREE(j_calls);\n") - out_c.write("\t}\n}\n") - - # Write out a clone function whether we need one or not, as we use them in moving to rust - out_c.write("static void* " + struct_name + "_JCalls_clone(const void* this_arg) {\n") - out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") - out_c.write("\tatomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);\n") - for var_line in field_var_lines: - if var_line.group(1) in trait_structs: - out_c.write("\tatomic_fetch_add_explicit(&j_calls->" + var_line.group(2) + "->refcnt, 1, memory_order_release);\n") - out_c.write("\treturn (void*) this_arg;\n") - out_c.write("}\n") + out_c.write("\t" + fn_line.group(1).strip() + "* ret = (" + fn_line.group(1).strip() + "*)(*env)->CallLongMethod(env, obj, j_calls->" + fn_line.group(2) + "_meth"); - out_java.write("\t}\n") + for arg_info in arg_names: + if arg_info.ret_conv is not None: + out_c.write(", " + arg_info.ret_conv_name) + else: + out_c.write(", " + arg_info.arg_name) + out_c.write(");\n"); + if ret_ty_info.c_ty.endswith("Array"): + out_c.write("\t" + ret_ty_info.rust_obj + " ret;\n") + out_c.write("\t(*env)->GetByteArrayRegion(env, jret, 0, " + ret_ty_info.arr_len + ", ret." + ret_ty_info.arr_access + ");\n") + out_c.write("\treturn ret;\n") - out_java.write("\tpublic static native long " + struct_name + "_new(" + struct_name + " impl") - out_c.write("static inline " + struct_name + " " + struct_name + "_init (JNIEnv * env, jclass _a, jobject o") - for var_line in field_var_lines: - if var_line.group(1) in trait_structs: - out_java.write(", " + var_line.group(1) + " " + var_line.group(2)) - out_c.write(", jobject " + var_line.group(2)) - out_java.write(");\n") - out_c.write(") {\n") + if ret_ty_info.passed_as_ptr: + out_c.write("\t" + fn_line.group(1).strip() + " res = *ret;\n") + out_c.write("\tFREE(ret);\n") + out_c.write("\treturn res;\n") + out_c.write("}\n") + elif fn_line.group(2) == "free": + out_c.write("static void " + struct_name + "_JCalls_free(void* this_arg) {\n") + out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") + out_c.write("\tif (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {\n") + out_c.write("\t\tJNIEnv *env;\n") + out_c.write("\t\tDO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);\n") + out_c.write("\t\t(*env)->DeleteWeakGlobalRef(env, j_calls->o);\n") + out_c.write("\t\tFREE(j_calls);\n") + out_c.write("\t}\n}\n") - out_c.write("\tjclass c = (*env)->GetObjectClass(env, o);\n") - out_c.write("\tDO_ASSERT(c != NULL);\n") - out_c.write("\t" + struct_name + "_JCalls *calls = MALLOC(sizeof(" + struct_name + "_JCalls), \"" + struct_name + "_JCalls\");\n") - out_c.write("\tatomic_init(&calls->refcnt, 1);\n") - out_c.write("\tDO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);\n") - out_c.write("\tcalls->o = (*env)->NewWeakGlobalRef(env, o);\n") - for (fn_line, java_meth_descr) in zip(trait_fn_lines, java_meths): - if fn_line.group(2) != "free" and fn_line.group(2) != "clone": - out_c.write("\tcalls->" + fn_line.group(2) + "_meth = (*env)->GetMethodID(env, c, \"" + fn_line.group(2) + "\", \"" + java_meth_descr + "\");\n") - out_c.write("\tDO_ASSERT(calls->" + fn_line.group(2) + "_meth != NULL);\n") - out_c.write("\n\t" + struct_name + " ret = {\n") - out_c.write("\t\t.this_arg = (void*) calls,\n") - for fn_line in trait_fn_lines: - if fn_line.group(2) != "free" and fn_line.group(2) != "clone": - out_c.write("\t\t." + fn_line.group(2) + " = " + fn_line.group(2) + "_jcall,\n") - elif fn_line.group(2) == "free": - out_c.write("\t\t.free = " + struct_name + "_JCalls_free,\n") - else: - out_c.write("\t\t.clone = " + struct_name + "_JCalls_clone,\n") - for var_line in field_var_lines: - if var_line.group(1) in trait_structs: - out_c.write("\t\t." + var_line.group(2) + " = " + var_line.group(1) + "_init(env, _a, " + var_line.group(2) + "),\n") - out_c.write("\t};\n") - for var_line in field_var_lines: - if var_line.group(1) in trait_structs: - out_c.write("\tcalls->" + var_line.group(2) + " = ret." + var_line.group(2) + ".this_arg;\n") - out_c.write("\treturn ret;\n") - out_c.write("}\n") + # Write out a clone function whether we need one or not, as we use them in moving to rust + out_c.write("static void* " + struct_name + "_JCalls_clone(const void* this_arg) {\n") + out_c.write("\t" + struct_name + "_JCalls *j_calls = (" + struct_name + "_JCalls*) this_arg;\n") + out_c.write("\tatomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);\n") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_c.write("\tatomic_fetch_add_explicit(&j_calls->" + var_line.group(2) + "->refcnt, 1, memory_order_release);\n") + out_c.write("\treturn (void*) this_arg;\n") + out_c.write("}\n") - out_c.write("JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_" + struct_name.replace("_", "_1") + "_1new (JNIEnv * env, jclass _a, jobject o") - for var_line in field_var_lines: - if var_line.group(1) in trait_structs: - out_c.write(", jobject " + var_line.group(2)) - out_c.write(") {\n") - out_c.write("\t" + struct_name + " *res_ptr = MALLOC(sizeof(" + struct_name + "), \"" + struct_name + "\");\n") - out_c.write("\t*res_ptr = " + struct_name + "_init(env, _a, o") - for var_line in field_var_lines: - if var_line.group(1) in trait_structs: - out_c.write(", " + var_line.group(2)) - out_c.write(");\n") - out_c.write("\treturn (long)res_ptr;\n") - out_c.write("}\n") + out_java.write("\t}\n") + + out_java.write("\tpublic static native long " + struct_name + "_new(" + struct_name + " impl") + out_c.write("static inline " + struct_name + " " + struct_name + "_init (JNIEnv * env, jclass _a, jobject o") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_java.write(", " + var_line.group(1) + " " + var_line.group(2)) + out_c.write(", jobject " + var_line.group(2)) + out_java.write(");\n") + out_c.write(") {\n") + + out_c.write("\tjclass c = (*env)->GetObjectClass(env, o);\n") + out_c.write("\tDO_ASSERT(c != NULL);\n") + out_c.write("\t" + struct_name + "_JCalls *calls = MALLOC(sizeof(" + struct_name + "_JCalls), \"" + struct_name + "_JCalls\");\n") + out_c.write("\tatomic_init(&calls->refcnt, 1);\n") + out_c.write("\tDO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);\n") + out_c.write("\tcalls->o = (*env)->NewWeakGlobalRef(env, o);\n") + for (fn_line, java_meth_descr) in zip(trait_fn_lines, java_meths): + if fn_line.group(2) != "free" and fn_line.group(2) != "clone": + out_c.write("\tcalls->" + fn_line.group(2) + "_meth = (*env)->GetMethodID(env, c, \"" + fn_line.group(2) + "\", \"" + java_meth_descr + "\");\n") + out_c.write("\tDO_ASSERT(calls->" + fn_line.group(2) + "_meth != NULL);\n") + out_c.write("\n\t" + struct_name + " ret = {\n") + out_c.write("\t\t.this_arg = (void*) calls,\n") + for fn_line in trait_fn_lines: + if fn_line.group(2) != "free" and fn_line.group(2) != "clone": + out_c.write("\t\t." + fn_line.group(2) + " = " + fn_line.group(2) + "_jcall,\n") + elif fn_line.group(2) == "free": + out_c.write("\t\t.free = " + struct_name + "_JCalls_free,\n") + else: + out_c.write("\t\t.clone = " + struct_name + "_JCalls_clone,\n") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_c.write("\t\t." + var_line.group(2) + " = " + var_line.group(1) + "_init(env, _a, " + var_line.group(2) + "),\n") + out_c.write("\t};\n") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_c.write("\tcalls->" + var_line.group(2) + " = ret." + var_line.group(2) + ".this_arg;\n") + out_c.write("\treturn ret;\n") + out_c.write("}\n") - out_java.write("\tpublic static native " + struct_name + " " + struct_name + "_get_obj_from_jcalls(long val);\n") - out_c.write("JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_" + struct_name.replace("_", "_1") + "_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {\n") - out_c.write("\tjobject ret = (*env)->NewLocalRef(env, ((" + struct_name + "_JCalls*)val)->o);\n") - out_c.write("\tDO_ASSERT(ret != NULL);\n") - out_c.write("\treturn ret;\n") - out_c.write("}\n") + out_c.write("JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_" + struct_name.replace("_", "_1") + "_1new (JNIEnv * env, jclass _a, jobject o") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_c.write(", jobject " + var_line.group(2)) + out_c.write(") {\n") + out_c.write("\t" + struct_name + " *res_ptr = MALLOC(sizeof(" + struct_name + "), \"" + struct_name + "\");\n") + out_c.write("\t*res_ptr = " + struct_name + "_init(env, _a, o") + for var_line in field_var_lines: + if var_line.group(1) in trait_structs: + out_c.write(", " + var_line.group(2)) + out_c.write(");\n") + out_c.write("\treturn (long)res_ptr;\n") + out_c.write("}\n") - for fn_line in trait_fn_lines: - # For now, just disable enabling the _call_log - we don't know how to inverse-map String - is_log = fn_line.group(2) == "log" and struct_name == "LDKLogger" - if fn_line.group(2) != "free" and fn_line.group(2) != "clone" and fn_line.group(2) != "eq" and not is_log: - dummy_line = fn_line.group(1) + struct_name + "_call_" + fn_line.group(2) + " " + struct_name + "* arg" + fn_line.group(4) + "\n" - map_fn(dummy_line, re.compile("([A-Za-z_0-9]*) *([A-Za-z_0-9]*) *(.*)").match(dummy_line), None, "(arg_conv->" + fn_line.group(2) + ")(arg_conv->this_arg") + out_java.write("\tpublic static native " + struct_name + " " + struct_name + "_get_obj_from_jcalls(long val);\n") + out_c.write("JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_" + struct_name.replace("_", "_1") + "_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {\n") + out_c.write("\tjobject ret = (*env)->NewLocalRef(env, ((" + struct_name + "_JCalls*)val)->o);\n") + out_c.write("\tDO_ASSERT(ret != NULL);\n") + out_c.write("\treturn ret;\n") + out_c.write("}\n") + + for fn_line in trait_fn_lines: + # For now, just disable enabling the _call_log - we don't know how to inverse-map String + is_log = fn_line.group(2) == "log" and struct_name == "LDKLogger" + if fn_line.group(2) != "free" and fn_line.group(2) != "clone" and fn_line.group(2) != "eq" and not is_log: + dummy_line = fn_line.group(1) + struct_name + "_call_" + fn_line.group(2) + " " + struct_name + "* arg" + fn_line.group(4) + "\n" + map_fn(dummy_line, re.compile("([A-Za-z_0-9]*) *([A-Za-z_0-9]*) *(.*)").match(dummy_line), None, "(arg_conv->" + fn_line.group(2) + ")(arg_conv->this_arg") out_c.write("""#include \"org_ldk_impl_bindings.h\" #include @@ -906,6 +1015,17 @@ _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec and [u8] need _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec and [u8] need to have been mapped identically"); _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec and [u8] need to have been mapped identically"); +""") + + with open(sys.argv[3] + "/structs/CommonBase.java", "a") as out_java_struct: + out_java_struct.write("""package org.ldk.structs; +import java.util.LinkedList; +class CommonBase { + final long ptr; + LinkedList ptrs_to = new LinkedList(); + protected CommonBase(long ptr) { this.ptr = ptr; } + public long _test_only_get_ptr() { return this.ptr; } +} """) # XXX: Temporarily write out a manual SecretKey_new() for testing, we should auto-gen this kind of thing @@ -918,9 +1038,6 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), in_block_comment = False cur_block_obj = None - fn_ptr_regex = re.compile("^extern const ([A-Za-z_0-9\* ]*) \(\*(.*)\)\((.*)\);$") - fn_ret_arr_regex = re.compile("(.*) \(\*(.*)\((.*)\)\)\[([0-9]*)\];$") - reg_fn_regex = re.compile("([A-Za-z_0-9\* ]* \*?)([a-zA-Z_0-9]*)\((.*)\);$") const_val_regex = re.compile("^extern const ([A-Za-z_0-9]*) ([A-Za-z_0-9]*);$") line_indicates_result_regex = re.compile("^ (LDKCResultPtr_[A-Za-z_0-9]*) contents;$") @@ -1007,6 +1124,16 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), if is_opaque: opaque_structs.add(struct_name) + with open(sys.argv[3] + "/structs/" + struct_name.replace("LDK","") + ".java", "w") as out_java_struct: + out_java_struct.write("package org.ldk.structs;\n\n") + out_java_struct.write("import org.ldk.impl.bindings;\n") + out_java_struct.write("import org.ldk.enums.*;\n\n") + out_java_struct.write("public class " + struct_name.replace("LDK","") + " extends CommonBase {\n") + out_java_struct.write("\t" + struct_name.replace("LDK", "") + "(Object _dummy, long ptr) { super(ptr); }\n") + out_java_struct.write("\t@Override @SuppressWarnings(\"deprecation\")\n") + out_java_struct.write("\tprotected void finalize() throws Throwable {\n") + out_java_struct.write("\t\tbindings." + struct_name.replace("LDK","") + "_free(ptr); super.finalize();\n") + out_java_struct.write("\t}\n\n") elif result_contents is not None: result_templ_structs.add(struct_name) assert result_contents in result_ptr_struct_items @@ -1156,3 +1283,6 @@ _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), assert(line == "\n") out_java.write("}\n") + for struct_name in opaque_structs: + with open(sys.argv[3] + "/structs/" + struct_name.replace("LDK","") + ".java", "a") as out_java_struct: + out_java_struct.write("}\n") diff --git a/genbindings.sh b/genbindings.sh index 7a6bdb48..00999383 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash usage() { echo "USAGE: path/to/rust-lightning \"JNI_CFLAGS\" debug" echo "For JNI_CFLAGS you probably want -I/usr/lib/jvm/java-11-openjdk-amd64/include/ -I/usr/lib/jvm/java-11-openjdk-amd64/include/linux/" @@ -9,9 +9,10 @@ usage() { [ "$3" != "true" -a "$3" != "false" ] && usage set -e -mkdir -p src/main/java/org/ldk/enums -rm -f src/main/java/org/ldk/enums/*.java -./genbindings.py "$1/lightning-c-bindings/include/lightning.h" src/main/java/org/ldk/impl/bindings.java src/main/java/org/ldk/enums src/main/jni/bindings.c $3 +mkdir -p src/main/java/org/ldk/{enums,structs} +rm -f src/main/java/org/ldk/{enums,structs}/*.java +rm -f src/main/jni/*.h +./genbindings.py "$1/lightning-c-bindings/include/lightning.h" src/main/java/org/ldk/impl/bindings.java src/main/java/org/ldk src/main/jni/bindings.c $3 javac -h src/main/jni src/main/java/org/ldk/enums/*.java src/main/java/org/ldk/impl/bindings.java rm src/main/java/org/ldk/enums/*.class src/main/java/org/ldk/impl/bindings*.class COMPILE="clang -std=c11 -Wall -Wno-unused-function -Wl,--no-undefined -pthread -ldl -o liblightningjni.so -shared -fPIC -Wno-pointer-sign -Isrc/main/jni" diff --git a/src/main/java/org/ldk/structs/AcceptChannel.java b/src/main/java/org/ldk/structs/AcceptChannel.java new file mode 100644 index 00000000..1c555612 --- /dev/null +++ b/src/main/java/org/ldk/structs/AcceptChannel.java @@ -0,0 +1,174 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class AcceptChannel extends CommonBase { + AcceptChannel(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.AcceptChannel_free(ptr); super.finalize(); + } + + public AcceptChannel(AcceptChannel orig) { + super(bindings.AcceptChannel_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_temporary_channel_id(AcceptChannel this_ptr) { + byte[] ret = bindings.AcceptChannel_get_temporary_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_temporary_channel_id(AcceptChannel this_ptr, byte[] val) { + bindings.AcceptChannel_set_temporary_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_dust_limit_satoshis(AcceptChannel this_ptr) { + long ret = bindings.AcceptChannel_get_dust_limit_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_dust_limit_satoshis(AcceptChannel this_ptr, long val) { + bindings.AcceptChannel_set_dust_limit_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_max_htlc_value_in_flight_msat(AcceptChannel this_ptr) { + long ret = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_htlc_value_in_flight_msat(AcceptChannel this_ptr, long val) { + bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_channel_reserve_satoshis(AcceptChannel this_ptr) { + long ret = bindings.AcceptChannel_get_channel_reserve_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_reserve_satoshis(AcceptChannel this_ptr, long val) { + bindings.AcceptChannel_set_channel_reserve_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_minimum_msat(AcceptChannel this_ptr) { + long ret = bindings.AcceptChannel_get_htlc_minimum_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_minimum_msat(AcceptChannel this_ptr, long val) { + bindings.AcceptChannel_set_htlc_minimum_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_minimum_depth(AcceptChannel this_ptr) { + int ret = bindings.AcceptChannel_get_minimum_depth(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_minimum_depth(AcceptChannel this_ptr, int val) { + bindings.AcceptChannel_set_minimum_depth(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_to_self_delay(AcceptChannel this_ptr) { + short ret = bindings.AcceptChannel_get_to_self_delay(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_to_self_delay(AcceptChannel this_ptr, short val) { + bindings.AcceptChannel_set_to_self_delay(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_max_accepted_htlcs(AcceptChannel this_ptr) { + short ret = bindings.AcceptChannel_get_max_accepted_htlcs(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_accepted_htlcs(AcceptChannel this_ptr, short val) { + bindings.AcceptChannel_set_max_accepted_htlcs(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_funding_pubkey(AcceptChannel this_ptr) { + byte[] ret = bindings.AcceptChannel_get_funding_pubkey(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_funding_pubkey(AcceptChannel this_ptr, byte[] val) { + bindings.AcceptChannel_set_funding_pubkey(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_revocation_basepoint(AcceptChannel this_ptr) { + byte[] ret = bindings.AcceptChannel_get_revocation_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_revocation_basepoint(AcceptChannel this_ptr, byte[] val) { + bindings.AcceptChannel_set_revocation_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_payment_point(AcceptChannel this_ptr) { + byte[] ret = bindings.AcceptChannel_get_payment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_payment_point(AcceptChannel this_ptr, byte[] val) { + bindings.AcceptChannel_set_payment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_delayed_payment_basepoint(AcceptChannel this_ptr) { + byte[] ret = bindings.AcceptChannel_get_delayed_payment_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_delayed_payment_basepoint(AcceptChannel this_ptr, byte[] val) { + bindings.AcceptChannel_set_delayed_payment_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_htlc_basepoint(AcceptChannel this_ptr) { + byte[] ret = bindings.AcceptChannel_get_htlc_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_basepoint(AcceptChannel this_ptr, byte[] val) { + bindings.AcceptChannel_set_htlc_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_first_per_commitment_point(AcceptChannel this_ptr) { + byte[] ret = bindings.AcceptChannel_get_first_per_commitment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_first_per_commitment_point(AcceptChannel this_ptr, byte[] val) { + bindings.AcceptChannel_set_first_per_commitment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped AcceptChannel_write + // Skipped AcceptChannel_read +} diff --git a/src/main/java/org/ldk/structs/Access.java b/src/main/java/org/ldk/structs/Access.java new file mode 100644 index 00000000..5dc9ef8c --- /dev/null +++ b/src/main/java/org/ldk/structs/Access.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class Access extends CommonBase { + Access(Object _dummy, long ptr) { super(ptr); } + public Access(bindings.LDKAccess arg) { + super(bindings.LDKAccess_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Access_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/AnnouncementSignatures.java b/src/main/java/org/ldk/structs/AnnouncementSignatures.java new file mode 100644 index 00000000..8ecbf3f3 --- /dev/null +++ b/src/main/java/org/ldk/structs/AnnouncementSignatures.java @@ -0,0 +1,47 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class AnnouncementSignatures extends CommonBase { + AnnouncementSignatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.AnnouncementSignatures_free(ptr); super.finalize(); + } + + public AnnouncementSignatures(AnnouncementSignatures orig) { + super(bindings.AnnouncementSignatures_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(AnnouncementSignatures this_ptr) { + byte[] ret = bindings.AnnouncementSignatures_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(AnnouncementSignatures this_ptr, byte[] val) { + bindings.AnnouncementSignatures_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_short_channel_id(AnnouncementSignatures this_ptr) { + long ret = bindings.AnnouncementSignatures_get_short_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_short_channel_id(AnnouncementSignatures this_ptr, long val) { + bindings.AnnouncementSignatures_set_short_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped AnnouncementSignatures_get_node_signature + // Skipped AnnouncementSignatures_set_node_signature + // Skipped AnnouncementSignatures_get_bitcoin_signature + // Skipped AnnouncementSignatures_set_bitcoin_signature + // Skipped AnnouncementSignatures_new + // Skipped AnnouncementSignatures_write + // Skipped AnnouncementSignatures_read +} diff --git a/src/main/java/org/ldk/structs/BroadcasterInterface.java b/src/main/java/org/ldk/structs/BroadcasterInterface.java new file mode 100644 index 00000000..4193e907 --- /dev/null +++ b/src/main/java/org/ldk/structs/BroadcasterInterface.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class BroadcasterInterface extends CommonBase { + BroadcasterInterface(Object _dummy, long ptr) { super(ptr); } + public BroadcasterInterface(bindings.LDKBroadcasterInterface arg) { + super(bindings.LDKBroadcasterInterface_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.BroadcasterInterface_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/ChainMonitor.java b/src/main/java/org/ldk/structs/ChainMonitor.java new file mode 100644 index 00000000..24ed59fd --- /dev/null +++ b/src/main/java/org/ldk/structs/ChainMonitor.java @@ -0,0 +1,38 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChainMonitor extends CommonBase { + ChainMonitor(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChainMonitor_free(ptr); super.finalize(); + } + + // Skipped ChainMonitor_block_connected + public void block_disconnected(byte[] header, int disconnected_height) { + bindings.ChainMonitor_block_disconnected(this.ptr, header, disconnected_height); + } + + public ChainMonitor(Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest) { + super(bindings.ChainMonitor_new(chain_source.ptr, broadcaster.ptr, logger.ptr, feeest.ptr)); + this.ptrs_to.add(chain_source); + this.ptrs_to.add(broadcaster); + this.ptrs_to.add(logger); + this.ptrs_to.add(feeest); + } + + public Watch as_Watch() { + Watch ret = new Watch(null, bindings.ChainMonitor_as_Watch(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + + public EventsProvider as_EventsProvider() { + EventsProvider ret = new EventsProvider(null, bindings.ChainMonitor_as_EventsProvider(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelAnnouncement.java b/src/main/java/org/ldk/structs/ChannelAnnouncement.java new file mode 100644 index 00000000..7ed2abd9 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelAnnouncement.java @@ -0,0 +1,41 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelAnnouncement extends CommonBase { + ChannelAnnouncement(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelAnnouncement_free(ptr); super.finalize(); + } + + public ChannelAnnouncement(ChannelAnnouncement orig) { + super(bindings.ChannelAnnouncement_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + // Skipped ChannelAnnouncement_get_node_signature_1 + // Skipped ChannelAnnouncement_set_node_signature_1 + // Skipped ChannelAnnouncement_get_node_signature_2 + // Skipped ChannelAnnouncement_set_node_signature_2 + // Skipped ChannelAnnouncement_get_bitcoin_signature_1 + // Skipped ChannelAnnouncement_set_bitcoin_signature_1 + // Skipped ChannelAnnouncement_get_bitcoin_signature_2 + // Skipped ChannelAnnouncement_set_bitcoin_signature_2 + public UnsignedChannelAnnouncement get_contents(ChannelAnnouncement this_ptr) { + UnsignedChannelAnnouncement ret = new UnsignedChannelAnnouncement(null, bindings.ChannelAnnouncement_get_contents(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_contents(ChannelAnnouncement this_ptr, UnsignedChannelAnnouncement val) { + bindings.ChannelAnnouncement_set_contents(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped ChannelAnnouncement_new + // Skipped ChannelAnnouncement_write + // Skipped ChannelAnnouncement_read +} diff --git a/src/main/java/org/ldk/structs/ChannelConfig.java b/src/main/java/org/ldk/structs/ChannelConfig.java new file mode 100644 index 00000000..b4c6a091 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelConfig.java @@ -0,0 +1,61 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelConfig extends CommonBase { + ChannelConfig(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelConfig_free(ptr); super.finalize(); + } + + public ChannelConfig(ChannelConfig orig) { + super(bindings.ChannelConfig_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public int get_fee_proportional_millionths(ChannelConfig this_ptr) { + int ret = bindings.ChannelConfig_get_fee_proportional_millionths(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_fee_proportional_millionths(ChannelConfig this_ptr, int val) { + bindings.ChannelConfig_set_fee_proportional_millionths(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public boolean get_announced_channel(ChannelConfig this_ptr) { + boolean ret = bindings.ChannelConfig_get_announced_channel(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_announced_channel(ChannelConfig this_ptr, boolean val) { + bindings.ChannelConfig_set_announced_channel(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public boolean get_commit_upfront_shutdown_pubkey(ChannelConfig this_ptr) { + boolean ret = bindings.ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_commit_upfront_shutdown_pubkey(ChannelConfig this_ptr, boolean val) { + bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ChannelConfig(int fee_proportional_millionths_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) { + super(bindings.ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg)); + } + + public ChannelConfig() { + super(bindings.ChannelConfig_default()); + } + + // Skipped ChannelConfig_write + // Skipped ChannelConfig_read +} diff --git a/src/main/java/org/ldk/structs/ChannelDetails.java b/src/main/java/org/ldk/structs/ChannelDetails.java new file mode 100644 index 00000000..b5bc4a16 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelDetails.java @@ -0,0 +1,102 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelDetails extends CommonBase { + ChannelDetails(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelDetails_free(ptr); super.finalize(); + } + + public byte[] get_channel_id(ChannelDetails this_ptr) { + byte[] ret = bindings.ChannelDetails_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(ChannelDetails this_ptr, byte[] val) { + bindings.ChannelDetails_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_remote_network_id(ChannelDetails this_ptr) { + byte[] ret = bindings.ChannelDetails_get_remote_network_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_remote_network_id(ChannelDetails this_ptr, byte[] val) { + bindings.ChannelDetails_set_remote_network_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public InitFeatures get_counterparty_features(ChannelDetails this_ptr) { + InitFeatures ret = new InitFeatures(null, bindings.ChannelDetails_get_counterparty_features(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_counterparty_features(ChannelDetails this_ptr, InitFeatures val) { + bindings.ChannelDetails_set_counterparty_features(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public long get_channel_value_satoshis(ChannelDetails this_ptr) { + long ret = bindings.ChannelDetails_get_channel_value_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_value_satoshis(ChannelDetails this_ptr, long val) { + bindings.ChannelDetails_set_channel_value_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_user_id(ChannelDetails this_ptr) { + long ret = bindings.ChannelDetails_get_user_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_user_id(ChannelDetails this_ptr, long val) { + bindings.ChannelDetails_set_user_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_outbound_capacity_msat(ChannelDetails this_ptr) { + long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_outbound_capacity_msat(ChannelDetails this_ptr, long val) { + bindings.ChannelDetails_set_outbound_capacity_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_inbound_capacity_msat(ChannelDetails this_ptr) { + long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_inbound_capacity_msat(ChannelDetails this_ptr, long val) { + bindings.ChannelDetails_set_inbound_capacity_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public boolean get_is_live(ChannelDetails this_ptr) { + boolean ret = bindings.ChannelDetails_get_is_live(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_is_live(ChannelDetails this_ptr, boolean val) { + bindings.ChannelDetails_set_is_live(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelFeatures.java b/src/main/java/org/ldk/structs/ChannelFeatures.java new file mode 100644 index 00000000..e697e791 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelFeatures.java @@ -0,0 +1,13 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelFeatures extends CommonBase { + ChannelFeatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelFeatures_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java new file mode 100644 index 00000000..a01e2a57 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -0,0 +1,59 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelHandshakeConfig extends CommonBase { + ChannelHandshakeConfig(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelHandshakeConfig_free(ptr); super.finalize(); + } + + public ChannelHandshakeConfig(ChannelHandshakeConfig orig) { + super(bindings.ChannelHandshakeConfig_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public int get_minimum_depth(ChannelHandshakeConfig this_ptr) { + int ret = bindings.ChannelHandshakeConfig_get_minimum_depth(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_minimum_depth(ChannelHandshakeConfig this_ptr, int val) { + bindings.ChannelHandshakeConfig_set_minimum_depth(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_our_to_self_delay(ChannelHandshakeConfig this_ptr) { + short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_our_to_self_delay(ChannelHandshakeConfig this_ptr, short val) { + bindings.ChannelHandshakeConfig_set_our_to_self_delay(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_our_htlc_minimum_msat(ChannelHandshakeConfig this_ptr) { + long ret = bindings.ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_our_htlc_minimum_msat(ChannelHandshakeConfig this_ptr, long val) { + bindings.ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ChannelHandshakeConfig(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg) { + super(bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg)); + } + + public ChannelHandshakeConfig() { + super(bindings.ChannelHandshakeConfig_default()); + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java b/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java new file mode 100644 index 00000000..2d6ed0ea --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java @@ -0,0 +1,136 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelHandshakeLimits extends CommonBase { + ChannelHandshakeLimits(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelHandshakeLimits_free(ptr); super.finalize(); + } + + public ChannelHandshakeLimits(ChannelHandshakeLimits orig) { + super(bindings.ChannelHandshakeLimits_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public long get_min_funding_satoshis(ChannelHandshakeLimits this_ptr) { + long ret = bindings.ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_min_funding_satoshis(ChannelHandshakeLimits this_ptr, long val) { + bindings.ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_max_htlc_minimum_msat(ChannelHandshakeLimits this_ptr) { + long ret = bindings.ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_htlc_minimum_msat(ChannelHandshakeLimits this_ptr, long val) { + bindings.ChannelHandshakeLimits_set_max_htlc_minimum_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_min_max_htlc_value_in_flight_msat(ChannelHandshakeLimits this_ptr) { + long ret = bindings.ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_min_max_htlc_value_in_flight_msat(ChannelHandshakeLimits this_ptr, long val) { + bindings.ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_max_channel_reserve_satoshis(ChannelHandshakeLimits this_ptr) { + long ret = bindings.ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_channel_reserve_satoshis(ChannelHandshakeLimits this_ptr, long val) { + bindings.ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_min_max_accepted_htlcs(ChannelHandshakeLimits this_ptr) { + short ret = bindings.ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_min_max_accepted_htlcs(ChannelHandshakeLimits this_ptr, short val) { + bindings.ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_min_dust_limit_satoshis(ChannelHandshakeLimits this_ptr) { + long ret = bindings.ChannelHandshakeLimits_get_min_dust_limit_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_min_dust_limit_satoshis(ChannelHandshakeLimits this_ptr, long val) { + bindings.ChannelHandshakeLimits_set_min_dust_limit_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_max_dust_limit_satoshis(ChannelHandshakeLimits this_ptr) { + long ret = bindings.ChannelHandshakeLimits_get_max_dust_limit_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_dust_limit_satoshis(ChannelHandshakeLimits this_ptr, long val) { + bindings.ChannelHandshakeLimits_set_max_dust_limit_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_max_minimum_depth(ChannelHandshakeLimits this_ptr) { + int ret = bindings.ChannelHandshakeLimits_get_max_minimum_depth(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_minimum_depth(ChannelHandshakeLimits this_ptr, int val) { + bindings.ChannelHandshakeLimits_set_max_minimum_depth(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public boolean get_force_announced_channel_preference(ChannelHandshakeLimits this_ptr) { + boolean ret = bindings.ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_force_announced_channel_preference(ChannelHandshakeLimits this_ptr, boolean val) { + bindings.ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_their_to_self_delay(ChannelHandshakeLimits this_ptr) { + short ret = bindings.ChannelHandshakeLimits_get_their_to_self_delay(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_their_to_self_delay(ChannelHandshakeLimits this_ptr, short val) { + bindings.ChannelHandshakeLimits_set_their_to_self_delay(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ChannelHandshakeLimits(long min_funding_satoshis_arg, long max_htlc_minimum_msat_arg, long min_max_htlc_value_in_flight_msat_arg, long max_channel_reserve_satoshis_arg, short min_max_accepted_htlcs_arg, long min_dust_limit_satoshis_arg, long max_dust_limit_satoshis_arg, int max_minimum_depth_arg, boolean force_announced_channel_preference_arg, short their_to_self_delay_arg) { + super(bindings.ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg)); + } + + public ChannelHandshakeLimits() { + super(bindings.ChannelHandshakeLimits_default()); + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java new file mode 100644 index 00000000..eee871e3 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -0,0 +1,85 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelInfo extends CommonBase { + ChannelInfo(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelInfo_free(ptr); super.finalize(); + } + + public ChannelFeatures get_features(ChannelInfo this_ptr) { + ChannelFeatures ret = new ChannelFeatures(null, bindings.ChannelInfo_get_features(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_features(ChannelInfo this_ptr, ChannelFeatures val) { + bindings.ChannelInfo_set_features(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public byte[] get_node_one(ChannelInfo this_ptr) { + byte[] ret = bindings.ChannelInfo_get_node_one(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_node_one(ChannelInfo this_ptr, byte[] val) { + bindings.ChannelInfo_set_node_one(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public DirectionalChannelInfo get_one_to_two(ChannelInfo this_ptr) { + DirectionalChannelInfo ret = new DirectionalChannelInfo(null, bindings.ChannelInfo_get_one_to_two(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_one_to_two(ChannelInfo this_ptr, DirectionalChannelInfo val) { + bindings.ChannelInfo_set_one_to_two(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public byte[] get_node_two(ChannelInfo this_ptr) { + byte[] ret = bindings.ChannelInfo_get_node_two(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_node_two(ChannelInfo this_ptr, byte[] val) { + bindings.ChannelInfo_set_node_two(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public DirectionalChannelInfo get_two_to_one(ChannelInfo this_ptr) { + DirectionalChannelInfo ret = new DirectionalChannelInfo(null, bindings.ChannelInfo_get_two_to_one(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_two_to_one(ChannelInfo this_ptr, DirectionalChannelInfo val) { + bindings.ChannelInfo_set_two_to_one(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public ChannelAnnouncement get_announcement_message(ChannelInfo this_ptr) { + ChannelAnnouncement ret = new ChannelAnnouncement(null, bindings.ChannelInfo_get_announcement_message(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_announcement_message(ChannelInfo this_ptr, ChannelAnnouncement val) { + bindings.ChannelInfo_set_announcement_message(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped ChannelInfo_write + // Skipped ChannelInfo_read +} diff --git a/src/main/java/org/ldk/structs/ChannelKeys.java b/src/main/java/org/ldk/structs/ChannelKeys.java new file mode 100644 index 00000000..014c2ff6 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelKeys.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class ChannelKeys extends CommonBase { + ChannelKeys(Object _dummy, long ptr) { super(ptr); } + public ChannelKeys(bindings.LDKChannelKeys arg) { + super(bindings.LDKChannelKeys_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelKeys_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java new file mode 100644 index 00000000..901a288d --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -0,0 +1,93 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelManager extends CommonBase { + ChannelManager(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelManager_free(ptr); super.finalize(); + } + + public ChannelManager(LDKNetwork network, FeeEstimator fee_est, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Logger logger, KeysInterface keys_manager, UserConfig config, long current_blockchain_height) { + super(bindings.ChannelManager_new(network, fee_est.ptr, chain_monitor.ptr, tx_broadcaster.ptr, logger.ptr, keys_manager.ptr, config.ptr & ~1, current_blockchain_height)); + this.ptrs_to.add(fee_est); + this.ptrs_to.add(chain_monitor); + this.ptrs_to.add(tx_broadcaster); + this.ptrs_to.add(logger); + this.ptrs_to.add(keys_manager); + this.ptrs_to.add(config); + } + + // Skipped ChannelManager_create_channel + // Skipped ChannelManager_list_channels + // Skipped ChannelManager_list_usable_channels + // Skipped ChannelManager_close_channel + public void force_close_channel(byte[] channel_id) { + bindings.ChannelManager_force_close_channel(this.ptr, channel_id); + } + + public void force_close_all_channels() { + bindings.ChannelManager_force_close_all_channels(this.ptr); + } + + // Skipped ChannelManager_send_payment + public void funding_transaction_generated(byte[] temporary_channel_id, OutPoint funding_txo) { + bindings.ChannelManager_funding_transaction_generated(this.ptr, temporary_channel_id, funding_txo.ptr & ~1); + this.ptrs_to.add(funding_txo); + } + + // Skipped ChannelManager_broadcast_node_announcement + public void process_pending_htlc_forwards() { + bindings.ChannelManager_process_pending_htlc_forwards(this.ptr); + } + + public void timer_chan_freshness_every_min() { + bindings.ChannelManager_timer_chan_freshness_every_min(this.ptr); + } + + public boolean fail_htlc_backwards(byte[] payment_hash, byte[] payment_secret) { + boolean ret = bindings.ChannelManager_fail_htlc_backwards(this.ptr, payment_hash, payment_secret); + return ret; + } + + public boolean claim_funds(byte[] payment_preimage, byte[] payment_secret, long expected_amount) { + boolean ret = bindings.ChannelManager_claim_funds(this.ptr, payment_preimage, payment_secret, expected_amount); + return ret; + } + + public byte[] get_our_node_id() { + byte[] ret = bindings.ChannelManager_get_our_node_id(this.ptr); + return ret; + } + + public void channel_monitor_updated(OutPoint funding_txo, long highest_applied_update_id) { + bindings.ChannelManager_channel_monitor_updated(this.ptr, funding_txo.ptr & ~1, highest_applied_update_id); + this.ptrs_to.add(funding_txo); + } + + public MessageSendEventsProvider as_MessageSendEventsProvider() { + MessageSendEventsProvider ret = new MessageSendEventsProvider(null, bindings.ChannelManager_as_MessageSendEventsProvider(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + + public EventsProvider as_EventsProvider() { + EventsProvider ret = new EventsProvider(null, bindings.ChannelManager_as_EventsProvider(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + + // Skipped ChannelManager_block_connected + public void block_disconnected(byte[] header) { + bindings.ChannelManager_block_disconnected(this.ptr, header); + } + + public ChannelMessageHandler as_ChannelMessageHandler() { + ChannelMessageHandler ret = new ChannelMessageHandler(null, bindings.ChannelManager_as_ChannelMessageHandler(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java new file mode 100644 index 00000000..a7151a53 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java @@ -0,0 +1,91 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelManagerReadArgs extends CommonBase { + ChannelManagerReadArgs(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelManagerReadArgs_free(ptr); super.finalize(); + } + + public KeysInterface get_keys_manager(ChannelManagerReadArgs this_ptr) { + KeysInterface ret = new KeysInterface(null, bindings.ChannelManagerReadArgs_get_keys_manager(this_ptr.ptr & ~1)); + ret.ptrs_to.add(this); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_keys_manager(ChannelManagerReadArgs this_ptr, KeysInterface val) { + bindings.ChannelManagerReadArgs_set_keys_manager(this_ptr.ptr & ~1, val.ptr); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public FeeEstimator get_fee_estimator(ChannelManagerReadArgs this_ptr) { + FeeEstimator ret = new FeeEstimator(null, bindings.ChannelManagerReadArgs_get_fee_estimator(this_ptr.ptr & ~1)); + ret.ptrs_to.add(this); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_fee_estimator(ChannelManagerReadArgs this_ptr, FeeEstimator val) { + bindings.ChannelManagerReadArgs_set_fee_estimator(this_ptr.ptr & ~1, val.ptr); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public Watch get_chain_monitor(ChannelManagerReadArgs this_ptr) { + Watch ret = new Watch(null, bindings.ChannelManagerReadArgs_get_chain_monitor(this_ptr.ptr & ~1)); + ret.ptrs_to.add(this); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_monitor(ChannelManagerReadArgs this_ptr, Watch val) { + bindings.ChannelManagerReadArgs_set_chain_monitor(this_ptr.ptr & ~1, val.ptr); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public BroadcasterInterface get_tx_broadcaster(ChannelManagerReadArgs this_ptr) { + BroadcasterInterface ret = new BroadcasterInterface(null, bindings.ChannelManagerReadArgs_get_tx_broadcaster(this_ptr.ptr & ~1)); + ret.ptrs_to.add(this); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_tx_broadcaster(ChannelManagerReadArgs this_ptr, BroadcasterInterface val) { + bindings.ChannelManagerReadArgs_set_tx_broadcaster(this_ptr.ptr & ~1, val.ptr); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public Logger get_logger(ChannelManagerReadArgs this_ptr) { + Logger ret = new Logger(null, bindings.ChannelManagerReadArgs_get_logger(this_ptr.ptr & ~1)); + ret.ptrs_to.add(this); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_logger(ChannelManagerReadArgs this_ptr, Logger val) { + bindings.ChannelManagerReadArgs_set_logger(this_ptr.ptr & ~1, val.ptr); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public UserConfig get_default_config(ChannelManagerReadArgs this_ptr) { + UserConfig ret = new UserConfig(null, bindings.ChannelManagerReadArgs_get_default_config(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_default_config(ChannelManagerReadArgs this_ptr, UserConfig val) { + bindings.ChannelManagerReadArgs_set_default_config(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped ChannelManagerReadArgs_new +} diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java new file mode 100644 index 00000000..02e66711 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class ChannelMessageHandler extends CommonBase { + ChannelMessageHandler(Object _dummy, long ptr) { super(ptr); } + public ChannelMessageHandler(bindings.LDKChannelMessageHandler arg, bindings.LDKMessageSendEventsProvider MessageSendEventsProvider) { + super(bindings.LDKChannelMessageHandler_new(arg, MessageSendEventsProvider)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelMessageHandler_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelMonitor.java b/src/main/java/org/ldk/structs/ChannelMonitor.java new file mode 100644 index 00000000..b30c1847 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelMonitor.java @@ -0,0 +1,31 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelMonitor extends CommonBase { + ChannelMonitor(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelMonitor_free(ptr); super.finalize(); + } + + // Skipped ChannelMonitor_update_monitor + public long get_latest_update_id() { + long ret = bindings.ChannelMonitor_get_latest_update_id(this.ptr); + return ret; + } + + // Skipped ChannelMonitor_get_funding_txo + // Skipped ChannelMonitor_get_and_clear_pending_monitor_events + // Skipped ChannelMonitor_get_and_clear_pending_events + // Skipped ChannelMonitor_get_latest_holder_commitment_txn + // Skipped ChannelMonitor_block_connected + public void block_disconnected(byte[] header, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { + bindings.ChannelMonitor_block_disconnected(this.ptr, header, height, broadcaster.ptr, fee_estimator.ptr, logger.ptr); + this.ptrs_to.add(broadcaster); + this.ptrs_to.add(fee_estimator); + this.ptrs_to.add(logger); + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java new file mode 100644 index 00000000..15542a97 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java @@ -0,0 +1,31 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelMonitorUpdate extends CommonBase { + ChannelMonitorUpdate(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelMonitorUpdate_free(ptr); super.finalize(); + } + + public ChannelMonitorUpdate(ChannelMonitorUpdate orig) { + super(bindings.ChannelMonitorUpdate_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public long get_update_id(ChannelMonitorUpdate this_ptr) { + long ret = bindings.ChannelMonitorUpdate_get_update_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_update_id(ChannelMonitorUpdate this_ptr, long val) { + bindings.ChannelMonitorUpdate_set_update_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped ChannelMonitorUpdate_write + // Skipped ChannelMonitorUpdate_read +} diff --git a/src/main/java/org/ldk/structs/ChannelPublicKeys.java b/src/main/java/org/ldk/structs/ChannelPublicKeys.java new file mode 100644 index 00000000..55d1566c --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelPublicKeys.java @@ -0,0 +1,79 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelPublicKeys extends CommonBase { + ChannelPublicKeys(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelPublicKeys_free(ptr); super.finalize(); + } + + public ChannelPublicKeys(ChannelPublicKeys orig) { + super(bindings.ChannelPublicKeys_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_funding_pubkey(ChannelPublicKeys this_ptr) { + byte[] ret = bindings.ChannelPublicKeys_get_funding_pubkey(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_funding_pubkey(ChannelPublicKeys this_ptr, byte[] val) { + bindings.ChannelPublicKeys_set_funding_pubkey(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_revocation_basepoint(ChannelPublicKeys this_ptr) { + byte[] ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_revocation_basepoint(ChannelPublicKeys this_ptr, byte[] val) { + bindings.ChannelPublicKeys_set_revocation_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_payment_point(ChannelPublicKeys this_ptr) { + byte[] ret = bindings.ChannelPublicKeys_get_payment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_payment_point(ChannelPublicKeys this_ptr, byte[] val) { + bindings.ChannelPublicKeys_set_payment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_delayed_payment_basepoint(ChannelPublicKeys this_ptr) { + byte[] ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_delayed_payment_basepoint(ChannelPublicKeys this_ptr, byte[] val) { + bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_htlc_basepoint(ChannelPublicKeys this_ptr) { + byte[] ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_basepoint(ChannelPublicKeys this_ptr, byte[] val) { + bindings.ChannelPublicKeys_set_htlc_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ChannelPublicKeys(byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg) { + super(bindings.ChannelPublicKeys_new(funding_pubkey_arg, revocation_basepoint_arg, payment_point_arg, delayed_payment_basepoint_arg, htlc_basepoint_arg)); + } + + // Skipped ChannelPublicKeys_write + // Skipped ChannelPublicKeys_read +} diff --git a/src/main/java/org/ldk/structs/ChannelReestablish.java b/src/main/java/org/ldk/structs/ChannelReestablish.java new file mode 100644 index 00000000..172ccd0e --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelReestablish.java @@ -0,0 +1,53 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelReestablish extends CommonBase { + ChannelReestablish(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelReestablish_free(ptr); super.finalize(); + } + + public ChannelReestablish(ChannelReestablish orig) { + super(bindings.ChannelReestablish_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(ChannelReestablish this_ptr) { + byte[] ret = bindings.ChannelReestablish_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(ChannelReestablish this_ptr, byte[] val) { + bindings.ChannelReestablish_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_next_local_commitment_number(ChannelReestablish this_ptr) { + long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_next_local_commitment_number(ChannelReestablish this_ptr, long val) { + bindings.ChannelReestablish_set_next_local_commitment_number(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_next_remote_commitment_number(ChannelReestablish this_ptr) { + long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_next_remote_commitment_number(ChannelReestablish this_ptr, long val) { + bindings.ChannelReestablish_set_next_remote_commitment_number(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped ChannelReestablish_write + // Skipped ChannelReestablish_read +} diff --git a/src/main/java/org/ldk/structs/ChannelUpdate.java b/src/main/java/org/ldk/structs/ChannelUpdate.java new file mode 100644 index 00000000..8f5d60e7 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelUpdate.java @@ -0,0 +1,35 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ChannelUpdate extends CommonBase { + ChannelUpdate(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ChannelUpdate_free(ptr); super.finalize(); + } + + public ChannelUpdate(ChannelUpdate orig) { + super(bindings.ChannelUpdate_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + // Skipped ChannelUpdate_get_signature + // Skipped ChannelUpdate_set_signature + public UnsignedChannelUpdate get_contents(ChannelUpdate this_ptr) { + UnsignedChannelUpdate ret = new UnsignedChannelUpdate(null, bindings.ChannelUpdate_get_contents(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_contents(ChannelUpdate this_ptr, UnsignedChannelUpdate val) { + bindings.ChannelUpdate_set_contents(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped ChannelUpdate_new + // Skipped ChannelUpdate_write + // Skipped ChannelUpdate_read +} diff --git a/src/main/java/org/ldk/structs/ClosingSigned.java b/src/main/java/org/ldk/structs/ClosingSigned.java new file mode 100644 index 00000000..4b2e8454 --- /dev/null +++ b/src/main/java/org/ldk/structs/ClosingSigned.java @@ -0,0 +1,45 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ClosingSigned extends CommonBase { + ClosingSigned(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ClosingSigned_free(ptr); super.finalize(); + } + + public ClosingSigned(ClosingSigned orig) { + super(bindings.ClosingSigned_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(ClosingSigned this_ptr) { + byte[] ret = bindings.ClosingSigned_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(ClosingSigned this_ptr, byte[] val) { + bindings.ClosingSigned_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_fee_satoshis(ClosingSigned this_ptr) { + long ret = bindings.ClosingSigned_get_fee_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_fee_satoshis(ClosingSigned this_ptr, long val) { + bindings.ClosingSigned_set_fee_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped ClosingSigned_get_signature + // Skipped ClosingSigned_set_signature + // Skipped ClosingSigned_new + // Skipped ClosingSigned_write + // Skipped ClosingSigned_read +} diff --git a/src/main/java/org/ldk/structs/CommitmentSigned.java b/src/main/java/org/ldk/structs/CommitmentSigned.java new file mode 100644 index 00000000..1ac5af60 --- /dev/null +++ b/src/main/java/org/ldk/structs/CommitmentSigned.java @@ -0,0 +1,35 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class CommitmentSigned extends CommonBase { + CommitmentSigned(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.CommitmentSigned_free(ptr); super.finalize(); + } + + public CommitmentSigned(CommitmentSigned orig) { + super(bindings.CommitmentSigned_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(CommitmentSigned this_ptr) { + byte[] ret = bindings.CommitmentSigned_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(CommitmentSigned this_ptr, byte[] val) { + bindings.CommitmentSigned_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped CommitmentSigned_get_signature + // Skipped CommitmentSigned_set_signature + // Skipped CommitmentSigned_set_htlc_signatures + // Skipped CommitmentSigned_new + // Skipped CommitmentSigned_write + // Skipped CommitmentSigned_read +} diff --git a/src/main/java/org/ldk/structs/CommitmentUpdate.java b/src/main/java/org/ldk/structs/CommitmentUpdate.java new file mode 100644 index 00000000..d886689d --- /dev/null +++ b/src/main/java/org/ldk/structs/CommitmentUpdate.java @@ -0,0 +1,47 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class CommitmentUpdate extends CommonBase { + CommitmentUpdate(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.CommitmentUpdate_free(ptr); super.finalize(); + } + + public CommitmentUpdate(CommitmentUpdate orig) { + super(bindings.CommitmentUpdate_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + // Skipped CommitmentUpdate_set_update_add_htlcs + // Skipped CommitmentUpdate_set_update_fulfill_htlcs + // Skipped CommitmentUpdate_set_update_fail_htlcs + // Skipped CommitmentUpdate_set_update_fail_malformed_htlcs + public UpdateFee get_update_fee(CommitmentUpdate this_ptr) { + UpdateFee ret = new UpdateFee(null, bindings.CommitmentUpdate_get_update_fee(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_update_fee(CommitmentUpdate this_ptr, UpdateFee val) { + bindings.CommitmentUpdate_set_update_fee(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public CommitmentSigned get_commitment_signed(CommitmentUpdate this_ptr) { + CommitmentSigned ret = new CommitmentSigned(null, bindings.CommitmentUpdate_get_commitment_signed(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_commitment_signed(CommitmentUpdate this_ptr, CommitmentSigned val) { + bindings.CommitmentUpdate_set_commitment_signed(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped CommitmentUpdate_new +} diff --git a/src/main/java/org/ldk/structs/CommonBase.java b/src/main/java/org/ldk/structs/CommonBase.java new file mode 100644 index 00000000..42971b3f --- /dev/null +++ b/src/main/java/org/ldk/structs/CommonBase.java @@ -0,0 +1,8 @@ +package org.ldk.structs; +import java.util.LinkedList; +class CommonBase { + final long ptr; + LinkedList ptrs_to = new LinkedList(); + protected CommonBase(long ptr) { this.ptr = ptr; } + public long _test_only_get_ptr() { return this.ptr; } +} diff --git a/src/main/java/org/ldk/structs/DataLossProtect.java b/src/main/java/org/ldk/structs/DataLossProtect.java new file mode 100644 index 00000000..dc59351f --- /dev/null +++ b/src/main/java/org/ldk/structs/DataLossProtect.java @@ -0,0 +1,44 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class DataLossProtect extends CommonBase { + DataLossProtect(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.DataLossProtect_free(ptr); super.finalize(); + } + + public DataLossProtect(DataLossProtect orig) { + super(bindings.DataLossProtect_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_your_last_per_commitment_secret(DataLossProtect this_ptr) { + byte[] ret = bindings.DataLossProtect_get_your_last_per_commitment_secret(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_your_last_per_commitment_secret(DataLossProtect this_ptr, byte[] val) { + bindings.DataLossProtect_set_your_last_per_commitment_secret(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_my_current_per_commitment_point(DataLossProtect this_ptr) { + byte[] ret = bindings.DataLossProtect_get_my_current_per_commitment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_my_current_per_commitment_point(DataLossProtect this_ptr, byte[] val) { + bindings.DataLossProtect_set_my_current_per_commitment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public DataLossProtect(byte[] your_last_per_commitment_secret_arg, byte[] my_current_per_commitment_point_arg) { + super(bindings.DataLossProtect_new(your_last_per_commitment_secret_arg, my_current_per_commitment_point_arg)); + } + +} diff --git a/src/main/java/org/ldk/structs/DecodeError.java b/src/main/java/org/ldk/structs/DecodeError.java new file mode 100644 index 00000000..dddda197 --- /dev/null +++ b/src/main/java/org/ldk/structs/DecodeError.java @@ -0,0 +1,13 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class DecodeError extends CommonBase { + DecodeError(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.DecodeError_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/DirectionalChannelInfo.java b/src/main/java/org/ldk/structs/DirectionalChannelInfo.java new file mode 100644 index 00000000..a853dc62 --- /dev/null +++ b/src/main/java/org/ldk/structs/DirectionalChannelInfo.java @@ -0,0 +1,71 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class DirectionalChannelInfo extends CommonBase { + DirectionalChannelInfo(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.DirectionalChannelInfo_free(ptr); super.finalize(); + } + + public int get_last_update(DirectionalChannelInfo this_ptr) { + int ret = bindings.DirectionalChannelInfo_get_last_update(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_last_update(DirectionalChannelInfo this_ptr, int val) { + bindings.DirectionalChannelInfo_set_last_update(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public boolean get_enabled(DirectionalChannelInfo this_ptr) { + boolean ret = bindings.DirectionalChannelInfo_get_enabled(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_enabled(DirectionalChannelInfo this_ptr, boolean val) { + bindings.DirectionalChannelInfo_set_enabled(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_cltv_expiry_delta(DirectionalChannelInfo this_ptr) { + short ret = bindings.DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_cltv_expiry_delta(DirectionalChannelInfo this_ptr, short val) { + bindings.DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_minimum_msat(DirectionalChannelInfo this_ptr) { + long ret = bindings.DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_minimum_msat(DirectionalChannelInfo this_ptr, long val) { + bindings.DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ChannelUpdate get_last_update_message(DirectionalChannelInfo this_ptr) { + ChannelUpdate ret = new ChannelUpdate(null, bindings.DirectionalChannelInfo_get_last_update_message(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_last_update_message(DirectionalChannelInfo this_ptr, ChannelUpdate val) { + bindings.DirectionalChannelInfo_set_last_update_message(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped DirectionalChannelInfo_write + // Skipped DirectionalChannelInfo_read +} diff --git a/src/main/java/org/ldk/structs/ErrorMessage.java b/src/main/java/org/ldk/structs/ErrorMessage.java new file mode 100644 index 00000000..3cf08e61 --- /dev/null +++ b/src/main/java/org/ldk/structs/ErrorMessage.java @@ -0,0 +1,34 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ErrorMessage extends CommonBase { + ErrorMessage(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ErrorMessage_free(ptr); super.finalize(); + } + + public ErrorMessage(ErrorMessage orig) { + super(bindings.ErrorMessage_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(ErrorMessage this_ptr) { + byte[] ret = bindings.ErrorMessage_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(ErrorMessage this_ptr, byte[] val) { + bindings.ErrorMessage_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped ErrorMessage_get_data + // Skipped ErrorMessage_set_data + // Skipped ErrorMessage_new + // Skipped ErrorMessage_write + // Skipped ErrorMessage_read +} diff --git a/src/main/java/org/ldk/structs/EventsProvider.java b/src/main/java/org/ldk/structs/EventsProvider.java new file mode 100644 index 00000000..67bd2a5c --- /dev/null +++ b/src/main/java/org/ldk/structs/EventsProvider.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class EventsProvider extends CommonBase { + EventsProvider(Object _dummy, long ptr) { super(ptr); } + public EventsProvider(bindings.LDKEventsProvider arg) { + super(bindings.LDKEventsProvider_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.EventsProvider_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/FeeEstimator.java b/src/main/java/org/ldk/structs/FeeEstimator.java new file mode 100644 index 00000000..3959317b --- /dev/null +++ b/src/main/java/org/ldk/structs/FeeEstimator.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class FeeEstimator extends CommonBase { + FeeEstimator(Object _dummy, long ptr) { super(ptr); } + public FeeEstimator(bindings.LDKFeeEstimator arg) { + super(bindings.LDKFeeEstimator_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.FeeEstimator_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java new file mode 100644 index 00000000..19e74505 --- /dev/null +++ b/src/main/java/org/ldk/structs/Filter.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class Filter extends CommonBase { + Filter(Object _dummy, long ptr) { super(ptr); } + public Filter(bindings.LDKFilter arg) { + super(bindings.LDKFilter_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Filter_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/FundingCreated.java b/src/main/java/org/ldk/structs/FundingCreated.java new file mode 100644 index 00000000..0101c77f --- /dev/null +++ b/src/main/java/org/ldk/structs/FundingCreated.java @@ -0,0 +1,56 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class FundingCreated extends CommonBase { + FundingCreated(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.FundingCreated_free(ptr); super.finalize(); + } + + public FundingCreated(FundingCreated orig) { + super(bindings.FundingCreated_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_temporary_channel_id(FundingCreated this_ptr) { + byte[] ret = bindings.FundingCreated_get_temporary_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_temporary_channel_id(FundingCreated this_ptr, byte[] val) { + bindings.FundingCreated_set_temporary_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_funding_txid(FundingCreated this_ptr) { + byte[] ret = bindings.FundingCreated_get_funding_txid(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_funding_txid(FundingCreated this_ptr, byte[] val) { + bindings.FundingCreated_set_funding_txid(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_funding_output_index(FundingCreated this_ptr) { + short ret = bindings.FundingCreated_get_funding_output_index(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_funding_output_index(FundingCreated this_ptr, short val) { + bindings.FundingCreated_set_funding_output_index(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped FundingCreated_get_signature + // Skipped FundingCreated_set_signature + // Skipped FundingCreated_new + // Skipped FundingCreated_write + // Skipped FundingCreated_read +} diff --git a/src/main/java/org/ldk/structs/FundingLocked.java b/src/main/java/org/ldk/structs/FundingLocked.java new file mode 100644 index 00000000..0e7a157b --- /dev/null +++ b/src/main/java/org/ldk/structs/FundingLocked.java @@ -0,0 +1,46 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class FundingLocked extends CommonBase { + FundingLocked(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.FundingLocked_free(ptr); super.finalize(); + } + + public FundingLocked(FundingLocked orig) { + super(bindings.FundingLocked_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(FundingLocked this_ptr) { + byte[] ret = bindings.FundingLocked_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(FundingLocked this_ptr, byte[] val) { + bindings.FundingLocked_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_next_per_commitment_point(FundingLocked this_ptr) { + byte[] ret = bindings.FundingLocked_get_next_per_commitment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_next_per_commitment_point(FundingLocked this_ptr, byte[] val) { + bindings.FundingLocked_set_next_per_commitment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public FundingLocked(byte[] channel_id_arg, byte[] next_per_commitment_point_arg) { + super(bindings.FundingLocked_new(channel_id_arg, next_per_commitment_point_arg)); + } + + // Skipped FundingLocked_write + // Skipped FundingLocked_read +} diff --git a/src/main/java/org/ldk/structs/FundingSigned.java b/src/main/java/org/ldk/structs/FundingSigned.java new file mode 100644 index 00000000..468c0265 --- /dev/null +++ b/src/main/java/org/ldk/structs/FundingSigned.java @@ -0,0 +1,34 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class FundingSigned extends CommonBase { + FundingSigned(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.FundingSigned_free(ptr); super.finalize(); + } + + public FundingSigned(FundingSigned orig) { + super(bindings.FundingSigned_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(FundingSigned this_ptr) { + byte[] ret = bindings.FundingSigned_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(FundingSigned this_ptr, byte[] val) { + bindings.FundingSigned_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped FundingSigned_get_signature + // Skipped FundingSigned_set_signature + // Skipped FundingSigned_new + // Skipped FundingSigned_write + // Skipped FundingSigned_read +} diff --git a/src/main/java/org/ldk/structs/GossipTimestampFilter.java b/src/main/java/org/ldk/structs/GossipTimestampFilter.java new file mode 100644 index 00000000..9bac7c1f --- /dev/null +++ b/src/main/java/org/ldk/structs/GossipTimestampFilter.java @@ -0,0 +1,57 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class GossipTimestampFilter extends CommonBase { + GossipTimestampFilter(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.GossipTimestampFilter_free(ptr); super.finalize(); + } + + public GossipTimestampFilter(GossipTimestampFilter orig) { + super(bindings.GossipTimestampFilter_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_chain_hash(GossipTimestampFilter this_ptr) { + byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(GossipTimestampFilter this_ptr, byte[] val) { + bindings.GossipTimestampFilter_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_first_timestamp(GossipTimestampFilter this_ptr) { + int ret = bindings.GossipTimestampFilter_get_first_timestamp(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_first_timestamp(GossipTimestampFilter this_ptr, int val) { + bindings.GossipTimestampFilter_set_first_timestamp(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_timestamp_range(GossipTimestampFilter this_ptr) { + int ret = bindings.GossipTimestampFilter_get_timestamp_range(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_timestamp_range(GossipTimestampFilter this_ptr, int val) { + bindings.GossipTimestampFilter_set_timestamp_range(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public GossipTimestampFilter(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) { + super(bindings.GossipTimestampFilter_new(chain_hash_arg, first_timestamp_arg, timestamp_range_arg)); + } + + // Skipped GossipTimestampFilter_read + // Skipped GossipTimestampFilter_write +} diff --git a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java new file mode 100644 index 00000000..3f4479b7 --- /dev/null +++ b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java @@ -0,0 +1,64 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class HTLCOutputInCommitment extends CommonBase { + HTLCOutputInCommitment(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.HTLCOutputInCommitment_free(ptr); super.finalize(); + } + + public HTLCOutputInCommitment(HTLCOutputInCommitment orig) { + super(bindings.HTLCOutputInCommitment_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public boolean get_offered(HTLCOutputInCommitment this_ptr) { + boolean ret = bindings.HTLCOutputInCommitment_get_offered(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_offered(HTLCOutputInCommitment this_ptr, boolean val) { + bindings.HTLCOutputInCommitment_set_offered(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_amount_msat(HTLCOutputInCommitment this_ptr) { + long ret = bindings.HTLCOutputInCommitment_get_amount_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_amount_msat(HTLCOutputInCommitment this_ptr, long val) { + bindings.HTLCOutputInCommitment_set_amount_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_cltv_expiry(HTLCOutputInCommitment this_ptr) { + int ret = bindings.HTLCOutputInCommitment_get_cltv_expiry(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_cltv_expiry(HTLCOutputInCommitment this_ptr, int val) { + bindings.HTLCOutputInCommitment_set_cltv_expiry(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_payment_hash(HTLCOutputInCommitment this_ptr) { + byte[] ret = bindings.HTLCOutputInCommitment_get_payment_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_payment_hash(HTLCOutputInCommitment this_ptr, byte[] val) { + bindings.HTLCOutputInCommitment_set_payment_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped HTLCOutputInCommitment_write + // Skipped HTLCOutputInCommitment_read +} diff --git a/src/main/java/org/ldk/structs/HTLCUpdate.java b/src/main/java/org/ldk/structs/HTLCUpdate.java new file mode 100644 index 00000000..3912c308 --- /dev/null +++ b/src/main/java/org/ldk/structs/HTLCUpdate.java @@ -0,0 +1,20 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class HTLCUpdate extends CommonBase { + HTLCUpdate(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.HTLCUpdate_free(ptr); super.finalize(); + } + + public HTLCUpdate(HTLCUpdate orig) { + super(bindings.HTLCUpdate_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + // Skipped HTLCUpdate_write + // Skipped HTLCUpdate_read +} diff --git a/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java b/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java new file mode 100644 index 00000000..78fe05c0 --- /dev/null +++ b/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java @@ -0,0 +1,49 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class HolderCommitmentTransaction extends CommonBase { + HolderCommitmentTransaction(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.HolderCommitmentTransaction_free(ptr); super.finalize(); + } + + public HolderCommitmentTransaction(HolderCommitmentTransaction orig) { + super(bindings.HolderCommitmentTransaction_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + // Skipped HolderCommitmentTransaction_get_unsigned_tx + // Skipped HolderCommitmentTransaction_set_unsigned_tx + // Skipped HolderCommitmentTransaction_get_counterparty_sig + // Skipped HolderCommitmentTransaction_set_counterparty_sig + public int get_feerate_per_kw(HolderCommitmentTransaction this_ptr) { + int ret = bindings.HolderCommitmentTransaction_get_feerate_per_kw(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_feerate_per_kw(HolderCommitmentTransaction this_ptr, int val) { + bindings.HolderCommitmentTransaction_set_feerate_per_kw(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped HolderCommitmentTransaction_set_per_htlc + // Skipped HolderCommitmentTransaction_new_missing_holder_sig + public TxCreationKeys trust_key_derivation() { + TxCreationKeys ret = new TxCreationKeys(null, bindings.HolderCommitmentTransaction_trust_key_derivation(this.ptr)); + return ret; + } + + public byte[] txid() { + byte[] ret = bindings.HolderCommitmentTransaction_txid(this.ptr); + return ret; + } + + // Skipped HolderCommitmentTransaction_get_holder_sig + // Skipped HolderCommitmentTransaction_get_htlc_sigs + // Skipped HolderCommitmentTransaction_write + // Skipped HolderCommitmentTransaction_read +} diff --git a/src/main/java/org/ldk/structs/InMemoryChannelKeys.java b/src/main/java/org/ldk/structs/InMemoryChannelKeys.java new file mode 100644 index 00000000..6ebd0d79 --- /dev/null +++ b/src/main/java/org/ldk/structs/InMemoryChannelKeys.java @@ -0,0 +1,88 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class InMemoryChannelKeys extends CommonBase { + InMemoryChannelKeys(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.InMemoryChannelKeys_free(ptr); super.finalize(); + } + + public InMemoryChannelKeys(InMemoryChannelKeys orig) { + super(bindings.InMemoryChannelKeys_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_funding_key(InMemoryChannelKeys this_ptr) { + byte[] ret = bindings.InMemoryChannelKeys_get_funding_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + // Skipped InMemoryChannelKeys_set_funding_key + public byte[] get_revocation_base_key(InMemoryChannelKeys this_ptr) { + byte[] ret = bindings.InMemoryChannelKeys_get_revocation_base_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + // Skipped InMemoryChannelKeys_set_revocation_base_key + public byte[] get_payment_key(InMemoryChannelKeys this_ptr) { + byte[] ret = bindings.InMemoryChannelKeys_get_payment_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + // Skipped InMemoryChannelKeys_set_payment_key + public byte[] get_delayed_payment_base_key(InMemoryChannelKeys this_ptr) { + byte[] ret = bindings.InMemoryChannelKeys_get_delayed_payment_base_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + // Skipped InMemoryChannelKeys_set_delayed_payment_base_key + public byte[] get_htlc_base_key(InMemoryChannelKeys this_ptr) { + byte[] ret = bindings.InMemoryChannelKeys_get_htlc_base_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + // Skipped InMemoryChannelKeys_set_htlc_base_key + public byte[] get_commitment_seed(InMemoryChannelKeys this_ptr) { + byte[] ret = bindings.InMemoryChannelKeys_get_commitment_seed(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_commitment_seed(InMemoryChannelKeys this_ptr, byte[] val) { + bindings.InMemoryChannelKeys_set_commitment_seed(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped InMemoryChannelKeys_new + public ChannelPublicKeys counterparty_pubkeys() { + ChannelPublicKeys ret = new ChannelPublicKeys(null, bindings.InMemoryChannelKeys_counterparty_pubkeys(this.ptr)); + return ret; + } + + public short counterparty_selected_contest_delay() { + short ret = bindings.InMemoryChannelKeys_counterparty_selected_contest_delay(this.ptr); + return ret; + } + + public short holder_selected_contest_delay() { + short ret = bindings.InMemoryChannelKeys_holder_selected_contest_delay(this.ptr); + return ret; + } + + public ChannelKeys as_ChannelKeys() { + ChannelKeys ret = new ChannelKeys(null, bindings.InMemoryChannelKeys_as_ChannelKeys(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + + // Skipped InMemoryChannelKeys_write + // Skipped InMemoryChannelKeys_read +} diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java new file mode 100644 index 00000000..3fae2a16 --- /dev/null +++ b/src/main/java/org/ldk/structs/Init.java @@ -0,0 +1,15 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class Init extends CommonBase { + Init(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Init_free(ptr); super.finalize(); + } + + // Skipped Init_write + // Skipped Init_read +} diff --git a/src/main/java/org/ldk/structs/InitFeatures.java b/src/main/java/org/ldk/structs/InitFeatures.java new file mode 100644 index 00000000..153f088f --- /dev/null +++ b/src/main/java/org/ldk/structs/InitFeatures.java @@ -0,0 +1,13 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class InitFeatures extends CommonBase { + InitFeatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.InitFeatures_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/KeysInterface.java b/src/main/java/org/ldk/structs/KeysInterface.java new file mode 100644 index 00000000..f38ee6ab --- /dev/null +++ b/src/main/java/org/ldk/structs/KeysInterface.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class KeysInterface extends CommonBase { + KeysInterface(Object _dummy, long ptr) { super(ptr); } + public KeysInterface(bindings.LDKKeysInterface arg) { + super(bindings.LDKKeysInterface_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.KeysInterface_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/KeysManager.java b/src/main/java/org/ldk/structs/KeysManager.java new file mode 100644 index 00000000..ca95138e --- /dev/null +++ b/src/main/java/org/ldk/structs/KeysManager.java @@ -0,0 +1,28 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class KeysManager extends CommonBase { + KeysManager(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.KeysManager_free(ptr); super.finalize(); + } + + public KeysManager(byte[] seed, LDKNetwork network, long starting_time_secs, int starting_time_nanos) { + super(bindings.KeysManager_new(seed, network, starting_time_secs, starting_time_nanos)); + } + + public InMemoryChannelKeys derive_channel_keys(long channel_value_satoshis, long params_1, long params_2) { + InMemoryChannelKeys ret = new InMemoryChannelKeys(null, bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, params_1, params_2)); + return ret; + } + + public KeysInterface as_KeysInterface() { + KeysInterface ret = new KeysInterface(null, bindings.KeysManager_as_KeysInterface(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java new file mode 100644 index 00000000..5f7391f6 --- /dev/null +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -0,0 +1,18 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class LightningError extends CommonBase { + LightningError(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.LightningError_free(ptr); super.finalize(); + } + + // Skipped LightningError_get_err + // Skipped LightningError_set_err + // Skipped LightningError_get_action + // Skipped LightningError_set_action + // Skipped LightningError_new +} diff --git a/src/main/java/org/ldk/structs/LockedNetworkGraph.java b/src/main/java/org/ldk/structs/LockedNetworkGraph.java new file mode 100644 index 00000000..3f1684a9 --- /dev/null +++ b/src/main/java/org/ldk/structs/LockedNetworkGraph.java @@ -0,0 +1,18 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class LockedNetworkGraph extends CommonBase { + LockedNetworkGraph(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.LockedNetworkGraph_free(ptr); super.finalize(); + } + + public NetworkGraph graph() { + NetworkGraph ret = new NetworkGraph(null, bindings.LockedNetworkGraph_graph(this.ptr)); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/Logger.java b/src/main/java/org/ldk/structs/Logger.java new file mode 100644 index 00000000..d9c71b88 --- /dev/null +++ b/src/main/java/org/ldk/structs/Logger.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class Logger extends CommonBase { + Logger(Object _dummy, long ptr) { super(ptr); } + public Logger(bindings.LDKLogger arg) { + super(bindings.LDKLogger_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Logger_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/MessageHandler.java b/src/main/java/org/ldk/structs/MessageHandler.java new file mode 100644 index 00000000..32fc51a3 --- /dev/null +++ b/src/main/java/org/ldk/structs/MessageHandler.java @@ -0,0 +1,45 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class MessageHandler extends CommonBase { + MessageHandler(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.MessageHandler_free(ptr); super.finalize(); + } + + public ChannelMessageHandler get_chan_handler(MessageHandler this_ptr) { + ChannelMessageHandler ret = new ChannelMessageHandler(null, bindings.MessageHandler_get_chan_handler(this_ptr.ptr & ~1)); + ret.ptrs_to.add(this); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chan_handler(MessageHandler this_ptr, ChannelMessageHandler val) { + bindings.MessageHandler_set_chan_handler(this_ptr.ptr & ~1, val.ptr); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public RoutingMessageHandler get_route_handler(MessageHandler this_ptr) { + RoutingMessageHandler ret = new RoutingMessageHandler(null, bindings.MessageHandler_get_route_handler(this_ptr.ptr & ~1)); + ret.ptrs_to.add(this); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_route_handler(MessageHandler this_ptr, RoutingMessageHandler val) { + bindings.MessageHandler_set_route_handler(this_ptr.ptr & ~1, val.ptr); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public MessageHandler(ChannelMessageHandler chan_handler_arg, RoutingMessageHandler route_handler_arg) { + super(bindings.MessageHandler_new(chan_handler_arg.ptr, route_handler_arg.ptr)); + this.ptrs_to.add(chan_handler_arg); + this.ptrs_to.add(route_handler_arg); + } + +} diff --git a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java new file mode 100644 index 00000000..5f2d952c --- /dev/null +++ b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class MessageSendEventsProvider extends CommonBase { + MessageSendEventsProvider(Object _dummy, long ptr) { super(ptr); } + public MessageSendEventsProvider(bindings.LDKMessageSendEventsProvider arg) { + super(bindings.LDKMessageSendEventsProvider_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.MessageSendEventsProvider_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/MonitorEvent.java b/src/main/java/org/ldk/structs/MonitorEvent.java new file mode 100644 index 00000000..d4259054 --- /dev/null +++ b/src/main/java/org/ldk/structs/MonitorEvent.java @@ -0,0 +1,13 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class MonitorEvent extends CommonBase { + MonitorEvent(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.MonitorEvent_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/MonitorUpdateError.java b/src/main/java/org/ldk/structs/MonitorUpdateError.java new file mode 100644 index 00000000..f56c45a5 --- /dev/null +++ b/src/main/java/org/ldk/structs/MonitorUpdateError.java @@ -0,0 +1,13 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class MonitorUpdateError extends CommonBase { + MonitorUpdateError(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.MonitorUpdateError_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/NetGraphMsgHandler.java b/src/main/java/org/ldk/structs/NetGraphMsgHandler.java new file mode 100644 index 00000000..c873c852 --- /dev/null +++ b/src/main/java/org/ldk/structs/NetGraphMsgHandler.java @@ -0,0 +1,37 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class NetGraphMsgHandler extends CommonBase { + NetGraphMsgHandler(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.NetGraphMsgHandler_free(ptr); super.finalize(); + } + + public NetGraphMsgHandler(Access chain_access, Logger logger) { + super(bindings.NetGraphMsgHandler_new(chain_access.ptr, logger.ptr)); + this.ptrs_to.add(chain_access); + this.ptrs_to.add(logger); + } + + public NetGraphMsgHandler(Access chain_access, Logger logger, NetworkGraph network_graph) { + super(bindings.NetGraphMsgHandler_from_net_graph(chain_access.ptr, logger.ptr, network_graph.ptr & ~1)); + this.ptrs_to.add(chain_access); + this.ptrs_to.add(logger); + this.ptrs_to.add(network_graph); + } + + public LockedNetworkGraph read_locked_graph() { + LockedNetworkGraph ret = new LockedNetworkGraph(null, bindings.NetGraphMsgHandler_read_locked_graph(this.ptr)); + return ret; + } + + public RoutingMessageHandler as_RoutingMessageHandler() { + RoutingMessageHandler ret = new RoutingMessageHandler(null, bindings.NetGraphMsgHandler_as_RoutingMessageHandler(this.ptr)); + ret.ptrs_to.add(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java new file mode 100644 index 00000000..0bb25757 --- /dev/null +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -0,0 +1,23 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class NetworkGraph extends CommonBase { + NetworkGraph(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.NetworkGraph_free(ptr); super.finalize(); + } + + // Skipped NetworkGraph_write + // Skipped NetworkGraph_read + public NetworkGraph() { + super(bindings.NetworkGraph_new()); + } + + public void close_channel_from_update(long short_channel_id, boolean is_permanent) { + bindings.NetworkGraph_close_channel_from_update(this.ptr, short_channel_id, is_permanent); + } + +} diff --git a/src/main/java/org/ldk/structs/NodeAnnouncement.java b/src/main/java/org/ldk/structs/NodeAnnouncement.java new file mode 100644 index 00000000..46123a79 --- /dev/null +++ b/src/main/java/org/ldk/structs/NodeAnnouncement.java @@ -0,0 +1,35 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class NodeAnnouncement extends CommonBase { + NodeAnnouncement(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.NodeAnnouncement_free(ptr); super.finalize(); + } + + public NodeAnnouncement(NodeAnnouncement orig) { + super(bindings.NodeAnnouncement_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + // Skipped NodeAnnouncement_get_signature + // Skipped NodeAnnouncement_set_signature + public UnsignedNodeAnnouncement get_contents(NodeAnnouncement this_ptr) { + UnsignedNodeAnnouncement ret = new UnsignedNodeAnnouncement(null, bindings.NodeAnnouncement_get_contents(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_contents(NodeAnnouncement this_ptr, UnsignedNodeAnnouncement val) { + bindings.NodeAnnouncement_set_contents(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped NodeAnnouncement_new + // Skipped NodeAnnouncement_write + // Skipped NodeAnnouncement_read +} diff --git a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java new file mode 100644 index 00000000..b6e1a0a0 --- /dev/null +++ b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java @@ -0,0 +1,70 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class NodeAnnouncementInfo extends CommonBase { + NodeAnnouncementInfo(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.NodeAnnouncementInfo_free(ptr); super.finalize(); + } + + public NodeFeatures get_features(NodeAnnouncementInfo this_ptr) { + NodeFeatures ret = new NodeFeatures(null, bindings.NodeAnnouncementInfo_get_features(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_features(NodeAnnouncementInfo this_ptr, NodeFeatures val) { + bindings.NodeAnnouncementInfo_set_features(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public int get_last_update(NodeAnnouncementInfo this_ptr) { + int ret = bindings.NodeAnnouncementInfo_get_last_update(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_last_update(NodeAnnouncementInfo this_ptr, int val) { + bindings.NodeAnnouncementInfo_set_last_update(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_rgb(NodeAnnouncementInfo this_ptr) { + byte[] ret = bindings.NodeAnnouncementInfo_get_rgb(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + // Skipped NodeAnnouncementInfo_set_rgb + public byte[] get_alias(NodeAnnouncementInfo this_ptr) { + byte[] ret = bindings.NodeAnnouncementInfo_get_alias(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_alias(NodeAnnouncementInfo this_ptr, byte[] val) { + bindings.NodeAnnouncementInfo_set_alias(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped NodeAnnouncementInfo_set_addresses + public NodeAnnouncement get_announcement_message(NodeAnnouncementInfo this_ptr) { + NodeAnnouncement ret = new NodeAnnouncement(null, bindings.NodeAnnouncementInfo_get_announcement_message(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_announcement_message(NodeAnnouncementInfo this_ptr, NodeAnnouncement val) { + bindings.NodeAnnouncementInfo_set_announcement_message(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped NodeAnnouncementInfo_new + // Skipped NodeAnnouncementInfo_write + // Skipped NodeAnnouncementInfo_read +} diff --git a/src/main/java/org/ldk/structs/NodeFeatures.java b/src/main/java/org/ldk/structs/NodeFeatures.java new file mode 100644 index 00000000..fe418ad3 --- /dev/null +++ b/src/main/java/org/ldk/structs/NodeFeatures.java @@ -0,0 +1,13 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class NodeFeatures extends CommonBase { + NodeFeatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.NodeFeatures_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/NodeInfo.java b/src/main/java/org/ldk/structs/NodeInfo.java new file mode 100644 index 00000000..5f15e82e --- /dev/null +++ b/src/main/java/org/ldk/structs/NodeInfo.java @@ -0,0 +1,41 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class NodeInfo extends CommonBase { + NodeInfo(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.NodeInfo_free(ptr); super.finalize(); + } + + // Skipped NodeInfo_set_channels + public RoutingFees get_lowest_inbound_channel_fees(NodeInfo this_ptr) { + RoutingFees ret = new RoutingFees(null, bindings.NodeInfo_get_lowest_inbound_channel_fees(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_lowest_inbound_channel_fees(NodeInfo this_ptr, RoutingFees val) { + bindings.NodeInfo_set_lowest_inbound_channel_fees(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public NodeAnnouncementInfo get_announcement_info(NodeInfo this_ptr) { + NodeAnnouncementInfo ret = new NodeAnnouncementInfo(null, bindings.NodeInfo_get_announcement_info(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_announcement_info(NodeInfo this_ptr, NodeAnnouncementInfo val) { + bindings.NodeInfo_set_announcement_info(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + // Skipped NodeInfo_new + // Skipped NodeInfo_write + // Skipped NodeInfo_read +} diff --git a/src/main/java/org/ldk/structs/OpenChannel.java b/src/main/java/org/ldk/structs/OpenChannel.java new file mode 100644 index 00000000..e0c5e8b3 --- /dev/null +++ b/src/main/java/org/ldk/structs/OpenChannel.java @@ -0,0 +1,218 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class OpenChannel extends CommonBase { + OpenChannel(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.OpenChannel_free(ptr); super.finalize(); + } + + public OpenChannel(OpenChannel orig) { + super(bindings.OpenChannel_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_chain_hash(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_temporary_channel_id(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_temporary_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_temporary_channel_id(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_temporary_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_funding_satoshis(OpenChannel this_ptr) { + long ret = bindings.OpenChannel_get_funding_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_funding_satoshis(OpenChannel this_ptr, long val) { + bindings.OpenChannel_set_funding_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_push_msat(OpenChannel this_ptr) { + long ret = bindings.OpenChannel_get_push_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_push_msat(OpenChannel this_ptr, long val) { + bindings.OpenChannel_set_push_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_dust_limit_satoshis(OpenChannel this_ptr) { + long ret = bindings.OpenChannel_get_dust_limit_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_dust_limit_satoshis(OpenChannel this_ptr, long val) { + bindings.OpenChannel_set_dust_limit_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_max_htlc_value_in_flight_msat(OpenChannel this_ptr) { + long ret = bindings.OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_htlc_value_in_flight_msat(OpenChannel this_ptr, long val) { + bindings.OpenChannel_set_max_htlc_value_in_flight_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_channel_reserve_satoshis(OpenChannel this_ptr) { + long ret = bindings.OpenChannel_get_channel_reserve_satoshis(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_reserve_satoshis(OpenChannel this_ptr, long val) { + bindings.OpenChannel_set_channel_reserve_satoshis(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_minimum_msat(OpenChannel this_ptr) { + long ret = bindings.OpenChannel_get_htlc_minimum_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_minimum_msat(OpenChannel this_ptr, long val) { + bindings.OpenChannel_set_htlc_minimum_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_feerate_per_kw(OpenChannel this_ptr) { + int ret = bindings.OpenChannel_get_feerate_per_kw(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_feerate_per_kw(OpenChannel this_ptr, int val) { + bindings.OpenChannel_set_feerate_per_kw(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_to_self_delay(OpenChannel this_ptr) { + short ret = bindings.OpenChannel_get_to_self_delay(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_to_self_delay(OpenChannel this_ptr, short val) { + bindings.OpenChannel_set_to_self_delay(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_max_accepted_htlcs(OpenChannel this_ptr) { + short ret = bindings.OpenChannel_get_max_accepted_htlcs(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_max_accepted_htlcs(OpenChannel this_ptr, short val) { + bindings.OpenChannel_set_max_accepted_htlcs(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_funding_pubkey(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_funding_pubkey(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_funding_pubkey(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_funding_pubkey(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_revocation_basepoint(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_revocation_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_revocation_basepoint(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_revocation_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_payment_point(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_payment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_payment_point(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_payment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_delayed_payment_basepoint(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_delayed_payment_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_delayed_payment_basepoint(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_delayed_payment_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_htlc_basepoint(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_htlc_basepoint(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_basepoint(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_htlc_basepoint(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_first_per_commitment_point(OpenChannel this_ptr) { + byte[] ret = bindings.OpenChannel_get_first_per_commitment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_first_per_commitment_point(OpenChannel this_ptr, byte[] val) { + bindings.OpenChannel_set_first_per_commitment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte get_channel_flags(OpenChannel this_ptr) { + byte ret = bindings.OpenChannel_get_channel_flags(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_flags(OpenChannel this_ptr, byte val) { + bindings.OpenChannel_set_channel_flags(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped OpenChannel_write + // Skipped OpenChannel_read +} diff --git a/src/main/java/org/ldk/structs/OutPoint.java b/src/main/java/org/ldk/structs/OutPoint.java new file mode 100644 index 00000000..071bc1ea --- /dev/null +++ b/src/main/java/org/ldk/structs/OutPoint.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class OutPoint extends CommonBase { + OutPoint(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.OutPoint_free(ptr); super.finalize(); + } + + public OutPoint(OutPoint orig) { + super(bindings.OutPoint_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_txid(OutPoint this_ptr) { + byte[] ret = bindings.OutPoint_get_txid(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_txid(OutPoint this_ptr, byte[] val) { + bindings.OutPoint_set_txid(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_index(OutPoint this_ptr) { + short ret = bindings.OutPoint_get_index(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_index(OutPoint this_ptr, short val) { + bindings.OutPoint_set_index(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public OutPoint(byte[] txid_arg, short index_arg) { + super(bindings.OutPoint_new(txid_arg, index_arg)); + } + + public byte[] to_channel_id() { + byte[] ret = bindings.OutPoint_to_channel_id(this.ptr); + return ret; + } + + // Skipped OutPoint_write + // Skipped OutPoint_read +} diff --git a/src/main/java/org/ldk/structs/PaymentSendFailure.java b/src/main/java/org/ldk/structs/PaymentSendFailure.java new file mode 100644 index 00000000..7eb6a56a --- /dev/null +++ b/src/main/java/org/ldk/structs/PaymentSendFailure.java @@ -0,0 +1,13 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class PaymentSendFailure extends CommonBase { + PaymentSendFailure(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.PaymentSendFailure_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/PeerHandleError.java b/src/main/java/org/ldk/structs/PeerHandleError.java new file mode 100644 index 00000000..391cb470 --- /dev/null +++ b/src/main/java/org/ldk/structs/PeerHandleError.java @@ -0,0 +1,28 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class PeerHandleError extends CommonBase { + PeerHandleError(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.PeerHandleError_free(ptr); super.finalize(); + } + + public boolean get_no_connection_possible(PeerHandleError this_ptr) { + boolean ret = bindings.PeerHandleError_get_no_connection_possible(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_no_connection_possible(PeerHandleError this_ptr, boolean val) { + bindings.PeerHandleError_set_no_connection_possible(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public PeerHandleError(boolean no_connection_possible_arg) { + super(bindings.PeerHandleError_new(no_connection_possible_arg)); + } + +} diff --git a/src/main/java/org/ldk/structs/PeerManager.java b/src/main/java/org/ldk/structs/PeerManager.java new file mode 100644 index 00000000..a8d7245e --- /dev/null +++ b/src/main/java/org/ldk/structs/PeerManager.java @@ -0,0 +1,32 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class PeerManager extends CommonBase { + PeerManager(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.PeerManager_free(ptr); super.finalize(); + } + + // Skipped PeerManager_new + // Skipped PeerManager_get_peer_node_ids + // Skipped PeerManager_new_outbound_connection + // Skipped PeerManager_new_inbound_connection + // Skipped PeerManager_write_buffer_space_avail + // Skipped PeerManager_read_event + public void process_events() { + bindings.PeerManager_process_events(this.ptr); + } + + public void socket_disconnected(SocketDescriptor descriptor) { + bindings.PeerManager_socket_disconnected(this.ptr, descriptor.ptr); + this.ptrs_to.add(descriptor); + } + + public void timer_tick_occured() { + bindings.PeerManager_timer_tick_occured(this.ptr); + } + +} diff --git a/src/main/java/org/ldk/structs/Ping.java b/src/main/java/org/ldk/structs/Ping.java new file mode 100644 index 00000000..860b2abe --- /dev/null +++ b/src/main/java/org/ldk/structs/Ping.java @@ -0,0 +1,41 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class Ping extends CommonBase { + Ping(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Ping_free(ptr); super.finalize(); + } + + public short get_ponglen(Ping this_ptr) { + short ret = bindings.Ping_get_ponglen(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_ponglen(Ping this_ptr, short val) { + bindings.Ping_set_ponglen(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_byteslen(Ping this_ptr) { + short ret = bindings.Ping_get_byteslen(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_byteslen(Ping this_ptr, short val) { + bindings.Ping_set_byteslen(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public Ping(short ponglen_arg, short byteslen_arg) { + super(bindings.Ping_new(ponglen_arg, byteslen_arg)); + } + + // Skipped Ping_write + // Skipped Ping_read +} diff --git a/src/main/java/org/ldk/structs/Pong.java b/src/main/java/org/ldk/structs/Pong.java new file mode 100644 index 00000000..c27d864d --- /dev/null +++ b/src/main/java/org/ldk/structs/Pong.java @@ -0,0 +1,30 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class Pong extends CommonBase { + Pong(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Pong_free(ptr); super.finalize(); + } + + public short get_byteslen(Pong this_ptr) { + short ret = bindings.Pong_get_byteslen(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_byteslen(Pong this_ptr, short val) { + bindings.Pong_set_byteslen(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public Pong(short byteslen_arg) { + super(bindings.Pong_new(byteslen_arg)); + } + + // Skipped Pong_write + // Skipped Pong_read +} diff --git a/src/main/java/org/ldk/structs/PreCalculatedTxCreationKeys.java b/src/main/java/org/ldk/structs/PreCalculatedTxCreationKeys.java new file mode 100644 index 00000000..45c8c29e --- /dev/null +++ b/src/main/java/org/ldk/structs/PreCalculatedTxCreationKeys.java @@ -0,0 +1,28 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class PreCalculatedTxCreationKeys extends CommonBase { + PreCalculatedTxCreationKeys(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.PreCalculatedTxCreationKeys_free(ptr); super.finalize(); + } + + public PreCalculatedTxCreationKeys(TxCreationKeys keys) { + super(bindings.PreCalculatedTxCreationKeys_new(keys.ptr & ~1)); + this.ptrs_to.add(keys); + } + + public TxCreationKeys trust_key_derivation() { + TxCreationKeys ret = new TxCreationKeys(null, bindings.PreCalculatedTxCreationKeys_trust_key_derivation(this.ptr)); + return ret; + } + + public byte[] per_commitment_point() { + byte[] ret = bindings.PreCalculatedTxCreationKeys_per_commitment_point(this.ptr); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/QueryChannelRange.java b/src/main/java/org/ldk/structs/QueryChannelRange.java new file mode 100644 index 00000000..64ba67b9 --- /dev/null +++ b/src/main/java/org/ldk/structs/QueryChannelRange.java @@ -0,0 +1,57 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class QueryChannelRange extends CommonBase { + QueryChannelRange(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.QueryChannelRange_free(ptr); super.finalize(); + } + + public QueryChannelRange(QueryChannelRange orig) { + super(bindings.QueryChannelRange_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_chain_hash(QueryChannelRange this_ptr) { + byte[] ret = bindings.QueryChannelRange_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(QueryChannelRange this_ptr, byte[] val) { + bindings.QueryChannelRange_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_first_blocknum(QueryChannelRange this_ptr) { + int ret = bindings.QueryChannelRange_get_first_blocknum(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_first_blocknum(QueryChannelRange this_ptr, int val) { + bindings.QueryChannelRange_set_first_blocknum(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_number_of_blocks(QueryChannelRange this_ptr) { + int ret = bindings.QueryChannelRange_get_number_of_blocks(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_number_of_blocks(QueryChannelRange this_ptr, int val) { + bindings.QueryChannelRange_set_number_of_blocks(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public QueryChannelRange(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg) { + super(bindings.QueryChannelRange_new(chain_hash_arg, first_blocknum_arg, number_of_blocks_arg)); + } + + // Skipped QueryChannelRange_read + // Skipped QueryChannelRange_write +} diff --git a/src/main/java/org/ldk/structs/QueryShortChannelIds.java b/src/main/java/org/ldk/structs/QueryShortChannelIds.java new file mode 100644 index 00000000..89654085 --- /dev/null +++ b/src/main/java/org/ldk/structs/QueryShortChannelIds.java @@ -0,0 +1,33 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class QueryShortChannelIds extends CommonBase { + QueryShortChannelIds(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.QueryShortChannelIds_free(ptr); super.finalize(); + } + + public QueryShortChannelIds(QueryShortChannelIds orig) { + super(bindings.QueryShortChannelIds_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_chain_hash(QueryShortChannelIds this_ptr) { + byte[] ret = bindings.QueryShortChannelIds_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(QueryShortChannelIds this_ptr, byte[] val) { + bindings.QueryShortChannelIds_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped QueryShortChannelIds_set_short_channel_ids + // Skipped QueryShortChannelIds_new + // Skipped QueryShortChannelIds_read + // Skipped QueryShortChannelIds_write +} diff --git a/src/main/java/org/ldk/structs/ReplyChannelRange.java b/src/main/java/org/ldk/structs/ReplyChannelRange.java new file mode 100644 index 00000000..a02c992b --- /dev/null +++ b/src/main/java/org/ldk/structs/ReplyChannelRange.java @@ -0,0 +1,66 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ReplyChannelRange extends CommonBase { + ReplyChannelRange(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ReplyChannelRange_free(ptr); super.finalize(); + } + + public ReplyChannelRange(ReplyChannelRange orig) { + super(bindings.ReplyChannelRange_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_chain_hash(ReplyChannelRange this_ptr) { + byte[] ret = bindings.ReplyChannelRange_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(ReplyChannelRange this_ptr, byte[] val) { + bindings.ReplyChannelRange_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_first_blocknum(ReplyChannelRange this_ptr) { + int ret = bindings.ReplyChannelRange_get_first_blocknum(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_first_blocknum(ReplyChannelRange this_ptr, int val) { + bindings.ReplyChannelRange_set_first_blocknum(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_number_of_blocks(ReplyChannelRange this_ptr) { + int ret = bindings.ReplyChannelRange_get_number_of_blocks(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_number_of_blocks(ReplyChannelRange this_ptr, int val) { + bindings.ReplyChannelRange_set_number_of_blocks(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public boolean get_full_information(ReplyChannelRange this_ptr) { + boolean ret = bindings.ReplyChannelRange_get_full_information(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_full_information(ReplyChannelRange this_ptr, boolean val) { + bindings.ReplyChannelRange_set_full_information(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped ReplyChannelRange_set_short_channel_ids + // Skipped ReplyChannelRange_new + // Skipped ReplyChannelRange_read + // Skipped ReplyChannelRange_write +} diff --git a/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java new file mode 100644 index 00000000..f0639009 --- /dev/null +++ b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java @@ -0,0 +1,46 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class ReplyShortChannelIdsEnd extends CommonBase { + ReplyShortChannelIdsEnd(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.ReplyShortChannelIdsEnd_free(ptr); super.finalize(); + } + + public ReplyShortChannelIdsEnd(ReplyShortChannelIdsEnd orig) { + super(bindings.ReplyShortChannelIdsEnd_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_chain_hash(ReplyShortChannelIdsEnd this_ptr) { + byte[] ret = bindings.ReplyShortChannelIdsEnd_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(ReplyShortChannelIdsEnd this_ptr, byte[] val) { + bindings.ReplyShortChannelIdsEnd_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public boolean get_full_information(ReplyShortChannelIdsEnd this_ptr) { + boolean ret = bindings.ReplyShortChannelIdsEnd_get_full_information(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_full_information(ReplyShortChannelIdsEnd this_ptr, boolean val) { + bindings.ReplyShortChannelIdsEnd_set_full_information(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ReplyShortChannelIdsEnd(byte[] chain_hash_arg, boolean full_information_arg) { + super(bindings.ReplyShortChannelIdsEnd_new(chain_hash_arg, full_information_arg)); + } + + // Skipped ReplyShortChannelIdsEnd_read + // Skipped ReplyShortChannelIdsEnd_write +} diff --git a/src/main/java/org/ldk/structs/RevokeAndACK.java b/src/main/java/org/ldk/structs/RevokeAndACK.java new file mode 100644 index 00000000..c3dd4bf8 --- /dev/null +++ b/src/main/java/org/ldk/structs/RevokeAndACK.java @@ -0,0 +1,57 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class RevokeAndACK extends CommonBase { + RevokeAndACK(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.RevokeAndACK_free(ptr); super.finalize(); + } + + public RevokeAndACK(RevokeAndACK orig) { + super(bindings.RevokeAndACK_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(RevokeAndACK this_ptr) { + byte[] ret = bindings.RevokeAndACK_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(RevokeAndACK this_ptr, byte[] val) { + bindings.RevokeAndACK_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_per_commitment_secret(RevokeAndACK this_ptr) { + byte[] ret = bindings.RevokeAndACK_get_per_commitment_secret(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_per_commitment_secret(RevokeAndACK this_ptr, byte[] val) { + bindings.RevokeAndACK_set_per_commitment_secret(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_next_per_commitment_point(RevokeAndACK this_ptr) { + byte[] ret = bindings.RevokeAndACK_get_next_per_commitment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_next_per_commitment_point(RevokeAndACK this_ptr, byte[] val) { + bindings.RevokeAndACK_set_next_per_commitment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public RevokeAndACK(byte[] channel_id_arg, byte[] per_commitment_secret_arg, byte[] next_per_commitment_point_arg) { + super(bindings.RevokeAndACK_new(channel_id_arg, per_commitment_secret_arg, next_per_commitment_point_arg)); + } + + // Skipped RevokeAndACK_write + // Skipped RevokeAndACK_read +} diff --git a/src/main/java/org/ldk/structs/Route.java b/src/main/java/org/ldk/structs/Route.java new file mode 100644 index 00000000..6451345b --- /dev/null +++ b/src/main/java/org/ldk/structs/Route.java @@ -0,0 +1,22 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class Route extends CommonBase { + Route(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Route_free(ptr); super.finalize(); + } + + public Route(Route orig) { + super(bindings.Route_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + // Skipped Route_set_paths + // Skipped Route_new + // Skipped Route_write + // Skipped Route_read +} diff --git a/src/main/java/org/ldk/structs/RouteHint.java b/src/main/java/org/ldk/structs/RouteHint.java new file mode 100644 index 00000000..a138d80d --- /dev/null +++ b/src/main/java/org/ldk/structs/RouteHint.java @@ -0,0 +1,74 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class RouteHint extends CommonBase { + RouteHint(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.RouteHint_free(ptr); super.finalize(); + } + + public byte[] get_src_node_id(RouteHint this_ptr) { + byte[] ret = bindings.RouteHint_get_src_node_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_src_node_id(RouteHint this_ptr, byte[] val) { + bindings.RouteHint_set_src_node_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_short_channel_id(RouteHint this_ptr) { + long ret = bindings.RouteHint_get_short_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_short_channel_id(RouteHint this_ptr, long val) { + bindings.RouteHint_set_short_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public RoutingFees get_fees(RouteHint this_ptr) { + RoutingFees ret = new RoutingFees(null, bindings.RouteHint_get_fees(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_fees(RouteHint this_ptr, RoutingFees val) { + bindings.RouteHint_set_fees(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public short get_cltv_expiry_delta(RouteHint this_ptr) { + short ret = bindings.RouteHint_get_cltv_expiry_delta(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_cltv_expiry_delta(RouteHint this_ptr, short val) { + bindings.RouteHint_set_cltv_expiry_delta(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_minimum_msat(RouteHint this_ptr) { + long ret = bindings.RouteHint_get_htlc_minimum_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_minimum_msat(RouteHint this_ptr, long val) { + bindings.RouteHint_set_htlc_minimum_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public RouteHint(byte[] src_node_id_arg, long short_channel_id_arg, RoutingFees fees_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg) { + super(bindings.RouteHint_new(src_node_id_arg, short_channel_id_arg, fees_arg.ptr & ~1, cltv_expiry_delta_arg, htlc_minimum_msat_arg)); + this.ptrs_to.add(fees_arg); + } + +} diff --git a/src/main/java/org/ldk/structs/RouteHop.java b/src/main/java/org/ldk/structs/RouteHop.java new file mode 100644 index 00000000..496e4eb0 --- /dev/null +++ b/src/main/java/org/ldk/structs/RouteHop.java @@ -0,0 +1,92 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class RouteHop extends CommonBase { + RouteHop(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.RouteHop_free(ptr); super.finalize(); + } + + public RouteHop(RouteHop orig) { + super(bindings.RouteHop_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_pubkey(RouteHop this_ptr) { + byte[] ret = bindings.RouteHop_get_pubkey(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_pubkey(RouteHop this_ptr, byte[] val) { + bindings.RouteHop_set_pubkey(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public NodeFeatures get_node_features(RouteHop this_ptr) { + NodeFeatures ret = new NodeFeatures(null, bindings.RouteHop_get_node_features(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_node_features(RouteHop this_ptr, NodeFeatures val) { + bindings.RouteHop_set_node_features(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public long get_short_channel_id(RouteHop this_ptr) { + long ret = bindings.RouteHop_get_short_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_short_channel_id(RouteHop this_ptr, long val) { + bindings.RouteHop_set_short_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public ChannelFeatures get_channel_features(RouteHop this_ptr) { + ChannelFeatures ret = new ChannelFeatures(null, bindings.RouteHop_get_channel_features(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_features(RouteHop this_ptr, ChannelFeatures val) { + bindings.RouteHop_set_channel_features(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public long get_fee_msat(RouteHop this_ptr) { + long ret = bindings.RouteHop_get_fee_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_fee_msat(RouteHop this_ptr, long val) { + bindings.RouteHop_set_fee_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_cltv_expiry_delta(RouteHop this_ptr) { + int ret = bindings.RouteHop_get_cltv_expiry_delta(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_cltv_expiry_delta(RouteHop this_ptr, int val) { + bindings.RouteHop_set_cltv_expiry_delta(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public RouteHop(byte[] pubkey_arg, NodeFeatures node_features_arg, long short_channel_id_arg, ChannelFeatures channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg) { + super(bindings.RouteHop_new(pubkey_arg, node_features_arg.ptr & ~1, short_channel_id_arg, channel_features_arg.ptr & ~1, fee_msat_arg, cltv_expiry_delta_arg)); + this.ptrs_to.add(node_features_arg); + this.ptrs_to.add(channel_features_arg); + } + +} diff --git a/src/main/java/org/ldk/structs/RoutingFees.java b/src/main/java/org/ldk/structs/RoutingFees.java new file mode 100644 index 00000000..ba1365c0 --- /dev/null +++ b/src/main/java/org/ldk/structs/RoutingFees.java @@ -0,0 +1,46 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class RoutingFees extends CommonBase { + RoutingFees(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.RoutingFees_free(ptr); super.finalize(); + } + + public RoutingFees(RoutingFees orig) { + super(bindings.RoutingFees_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public int get_base_msat(RoutingFees this_ptr) { + int ret = bindings.RoutingFees_get_base_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_base_msat(RoutingFees this_ptr, int val) { + bindings.RoutingFees_set_base_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_proportional_millionths(RoutingFees this_ptr) { + int ret = bindings.RoutingFees_get_proportional_millionths(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_proportional_millionths(RoutingFees this_ptr, int val) { + bindings.RoutingFees_set_proportional_millionths(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public RoutingFees(int base_msat_arg, int proportional_millionths_arg) { + super(bindings.RoutingFees_new(base_msat_arg, proportional_millionths_arg)); + } + + // Skipped RoutingFees_read + // Skipped RoutingFees_write +} diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java new file mode 100644 index 00000000..01d97c02 --- /dev/null +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class RoutingMessageHandler extends CommonBase { + RoutingMessageHandler(Object _dummy, long ptr) { super(ptr); } + public RoutingMessageHandler(bindings.LDKRoutingMessageHandler arg) { + super(bindings.LDKRoutingMessageHandler_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.RoutingMessageHandler_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/Shutdown.java b/src/main/java/org/ldk/structs/Shutdown.java new file mode 100644 index 00000000..599ffcf6 --- /dev/null +++ b/src/main/java/org/ldk/structs/Shutdown.java @@ -0,0 +1,34 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class Shutdown extends CommonBase { + Shutdown(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Shutdown_free(ptr); super.finalize(); + } + + public Shutdown(Shutdown orig) { + super(bindings.Shutdown_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(Shutdown this_ptr) { + byte[] ret = bindings.Shutdown_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(Shutdown this_ptr, byte[] val) { + bindings.Shutdown_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped Shutdown_get_scriptpubkey + // Skipped Shutdown_set_scriptpubkey + // Skipped Shutdown_new + // Skipped Shutdown_write + // Skipped Shutdown_read +} diff --git a/src/main/java/org/ldk/structs/SocketDescriptor.java b/src/main/java/org/ldk/structs/SocketDescriptor.java new file mode 100644 index 00000000..9518201f --- /dev/null +++ b/src/main/java/org/ldk/structs/SocketDescriptor.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class SocketDescriptor extends CommonBase { + SocketDescriptor(Object _dummy, long ptr) { super(ptr); } + public SocketDescriptor(bindings.LDKSocketDescriptor arg) { + super(bindings.LDKSocketDescriptor_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.SocketDescriptor_free(ptr); super.finalize(); + } + +} diff --git a/src/main/java/org/ldk/structs/TxCreationKeys.java b/src/main/java/org/ldk/structs/TxCreationKeys.java new file mode 100644 index 00000000..e013ca15 --- /dev/null +++ b/src/main/java/org/ldk/structs/TxCreationKeys.java @@ -0,0 +1,80 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class TxCreationKeys extends CommonBase { + TxCreationKeys(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.TxCreationKeys_free(ptr); super.finalize(); + } + + public TxCreationKeys(TxCreationKeys orig) { + super(bindings.TxCreationKeys_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_per_commitment_point(TxCreationKeys this_ptr) { + byte[] ret = bindings.TxCreationKeys_get_per_commitment_point(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_per_commitment_point(TxCreationKeys this_ptr, byte[] val) { + bindings.TxCreationKeys_set_per_commitment_point(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_revocation_key(TxCreationKeys this_ptr) { + byte[] ret = bindings.TxCreationKeys_get_revocation_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_revocation_key(TxCreationKeys this_ptr, byte[] val) { + bindings.TxCreationKeys_set_revocation_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_broadcaster_htlc_key(TxCreationKeys this_ptr) { + byte[] ret = bindings.TxCreationKeys_get_broadcaster_htlc_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_broadcaster_htlc_key(TxCreationKeys this_ptr, byte[] val) { + bindings.TxCreationKeys_set_broadcaster_htlc_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_countersignatory_htlc_key(TxCreationKeys this_ptr) { + byte[] ret = bindings.TxCreationKeys_get_countersignatory_htlc_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_countersignatory_htlc_key(TxCreationKeys this_ptr, byte[] val) { + bindings.TxCreationKeys_set_countersignatory_htlc_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_broadcaster_delayed_payment_key(TxCreationKeys this_ptr) { + byte[] ret = bindings.TxCreationKeys_get_broadcaster_delayed_payment_key(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_broadcaster_delayed_payment_key(TxCreationKeys this_ptr, byte[] val) { + bindings.TxCreationKeys_set_broadcaster_delayed_payment_key(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public TxCreationKeys(byte[] per_commitment_point_arg, byte[] revocation_key_arg, byte[] broadcaster_htlc_key_arg, byte[] countersignatory_htlc_key_arg, byte[] broadcaster_delayed_payment_key_arg) { + super(bindings.TxCreationKeys_new(per_commitment_point_arg, revocation_key_arg, broadcaster_htlc_key_arg, countersignatory_htlc_key_arg, broadcaster_delayed_payment_key_arg)); + } + + // Skipped TxCreationKeys_write + // Skipped TxCreationKeys_read + // Skipped TxCreationKeys_derive_new +} diff --git a/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java new file mode 100644 index 00000000..04853363 --- /dev/null +++ b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java @@ -0,0 +1,98 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UnsignedChannelAnnouncement extends CommonBase { + UnsignedChannelAnnouncement(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UnsignedChannelAnnouncement_free(ptr); super.finalize(); + } + + public UnsignedChannelAnnouncement(UnsignedChannelAnnouncement orig) { + super(bindings.UnsignedChannelAnnouncement_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public ChannelFeatures get_features(UnsignedChannelAnnouncement this_ptr) { + ChannelFeatures ret = new ChannelFeatures(null, bindings.UnsignedChannelAnnouncement_get_features(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_features(UnsignedChannelAnnouncement this_ptr, ChannelFeatures val) { + bindings.UnsignedChannelAnnouncement_set_features(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public byte[] get_chain_hash(UnsignedChannelAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(UnsignedChannelAnnouncement this_ptr, byte[] val) { + bindings.UnsignedChannelAnnouncement_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_short_channel_id(UnsignedChannelAnnouncement this_ptr) { + long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_short_channel_id(UnsignedChannelAnnouncement this_ptr, long val) { + bindings.UnsignedChannelAnnouncement_set_short_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_node_id_1(UnsignedChannelAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_node_id_1(UnsignedChannelAnnouncement this_ptr, byte[] val) { + bindings.UnsignedChannelAnnouncement_set_node_id_1(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_node_id_2(UnsignedChannelAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_node_id_2(UnsignedChannelAnnouncement this_ptr, byte[] val) { + bindings.UnsignedChannelAnnouncement_set_node_id_2(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_bitcoin_key_1(UnsignedChannelAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_bitcoin_key_1(UnsignedChannelAnnouncement this_ptr, byte[] val) { + bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_bitcoin_key_2(UnsignedChannelAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_bitcoin_key_2(UnsignedChannelAnnouncement this_ptr, byte[] val) { + bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped UnsignedChannelAnnouncement_write + // Skipped UnsignedChannelAnnouncement_read +} diff --git a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java new file mode 100644 index 00000000..c7f51710 --- /dev/null +++ b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java @@ -0,0 +1,108 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UnsignedChannelUpdate extends CommonBase { + UnsignedChannelUpdate(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UnsignedChannelUpdate_free(ptr); super.finalize(); + } + + public UnsignedChannelUpdate(UnsignedChannelUpdate orig) { + super(bindings.UnsignedChannelUpdate_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_chain_hash(UnsignedChannelUpdate this_ptr) { + byte[] ret = bindings.UnsignedChannelUpdate_get_chain_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_chain_hash(UnsignedChannelUpdate this_ptr, byte[] val) { + bindings.UnsignedChannelUpdate_set_chain_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_short_channel_id(UnsignedChannelUpdate this_ptr) { + long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_short_channel_id(UnsignedChannelUpdate this_ptr, long val) { + bindings.UnsignedChannelUpdate_set_short_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_timestamp(UnsignedChannelUpdate this_ptr) { + int ret = bindings.UnsignedChannelUpdate_get_timestamp(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_timestamp(UnsignedChannelUpdate this_ptr, int val) { + bindings.UnsignedChannelUpdate_set_timestamp(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte get_flags(UnsignedChannelUpdate this_ptr) { + byte ret = bindings.UnsignedChannelUpdate_get_flags(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_flags(UnsignedChannelUpdate this_ptr, byte val) { + bindings.UnsignedChannelUpdate_set_flags(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_cltv_expiry_delta(UnsignedChannelUpdate this_ptr) { + short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_cltv_expiry_delta(UnsignedChannelUpdate this_ptr, short val) { + bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_minimum_msat(UnsignedChannelUpdate this_ptr) { + long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_minimum_msat(UnsignedChannelUpdate this_ptr, long val) { + bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_fee_base_msat(UnsignedChannelUpdate this_ptr) { + int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_fee_base_msat(UnsignedChannelUpdate this_ptr, int val) { + bindings.UnsignedChannelUpdate_set_fee_base_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_fee_proportional_millionths(UnsignedChannelUpdate this_ptr) { + int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_fee_proportional_millionths(UnsignedChannelUpdate this_ptr, int val) { + bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped UnsignedChannelUpdate_write + // Skipped UnsignedChannelUpdate_read +} diff --git a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java new file mode 100644 index 00000000..f36b5f1f --- /dev/null +++ b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java @@ -0,0 +1,73 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UnsignedNodeAnnouncement extends CommonBase { + UnsignedNodeAnnouncement(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UnsignedNodeAnnouncement_free(ptr); super.finalize(); + } + + public UnsignedNodeAnnouncement(UnsignedNodeAnnouncement orig) { + super(bindings.UnsignedNodeAnnouncement_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public NodeFeatures get_features(UnsignedNodeAnnouncement this_ptr) { + NodeFeatures ret = new NodeFeatures(null, bindings.UnsignedNodeAnnouncement_get_features(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_features(UnsignedNodeAnnouncement this_ptr, NodeFeatures val) { + bindings.UnsignedNodeAnnouncement_set_features(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public int get_timestamp(UnsignedNodeAnnouncement this_ptr) { + int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_timestamp(UnsignedNodeAnnouncement this_ptr, int val) { + bindings.UnsignedNodeAnnouncement_set_timestamp(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_node_id(UnsignedNodeAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_node_id(UnsignedNodeAnnouncement this_ptr, byte[] val) { + bindings.UnsignedNodeAnnouncement_set_node_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_rgb(UnsignedNodeAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + // Skipped UnsignedNodeAnnouncement_set_rgb + public byte[] get_alias(UnsignedNodeAnnouncement this_ptr) { + byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_alias(UnsignedNodeAnnouncement this_ptr, byte[] val) { + bindings.UnsignedNodeAnnouncement_set_alias(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped UnsignedNodeAnnouncement_set_addresses + // Skipped UnsignedNodeAnnouncement_write + // Skipped UnsignedNodeAnnouncement_read +} diff --git a/src/main/java/org/ldk/structs/UpdateAddHTLC.java b/src/main/java/org/ldk/structs/UpdateAddHTLC.java new file mode 100644 index 00000000..7fbf3869 --- /dev/null +++ b/src/main/java/org/ldk/structs/UpdateAddHTLC.java @@ -0,0 +1,75 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UpdateAddHTLC extends CommonBase { + UpdateAddHTLC(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UpdateAddHTLC_free(ptr); super.finalize(); + } + + public UpdateAddHTLC(UpdateAddHTLC orig) { + super(bindings.UpdateAddHTLC_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(UpdateAddHTLC this_ptr) { + byte[] ret = bindings.UpdateAddHTLC_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(UpdateAddHTLC this_ptr, byte[] val) { + bindings.UpdateAddHTLC_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_id(UpdateAddHTLC this_ptr) { + long ret = bindings.UpdateAddHTLC_get_htlc_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_id(UpdateAddHTLC this_ptr, long val) { + bindings.UpdateAddHTLC_set_htlc_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_amount_msat(UpdateAddHTLC this_ptr) { + long ret = bindings.UpdateAddHTLC_get_amount_msat(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_amount_msat(UpdateAddHTLC this_ptr, long val) { + bindings.UpdateAddHTLC_set_amount_msat(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_payment_hash(UpdateAddHTLC this_ptr) { + byte[] ret = bindings.UpdateAddHTLC_get_payment_hash(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_payment_hash(UpdateAddHTLC this_ptr, byte[] val) { + bindings.UpdateAddHTLC_set_payment_hash(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_cltv_expiry(UpdateAddHTLC this_ptr) { + int ret = bindings.UpdateAddHTLC_get_cltv_expiry(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_cltv_expiry(UpdateAddHTLC this_ptr, int val) { + bindings.UpdateAddHTLC_set_cltv_expiry(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped UpdateAddHTLC_write + // Skipped UpdateAddHTLC_read +} diff --git a/src/main/java/org/ldk/structs/UpdateFailHTLC.java b/src/main/java/org/ldk/structs/UpdateFailHTLC.java new file mode 100644 index 00000000..42433638 --- /dev/null +++ b/src/main/java/org/ldk/structs/UpdateFailHTLC.java @@ -0,0 +1,42 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UpdateFailHTLC extends CommonBase { + UpdateFailHTLC(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UpdateFailHTLC_free(ptr); super.finalize(); + } + + public UpdateFailHTLC(UpdateFailHTLC orig) { + super(bindings.UpdateFailHTLC_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(UpdateFailHTLC this_ptr) { + byte[] ret = bindings.UpdateFailHTLC_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(UpdateFailHTLC this_ptr, byte[] val) { + bindings.UpdateFailHTLC_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_id(UpdateFailHTLC this_ptr) { + long ret = bindings.UpdateFailHTLC_get_htlc_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_id(UpdateFailHTLC this_ptr, long val) { + bindings.UpdateFailHTLC_set_htlc_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped UpdateFailHTLC_write + // Skipped UpdateFailHTLC_read +} diff --git a/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java new file mode 100644 index 00000000..d1886201 --- /dev/null +++ b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java @@ -0,0 +1,53 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UpdateFailMalformedHTLC extends CommonBase { + UpdateFailMalformedHTLC(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UpdateFailMalformedHTLC_free(ptr); super.finalize(); + } + + public UpdateFailMalformedHTLC(UpdateFailMalformedHTLC orig) { + super(bindings.UpdateFailMalformedHTLC_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(UpdateFailMalformedHTLC this_ptr) { + byte[] ret = bindings.UpdateFailMalformedHTLC_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(UpdateFailMalformedHTLC this_ptr, byte[] val) { + bindings.UpdateFailMalformedHTLC_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_id(UpdateFailMalformedHTLC this_ptr) { + long ret = bindings.UpdateFailMalformedHTLC_get_htlc_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_id(UpdateFailMalformedHTLC this_ptr, long val) { + bindings.UpdateFailMalformedHTLC_set_htlc_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public short get_failure_code(UpdateFailMalformedHTLC this_ptr) { + short ret = bindings.UpdateFailMalformedHTLC_get_failure_code(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_failure_code(UpdateFailMalformedHTLC this_ptr, short val) { + bindings.UpdateFailMalformedHTLC_set_failure_code(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + // Skipped UpdateFailMalformedHTLC_write + // Skipped UpdateFailMalformedHTLC_read +} diff --git a/src/main/java/org/ldk/structs/UpdateFee.java b/src/main/java/org/ldk/structs/UpdateFee.java new file mode 100644 index 00000000..49cc4fc5 --- /dev/null +++ b/src/main/java/org/ldk/structs/UpdateFee.java @@ -0,0 +1,46 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UpdateFee extends CommonBase { + UpdateFee(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UpdateFee_free(ptr); super.finalize(); + } + + public UpdateFee(UpdateFee orig) { + super(bindings.UpdateFee_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(UpdateFee this_ptr) { + byte[] ret = bindings.UpdateFee_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(UpdateFee this_ptr, byte[] val) { + bindings.UpdateFee_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public int get_feerate_per_kw(UpdateFee this_ptr) { + int ret = bindings.UpdateFee_get_feerate_per_kw(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_feerate_per_kw(UpdateFee this_ptr, int val) { + bindings.UpdateFee_set_feerate_per_kw(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public UpdateFee(byte[] channel_id_arg, int feerate_per_kw_arg) { + super(bindings.UpdateFee_new(channel_id_arg, feerate_per_kw_arg)); + } + + // Skipped UpdateFee_write + // Skipped UpdateFee_read +} diff --git a/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java new file mode 100644 index 00000000..9202a97e --- /dev/null +++ b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java @@ -0,0 +1,57 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UpdateFulfillHTLC extends CommonBase { + UpdateFulfillHTLC(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UpdateFulfillHTLC_free(ptr); super.finalize(); + } + + public UpdateFulfillHTLC(UpdateFulfillHTLC orig) { + super(bindings.UpdateFulfillHTLC_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public byte[] get_channel_id(UpdateFulfillHTLC this_ptr) { + byte[] ret = bindings.UpdateFulfillHTLC_get_channel_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_id(UpdateFulfillHTLC this_ptr, byte[] val) { + bindings.UpdateFulfillHTLC_set_channel_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public long get_htlc_id(UpdateFulfillHTLC this_ptr) { + long ret = bindings.UpdateFulfillHTLC_get_htlc_id(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_htlc_id(UpdateFulfillHTLC this_ptr, long val) { + bindings.UpdateFulfillHTLC_set_htlc_id(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public byte[] get_payment_preimage(UpdateFulfillHTLC this_ptr) { + byte[] ret = bindings.UpdateFulfillHTLC_get_payment_preimage(this_ptr.ptr & ~1); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_payment_preimage(UpdateFulfillHTLC this_ptr, byte[] val) { + bindings.UpdateFulfillHTLC_set_payment_preimage(this_ptr.ptr & ~1, val); + this.ptrs_to.add(this_ptr); + } + + public UpdateFulfillHTLC(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg) { + super(bindings.UpdateFulfillHTLC_new(channel_id_arg, htlc_id_arg, payment_preimage_arg)); + } + + // Skipped UpdateFulfillHTLC_write + // Skipped UpdateFulfillHTLC_read +} diff --git a/src/main/java/org/ldk/structs/UserConfig.java b/src/main/java/org/ldk/structs/UserConfig.java new file mode 100644 index 00000000..0b1b072f --- /dev/null +++ b/src/main/java/org/ldk/structs/UserConfig.java @@ -0,0 +1,65 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; + +public class UserConfig extends CommonBase { + UserConfig(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.UserConfig_free(ptr); super.finalize(); + } + + public UserConfig(UserConfig orig) { + super(bindings.UserConfig_clone(orig.ptr & ~1)); + this.ptrs_to.add(orig); + } + + public ChannelHandshakeConfig get_own_channel_config(UserConfig this_ptr) { + ChannelHandshakeConfig ret = new ChannelHandshakeConfig(null, bindings.UserConfig_get_own_channel_config(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_own_channel_config(UserConfig this_ptr, ChannelHandshakeConfig val) { + bindings.UserConfig_set_own_channel_config(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public ChannelHandshakeLimits get_peer_channel_config_limits(UserConfig this_ptr) { + ChannelHandshakeLimits ret = new ChannelHandshakeLimits(null, bindings.UserConfig_get_peer_channel_config_limits(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_peer_channel_config_limits(UserConfig this_ptr, ChannelHandshakeLimits val) { + bindings.UserConfig_set_peer_channel_config_limits(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public ChannelConfig get_channel_options(UserConfig this_ptr) { + ChannelConfig ret = new ChannelConfig(null, bindings.UserConfig_get_channel_options(this_ptr.ptr & ~1)); + this.ptrs_to.add(this_ptr); + return ret; + } + + public void set_channel_options(UserConfig this_ptr, ChannelConfig val) { + bindings.UserConfig_set_channel_options(this_ptr.ptr & ~1, val.ptr & ~1); + this.ptrs_to.add(this_ptr); + this.ptrs_to.add(val); + } + + public UserConfig(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg) { + super(bindings.UserConfig_new(own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg.ptr & ~1, channel_options_arg.ptr & ~1)); + this.ptrs_to.add(own_channel_config_arg); + this.ptrs_to.add(peer_channel_config_limits_arg); + this.ptrs_to.add(channel_options_arg); + } + + public UserConfig() { + super(bindings.UserConfig_default()); + } + +} diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java new file mode 100644 index 00000000..dcaf613b --- /dev/null +++ b/src/main/java/org/ldk/structs/Watch.java @@ -0,0 +1,16 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; + +public class Watch extends CommonBase { + Watch(Object _dummy, long ptr) { super(ptr); } + public Watch(bindings.LDKWatch arg) { + super(bindings.LDKWatch_new(arg)); + this.ptrs_to.add(arg); + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + bindings.Watch_free(ptr); super.finalize(); + } + +} diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java new file mode 100644 index 00000000..bd59b044 --- /dev/null +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -0,0 +1,341 @@ +package org.ldk; + +import org.bitcoinj.core.*; +import org.bitcoinj.script.Script; +import org.junit.jupiter.api.Test; +import org.ldk.enums.LDKNetwork; +import org.ldk.impl.bindings; +import org.ldk.structs.*; + +import java.lang.ref.WeakReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.concurrent.ConcurrentLinkedQueue; + +public class HumanObjectPeerTest { + class Peer { + final long logger; + final long fee_estimator; + final long tx_broadcaster; + final KeysManager keys; + final long keys_interface; + final ChannelManager chan_manager; + final long chan_manager_events; + final long chan_handler; + final long router; + final long route_handler; + final long message_handler; + final long peer_manager; + HashMap monitors; // Wow I forgot just how terrible Java is - we can't put a byte array here. + byte[] node_id; + + Peer(byte seed) { + bindings.LDKLogger log_trait = (String arg) -> System.out.println(seed + ": " + arg); + logger = bindings.LDKLogger_new(log_trait); + this.fee_estimator = bindings.LDKFeeEstimator_new(confirmation_target -> 0); + this.tx_broadcaster = bindings.LDKBroadcasterInterface_new(tx -> { + // We should broadcast + }); + this.monitors = new HashMap<>(); + Watch chain_monitor = new Watch(new bindings.LDKWatch() { + @Override + public long watch_channel(long funding_txo, long monitor) { + synchronized (monitors) { + assert monitors.put(Arrays.toString(bindings.OutPoint_get_txid(funding_txo)), monitor) == null; + } + bindings.OutPoint_free(funding_txo); + return bindings.CResult_NoneChannelMonitorUpdateErrZ_ok(); + } + + @Override + public long update_channel(long funding_txo, long update) { + synchronized (monitors) { + String txid = Arrays.toString(bindings.OutPoint_get_txid(funding_txo)); + assert monitors.containsKey(txid); + long update_res = bindings.ChannelMonitor_update_monitor(monitors.get(txid), update, tx_broadcaster, logger); + assert bindings.LDKCResult_NoneMonitorUpdateErrorZ_result_ok(update_res); + bindings.CResult_NoneMonitorUpdateErrorZ_free(update_res); + } + bindings.OutPoint_free(funding_txo); + bindings.ChannelMonitorUpdate_free(update); + return bindings.CResult_NoneChannelMonitorUpdateErrZ_ok(); + } + + @Override + public long release_pending_monitor_events() { + synchronized (monitors) { + assert monitors.size() <= 1; + for (Long mon : monitors.values()) { + return bindings.ChannelMonitor_get_and_clear_pending_monitor_events(mon); + } + } + return bindings.new_empty_slice_vec(); + } + }); + + byte[] key_seed = new byte[32]; + for (byte i = 0; i < 32; i++) { + key_seed[i] = (byte) (i ^ seed); + } + this.keys = new KeysManager(key_seed, LDKNetwork.LDKNetwork_Bitcoin, System.currentTimeMillis() / 1000, (int) (System.currentTimeMillis() * 1000) & 0xffffffff); + this.keys_interface = bindings.KeysManager_as_KeysInterface(keys._test_only_get_ptr()); + this.chan_manager = new ChannelManager(LDKNetwork.LDKNetwork_Bitcoin, new FeeEstimator(confirmation_target -> 0), chain_monitor, + new BroadcasterInterface(tx -> { + }), new Logger(log_trait), keys.as_KeysInterface(), new UserConfig(), 1); + this.node_id = chan_manager.get_our_node_id(); + this.chan_manager_events = bindings.ChannelManager_as_EventsProvider(chan_manager._test_only_get_ptr()); + + this.chan_handler = bindings.ChannelManager_as_ChannelMessageHandler(chan_manager._test_only_get_ptr()); + this.router = bindings.NetGraphMsgHandler_new(0, logger); + this.route_handler = bindings.NetGraphMsgHandler_as_RoutingMessageHandler(router); + this.message_handler = bindings.MessageHandler_new(chan_handler, route_handler); + + byte[] random_data = new byte[32]; + for (byte i = 0; i < 32; i++) { + random_data[i] = (byte) ((i ^ seed) ^ 0xf0); + } + this.peer_manager = bindings.PeerManager_new(message_handler, bindings.LDKKeysInterface_call_get_node_secret(keys_interface), random_data, logger); + System.gc(); + } + + void connect_block(Block b, Transaction t, int height) { + byte[] header = b.bitcoinSerialize(); + long txn; + if (t != null) + txn = bindings.LDKCVecTempl_C2TupleTempl_usize__Transaction_new( + new long[]{bindings.C2Tuple_usizeTransactionZ_new(1, bindings.new_txpointer_copy_data(t.bitcoinSerialize()))}); + else + txn = bindings.LDKCVecTempl_C2TupleTempl_usize__Transaction_new(new long[0]); + bindings.ChannelManager_block_connected(chan_manager._test_only_get_ptr(), header, txn, height); + synchronized (monitors) { + for (Long mon : monitors.values()) { + if (t != null) + txn = bindings.LDKCVecTempl_C2TupleTempl_usize__Transaction_new( + new long[]{bindings.C2Tuple_usizeTransactionZ_new(1, bindings.new_txpointer_copy_data(t.bitcoinSerialize()))}); + else + txn = bindings.LDKCVecTempl_C2TupleTempl_usize__Transaction_new(new long[0]); + long ret = bindings.ChannelMonitor_block_connected(mon, header, txn, height, tx_broadcaster, fee_estimator, logger); + bindings.CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret); + } + } + } + + void free() { + // Note that we can't rely on finalizer order, so don't bother trying to rely on it here + bindings.Logger_free(logger); + bindings.FeeEstimator_free(fee_estimator); + bindings.BroadcasterInterface_free(tx_broadcaster); + bindings.KeysInterface_free(keys_interface); + bindings.EventsProvider_free(chan_manager_events); + bindings.ChannelMessageHandler_free(chan_handler); + bindings.NetGraphMsgHandler_free(router); + bindings.RoutingMessageHandler_free(route_handler); + //MessageHandler was actually moved into the route_handler!: bindings.MessageHandler_free(message_handler); + bindings.PeerManager_free(peer_manager); + synchronized (monitors) { + for (Long mon : monitors.values()) { + bindings.ChannelMonitor_free(mon); + } + } + } + } + + class LongHolder { long val; } + + byte[] do_read_event(ConcurrentLinkedQueue list, long pm, long descriptor, long data) { + byte[] arr = bindings.get_u8_slice_bytes(data); + Thread thread = new Thread(() -> { + long arr_vec = bindings.bytes_to_u8_vec(arr); + long res = bindings.PeerManager_read_event(pm, descriptor, arr_vec); + assert bindings.LDKCResult_boolPeerHandleErrorZ_result_ok(res); + //assert bindings.deref_bool(bindings.LDKCResult_boolPeerHandleErrorZ_get_inner(res)); + bindings.CResult_boolPeerHandleErrorZ_free(res); + bindings.CVec_u8Z_free(arr_vec); + }); + thread.start(); + list.add(thread); + return arr; + } + + boolean gc_ran = false; + class GcCheck { + @Override + protected void finalize() throws Throwable { + gc_ran = true; + super.finalize(); + } + } + void do_test_message_handler() throws InterruptedException { + GcCheck obj = new GcCheck(); + Peer peer1 = new Peer((byte) 1); + Peer peer2 = new Peer((byte) 2); + + ConcurrentLinkedQueue list = new ConcurrentLinkedQueue(); + LongHolder descriptor1 = new LongHolder(); + LongHolder descriptor1ref = descriptor1; + bindings.LDKSocketDescriptor sock1 = new bindings.LDKSocketDescriptor() { + @Override + public long send_data(long data, boolean resume_read) { + return do_read_event(list, peer1.peer_manager, descriptor1ref.val, data).length; + } + + @Override public void disconnect_socket() { assert false; } + @Override public boolean eq(long other_arg) { return bindings.LDKSocketDescriptor_get_obj_from_jcalls(other_arg).hash() == 2; } + @Override public long hash() { return 2; } + }; + long descriptor2 = bindings.LDKSocketDescriptor_new(sock1); + + bindings.LDKSocketDescriptor sock2 = new bindings.LDKSocketDescriptor() { + @Override + public long send_data(long data, boolean resume_read) { + return do_read_event(list, peer2.peer_manager, descriptor2, data).length; + } + + @Override public void disconnect_socket() { assert false; } + @Override public boolean eq(long other_arg) { return bindings.LDKSocketDescriptor_get_obj_from_jcalls(other_arg).hash() == 1; } + @Override public long hash() { return 1; } + }; + descriptor1.val = bindings.LDKSocketDescriptor_new(sock2); + + long init_vec = bindings.PeerManager_new_outbound_connection(peer1.peer_manager, peer2.node_id, descriptor1.val); + assert (bindings.LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(init_vec)); + + long con_res = bindings.PeerManager_new_inbound_connection(peer2.peer_manager, descriptor2); + assert (bindings.LDKCResult_NonePeerHandleErrorZ_result_ok(con_res)); + bindings.CResult_NonePeerHandleErrorZ_free(con_res); + do_read_event(list, peer2.peer_manager, descriptor2, bindings.LDKCResult_CVec_u8ZPeerHandleErrorZ_get_inner(init_vec)); + bindings.CResult_CVec_u8ZPeerHandleErrorZ_free(init_vec); + + while (!list.isEmpty()) { list.poll().join(); } + + long cc_res = bindings.ChannelManager_create_channel(peer1.chan_manager._test_only_get_ptr(), peer2.node_id, 10000, 1000, 42, 0); + assert bindings.LDKCResult_NoneAPIErrorZ_result_ok(cc_res); + bindings.CResult_NoneAPIErrorZ_free(cc_res); + + bindings.PeerManager_process_events(peer1.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + bindings.PeerManager_process_events(peer2.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + + long events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + bindings.VecOrSliceDef events_arr_info = bindings.LDKCVecTempl_Event_arr_info(events); + assert events_arr_info.datalen == 1; + bindings.LDKEvent event = bindings.LDKEvent_ref_from_ptr(events_arr_info.dataptr); + assert event instanceof bindings.LDKEvent.FundingGenerationReady; + assert ((bindings.LDKEvent.FundingGenerationReady) event).channel_value_satoshis == 10000; + assert ((bindings.LDKEvent.FundingGenerationReady) event).user_channel_id == 42; + byte[] funding_spk = bindings.get_u8_slice_bytes(((bindings.LDKEvent.FundingGenerationReady) event).output_script); + assert funding_spk.length == 34 && funding_spk[0] == 0 && funding_spk[1] == 32; // P2WSH + byte[] chan_id = ((bindings.LDKEvent.FundingGenerationReady) event).temporary_channel_id; + bindings.CVec_EventZ_free(events); + + Transaction funding = new Transaction(NetworkParameters.fromID(NetworkParameters.ID_MAINNET)); + funding.addInput(new TransactionInput(NetworkParameters.fromID(NetworkParameters.ID_MAINNET), funding, new byte[0])); + funding.getInputs().get(0).setWitness(new TransactionWitness(2)); // Make sure we don't complain about lack of witness + funding.getInput(0).getWitness().setPush(0, new byte[]{0x1}); + funding.addOutput(Coin.SATOSHI.multiply(10000), new Script(funding_spk)); + peer1.chan_manager.funding_transaction_generated(chan_id, new OutPoint(funding.getTxId().getReversedBytes(), (short) 0)); + + bindings.PeerManager_process_events(peer1.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + bindings.PeerManager_process_events(peer2.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + + events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + events_arr_info = bindings.LDKCVecTempl_Event_arr_info(events); + assert events_arr_info.datalen == 1; + event = bindings.LDKEvent_ref_from_ptr(events_arr_info.dataptr); + assert event instanceof bindings.LDKEvent.FundingBroadcastSafe; + bindings.CVec_EventZ_free(events); + + Block b = new Block(NetworkParameters.fromID(NetworkParameters.ID_MAINNET), 2, Sha256Hash.ZERO_HASH, Sha256Hash.ZERO_HASH, 42, 0, 0, Arrays.asList(new Transaction[]{funding})); + peer1.connect_block(b, funding, 1); + peer2.connect_block(b, funding, 1); + + for (int height = 2; height < 10; height++) { + b = new Block(NetworkParameters.fromID(NetworkParameters.ID_MAINNET), 2, b.getHash(), Sha256Hash.ZERO_HASH, 42, 0, 0, Arrays.asList(new Transaction[]{funding})); + peer1.connect_block(b, null, height); + peer2.connect_block(b, null, height); + } + + bindings.PeerManager_process_events(peer1.peer_manager); + bindings.PeerManager_process_events(peer2.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + + long peer1_chans = bindings.ChannelManager_list_channels(peer1.chan_manager._test_only_get_ptr()); + long peer2_chans = bindings.ChannelManager_list_channels(peer2.chan_manager._test_only_get_ptr()); + assert bindings.vec_slice_len(peer1_chans) == 1; + assert bindings.vec_slice_len(peer2_chans) == 1; + long[] peer_1_chan_info = bindings.LDKCVecTempl_ChannelDetails_arr_info(peer1_chans); + assert peer_1_chan_info.length == 1; + assert bindings.ChannelDetails_get_channel_value_satoshis(peer_1_chan_info[0]) == 10000; + assert bindings.ChannelDetails_get_is_live(peer_1_chan_info[0]); + assert Arrays.equals(bindings.ChannelDetails_get_channel_id(peer_1_chan_info[0]), funding.getTxId().getReversedBytes()); + assert Arrays.equals(bindings.ChannelDetails_get_channel_id(bindings.LDKCVecTempl_ChannelDetails_arr_info(peer2_chans)[0]), funding.getTxId().getReversedBytes()); + bindings.CVec_ChannelDetailsZ_free(peer2_chans); + + byte[] payment_preimage = new byte[32]; + for (int i = 0; i < 32; i++) payment_preimage[i] = (byte) (i ^ 0x0f); + byte[] payment_hash = Sha256Hash.hash(payment_preimage); + long netgraph = bindings.NetGraphMsgHandler_read_locked_graph(peer1.router); + long route = bindings.get_route(peer1.node_id, bindings.LockedNetworkGraph_graph(netgraph), peer2.node_id, peer1_chans, + bindings.LDKCVecTempl_RouteHint_new(new long[0]), 1000, 42, peer1.logger); + bindings.CVec_ChannelDetailsZ_free(peer1_chans); + assert bindings.LDKCResult_RouteLightningErrorZ_result_ok(route); + bindings.LockedNetworkGraph_free(netgraph); + long payment_res = bindings.ChannelManager_send_payment(peer1.chan_manager._test_only_get_ptr(), bindings.LDKCResult_RouteLightningErrorZ_get_inner(route), payment_hash, new byte[32]); + bindings.CResult_RouteLightningErrorZ_free(route); + assert bindings.LDKCResult_NonePaymentSendFailureZ_result_ok(payment_res); + bindings.CResult_NonePaymentSendFailureZ_free(payment_res); + + bindings.PeerManager_process_events(peer1.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + bindings.PeerManager_process_events(peer2.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + bindings.PeerManager_process_events(peer1.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + + long peer2_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); + bindings.VecOrSliceDef event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer2_events); + assert event_arr_info.datalen == 1; + bindings.LDKEvent forwardable = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); + assert forwardable instanceof bindings.LDKEvent.PendingHTLCsForwardable; + bindings.CVec_EventZ_free(peer2_events); + bindings.ChannelManager_process_pending_htlc_forwards(peer2.chan_manager._test_only_get_ptr()); + + peer2_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer2.chan_manager_events); + event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer2_events); + assert event_arr_info.datalen == 1; + bindings.LDKEvent payment_recvd = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); + assert payment_recvd instanceof bindings.LDKEvent.PaymentReceived; + peer2.chan_manager.claim_funds(payment_preimage, new byte[32], ((bindings.LDKEvent.PaymentReceived) payment_recvd).amt); + bindings.CVec_EventZ_free(peer2_events); + + bindings.PeerManager_process_events(peer2.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + bindings.PeerManager_process_events(peer1.peer_manager); + while (!list.isEmpty()) { list.poll().join(); } + + long peer1_events = bindings.LDKEventsProvider_call_get_and_clear_pending_events(peer1.chan_manager_events); + event_arr_info = bindings.LDKCVecTempl_Event_arr_info(peer1_events); + assert event_arr_info.datalen == 1; + bindings.LDKEvent sent = bindings.LDKEvent_ref_from_ptr(event_arr_info.dataptr); + assert sent instanceof bindings.LDKEvent.PaymentSent; + assert Arrays.equals(((bindings.LDKEvent.PaymentSent) sent).payment_preimage, payment_preimage); + bindings.CVec_EventZ_free(peer1_events); + + peer1.free(); + peer2.free(); + bindings.SocketDescriptor_free(descriptor2); + bindings.SocketDescriptor_free(descriptor1.val); + } + + @Test + public void test_message_handler() throws InterruptedException { + do_test_message_handler(); + while (!gc_ran) { + System.gc(); + System.runFinalization(); + } + } +}