+void __attribute__((visibility("default"))) TS_BestBlock_free(uint32_t this_obj) {
+ LDKBestBlock this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ BestBlock_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_BestBlock_clone(uint32_t orig) {
+ LDKBestBlock orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_BestBlock_from_genesis(uint32_t network) {
+ LDKNetwork network_conv = LDKNetwork_from_js(network);
+ LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_BestBlock_new(int8_tArray block_hash, int32_t height) {
+ LDKThirtyTwoBytes block_hash_ref;
+ CHECK(*((uint32_t*)block_hash) == 32);
+ memcpy(block_hash_ref.data, (uint8_t*)(block_hash + 4), 32);
+ LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_BestBlock_block_hash(uint32_t this_arg) {
+ LDKBestBlock this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), BestBlock_block_hash(&this_arg_conv).data, 32);
+ return ret_arr;
+}
+
+int32_t __attribute__((visibility("default"))) TS_BestBlock_height(uint32_t this_arg) {
+ LDKBestBlock this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int32_t ret_val = BestBlock_height(&this_arg_conv);
+ return ret_val;
+}
+