if (!get_lib_version_string().equals(version.get_ldk_java_bindings_version()))
throw new IllegalArgumentException("Compiled LDK library and LDK class failes do not match");
// Fetching the LDK versions from C also checks that the header and binaries match
- get_ldk_c_bindings_version();
- get_ldk_version();
+ System.err.println("Loaded LDK-Java Bindings " + version.get_ldk_java_bindings_version() + " with LDK " + get_ldk_version() + " and LDK-C-Bindings " + get_ldk_c_bindings_version());
}
static native void init(java.lang.Class c, java.lang.Class slicedef);
static native void init_class_cache();
DEBUG_PRINT("LDK version did not match the header we built against\\n");
if (check_get_ldk_bindings_version() == NULL)
DEBUG_PRINT("LDK C Bindings version did not match the header we built against\\n");
- DEBUG_PRINT("Loaded LDK-Java Bindings with LDK %s and LDK-C-Bindings %s\\n", check_get_ldk_version(), check_get_ldk_bindings_version());
}
"""
self.file_ext = ".java"
self.ptr_c_ty = "int64_t"
self.ptr_native_ty = "long"
+ self.u128_native_ty = "UInt128"
self.usize_c_ty = "int64_t"
self.usize_native_ty = "long"
self.native_zero_ptr = "0"
def cleanup_converted_native_array(self, ty_info, arr_name):
return None
- def primitive_arr_from_hu(self, mapped_ty, fixed_len, arr_name):
+ def primitive_arr_from_hu(self, arr_ty, fixed_len, arr_name):
+ mapped_ty = arr_ty.subty
+ if arr_ty.rust_obj == "LDKU128":
+ return ("" + arr_name + ".getLEBytes()", "")
if fixed_len is not None:
return ("InternalUtils.check_arr_len(" + arr_name + ", " + fixed_len + ")", "")
return None
- def primitive_arr_to_hu(self, primitive_ty, fixed_len, arr_name, conv_name):
+ def primitive_arr_to_hu(self, arr_ty, fixed_len, arr_name, conv_name):
+ if arr_ty.rust_obj == "LDKU128":
+ return "org.ldk.util.UInt128 " + conv_name + " = new org.ldk.util.UInt128(" + arr_name + ");"
return None
def java_arr_ty_str(self, elem_ty_str):
def fully_qualified_hu_ty_path(self, ty):
if ty.java_fn_ty_arg.startswith("L") and ty.java_fn_ty_arg.endswith(";"):
return ty.java_fn_ty_arg.strip("L;").replace("/", ".")
- if ty.java_hu_ty == "UnqualifiedError" or ty.java_hu_ty == "UInt5" or ty.java_hu_ty == "WitnessVersion":
+ if ty.java_hu_ty == "UnqualifiedError" or ty.java_hu_ty == "UInt128" or ty.java_hu_ty == "UInt5" or ty.java_hu_ty == "WitnessVersion":
return "org.ldk.util." + ty.java_hu_ty
if not ty.is_native_primitive and ty.rust_obj is not None and not "[]" in ty.java_hu_ty:
return "org.ldk.structs." + ty.java_hu_ty