+
+ def map_opaque_struct(self, struct_name):
+ implementations = ""
+ method_header = ""
+ if struct_name.startswith("LDKLocked"):
+ implementations += "implements AutoCloseable "
+ method_header = """
+ public close() {
+"""
+ else:
+ method_header = """
+ protected finalize() {
+ super.finalize();
+"""
+
+ out_opaque_struct_human = f"""
+ {self.hu_struct_file_prefix}
+
+ export default class {struct_name.replace("LDK","")} extends CommonBase {implementations}{{
+ constructor(_dummy: object, ptr: number) {{
+ super(ptr);
+ }}
+
+ {method_header}
+ if (this.ptr != 0) {{
+ bindings.{struct_name.replace("LDK","")}_free(this.ptr);
+ }}
+ }}
+"""
+ return out_opaque_struct_human