+int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) {
+ LDKNetworkGraph obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
+ *ret_conv = NetworkGraph_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) {
+ LDKThirtyTwoBytes genesis_hash_ref;
+ CHECK(*((uint32_t*)genesis_hash) == 32);
+ memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
+ LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKNodeAnnouncement msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKUnsignedNodeAnnouncement msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKChannelAnnouncement msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
+ CHECK_ACCESS(chain_access_ptr);
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ }
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKUnsignedChannelAnnouncement msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ void* chain_access_ptr = (void*)(((uint64_t)chain_access) & ~1);
+ CHECK_ACCESS(chain_access_ptr);
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ }
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
+}
+
+void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKPublicKey _node_id_ref;
+ CHECK(*((uint32_t*)_node_id) == 33);
+ memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
+ NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKUnsignedChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) {
+ LDKReadOnlyNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKPublicKey pubkey_ref;
+ CHECK(*((uint32_t*)pubkey) == 33);
+ memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
+ LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ");
+ *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
+ LDKRouteHop this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ RouteHop_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(*((uint32_t*)val) == 33);
+ memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
+ RouteHop_set_pubkey(&this_ptr_conv, val_ref);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNodeFeatures val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = NodeFeatures_clone(&val_conv);
+ RouteHop_set_node_features(&this_ptr_conv, val_conv);
+}
+
+int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ RouteHop_set_short_channel_id(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKChannelFeatures val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = ChannelFeatures_clone(&val_conv);
+ RouteHop_set_channel_features(&this_ptr_conv, val_conv);
+}
+
+int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ RouteHop_set_fee_msat(&this_ptr_conv, val);
+}
+
+int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
+ LDKRouteHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
+ LDKPublicKey pubkey_arg_ref;
+ CHECK(*((uint32_t*)pubkey_arg) == 33);
+ memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
+ LDKNodeFeatures node_features_arg_conv;
+ node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
+ node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
+ node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
+ LDKChannelFeatures channel_features_arg_conv;
+ channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
+ channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
+ channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
+ LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) {
+ LDKRouteHop orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
+ LDKRouteHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHop_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
+ LDKRouteHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
+ LDKRouteHop obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
+ *ret_conv = RouteHop_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) {
+ LDKRoute this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Route_free(this_obj_conv);
+}
+
+ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
+ ptrArray ret_arr = NULL;
+ ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
+ uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
+ for (size_t m = 0; m < ret_var.datalen; m++) {
+ LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
+ uint32_tArray ret_conv_12_arr = NULL;
+ ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
+ for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
+ LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
+ uint64_t ret_conv_12_conv_10_ref = 0;
+ CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
+ if (ret_conv_12_conv_10_var.is_owned) {
+ ret_conv_12_conv_10_ref |= 1;
+ }
+ ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
+ }
+
+ FREE(ret_conv_12_var.data);
+ ret_arr_ptr[m] = ret_conv_12_arr;
+ }
+
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_CVec_RouteHopZZ val_constr;
+ val_constr.datalen = *((uint32_t*)val);
+ if (val_constr.datalen > 0)
+ val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
+ else
+ val_constr.data = NULL;
+ uint32_tArray* val_vals = (uint32_tArray*)(val + 4);
+ for (size_t m = 0; m < val_constr.datalen; m++) {
+ uint32_tArray val_conv_12 = val_vals[m];
+ LDKCVec_RouteHopZ val_conv_12_constr;
+ val_conv_12_constr.datalen = *((uint32_t*)val_conv_12);
+ if (val_conv_12_constr.datalen > 0)
+ val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
+ else
+ val_conv_12_constr.data = NULL;
+ uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4);
+ for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
+ uint32_t val_conv_12_conv_10 = val_conv_12_vals[k];
+ LDKRouteHop val_conv_12_conv_10_conv;
+ val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
+ val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
+ val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
+ val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
+ }
+ val_constr.data[m] = val_conv_12_constr;
+ }
+ Route_set_paths(&this_ptr_conv, val_constr);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Route_get_payee(uint32_t this_ptr) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPayee ret_var = Route_get_payee(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ if ((uint64_t)ret_var.inner > 4096) {
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_Route_set_payee(uint32_t this_ptr, uint32_t val) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPayee val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = Payee_clone(&val_conv);
+ Route_set_payee(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg, uint32_t payee_arg) {
+ LDKCVec_CVec_RouteHopZZ paths_arg_constr;
+ paths_arg_constr.datalen = *((uint32_t*)paths_arg);
+ if (paths_arg_constr.datalen > 0)
+ paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
+ else
+ paths_arg_constr.data = NULL;
+ uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4);
+ for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
+ uint32_tArray paths_arg_conv_12 = paths_arg_vals[m];
+ LDKCVec_RouteHopZ paths_arg_conv_12_constr;
+ paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12);
+ if (paths_arg_conv_12_constr.datalen > 0)
+ paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
+ else
+ paths_arg_conv_12_constr.data = NULL;
+ uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4);
+ for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
+ uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
+ LDKRouteHop paths_arg_conv_12_conv_10_conv;
+ paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
+ paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
+ paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
+ paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
+ }
+ paths_arg_constr.data[m] = paths_arg_conv_12_constr;
+ }
+ LDKPayee payee_arg_conv;
+ payee_arg_conv.inner = (void*)(payee_arg & (~1));
+ payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
+ payee_arg_conv = Payee_clone(&payee_arg_conv);
+ LDKRoute ret_var = Route_new(paths_arg_constr, payee_arg_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) {
+ LDKRoute orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKRoute ret_var = Route_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
+ LDKRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Route_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
+ LDKRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = Route_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_fees(&this_arg_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_amount(&this_arg_conv);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
+ LDKRoute obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = Route_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
+ *ret_conv = Route_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_RouteParameters_free(uint32_t this_obj) {
+ LDKRouteParameters this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ RouteParameters_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteParameters_get_payee(uint32_t this_ptr) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPayee ret_var = RouteParameters_get_payee(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteParameters_set_payee(uint32_t this_ptr, uint32_t val) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPayee val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = Payee_clone(&val_conv);
+ RouteParameters_set_payee(&this_ptr_conv, val_conv);
+}
+
+int64_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_value_msat(uint32_t this_ptr) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = RouteParameters_get_final_value_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_RouteParameters_set_final_value_msat(uint32_t this_ptr, int64_t val) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ RouteParameters_set_final_value_msat(&this_ptr_conv, val);
+}
+
+int32_t __attribute__((visibility("default"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint32_t this_ptr) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int32_t ret_val = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint32_t this_ptr, int32_t val) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteParameters_new(uint32_t payee_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) {
+ LDKPayee payee_arg_conv;
+ payee_arg_conv.inner = (void*)(payee_arg & (~1));
+ payee_arg_conv.is_owned = (payee_arg & 1) || (payee_arg == 0);
+ payee_arg_conv = Payee_clone(&payee_arg_conv);
+ LDKRouteParameters ret_var = RouteParameters_new(payee_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteParameters_clone(uint32_t orig) {
+ LDKRouteParameters orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_RouteParameters_write(uint32_t obj) {
+ LDKRouteParameters obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteParameters_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
+ *ret_conv = RouteParameters_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_Payee_free(uint32_t this_obj) {
+ LDKPayee this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Payee_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_Payee_get_pubkey(uint32_t this_ptr) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), Payee_get_pubkey(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_Payee_set_pubkey(uint32_t this_ptr, int8_tArray val) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(*((uint32_t*)val) == 33);
+ memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
+ Payee_set_pubkey(&this_ptr_conv, val_ref);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Payee_get_features(uint32_t this_ptr) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInvoiceFeatures ret_var = Payee_get_features(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ if ((uint64_t)ret_var.inner > 4096) {
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_Payee_set_features(uint32_t this_ptr, uint32_t val) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInvoiceFeatures val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = InvoiceFeatures_clone(&val_conv);
+ Payee_set_features(&this_ptr_conv, val_conv);
+}
+
+uint32_tArray __attribute__((visibility("default"))) TS_Payee_get_route_hints(uint32_t this_ptr) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_RouteHintZ ret_var = Payee_get_route_hints(&this_ptr_conv);
+ uint32_tArray ret_arr = NULL;
+ ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t l = 0; l < ret_var.datalen; l++) {
+ LDKRouteHint ret_conv_11_var = ret_var.data[l];
+ uint64_t ret_conv_11_ref = 0;
+ CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
+ if (ret_conv_11_var.is_owned) {
+ ret_conv_11_ref |= 1;
+ }
+ ret_arr_ptr[l] = ret_conv_11_ref;
+ }
+
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_Payee_set_route_hints(uint32_t this_ptr, uint32_tArray val) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_RouteHintZ val_constr;
+ val_constr.datalen = *((uint32_t*)val);
+ if (val_constr.datalen > 0)
+ val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
+ else
+ val_constr.data = NULL;
+ uint32_t* val_vals = (uint32_t*)(val + 4);
+ for (size_t l = 0; l < val_constr.datalen; l++) {
+ uint32_t val_conv_11 = val_vals[l];
+ LDKRouteHint val_conv_11_conv;
+ val_conv_11_conv.inner = (void*)(val_conv_11 & (~1));
+ val_conv_11_conv.is_owned = (val_conv_11 & 1) || (val_conv_11 == 0);
+ val_conv_11_conv = RouteHint_clone(&val_conv_11_conv);
+ val_constr.data[l] = val_conv_11_conv;
+ }
+ Payee_set_route_hints(&this_ptr_conv, val_constr);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Payee_get_expiry_time(uint32_t this_ptr) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
+ *ret_copy = Payee_get_expiry_time(&this_ptr_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_Payee_set_expiry_time(uint32_t this_ptr, uint32_t val) {
+ LDKPayee this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
+ Payee_set_expiry_time(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Payee_new(int8_tArray pubkey_arg, uint32_t features_arg, uint32_tArray route_hints_arg, uint32_t expiry_time_arg) {
+ LDKPublicKey pubkey_arg_ref;
+ CHECK(*((uint32_t*)pubkey_arg) == 33);
+ memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33);
+ LDKInvoiceFeatures features_arg_conv;
+ features_arg_conv.inner = (void*)(features_arg & (~1));
+ features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
+ features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
+ LDKCVec_RouteHintZ route_hints_arg_constr;
+ route_hints_arg_constr.datalen = *((uint32_t*)route_hints_arg);
+ if (route_hints_arg_constr.datalen > 0)
+ route_hints_arg_constr.data = MALLOC(route_hints_arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
+ else
+ route_hints_arg_constr.data = NULL;
+ uint32_t* route_hints_arg_vals = (uint32_t*)(route_hints_arg + 4);
+ for (size_t l = 0; l < route_hints_arg_constr.datalen; l++) {
+ uint32_t route_hints_arg_conv_11 = route_hints_arg_vals[l];
+ LDKRouteHint route_hints_arg_conv_11_conv;
+ route_hints_arg_conv_11_conv.inner = (void*)(route_hints_arg_conv_11 & (~1));
+ route_hints_arg_conv_11_conv.is_owned = (route_hints_arg_conv_11 & 1) || (route_hints_arg_conv_11 == 0);
+ route_hints_arg_conv_11_conv = RouteHint_clone(&route_hints_arg_conv_11_conv);
+ route_hints_arg_constr.data[l] = route_hints_arg_conv_11_conv;
+ }
+ void* expiry_time_arg_ptr = (void*)(((uint64_t)expiry_time_arg) & ~1);
+ CHECK_ACCESS(expiry_time_arg_ptr);
+ LDKCOption_u64Z expiry_time_arg_conv = *(LDKCOption_u64Z*)(expiry_time_arg_ptr);
+ expiry_time_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)expiry_time_arg) & ~1));
+ LDKPayee ret_var = Payee_new(pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Payee_clone(uint32_t orig) {
+ LDKPayee orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKPayee ret_var = Payee_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Payee_hash(uint32_t o) {
+ LDKPayee o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Payee_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_Payee_eq(uint32_t a, uint32_t b) {
+ LDKPayee a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKPayee b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = Payee_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_Payee_write(uint32_t obj) {
+ LDKPayee obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = Payee_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Payee_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_PayeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeeDecodeErrorZ), "LDKCResult_PayeeDecodeErrorZ");
+ *ret_conv = Payee_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Payee_from_node_id(int8_tArray pubkey) {
+ LDKPublicKey pubkey_ref;
+ CHECK(*((uint32_t*)pubkey) == 33);
+ memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
+ LDKPayee ret_var = Payee_from_node_id(pubkey_ref);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Payee_for_keysend(int8_tArray pubkey) {
+ LDKPublicKey pubkey_ref;
+ CHECK(*((uint32_t*)pubkey) == 33);
+ memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33);
+ LDKPayee ret_var = Payee_for_keysend(pubkey_ref);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) {
+ LDKRouteHint this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ RouteHint_free(this_obj_conv);
+}
+
+uint32_tArray __attribute__((visibility("default"))) TS_RouteHint_get_a(uint32_t this_ptr) {
+ LDKRouteHint this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
+ uint32_tArray ret_arr = NULL;
+ ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t o = 0; o < ret_var.datalen; o++) {
+ LDKRouteHintHop ret_conv_14_var = ret_var.data[o];
+ uint64_t ret_conv_14_ref = 0;
+ CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
+ if (ret_conv_14_var.is_owned) {
+ ret_conv_14_ref |= 1;
+ }
+ ret_arr_ptr[o] = ret_conv_14_ref;
+ }
+
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHint_set_a(uint32_t this_ptr, uint32_tArray val) {
+ LDKRouteHint this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_RouteHintHopZ val_constr;
+ val_constr.datalen = *((uint32_t*)val);
+ if (val_constr.datalen > 0)
+ val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
+ else
+ val_constr.data = NULL;
+ uint32_t* val_vals = (uint32_t*)(val + 4);
+ for (size_t o = 0; o < val_constr.datalen; o++) {
+ uint32_t val_conv_14 = val_vals[o];
+ LDKRouteHintHop val_conv_14_conv;
+ val_conv_14_conv.inner = (void*)(val_conv_14 & (~1));
+ val_conv_14_conv.is_owned = (val_conv_14 & 1) || (val_conv_14 == 0);
+ val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
+ val_constr.data[o] = val_conv_14_conv;
+ }
+ RouteHint_set_a(&this_ptr_conv, val_constr);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHint_new(uint32_tArray a_arg) {
+ LDKCVec_RouteHintHopZ a_arg_constr;
+ a_arg_constr.datalen = *((uint32_t*)a_arg);
+ if (a_arg_constr.datalen > 0)
+ a_arg_constr.data = MALLOC(a_arg_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
+ else
+ a_arg_constr.data = NULL;
+ uint32_t* a_arg_vals = (uint32_t*)(a_arg + 4);
+ for (size_t o = 0; o < a_arg_constr.datalen; o++) {
+ uint32_t a_arg_conv_14 = a_arg_vals[o];
+ LDKRouteHintHop a_arg_conv_14_conv;
+ a_arg_conv_14_conv.inner = (void*)(a_arg_conv_14 & (~1));
+ a_arg_conv_14_conv.is_owned = (a_arg_conv_14 & 1) || (a_arg_conv_14 == 0);
+ a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
+ a_arg_constr.data[o] = a_arg_conv_14_conv;
+ }
+ LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
+ LDKRouteHint orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
+ LDKRouteHint o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHint_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
+ LDKRouteHint a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHint b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_RouteHint_write(uint32_t obj) {
+ LDKRouteHint obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHint_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
+ *ret_conv = RouteHint_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
+ LDKRouteHintHop this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ RouteHintHop_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(*((uint32_t*)val) == 33);
+ memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
+ RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
+}
+
+int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKRoutingFees val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = RoutingFees_clone(&val_conv);
+ RouteHintHop_set_fees(&this_ptr_conv, val_conv);
+}
+
+int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
+ *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
+ RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
+ *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
+ RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) {
+ LDKPublicKey src_node_id_arg_ref;
+ CHECK(*((uint32_t*)src_node_id_arg) == 33);
+ memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33);
+ LDKRoutingFees fees_arg_conv;
+ fees_arg_conv.inner = (void*)(fees_arg & (~1));
+ fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
+ fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
+ void* htlc_minimum_msat_arg_ptr = (void*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
+ CHECK_ACCESS(htlc_minimum_msat_arg_ptr);
+ LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_minimum_msat_arg_ptr);
+ htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
+ void* htlc_maximum_msat_arg_ptr = (void*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ CHECK_ACCESS(htlc_maximum_msat_arg_ptr);
+ LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_arg_ptr);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
+ LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
+ LDKRouteHintHop orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
+ LDKRouteHintHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHintHop_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
+ LDKRouteHintHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHintHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_write(uint32_t obj) {
+ LDKRouteHintHop obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
+ *ret_conv = RouteHintHop_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_find_route(int8_tArray our_node_pubkey, uint32_t params, uint32_t network, uint32_tArray first_hops, uint32_t logger, uint32_t scorer) {
+ LDKPublicKey our_node_pubkey_ref;
+ CHECK(*((uint32_t*)our_node_pubkey) == 33);
+ memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33);
+ LDKRouteParameters params_conv;
+ params_conv.inner = (void*)(params & (~1));
+ params_conv.is_owned = false;
+ LDKNetworkGraph network_conv;
+ network_conv.inner = (void*)(network & (~1));
+ network_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ first_hops_constr;
+ LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
+ if (first_hops != 0) {
+ first_hops_constr.datalen = *((uint32_t*)first_hops);
+ if (first_hops_constr.datalen > 0)
+ first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+ else
+ first_hops_constr.data = NULL;
+ uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
+ for (size_t q = 0; q < first_hops_constr.datalen; q++) {
+ uint32_t first_hops_conv_16 = first_hops_vals[q];
+ LDKChannelDetails first_hops_conv_16_conv;
+ first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
+ first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
+ first_hops_constr.data[q] = first_hops_conv_16_conv;
+ }
+ first_hops_ptr = &first_hops_constr;
+ }
+ void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
+ CHECK_ACCESS(logger_ptr);
+ LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
+ void* scorer_ptr = (void*)(((uint64_t)scorer) & ~1);
+ if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); }
+ LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
+ LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+ *ret_conv = find_route(our_node_pubkey_ref, ¶ms_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv);
+ if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) {
+ LDKScorer this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Scorer_free(this_obj_conv);
+}
+
+void __attribute__((visibility("default"))) TS_ScoringParameters_free(uint32_t this_obj) {
+ LDKScoringParameters this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ScoringParameters_free(this_obj_conv);
+}
+
+int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_base_penalty_msat(uint32_t this_ptr) {
+ LDKScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = ScoringParameters_get_base_penalty_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_ScoringParameters_set_base_penalty_msat(uint32_t this_ptr, int64_t val) {
+ LDKScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ ScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_msat(uint32_t this_ptr) {
+ LDKScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = ScoringParameters_get_failure_penalty_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_msat(uint32_t this_ptr, int64_t val) {
+ LDKScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) {
+ LDKScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = ScoringParameters_get_failure_penalty_half_life(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_penalty_half_life(uint32_t this_ptr, int64_t val) {
+ LDKScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) {
+ LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg);
+ uint64_t ret_ref = 0;
+ 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.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ScoringParameters_write(uint32_t obj) {
+ LDKScoringParameters obj_conv;