+uint64_t __attribute__((export_name("TS_RouteParameters_get_payment_params"))) TS_RouteParameters_get_payment_params(uint64_t this_ptr) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKPaymentParameters ret_var = RouteParameters_get_payment_params(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_RouteParameters_set_payment_params"))) TS_RouteParameters_set_payment_params(uint64_t this_ptr, uint64_t val) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKPaymentParameters val_conv;
+ val_conv.inner = untag_ptr(val);
+ val_conv.is_owned = ptr_is_owned(val);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
+ val_conv = PaymentParameters_clone(&val_conv);
+ RouteParameters_set_payment_params(&this_ptr_conv, val_conv);
+}
+
+int64_t __attribute__((export_name("TS_RouteParameters_get_final_value_msat"))) TS_RouteParameters_get_final_value_msat(uint64_t this_ptr) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = RouteParameters_get_final_value_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS_RouteParameters_set_final_value_msat(uint64_t this_ptr, int64_t val) {
+ LDKRouteParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ RouteParameters_set_final_value_msat(&this_ptr_conv, val);
+}
+
+uint64_t __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) {
+ LDKPaymentParameters payment_params_arg_conv;
+ payment_params_arg_conv.inner = untag_ptr(payment_params_arg);
+ payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv);
+ payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv);
+ LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+static inline uint64_t RouteParameters_clone_ptr(LDKRouteParameters *NONNULL_PTR arg) {
+ LDKRouteParameters ret_var = RouteParameters_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_RouteParameters_clone_ptr"))) TS_RouteParameters_clone_ptr(uint64_t arg) {
+ LDKRouteParameters arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = RouteParameters_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParameters_clone(uint64_t orig) {
+ LDKRouteParameters orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKRouteParameters ret_var = RouteParameters_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+jboolean __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) {
+ LDKRouteParameters a_conv;
+ a_conv.inner = untag_ptr(a);
+ a_conv.is_owned = ptr_is_owned(a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
+ a_conv.is_owned = false;
+ LDKRouteParameters b_conv;
+ b_conv.inner = untag_ptr(b);
+ b_conv.is_owned = ptr_is_owned(b);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
+ b_conv.is_owned = false;
+ jboolean ret_conv = RouteParameters_eq(&a_conv, &b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) {
+ LDKRouteParameters obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = RouteParameters_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_RouteParameters_read"))) TS_RouteParameters_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ");
+ *ret_conv = RouteParameters_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_PaymentParameters_free"))) TS_PaymentParameters_free(uint64_t this_obj) {
+ LDKPaymentParameters this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ PaymentParameters_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((export_name("TS_PaymentParameters_get_payee_pubkey"))) TS_PaymentParameters_get_payee_pubkey(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
+ memcpy(ret_arr->elems, PaymentParameters_get_payee_pubkey(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_payee_pubkey"))) TS_PaymentParameters_set_payee_pubkey(uint64_t this_ptr, int8_tArray val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(val->arr_len == 33);
+ memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
+ PaymentParameters_set_payee_pubkey(&this_ptr_conv, val_ref);
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_get_features"))) TS_PaymentParameters_get_features(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKInvoiceFeatures ret_var = PaymentParameters_get_features(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_features"))) TS_PaymentParameters_set_features(uint64_t this_ptr, uint64_t val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKInvoiceFeatures val_conv;
+ val_conv.inner = untag_ptr(val);
+ val_conv.is_owned = ptr_is_owned(val);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
+ val_conv = InvoiceFeatures_clone(&val_conv);
+ PaymentParameters_set_features(&this_ptr_conv, val_conv);
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_get_route_hints"))) TS_PaymentParameters_get_route_hints(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
+ *ret_copy = PaymentParameters_get_route_hints(&this_ptr_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_route_hints"))) TS_PaymentParameters_set_route_hints(uint64_t this_ptr, uint64_t val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = untag_ptr(val);
+ CHECK_ACCESS(val_ptr);
+ LDKHints val_conv = *(LDKHints*)(val_ptr);
+ val_conv = Hints_clone((LDKHints*)untag_ptr(val));
+ PaymentParameters_set_route_hints(&this_ptr_conv, val_conv);
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_get_expiry_time"))) TS_PaymentParameters_get_expiry_time(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
+ *ret_copy = PaymentParameters_get_expiry_time(&this_ptr_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_expiry_time"))) TS_PaymentParameters_set_expiry_time(uint64_t this_ptr, uint64_t val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = untag_ptr(val);
+ CHECK_ACCESS(val_ptr);
+ LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
+ PaymentParameters_set_expiry_time(&this_ptr_conv, val_conv);
+}
+
+int32_t __attribute__((export_name("TS_PaymentParameters_get_max_total_cltv_expiry_delta"))) TS_PaymentParameters_get_max_total_cltv_expiry_delta(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int32_t ret_conv = PaymentParameters_get_max_total_cltv_expiry_delta(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_max_total_cltv_expiry_delta"))) TS_PaymentParameters_set_max_total_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ PaymentParameters_set_max_total_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+int8_t __attribute__((export_name("TS_PaymentParameters_get_max_path_count"))) TS_PaymentParameters_get_max_path_count(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int8_t ret_conv = PaymentParameters_get_max_path_count(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_max_path_count"))) TS_PaymentParameters_set_max_path_count(uint64_t this_ptr, int8_t val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ PaymentParameters_set_max_path_count(&this_ptr_conv, val);
+}
+
+int8_t __attribute__((export_name("TS_PaymentParameters_get_max_channel_saturation_power_of_half"))) TS_PaymentParameters_get_max_channel_saturation_power_of_half(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int8_t ret_conv = PaymentParameters_get_max_channel_saturation_power_of_half(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_max_channel_saturation_power_of_half"))) TS_PaymentParameters_set_max_channel_saturation_power_of_half(uint64_t this_ptr, int8_t val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ PaymentParameters_set_max_channel_saturation_power_of_half(&this_ptr_conv, val);
+}
+
+int64_tArray __attribute__((export_name("TS_PaymentParameters_get_previously_failed_channels"))) TS_PaymentParameters_get_previously_failed_channels(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKCVec_u64Z ret_var = PaymentParameters_get_previously_failed_channels(&this_ptr_conv);
+ int64_tArray ret_arr = NULL;
+ ret_arr = init_int64_tArray(ret_var.datalen, __LINE__);
+ int64_t *ret_arr_ptr = (int64_t*)(((uint8_t*)ret_arr) + 8);
+ for (size_t i = 0; i < ret_var.datalen; i++) {
+ int64_t ret_conv_8_conv = ret_var.data[i];
+ ret_arr_ptr[i] = ret_conv_8_conv;
+ }
+
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_previously_failed_channels"))) TS_PaymentParameters_set_previously_failed_channels(uint64_t this_ptr, int64_tArray val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKCVec_u64Z val_constr;
+ val_constr.datalen = val->arr_len;
+ if (val_constr.datalen > 0)
+ val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
+ else
+ val_constr.data = NULL;
+ int64_t* val_vals = val->elems;
+ for (size_t i = 0; i < val_constr.datalen; i++) {
+ int64_t val_conv_8 = val_vals[i];
+ val_constr.data[i] = val_conv_8;
+ }
+ FREE(val);
+ PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr);
+}
+
+int32_t __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_PaymentParameters_set_final_cltv_expiry_delta"))) TS_PaymentParameters_set_final_cltv_expiry_delta(uint64_t this_ptr, int32_t val) {
+ LDKPaymentParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(int8_tArray payee_pubkey_arg, uint64_t features_arg, uint64_t route_hints_arg, uint64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int32_t final_cltv_expiry_delta_arg) {
+ LDKPublicKey payee_pubkey_arg_ref;
+ CHECK(payee_pubkey_arg->arr_len == 33);
+ memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg);
+ LDKInvoiceFeatures features_arg_conv;
+ features_arg_conv.inner = untag_ptr(features_arg);
+ features_arg_conv.is_owned = ptr_is_owned(features_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv);
+ features_arg_conv = InvoiceFeatures_clone(&features_arg_conv);
+ void* route_hints_arg_ptr = untag_ptr(route_hints_arg);
+ CHECK_ACCESS(route_hints_arg_ptr);
+ LDKHints route_hints_arg_conv = *(LDKHints*)(route_hints_arg_ptr);
+ route_hints_arg_conv = Hints_clone((LDKHints*)untag_ptr(route_hints_arg));
+ void* expiry_time_arg_ptr = untag_ptr(expiry_time_arg);
+ 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*)untag_ptr(expiry_time_arg));
+ LDKCVec_u64Z previously_failed_channels_arg_constr;
+ previously_failed_channels_arg_constr.datalen = previously_failed_channels_arg->arr_len;
+ if (previously_failed_channels_arg_constr.datalen > 0)
+ previously_failed_channels_arg_constr.data = MALLOC(previously_failed_channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
+ else
+ previously_failed_channels_arg_constr.data = NULL;
+ int64_t* previously_failed_channels_arg_vals = previously_failed_channels_arg->elems;
+ for (size_t i = 0; i < previously_failed_channels_arg_constr.datalen; i++) {
+ int64_t previously_failed_channels_arg_conv_8 = previously_failed_channels_arg_vals[i];
+ previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8;
+ }
+ FREE(previously_failed_channels_arg);
+ LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_conv, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr, final_cltv_expiry_delta_arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+static inline uint64_t PaymentParameters_clone_ptr(LDKPaymentParameters *NONNULL_PTR arg) {
+ LDKPaymentParameters ret_var = PaymentParameters_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_PaymentParameters_clone_ptr"))) TS_PaymentParameters_clone_ptr(uint64_t arg) {
+ LDKPaymentParameters arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = PaymentParameters_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_clone"))) TS_PaymentParameters_clone(uint64_t orig) {
+ LDKPaymentParameters orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKPaymentParameters ret_var = PaymentParameters_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+int64_t __attribute__((export_name("TS_PaymentParameters_hash"))) TS_PaymentParameters_hash(uint64_t o) {
+ LDKPaymentParameters o_conv;
+ o_conv.inner = untag_ptr(o);
+ o_conv.is_owned = ptr_is_owned(o);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
+ o_conv.is_owned = false;
+ int64_t ret_conv = PaymentParameters_hash(&o_conv);
+ return ret_conv;
+}
+
+jboolean __attribute__((export_name("TS_PaymentParameters_eq"))) TS_PaymentParameters_eq(uint64_t a, uint64_t b) {
+ LDKPaymentParameters a_conv;
+ a_conv.inner = untag_ptr(a);
+ a_conv.is_owned = ptr_is_owned(a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
+ a_conv.is_owned = false;
+ LDKPaymentParameters b_conv;
+ b_conv.inner = untag_ptr(b);
+ b_conv.is_owned = ptr_is_owned(b);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
+ b_conv.is_owned = false;
+ jboolean ret_conv = PaymentParameters_eq(&a_conv, &b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_PaymentParameters_write(uint64_t obj) {
+ LDKPaymentParameters obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = PaymentParameters_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ");
+ *ret_conv = PaymentParameters_read(ser_ref, arg);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
+ LDKPublicKey payee_pubkey_ref;
+ CHECK(payee_pubkey->arr_len == 33);
+ memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
+ LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) {
+ LDKPublicKey payee_pubkey_ref;
+ CHECK(payee_pubkey->arr_len == 33);
+ memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey);
+ LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_Hints_free"))) TS_Hints_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKHints this_ptr_conv = *(LDKHints*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ Hints_free(this_ptr_conv);
+}
+
+static inline uint64_t Hints_clone_ptr(LDKHints *NONNULL_PTR arg) {
+ LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
+ *ret_copy = Hints_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_Hints_clone_ptr"))) TS_Hints_clone_ptr(uint64_t arg) {
+ LDKHints* arg_conv = (LDKHints*)untag_ptr(arg);
+ int64_t ret_conv = Hints_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_Hints_clone"))) TS_Hints_clone(uint64_t orig) {
+ LDKHints* orig_conv = (LDKHints*)untag_ptr(orig);
+ LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
+ *ret_copy = Hints_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Hints_blinded"))) TS_Hints_blinded(uint64_tArray a) {
+ LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a_constr;
+ a_constr.datalen = a->arr_len;
+ if (a_constr.datalen > 0)
+ a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKC2Tuple_BlindedPayInfoBlindedPathZ), "LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ Elements");
+ else
+ a_constr.data = NULL;
+ uint64_t* a_vals = a->elems;
+ for (size_t l = 0; l < a_constr.datalen; l++) {
+ uint64_t a_conv_37 = a_vals[l];
+ void* a_conv_37_ptr = untag_ptr(a_conv_37);
+ CHECK_ACCESS(a_conv_37_ptr);
+ LDKC2Tuple_BlindedPayInfoBlindedPathZ a_conv_37_conv = *(LDKC2Tuple_BlindedPayInfoBlindedPathZ*)(a_conv_37_ptr);
+ a_conv_37_conv = C2Tuple_BlindedPayInfoBlindedPathZ_clone((LDKC2Tuple_BlindedPayInfoBlindedPathZ*)untag_ptr(a_conv_37));
+ a_constr.data[l] = a_conv_37_conv;
+ }
+ FREE(a);
+ LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
+ *ret_copy = Hints_blinded(a_constr);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Hints_clear"))) TS_Hints_clear(uint64_tArray a) {
+ LDKCVec_RouteHintZ a_constr;
+ a_constr.datalen = a->arr_len;
+ if (a_constr.datalen > 0)
+ a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
+ else
+ a_constr.data = NULL;
+ uint64_t* a_vals = a->elems;
+ for (size_t l = 0; l < a_constr.datalen; l++) {
+ uint64_t a_conv_11 = a_vals[l];
+ LDKRouteHint a_conv_11_conv;
+ a_conv_11_conv.inner = untag_ptr(a_conv_11);
+ a_conv_11_conv.is_owned = ptr_is_owned(a_conv_11);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv_11_conv);
+ a_conv_11_conv = RouteHint_clone(&a_conv_11_conv);
+ a_constr.data[l] = a_conv_11_conv;
+ }
+ FREE(a);
+ LDKHints *ret_copy = MALLOC(sizeof(LDKHints), "LDKHints");
+ *ret_copy = Hints_clear(a_constr);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+int64_t __attribute__((export_name("TS_Hints_hash"))) TS_Hints_hash(uint64_t o) {
+ LDKHints* o_conv = (LDKHints*)untag_ptr(o);
+ int64_t ret_conv = Hints_hash(o_conv);
+ return ret_conv;
+}
+
+jboolean __attribute__((export_name("TS_Hints_eq"))) TS_Hints_eq(uint64_t a, uint64_t b) {
+ LDKHints* a_conv = (LDKHints*)untag_ptr(a);
+ LDKHints* b_conv = (LDKHints*)untag_ptr(b);
+ jboolean ret_conv = Hints_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_RouteHint_free"))) TS_RouteHint_free(uint64_t this_obj) {
+ LDKRouteHint this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ RouteHint_free(this_obj_conv);
+}
+
+uint64_tArray __attribute__((export_name("TS_RouteHint_get_a"))) TS_RouteHint_get_a(uint64_t this_ptr) {
+ LDKRouteHint this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKCVec_RouteHintHopZ ret_var = RouteHint_get_a(&this_ptr_conv);
+ uint64_tArray ret_arr = NULL;
+ ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__);
+ uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8);
+ 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_INNER_FIELD_ACCESS_OR_NULL(ret_conv_14_var);
+ ret_conv_14_ref = tag_ptr(ret_conv_14_var.inner, ret_conv_14_var.is_owned);
+ ret_arr_ptr[o] = ret_conv_14_ref;
+ }
+
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+void __attribute__((export_name("TS_RouteHint_set_a"))) TS_RouteHint_set_a(uint64_t this_ptr, uint64_tArray val) {
+ LDKRouteHint this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKCVec_RouteHintHopZ val_constr;
+ val_constr.datalen = val->arr_len;
+ if (val_constr.datalen > 0)
+ val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKRouteHintHop), "LDKCVec_RouteHintHopZ Elements");
+ else
+ val_constr.data = NULL;
+ uint64_t* val_vals = val->elems;
+ for (size_t o = 0; o < val_constr.datalen; o++) {
+ uint64_t val_conv_14 = val_vals[o];
+ LDKRouteHintHop val_conv_14_conv;
+ val_conv_14_conv.inner = untag_ptr(val_conv_14);
+ val_conv_14_conv.is_owned = ptr_is_owned(val_conv_14);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv_14_conv);
+ val_conv_14_conv = RouteHintHop_clone(&val_conv_14_conv);
+ val_constr.data[o] = val_conv_14_conv;
+ }
+ FREE(val);
+ RouteHint_set_a(&this_ptr_conv, val_constr);
+}
+
+uint64_t __attribute__((export_name("TS_RouteHint_new"))) TS_RouteHint_new(uint64_tArray a_arg) {
+ LDKCVec_RouteHintHopZ a_arg_constr;
+ a_arg_constr.datalen = a_arg->arr_len;
+ 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;
+ uint64_t* a_arg_vals = a_arg->elems;
+ for (size_t o = 0; o < a_arg_constr.datalen; o++) {
+ uint64_t a_arg_conv_14 = a_arg_vals[o];
+ LDKRouteHintHop a_arg_conv_14_conv;
+ a_arg_conv_14_conv.inner = untag_ptr(a_arg_conv_14);
+ a_arg_conv_14_conv.is_owned = ptr_is_owned(a_arg_conv_14);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_arg_conv_14_conv);
+ a_arg_conv_14_conv = RouteHintHop_clone(&a_arg_conv_14_conv);
+ a_arg_constr.data[o] = a_arg_conv_14_conv;
+ }
+ FREE(a_arg);
+ LDKRouteHint ret_var = RouteHint_new(a_arg_constr);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+static inline uint64_t RouteHint_clone_ptr(LDKRouteHint *NONNULL_PTR arg) {
+ LDKRouteHint ret_var = RouteHint_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_RouteHint_clone_ptr"))) TS_RouteHint_clone_ptr(uint64_t arg) {
+ LDKRouteHint arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = RouteHint_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_RouteHint_clone"))) TS_RouteHint_clone(uint64_t orig) {
+ LDKRouteHint orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+int64_t __attribute__((export_name("TS_RouteHint_hash"))) TS_RouteHint_hash(uint64_t o) {
+ LDKRouteHint o_conv;
+ o_conv.inner = untag_ptr(o);
+ o_conv.is_owned = ptr_is_owned(o);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
+ o_conv.is_owned = false;
+ int64_t ret_conv = RouteHint_hash(&o_conv);
+ return ret_conv;
+}
+
+jboolean __attribute__((export_name("TS_RouteHint_eq"))) TS_RouteHint_eq(uint64_t a, uint64_t b) {
+ LDKRouteHint a_conv;
+ a_conv.inner = untag_ptr(a);
+ a_conv.is_owned = ptr_is_owned(a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
+ a_conv.is_owned = false;
+ LDKRouteHint b_conv;
+ b_conv.inner = untag_ptr(b);
+ b_conv.is_owned = ptr_is_owned(b);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
+ b_conv.is_owned = false;
+ jboolean ret_conv = RouteHint_eq(&a_conv, &b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_RouteHint_write"))) TS_RouteHint_write(uint64_t obj) {
+ LDKRouteHint obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = RouteHint_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_RouteHint_read"))) TS_RouteHint_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_RouteHintDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintDecodeErrorZ), "LDKCResult_RouteHintDecodeErrorZ");
+ *ret_conv = RouteHint_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_RouteHintHop_free"))) TS_RouteHintHop_free(uint64_t this_obj) {
+ LDKRouteHintHop this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ RouteHintHop_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((export_name("TS_RouteHintHop_get_src_node_id"))) TS_RouteHintHop_get_src_node_id(uint64_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_int8_tArray(33, __LINE__);
+ memcpy(ret_arr->elems, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((export_name("TS_RouteHintHop_set_src_node_id"))) TS_RouteHintHop_set_src_node_id(uint64_t this_ptr, int8_tArray val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(val->arr_len == 33);
+ memcpy(val_ref.compressed_form, val->elems, 33); FREE(val);
+ RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
+}
+
+int64_t __attribute__((export_name("TS_RouteHintHop_get_short_channel_id"))) TS_RouteHintHop_get_short_channel_id(uint64_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = RouteHintHop_get_short_channel_id(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_RouteHintHop_set_short_channel_id"))) TS_RouteHintHop_set_short_channel_id(uint64_t this_ptr, int64_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
+}
+
+uint64_t __attribute__((export_name("TS_RouteHintHop_get_fees"))) TS_RouteHintHop_get_fees(uint64_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_RouteHintHop_set_fees"))) TS_RouteHintHop_set_fees(uint64_t this_ptr, uint64_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKRoutingFees val_conv;
+ val_conv.inner = untag_ptr(val);
+ val_conv.is_owned = ptr_is_owned(val);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv);
+ val_conv = RoutingFees_clone(&val_conv);
+ RouteHintHop_set_fees(&this_ptr_conv, val_conv);
+}
+
+int16_t __attribute__((export_name("TS_RouteHintHop_get_cltv_expiry_delta"))) TS_RouteHintHop_get_cltv_expiry_delta(uint64_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int16_t ret_conv = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_RouteHintHop_set_cltv_expiry_delta"))) TS_RouteHintHop_set_cltv_expiry_delta(uint64_t this_ptr, int16_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+uint64_t __attribute__((export_name("TS_RouteHintHop_get_htlc_minimum_msat"))) TS_RouteHintHop_get_htlc_minimum_msat(uint64_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ 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 = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_RouteHintHop_set_htlc_minimum_msat"))) TS_RouteHintHop_set_htlc_minimum_msat(uint64_t this_ptr, uint64_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = untag_ptr(val);
+ CHECK_ACCESS(val_ptr);
+ LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
+ RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
+}
+
+uint64_t __attribute__((export_name("TS_RouteHintHop_get_htlc_maximum_msat"))) TS_RouteHintHop_get_htlc_maximum_msat(uint64_t this_ptr) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ 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 = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_RouteHintHop_set_htlc_maximum_msat"))) TS_RouteHintHop_set_htlc_maximum_msat(uint64_t this_ptr, uint64_t val) {
+ LDKRouteHintHop this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = untag_ptr(val);
+ CHECK_ACCESS(val_ptr);
+ LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(val));
+ RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
+}
+
+uint64_t __attribute__((export_name("TS_RouteHintHop_new"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint64_t fees_arg, int16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg) {
+ LDKPublicKey src_node_id_arg_ref;
+ CHECK(src_node_id_arg->arr_len == 33);
+ memcpy(src_node_id_arg_ref.compressed_form, src_node_id_arg->elems, 33); FREE(src_node_id_arg);
+ LDKRoutingFees fees_arg_conv;
+ fees_arg_conv.inner = untag_ptr(fees_arg);
+ fees_arg_conv.is_owned = ptr_is_owned(fees_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(fees_arg_conv);
+ fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
+ void* htlc_minimum_msat_arg_ptr = untag_ptr(htlc_minimum_msat_arg);
+ 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*)untag_ptr(htlc_minimum_msat_arg));
+ void* htlc_maximum_msat_arg_ptr = untag_ptr(htlc_maximum_msat_arg);
+ 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*)untag_ptr(htlc_maximum_msat_arg));
+ 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_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+static inline uint64_t RouteHintHop_clone_ptr(LDKRouteHintHop *NONNULL_PTR arg) {
+ LDKRouteHintHop ret_var = RouteHintHop_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_RouteHintHop_clone_ptr"))) TS_RouteHintHop_clone_ptr(uint64_t arg) {
+ LDKRouteHintHop arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = RouteHintHop_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_RouteHintHop_clone"))) TS_RouteHintHop_clone(uint64_t orig) {
+ LDKRouteHintHop orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+int64_t __attribute__((export_name("TS_RouteHintHop_hash"))) TS_RouteHintHop_hash(uint64_t o) {
+ LDKRouteHintHop o_conv;
+ o_conv.inner = untag_ptr(o);
+ o_conv.is_owned = ptr_is_owned(o);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
+ o_conv.is_owned = false;
+ int64_t ret_conv = RouteHintHop_hash(&o_conv);
+ return ret_conv;
+}
+
+jboolean __attribute__((export_name("TS_RouteHintHop_eq"))) TS_RouteHintHop_eq(uint64_t a, uint64_t b) {
+ LDKRouteHintHop a_conv;
+ a_conv.inner = untag_ptr(a);
+ a_conv.is_owned = ptr_is_owned(a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
+ a_conv.is_owned = false;
+ LDKRouteHintHop b_conv;
+ b_conv.inner = untag_ptr(b);
+ b_conv.is_owned = ptr_is_owned(b);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
+ b_conv.is_owned = false;
+ jboolean ret_conv = RouteHintHop_eq(&a_conv, &b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_RouteHintHop_write"))) TS_RouteHintHop_write(uint64_t obj) {
+ LDKRouteHintHop obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = RouteHintHop_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_RouteHintHop_read"))) TS_RouteHintHop_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_RouteHintHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHintHopDecodeErrorZ), "LDKCResult_RouteHintHopDecodeErrorZ");
+ *ret_conv = RouteHintHop_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+uint64_t __attribute__((export_name("TS_find_route"))) TS_find_route(int8_tArray our_node_pubkey, uint64_t route_params, uint64_t network_graph, uint64_tArray first_hops, uint64_t logger, uint64_t scorer, int8_tArray random_seed_bytes) {
+ LDKPublicKey our_node_pubkey_ref;
+ CHECK(our_node_pubkey->arr_len == 33);
+ memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
+ LDKRouteParameters route_params_conv;
+ route_params_conv.inner = untag_ptr(route_params);
+ route_params_conv.is_owned = ptr_is_owned(route_params);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
+ route_params_conv.is_owned = false;
+ LDKNetworkGraph network_graph_conv;
+ network_graph_conv.inner = untag_ptr(network_graph);
+ network_graph_conv.is_owned = ptr_is_owned(network_graph);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
+ network_graph_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ first_hops_constr;
+ LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
+ if (first_hops != 0) {
+ first_hops_constr.datalen = first_hops->arr_len;
+ 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;
+ uint64_t* first_hops_vals = first_hops->elems;
+ for (size_t q = 0; q < first_hops_constr.datalen; q++) {
+ uint64_t first_hops_conv_16 = first_hops_vals[q];
+ LDKChannelDetails first_hops_conv_16_conv;
+ first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16);
+ first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv);
+ first_hops_conv_16_conv.is_owned = false;
+ first_hops_constr.data[q] = first_hops_conv_16_conv;
+ }
+ FREE(first_hops);
+ first_hops_ptr = &first_hops_constr;
+ }
+ void* logger_ptr = untag_ptr(logger);
+ CHECK_ACCESS(logger_ptr);
+ LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_cloned(&logger_conv);
+ }
+ void* scorer_ptr = untag_ptr(scorer);
+ if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); }
+ LDKScore* scorer_conv = (LDKScore*)scorer_ptr;
+ uint8_t random_seed_bytes_arr[32];
+ CHECK(random_seed_bytes->arr_len == 32);
+ memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
+ uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
+ LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+ *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref);
+ if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
+ return tag_ptr(ret_conv, true);
+}
+
+uint64_t __attribute__((export_name("TS_build_route_from_hops"))) TS_build_route_from_hops(int8_tArray our_node_pubkey, ptrArray hops, uint64_t route_params, uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes) {
+ LDKPublicKey our_node_pubkey_ref;
+ CHECK(our_node_pubkey->arr_len == 33);
+ memcpy(our_node_pubkey_ref.compressed_form, our_node_pubkey->elems, 33); FREE(our_node_pubkey);
+ LDKCVec_PublicKeyZ hops_constr;
+ hops_constr.datalen = hops->arr_len;
+ if (hops_constr.datalen > 0)
+ hops_constr.data = MALLOC(hops_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
+ else
+ hops_constr.data = NULL;
+ int8_tArray* hops_vals = (void*) hops->elems;
+ for (size_t m = 0; m < hops_constr.datalen; m++) {
+ int8_tArray hops_conv_12 = hops_vals[m];
+ LDKPublicKey hops_conv_12_ref;
+ CHECK(hops_conv_12->arr_len == 33);
+ memcpy(hops_conv_12_ref.compressed_form, hops_conv_12->elems, 33); FREE(hops_conv_12);
+ hops_constr.data[m] = hops_conv_12_ref;
+ }
+ FREE(hops);
+ LDKRouteParameters route_params_conv;
+ route_params_conv.inner = untag_ptr(route_params);
+ route_params_conv.is_owned = ptr_is_owned(route_params);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv);
+ route_params_conv.is_owned = false;
+ LDKNetworkGraph network_graph_conv;
+ network_graph_conv.inner = untag_ptr(network_graph);
+ network_graph_conv.is_owned = ptr_is_owned(network_graph);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
+ network_graph_conv.is_owned = false;
+ void* logger_ptr = untag_ptr(logger);
+ CHECK_ACCESS(logger_ptr);
+ LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_cloned(&logger_conv);
+ }
+ uint8_t random_seed_bytes_arr[32];
+ CHECK(random_seed_bytes->arr_len == 32);
+ memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes);
+ uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr;
+ LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+ *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_Score_free"))) TS_Score_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ Score_free(this_ptr_conv);
+}
+
+void __attribute__((export_name("TS_LockableScore_free"))) TS_LockableScore_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ LockableScore_free(this_ptr_conv);
+}
+
+void __attribute__((export_name("TS_WriteableScore_free"))) TS_WriteableScore_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKWriteableScore this_ptr_conv = *(LDKWriteableScore*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ WriteableScore_free(this_ptr_conv);
+}
+
+void __attribute__((export_name("TS_MultiThreadedLockableScore_free"))) TS_MultiThreadedLockableScore_free(uint64_t this_obj) {
+ LDKMultiThreadedLockableScore this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ MultiThreadedLockableScore_free(this_obj_conv);
+}
+
+void __attribute__((export_name("TS_MultiThreadedScoreLock_free"))) TS_MultiThreadedScoreLock_free(uint64_t this_obj) {
+ LDKMultiThreadedScoreLock this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ MultiThreadedScoreLock_free(this_obj_conv);
+}
+
+uint64_t __attribute__((export_name("TS_MultiThreadedScoreLock_as_Score"))) TS_MultiThreadedScoreLock_as_Score(uint64_t this_arg) {
+ LDKMultiThreadedScoreLock this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
+ *ret_ret = MultiThreadedScoreLock_as_Score(&this_arg_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+int8_tArray __attribute__((export_name("TS_MultiThreadedScoreLock_write"))) TS_MultiThreadedScoreLock_write(uint64_t obj) {
+ LDKMultiThreadedScoreLock obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = MultiThreadedScoreLock_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_MultiThreadedLockableScore_as_LockableScore"))) TS_MultiThreadedLockableScore_as_LockableScore(uint64_t this_arg) {
+ LDKMultiThreadedLockableScore this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKLockableScore* ret_ret = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore");
+ *ret_ret = MultiThreadedLockableScore_as_LockableScore(&this_arg_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+int8_tArray __attribute__((export_name("TS_MultiThreadedLockableScore_write"))) TS_MultiThreadedLockableScore_write(uint64_t obj) {
+ LDKMultiThreadedLockableScore obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = MultiThreadedLockableScore_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_MultiThreadedLockableScore_as_WriteableScore"))) TS_MultiThreadedLockableScore_as_WriteableScore(uint64_t this_arg) {
+ LDKMultiThreadedLockableScore this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKWriteableScore* ret_ret = MALLOC(sizeof(LDKWriteableScore), "LDKWriteableScore");
+ *ret_ret = MultiThreadedLockableScore_as_WriteableScore(&this_arg_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+uint64_t __attribute__((export_name("TS_MultiThreadedLockableScore_new"))) TS_MultiThreadedLockableScore_new(uint64_t score) {
+ void* score_ptr = untag_ptr(score);
+ CHECK_ACCESS(score_ptr);
+ LDKScore score_conv = *(LDKScore*)(score_ptr);
+ if (score_conv.free == LDKScore_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKScore_JCalls_cloned(&score_conv);
+ }
+ LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_ChannelUsage_free"))) TS_ChannelUsage_free(uint64_t this_obj) {
+ LDKChannelUsage this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ ChannelUsage_free(this_obj_conv);
+}
+
+int64_t __attribute__((export_name("TS_ChannelUsage_get_amount_msat"))) TS_ChannelUsage_get_amount_msat(uint64_t this_ptr) {
+ LDKChannelUsage this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ChannelUsage_get_amount_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ChannelUsage_set_amount_msat"))) TS_ChannelUsage_set_amount_msat(uint64_t this_ptr, int64_t val) {
+ LDKChannelUsage this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ChannelUsage_set_amount_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ChannelUsage_get_inflight_htlc_msat"))) TS_ChannelUsage_get_inflight_htlc_msat(uint64_t this_ptr) {
+ LDKChannelUsage this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ChannelUsage_get_inflight_htlc_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ChannelUsage_set_inflight_htlc_msat"))) TS_ChannelUsage_set_inflight_htlc_msat(uint64_t this_ptr, int64_t val) {
+ LDKChannelUsage this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ChannelUsage_set_inflight_htlc_msat(&this_ptr_conv, val);
+}
+
+uint64_t __attribute__((export_name("TS_ChannelUsage_get_effective_capacity"))) TS_ChannelUsage_get_effective_capacity(uint64_t this_ptr) {
+ LDKChannelUsage this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity");
+ *ret_copy = ChannelUsage_get_effective_capacity(&this_ptr_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_ChannelUsage_set_effective_capacity"))) TS_ChannelUsage_set_effective_capacity(uint64_t this_ptr, uint64_t val) {
+ LDKChannelUsage this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = untag_ptr(val);
+ CHECK_ACCESS(val_ptr);
+ LDKEffectiveCapacity val_conv = *(LDKEffectiveCapacity*)(val_ptr);
+ val_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(val));
+ ChannelUsage_set_effective_capacity(&this_ptr_conv, val_conv);
+}
+
+uint64_t __attribute__((export_name("TS_ChannelUsage_new"))) TS_ChannelUsage_new(int64_t amount_msat_arg, int64_t inflight_htlc_msat_arg, uint64_t effective_capacity_arg) {
+ void* effective_capacity_arg_ptr = untag_ptr(effective_capacity_arg);
+ CHECK_ACCESS(effective_capacity_arg_ptr);
+ LDKEffectiveCapacity effective_capacity_arg_conv = *(LDKEffectiveCapacity*)(effective_capacity_arg_ptr);
+ effective_capacity_arg_conv = EffectiveCapacity_clone((LDKEffectiveCapacity*)untag_ptr(effective_capacity_arg));
+ LDKChannelUsage ret_var = ChannelUsage_new(amount_msat_arg, inflight_htlc_msat_arg, effective_capacity_arg_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+static inline uint64_t ChannelUsage_clone_ptr(LDKChannelUsage *NONNULL_PTR arg) {
+ LDKChannelUsage ret_var = ChannelUsage_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_ChannelUsage_clone_ptr"))) TS_ChannelUsage_clone_ptr(uint64_t arg) {
+ LDKChannelUsage arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = ChannelUsage_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_ChannelUsage_clone"))) TS_ChannelUsage_clone(uint64_t orig) {
+ LDKChannelUsage orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKChannelUsage ret_var = ChannelUsage_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_FixedPenaltyScorer_free"))) TS_FixedPenaltyScorer_free(uint64_t this_obj) {
+ LDKFixedPenaltyScorer this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ FixedPenaltyScorer_free(this_obj_conv);
+}
+
+static inline uint64_t FixedPenaltyScorer_clone_ptr(LDKFixedPenaltyScorer *NONNULL_PTR arg) {
+ LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_FixedPenaltyScorer_clone_ptr"))) TS_FixedPenaltyScorer_clone_ptr(uint64_t arg) {
+ LDKFixedPenaltyScorer arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = FixedPenaltyScorer_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_FixedPenaltyScorer_clone"))) TS_FixedPenaltyScorer_clone(uint64_t orig) {
+ LDKFixedPenaltyScorer orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_FixedPenaltyScorer_with_penalty"))) TS_FixedPenaltyScorer_with_penalty(int64_t penalty_msat) {
+ LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_FixedPenaltyScorer_as_Score"))) TS_FixedPenaltyScorer_as_Score(uint64_t this_arg) {
+ LDKFixedPenaltyScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
+ *ret_ret = FixedPenaltyScorer_as_Score(&this_arg_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+int8_tArray __attribute__((export_name("TS_FixedPenaltyScorer_write"))) TS_FixedPenaltyScorer_write(uint64_t obj) {
+ LDKFixedPenaltyScorer obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = FixedPenaltyScorer_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_FixedPenaltyScorer_read"))) TS_FixedPenaltyScorer_read(int8_tArray ser, int64_t arg) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ");
+ *ret_conv = FixedPenaltyScorer_read(ser_ref, arg);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_ProbabilisticScorer_free"))) TS_ProbabilisticScorer_free(uint64_t this_obj) {
+ LDKProbabilisticScorer this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ ProbabilisticScorer_free(this_obj_conv);
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_free"))) TS_ProbabilisticScoringParameters_free(uint64_t this_obj) {
+ LDKProbabilisticScoringParameters this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ ProbabilisticScoringParameters_free(this_obj_conv);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_get_liquidity_offset_half_life(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_offset_half_life(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_offset_half_life"))) TS_ProbabilisticScoringParameters_set_liquidity_offset_half_life(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_historical_liquidity_penalty_multiplier_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat"))) TS_ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_historical_liquidity_penalty_amount_multiplier_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_historical_no_updates_half_life"))) TS_ProbabilisticScoringParameters_get_historical_no_updates_half_life(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_historical_no_updates_half_life(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_historical_no_updates_half_life"))) TS_ProbabilisticScoringParameters_set_historical_no_updates_half_life(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_historical_no_updates_half_life(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_get_anti_probing_penalty_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_anti_probing_penalty_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_anti_probing_penalty_msat"))) TS_ProbabilisticScoringParameters_set_anti_probing_penalty_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_anti_probing_penalty_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(uint64_t this_ptr) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(&this_ptr_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_set_considered_impossible_penalty_msat"))) TS_ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(uint64_t this_ptr, int64_t val) {
+ LDKProbabilisticScoringParameters this_ptr_conv;
+ this_ptr_conv.inner = untag_ptr(this_ptr);
+ this_ptr_conv.is_owned = ptr_is_owned(this_ptr);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv);
+ this_ptr_conv.is_owned = false;
+ ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(&this_ptr_conv, val);
+}
+
+static inline uint64_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg) {
+ LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone_ptr"))) TS_ProbabilisticScoringParameters_clone_ptr(uint64_t arg) {
+ LDKProbabilisticScoringParameters arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = ProbabilisticScoringParameters_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_clone"))) TS_ProbabilisticScoringParameters_clone(uint64_t orig) {
+ LDKProbabilisticScoringParameters orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ProbabilisticScorer_new"))) TS_ProbabilisticScorer_new(uint64_t params, uint64_t network_graph, uint64_t logger) {
+ LDKProbabilisticScoringParameters params_conv;
+ params_conv.inner = untag_ptr(params);
+ params_conv.is_owned = ptr_is_owned(params);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv);
+ params_conv = ProbabilisticScoringParameters_clone(¶ms_conv);
+ LDKNetworkGraph network_graph_conv;
+ network_graph_conv.inner = untag_ptr(network_graph);
+ network_graph_conv.is_owned = ptr_is_owned(network_graph);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv);
+ network_graph_conv.is_owned = false;
+ void* logger_ptr = untag_ptr(logger);
+ CHECK_ACCESS(logger_ptr);
+ LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_cloned(&logger_conv);
+ }
+ LDKProbabilisticScorer ret_var = ProbabilisticScorer_new(params_conv, &network_graph_conv, logger_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScorer_debug_log_liquidity_stats"))) TS_ProbabilisticScorer_debug_log_liquidity_stats(uint64_t this_arg) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ ProbabilisticScorer_debug_log_liquidity_stats(&this_arg_conv);
+}
+
+uint64_t __attribute__((export_name("TS_ProbabilisticScorer_estimated_channel_liquidity_range"))) TS_ProbabilisticScorer_estimated_channel_liquidity_range(uint64_t this_arg, int64_t scid, uint64_t target) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKNodeId target_conv;
+ target_conv.inner = untag_ptr(target);
+ target_conv.is_owned = ptr_is_owned(target);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
+ target_conv.is_owned = false;
+ LDKCOption_C2Tuple_u64u64ZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_u64u64ZZ), "LDKCOption_C2Tuple_u64u64ZZ");
+ *ret_copy = ProbabilisticScorer_estimated_channel_liquidity_range(&this_arg_conv, scid, &target_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities"))) TS_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(uint64_t this_arg, int64_t scid, uint64_t target) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKNodeId target_conv;
+ target_conv.inner = untag_ptr(target);
+ target_conv.is_owned = ptr_is_owned(target);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv);
+ target_conv.is_owned = false;
+ LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ");
+ *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKNodeId node_id_conv;
+ node_id_conv.inner = untag_ptr(node_id);
+ node_id_conv.is_owned = ptr_is_owned(node_id);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
+ node_id_conv.is_owned = false;
+ ProbabilisticScorer_add_banned(&this_arg_conv, &node_id_conv);
+}
+
+void __attribute__((export_name("TS_ProbabilisticScorer_remove_banned"))) TS_ProbabilisticScorer_remove_banned(uint64_t this_arg, uint64_t node_id) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKNodeId node_id_conv;
+ node_id_conv.inner = untag_ptr(node_id);
+ node_id_conv.is_owned = ptr_is_owned(node_id);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
+ node_id_conv.is_owned = false;
+ ProbabilisticScorer_remove_banned(&this_arg_conv, &node_id_conv);
+}
+
+void __attribute__((export_name("TS_ProbabilisticScorer_set_manual_penalty"))) TS_ProbabilisticScorer_set_manual_penalty(uint64_t this_arg, uint64_t node_id, int64_t penalty) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKNodeId node_id_conv;
+ node_id_conv.inner = untag_ptr(node_id);
+ node_id_conv.is_owned = ptr_is_owned(node_id);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
+ node_id_conv.is_owned = false;
+ ProbabilisticScorer_set_manual_penalty(&this_arg_conv, &node_id_conv, penalty);
+}
+
+void __attribute__((export_name("TS_ProbabilisticScorer_remove_manual_penalty"))) TS_ProbabilisticScorer_remove_manual_penalty(uint64_t this_arg, uint64_t node_id) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKNodeId node_id_conv;
+ node_id_conv.inner = untag_ptr(node_id);
+ node_id_conv.is_owned = ptr_is_owned(node_id);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(node_id_conv);
+ node_id_conv.is_owned = false;
+ ProbabilisticScorer_remove_manual_penalty(&this_arg_conv, &node_id_conv);
+}
+
+void __attribute__((export_name("TS_ProbabilisticScorer_clear_manual_penalties"))) TS_ProbabilisticScorer_clear_manual_penalties(uint64_t this_arg) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ ProbabilisticScorer_clear_manual_penalties(&this_arg_conv);
+}
+
+void __attribute__((export_name("TS_ProbabilisticScoringParameters_add_banned_from_list"))) TS_ProbabilisticScoringParameters_add_banned_from_list(uint64_t this_arg, uint64_tArray node_ids) {
+ LDKProbabilisticScoringParameters this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKCVec_NodeIdZ node_ids_constr;
+ node_ids_constr.datalen = node_ids->arr_len;
+ if (node_ids_constr.datalen > 0)
+ node_ids_constr.data = MALLOC(node_ids_constr.datalen * sizeof(LDKNodeId), "LDKCVec_NodeIdZ Elements");
+ else
+ node_ids_constr.data = NULL;
+ uint64_t* node_ids_vals = node_ids->elems;
+ for (size_t i = 0; i < node_ids_constr.datalen; i++) {
+ uint64_t node_ids_conv_8 = node_ids_vals[i];
+ LDKNodeId node_ids_conv_8_conv;
+ node_ids_conv_8_conv.inner = untag_ptr(node_ids_conv_8);
+ node_ids_conv_8_conv.is_owned = ptr_is_owned(node_ids_conv_8);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(node_ids_conv_8_conv);
+ node_ids_conv_8_conv = NodeId_clone(&node_ids_conv_8_conv);
+ node_ids_constr.data[i] = node_ids_conv_8_conv;
+ }
+ FREE(node_ids);
+ ProbabilisticScoringParameters_add_banned_from_list(&this_arg_conv, node_ids_constr);
+}
+
+uint64_t __attribute__((export_name("TS_ProbabilisticScoringParameters_default"))) TS_ProbabilisticScoringParameters_default() {
+ LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_default();
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ProbabilisticScorer_as_Score"))) TS_ProbabilisticScorer_as_Score(uint64_t this_arg) {
+ LDKProbabilisticScorer this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore");
+ *ret_ret = ProbabilisticScorer_as_Score(&this_arg_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+int8_tArray __attribute__((export_name("TS_ProbabilisticScorer_write"))) TS_ProbabilisticScorer_write(uint64_t obj) {
+ LDKProbabilisticScorer obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = ProbabilisticScorer_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_ProbabilisticScorer_read"))) TS_ProbabilisticScorer_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b, uint64_t arg_c) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKProbabilisticScoringParameters arg_a_conv;
+ arg_a_conv.inner = untag_ptr(arg_a);
+ arg_a_conv.is_owned = ptr_is_owned(arg_a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv);
+ arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv);
+ LDKNetworkGraph arg_b_conv;
+ arg_b_conv.inner = untag_ptr(arg_b);
+ arg_b_conv.is_owned = ptr_is_owned(arg_b);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv);
+ arg_b_conv.is_owned = false;
+ void* arg_c_ptr = untag_ptr(arg_c);
+ CHECK_ACCESS(arg_c_ptr);
+ LDKLogger arg_c_conv = *(LDKLogger*)(arg_c_ptr);
+ if (arg_c_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_cloned(&arg_c_conv);
+ }
+ LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ");
+ *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv, arg_c_conv);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_OnionMessenger_free"))) TS_OnionMessenger_free(uint64_t this_obj) {
+ LDKOnionMessenger this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ OnionMessenger_free(this_obj_conv);
+}
+
+void __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKDestination this_ptr_conv = *(LDKDestination*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ Destination_free(this_ptr_conv);
+}
+
+static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) {
+ LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
+ *ret_copy = Destination_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) {
+ LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg);
+ int64_t ret_conv = Destination_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) {
+ LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig);
+ LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
+ *ret_copy = Destination_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) {
+ LDKPublicKey a_ref;
+ CHECK(a->arr_len == 33);
+ memcpy(a_ref.compressed_form, a->elems, 33); FREE(a);
+ LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
+ *ret_copy = Destination_node(a_ref);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) {
+ LDKBlindedPath a_conv;
+ a_conv.inner = untag_ptr(a);
+ a_conv.is_owned = ptr_is_owned(a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
+ a_conv = BlindedPath_clone(&a_conv);
+ LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination");
+ *ret_copy = Destination_blinded_path(a_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+void __attribute__((export_name("TS_SendError_free"))) TS_SendError_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKSendError this_ptr_conv = *(LDKSendError*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ SendError_free(this_ptr_conv);
+}
+
+static inline uint64_t SendError_clone_ptr(LDKSendError *NONNULL_PTR arg) {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_SendError_clone_ptr"))) TS_SendError_clone_ptr(uint64_t arg) {
+ LDKSendError* arg_conv = (LDKSendError*)untag_ptr(arg);
+ int64_t ret_conv = SendError_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_clone"))) TS_SendError_clone(uint64_t orig) {
+ LDKSendError* orig_conv = (LDKSendError*)untag_ptr(orig);
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_secp256k1"))) TS_SendError_secp256k1(uint32_t a) {
+ LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_js(a);
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_secp256k1(a_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_too_big_packet"))) TS_SendError_too_big_packet() {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_too_big_packet();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_too_few_blinded_hops"))) TS_SendError_too_few_blinded_hops() {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_too_few_blinded_hops();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_invalid_first_hop"))) TS_SendError_invalid_first_hop() {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_invalid_first_hop();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_invalid_message"))) TS_SendError_invalid_message() {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_invalid_message();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_buffer_full() {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_buffer_full();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_get_node_id_failed();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() {
+ LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError");
+ *ret_copy = SendError_blinded_path_advance_failed();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+jboolean __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) {
+ LDKSendError* a_conv = (LDKSendError*)untag_ptr(a);
+ LDKSendError* b_conv = (LDKSendError*)untag_ptr(b);
+ jboolean ret_conv = SendError_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_CustomOnionMessageHandler_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKCustomOnionMessageHandler this_ptr_conv = *(LDKCustomOnionMessageHandler*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ CustomOnionMessageHandler_free(this_ptr_conv);
+}
+
+uint64_t __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint64_t custom_handler) {
+ void* entropy_source_ptr = untag_ptr(entropy_source);
+ CHECK_ACCESS(entropy_source_ptr);
+ LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr);
+ if (entropy_source_conv.free == LDKEntropySource_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKEntropySource_JCalls_cloned(&entropy_source_conv);
+ }
+ void* node_signer_ptr = untag_ptr(node_signer);
+ CHECK_ACCESS(node_signer_ptr);
+ LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr);
+ if (node_signer_conv.free == LDKNodeSigner_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKNodeSigner_JCalls_cloned(&node_signer_conv);
+ }
+ void* logger_ptr = untag_ptr(logger);
+ CHECK_ACCESS(logger_ptr);
+ LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
+ if (logger_conv.free == LDKLogger_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKLogger_JCalls_cloned(&logger_conv);
+ }
+ void* custom_handler_ptr = untag_ptr(custom_handler);
+ CHECK_ACCESS(custom_handler_ptr);
+ LDKCustomOnionMessageHandler custom_handler_conv = *(LDKCustomOnionMessageHandler*)(custom_handler_ptr);
+ if (custom_handler_conv.free == LDKCustomOnionMessageHandler_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv);
+ }
+ LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, ptrArray intermediate_nodes, uint64_t destination, uint64_t message, uint64_t reply_path) {
+ LDKOnionMessenger this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKCVec_PublicKeyZ intermediate_nodes_constr;
+ intermediate_nodes_constr.datalen = intermediate_nodes->arr_len;
+ if (intermediate_nodes_constr.datalen > 0)
+ intermediate_nodes_constr.data = MALLOC(intermediate_nodes_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
+ else
+ intermediate_nodes_constr.data = NULL;
+ int8_tArray* intermediate_nodes_vals = (void*) intermediate_nodes->elems;
+ for (size_t m = 0; m < intermediate_nodes_constr.datalen; m++) {
+ int8_tArray intermediate_nodes_conv_12 = intermediate_nodes_vals[m];
+ LDKPublicKey intermediate_nodes_conv_12_ref;
+ CHECK(intermediate_nodes_conv_12->arr_len == 33);
+ memcpy(intermediate_nodes_conv_12_ref.compressed_form, intermediate_nodes_conv_12->elems, 33); FREE(intermediate_nodes_conv_12);
+ intermediate_nodes_constr.data[m] = intermediate_nodes_conv_12_ref;
+ }
+ FREE(intermediate_nodes);
+ void* destination_ptr = untag_ptr(destination);
+ CHECK_ACCESS(destination_ptr);
+ LDKDestination destination_conv = *(LDKDestination*)(destination_ptr);
+ destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination));
+ void* message_ptr = untag_ptr(message);
+ CHECK_ACCESS(message_ptr);
+ LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr);
+ message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message));
+ LDKBlindedPath reply_path_conv;
+ reply_path_conv.inner = untag_ptr(reply_path);
+ reply_path_conv.is_owned = ptr_is_owned(reply_path);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv);
+ reply_path_conv = BlindedPath_clone(&reply_path_conv);
+ LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ");
+ *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv);
+ return tag_ptr(ret_conv, true);
+}
+
+uint64_t __attribute__((export_name("TS_OnionMessenger_as_OnionMessageHandler"))) TS_OnionMessenger_as_OnionMessageHandler(uint64_t this_arg) {
+ LDKOnionMessenger this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKOnionMessageHandler* ret_ret = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler");
+ *ret_ret = OnionMessenger_as_OnionMessageHandler(&this_arg_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+uint64_t __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider"))) TS_OnionMessenger_as_OnionMessageProvider(uint64_t this_arg) {
+ LDKOnionMessenger this_arg_conv;
+ this_arg_conv.inner = untag_ptr(this_arg);
+ this_arg_conv.is_owned = ptr_is_owned(this_arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv);
+ this_arg_conv.is_owned = false;
+ LDKOnionMessageProvider* ret_ret = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider");
+ *ret_ret = OnionMessenger_as_OnionMessageProvider(&this_arg_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+void __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ OnionMessageContents_free(this_ptr_conv);
+}
+
+static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) {
+ LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
+ *ret_copy = OnionMessageContents_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) {
+ LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg);
+ int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) {
+ LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig);
+ LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
+ *ret_copy = OnionMessageContents_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) {
+ void* a_ptr = untag_ptr(a);
+ CHECK_ACCESS(a_ptr);
+ LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr);
+ if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKCustomOnionMessageContents_JCalls_cloned(&a_conv);
+ }
+ LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents");
+ *ret_copy = OnionMessageContents_custom(a_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) {
+ LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
+ *ret_ret = CustomOnionMessageContents_clone(arg);
+ return tag_ptr(ret_ret, true);
+}
+int64_t __attribute__((export_name("TS_CustomOnionMessageContents_clone_ptr"))) TS_CustomOnionMessageContents_clone_ptr(uint64_t arg) {
+ void* arg_ptr = untag_ptr(arg);
+ if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); }
+ LDKCustomOnionMessageContents* arg_conv = (LDKCustomOnionMessageContents*)arg_ptr;
+ int64_t ret_conv = CustomOnionMessageContents_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_CustomOnionMessageContents_clone"))) TS_CustomOnionMessageContents_clone(uint64_t orig) {
+ void* orig_ptr = untag_ptr(orig);
+ if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); }
+ LDKCustomOnionMessageContents* orig_conv = (LDKCustomOnionMessageContents*)orig_ptr;
+ LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents");
+ *ret_ret = CustomOnionMessageContents_clone(orig_conv);
+ return tag_ptr(ret_ret, true);
+}
+
+void __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_CustomOnionMessageContents_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKCustomOnionMessageContents this_ptr_conv = *(LDKCustomOnionMessageContents*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ CustomOnionMessageContents_free(this_ptr_conv);
+}
+
+void __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) {
+ LDKBlindedPath this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ BlindedPath_free(this_obj_conv);
+}
+
+static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) {
+ LDKBlindedPath ret_var = BlindedPath_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) {
+ LDKBlindedPath arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) {
+ LDKBlindedPath orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+int64_t __attribute__((export_name("TS_BlindedPath_hash"))) TS_BlindedPath_hash(uint64_t o) {
+ LDKBlindedPath o_conv;
+ o_conv.inner = untag_ptr(o);
+ o_conv.is_owned = ptr_is_owned(o);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
+ o_conv.is_owned = false;
+ int64_t ret_conv = BlindedPath_hash(&o_conv);
+ return ret_conv;
+}
+
+jboolean __attribute__((export_name("TS_BlindedPath_eq"))) TS_BlindedPath_eq(uint64_t a, uint64_t b) {
+ LDKBlindedPath a_conv;
+ a_conv.inner = untag_ptr(a);
+ a_conv.is_owned = ptr_is_owned(a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
+ a_conv.is_owned = false;
+ LDKBlindedPath b_conv;
+ b_conv.inner = untag_ptr(b);
+ b_conv.is_owned = ptr_is_owned(b);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
+ b_conv.is_owned = false;
+ jboolean ret_conv = BlindedPath_eq(&a_conv, &b_conv);
+ return ret_conv;
+}
+
+void __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) {
+ LDKBlindedHop this_obj_conv;
+ this_obj_conv.inner = untag_ptr(this_obj);
+ this_obj_conv.is_owned = ptr_is_owned(this_obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv);
+ BlindedHop_free(this_obj_conv);
+}
+
+static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) {
+ LDKBlindedHop ret_var = BlindedHop_clone(arg);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) {
+ LDKBlindedHop arg_conv;
+ arg_conv.inner = untag_ptr(arg);
+ arg_conv.is_owned = ptr_is_owned(arg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv);
+ arg_conv.is_owned = false;
+ int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) {
+ LDKBlindedHop orig_conv;
+ orig_conv.inner = untag_ptr(orig);
+ orig_conv.is_owned = ptr_is_owned(orig);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv);
+ orig_conv.is_owned = false;
+ LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned);
+ return ret_ref;
+}
+
+int64_t __attribute__((export_name("TS_BlindedHop_hash"))) TS_BlindedHop_hash(uint64_t o) {
+ LDKBlindedHop o_conv;
+ o_conv.inner = untag_ptr(o);
+ o_conv.is_owned = ptr_is_owned(o);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv);
+ o_conv.is_owned = false;
+ int64_t ret_conv = BlindedHop_hash(&o_conv);
+ return ret_conv;
+}
+
+jboolean __attribute__((export_name("TS_BlindedHop_eq"))) TS_BlindedHop_eq(uint64_t a, uint64_t b) {
+ LDKBlindedHop a_conv;
+ a_conv.inner = untag_ptr(a);
+ a_conv.is_owned = ptr_is_owned(a);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv);
+ a_conv.is_owned = false;
+ LDKBlindedHop b_conv;
+ b_conv.inner = untag_ptr(b);
+ b_conv.is_owned = ptr_is_owned(b);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv);
+ b_conv.is_owned = false;
+ jboolean ret_conv = BlindedHop_eq(&a_conv, &b_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_BlindedPath_new_for_message"))) TS_BlindedPath_new_for_message(ptrArray node_pks, uint64_t entropy_source) {
+ LDKCVec_PublicKeyZ node_pks_constr;
+ node_pks_constr.datalen = node_pks->arr_len;
+ if (node_pks_constr.datalen > 0)
+ node_pks_constr.data = MALLOC(node_pks_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
+ else
+ node_pks_constr.data = NULL;
+ int8_tArray* node_pks_vals = (void*) node_pks->elems;
+ for (size_t m = 0; m < node_pks_constr.datalen; m++) {
+ int8_tArray node_pks_conv_12 = node_pks_vals[m];
+ LDKPublicKey node_pks_conv_12_ref;
+ CHECK(node_pks_conv_12->arr_len == 33);
+ memcpy(node_pks_conv_12_ref.compressed_form, node_pks_conv_12->elems, 33); FREE(node_pks_conv_12);
+ node_pks_constr.data[m] = node_pks_conv_12_ref;
+ }
+ FREE(node_pks);
+ void* entropy_source_ptr = untag_ptr(entropy_source);
+ if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); }
+ LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr;
+ LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ");
+ *ret_conv = BlindedPath_new_for_message(node_pks_constr, entropy_source_conv);
+ return tag_ptr(ret_conv, true);
+}
+
+int8_tArray __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) {
+ LDKBlindedPath obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ");
+ *ret_conv = BlindedPath_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+int8_tArray __attribute__((export_name("TS_BlindedHop_write"))) TS_BlindedHop_write(uint64_t obj) {
+ LDKBlindedHop obj_conv;
+ obj_conv.inner = untag_ptr(obj);
+ obj_conv.is_owned = ptr_is_owned(obj);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv);
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = BlindedHop_write(&obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_BlindedHop_read"))) TS_BlindedHop_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ");
+ *ret_conv = BlindedHop_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ PaymentPurpose_free(this_ptr_conv);
+}
+
+static inline uint64_t PaymentPurpose_clone_ptr(LDKPaymentPurpose *NONNULL_PTR arg) {
+ LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+ *ret_copy = PaymentPurpose_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_PaymentPurpose_clone_ptr"))) TS_PaymentPurpose_clone_ptr(uint64_t arg) {
+ LDKPaymentPurpose* arg_conv = (LDKPaymentPurpose*)untag_ptr(arg);
+ int64_t ret_conv = PaymentPurpose_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentPurpose_clone"))) TS_PaymentPurpose_clone(uint64_t orig) {
+ LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)untag_ptr(orig);
+ LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+ *ret_copy = PaymentPurpose_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentPurpose_invoice_payment"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) {
+ LDKThirtyTwoBytes payment_preimage_ref;
+ CHECK(payment_preimage->arr_len == 32);
+ memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
+ LDKThirtyTwoBytes payment_secret_ref;
+ CHECK(payment_secret->arr_len == 32);
+ memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret);
+ LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+ *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
+ LDKThirtyTwoBytes a_ref;
+ CHECK(a->arr_len == 32);
+ memcpy(a_ref.data, a->elems, 32); FREE(a);
+ LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+ *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+jboolean __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) {
+ LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a);
+ LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b);
+ jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) {
+ LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj);
+ LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpose_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_PaymentPurposeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPurposeDecodeErrorZ), "LDKCResult_PaymentPurposeDecodeErrorZ");
+ *ret_conv = PaymentPurpose_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ PathFailure_free(this_ptr_conv);
+}
+
+static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) {
+ LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
+ *ret_copy = PathFailure_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) {
+ LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg);
+ int64_t ret_conv = PathFailure_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) {
+ LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig);
+ LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
+ *ret_copy = PathFailure_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) {
+ void* err_ptr = untag_ptr(err);
+ CHECK_ACCESS(err_ptr);
+ LDKAPIError err_conv = *(LDKAPIError*)(err_ptr);
+ err_conv = APIError_clone((LDKAPIError*)untag_ptr(err));
+ LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
+ *ret_copy = PathFailure_initial_send(err_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) {
+ void* network_update_ptr = untag_ptr(network_update);
+ CHECK_ACCESS(network_update_ptr);
+ LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr);
+ network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update));
+ LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure");
+ *ret_copy = PathFailure_on_path(network_update_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+jboolean __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) {
+ LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a);
+ LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b);
+ jboolean ret_conv = PathFailure_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) {
+ LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj);
+ LDKCVec_u8Z ret_var = PathFailure_write(obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ");
+ *ret_conv = PathFailure_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ ClosureReason_free(this_ptr_conv);
+}
+
+static inline uint64_t ClosureReason_clone_ptr(LDKClosureReason *NONNULL_PTR arg) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_ClosureReason_clone_ptr"))) TS_ClosureReason_clone_ptr(uint64_t arg) {
+ LDKClosureReason* arg_conv = (LDKClosureReason*)untag_ptr(arg);
+ int64_t ret_conv = ClosureReason_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_clone"))) TS_ClosureReason_clone(uint64_t orig) {
+ LDKClosureReason* orig_conv = (LDKClosureReason*)untag_ptr(orig);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_counterparty_force_closed"))) TS_ClosureReason_counterparty_force_closed(uint64_t peer_msg) {
+ LDKUntrustedString peer_msg_conv;
+ peer_msg_conv.inner = untag_ptr(peer_msg);
+ peer_msg_conv.is_owned = ptr_is_owned(peer_msg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(peer_msg_conv);
+ peer_msg_conv = UntrustedString_clone(&peer_msg_conv);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_holder_force_closed"))) TS_ClosureReason_holder_force_closed() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_holder_force_closed();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_cooperative_closure"))) TS_ClosureReason_cooperative_closure() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_cooperative_closure();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_commitment_tx_confirmed"))) TS_ClosureReason_commitment_tx_confirmed() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_commitment_tx_confirmed();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_funding_timed_out"))) TS_ClosureReason_funding_timed_out() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_funding_timed_out();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_processing_error"))) TS_ClosureReason_processing_error(jstring err) {
+ LDKStr err_conv = str_ref_to_owned_c(err);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_processing_error(err_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_disconnected_peer"))) TS_ClosureReason_disconnected_peer() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_disconnected_peer();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_outdated_channel_manager"))) TS_ClosureReason_outdated_channel_manager() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_outdated_channel_manager();
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+jboolean __attribute__((export_name("TS_ClosureReason_eq"))) TS_ClosureReason_eq(uint64_t a, uint64_t b) {
+ LDKClosureReason* a_conv = (LDKClosureReason*)untag_ptr(a);
+ LDKClosureReason* b_conv = (LDKClosureReason*)untag_ptr(b);
+ jboolean ret_conv = ClosureReason_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_ClosureReason_write"))) TS_ClosureReason_write(uint64_t obj) {
+ LDKClosureReason* obj_conv = (LDKClosureReason*)untag_ptr(obj);
+ LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_ClosureReason_read"))) TS_ClosureReason_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_COption_ClosureReasonZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ), "LDKCResult_COption_ClosureReasonZDecodeErrorZ");
+ *ret_conv = ClosureReason_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_HTLCDestination_free"))) TS_HTLCDestination_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKHTLCDestination this_ptr_conv = *(LDKHTLCDestination*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ HTLCDestination_free(this_ptr_conv);
+}
+
+static inline uint64_t HTLCDestination_clone_ptr(LDKHTLCDestination *NONNULL_PTR arg) {
+ LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
+ *ret_copy = HTLCDestination_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_HTLCDestination_clone_ptr"))) TS_HTLCDestination_clone_ptr(uint64_t arg) {
+ LDKHTLCDestination* arg_conv = (LDKHTLCDestination*)untag_ptr(arg);
+ int64_t ret_conv = HTLCDestination_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_HTLCDestination_clone"))) TS_HTLCDestination_clone(uint64_t orig) {
+ LDKHTLCDestination* orig_conv = (LDKHTLCDestination*)untag_ptr(orig);
+ LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
+ *ret_copy = HTLCDestination_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_HTLCDestination_next_hop_channel"))) TS_HTLCDestination_next_hop_channel(int8_tArray node_id, int8_tArray channel_id) {
+ LDKPublicKey node_id_ref;
+ CHECK(node_id->arr_len == 33);
+ memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK(channel_id->arr_len == 32);
+ memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
+ LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
+ *ret_copy = HTLCDestination_next_hop_channel(node_id_ref, channel_id_ref);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS_HTLCDestination_unknown_next_hop(int64_t requested_forward_scid) {
+ LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
+ *ret_copy = HTLCDestination_unknown_next_hop(requested_forward_scid);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) {
+ LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
+ *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) {
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination");
+ *ret_copy = HTLCDestination_failed_payment(payment_hash_ref);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+jboolean __attribute__((export_name("TS_HTLCDestination_eq"))) TS_HTLCDestination_eq(uint64_t a, uint64_t b) {
+ LDKHTLCDestination* a_conv = (LDKHTLCDestination*)untag_ptr(a);
+ LDKHTLCDestination* b_conv = (LDKHTLCDestination*)untag_ptr(b);
+ jboolean ret_conv = HTLCDestination_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_HTLCDestination_write"))) TS_HTLCDestination_write(uint64_t obj) {
+ LDKHTLCDestination* obj_conv = (LDKHTLCDestination*)untag_ptr(obj);
+ LDKCVec_u8Z ret_var = HTLCDestination_write(obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_HTLCDestination_read"))) TS_HTLCDestination_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_COption_HTLCDestinationZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ), "LDKCResult_COption_HTLCDestinationZDecodeErrorZ");
+ *ret_conv = HTLCDestination_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+uint32_t __attribute__((export_name("TS_PaymentFailureReason_clone"))) TS_PaymentFailureReason_clone(uint64_t orig) {
+ LDKPaymentFailureReason* orig_conv = (LDKPaymentFailureReason*)untag_ptr(orig);
+ uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_clone(orig_conv));
+ return ret_conv;
+}
+
+uint32_t __attribute__((export_name("TS_PaymentFailureReason_recipient_rejected"))) TS_PaymentFailureReason_recipient_rejected() {
+ uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_recipient_rejected());
+ return ret_conv;
+}
+
+uint32_t __attribute__((export_name("TS_PaymentFailureReason_user_abandoned"))) TS_PaymentFailureReason_user_abandoned() {
+ uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_user_abandoned());
+ return ret_conv;
+}
+
+uint32_t __attribute__((export_name("TS_PaymentFailureReason_retries_exhausted"))) TS_PaymentFailureReason_retries_exhausted() {
+ uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_retries_exhausted());
+ return ret_conv;
+}
+
+uint32_t __attribute__((export_name("TS_PaymentFailureReason_payment_expired"))) TS_PaymentFailureReason_payment_expired() {
+ uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_payment_expired());
+ return ret_conv;
+}
+
+uint32_t __attribute__((export_name("TS_PaymentFailureReason_route_not_found"))) TS_PaymentFailureReason_route_not_found() {
+ uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_route_not_found());
+ return ret_conv;
+}
+
+uint32_t __attribute__((export_name("TS_PaymentFailureReason_unexpected_error"))) TS_PaymentFailureReason_unexpected_error() {
+ uint32_t ret_conv = LDKPaymentFailureReason_to_js(PaymentFailureReason_unexpected_error());
+ return ret_conv;
+}
+
+jboolean __attribute__((export_name("TS_PaymentFailureReason_eq"))) TS_PaymentFailureReason_eq(uint64_t a, uint64_t b) {
+ LDKPaymentFailureReason* a_conv = (LDKPaymentFailureReason*)untag_ptr(a);
+ LDKPaymentFailureReason* b_conv = (LDKPaymentFailureReason*)untag_ptr(b);
+ jboolean ret_conv = PaymentFailureReason_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_PaymentFailureReason_write"))) TS_PaymentFailureReason_write(uint64_t obj) {
+ LDKPaymentFailureReason* obj_conv = (LDKPaymentFailureReason*)untag_ptr(obj);
+ LDKCVec_u8Z ret_var = PaymentFailureReason_write(obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_PaymentFailureReason_read"))) TS_PaymentFailureReason_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_PaymentFailureReasonDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentFailureReasonDecodeErrorZ), "LDKCResult_PaymentFailureReasonDecodeErrorZ");
+ *ret_conv = PaymentFailureReason_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_Event_free"))) TS_Event_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKEvent this_ptr_conv = *(LDKEvent*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ Event_free(this_ptr_conv);
+}
+
+static inline uint64_t Event_clone_ptr(LDKEvent *NONNULL_PTR arg) {
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_Event_clone_ptr"))) TS_Event_clone_ptr(uint64_t arg) {
+ LDKEvent* arg_conv = (LDKEvent*)untag_ptr(arg);
+ int64_t ret_conv = Event_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t orig) {
+ LDKEvent* orig_conv = (LDKEvent*)untag_ptr(orig);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) {
+ LDKThirtyTwoBytes temporary_channel_id_ref;
+ CHECK(temporary_channel_id->arr_len == 32);
+ memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
+ LDKPublicKey counterparty_node_id_ref;
+ CHECK(counterparty_node_id->arr_len == 33);
+ memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
+ LDKCVec_u8Z output_script_ref;
+ output_script_ref.datalen = output_script->arr_len;
+ output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script);
+ LDKU128 user_channel_id_ref;
+ CHECK(user_channel_id->arr_len == 16);
+ memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, uint64_t onion_fields, int64_t amount_msat, uint64_t purpose, int8_tArray via_channel_id, uint64_t via_user_channel_id, uint64_t claim_deadline) {
+ LDKPublicKey receiver_node_id_ref;
+ CHECK(receiver_node_id->arr_len == 33);
+ memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ LDKRecipientOnionFields onion_fields_conv;
+ onion_fields_conv.inner = untag_ptr(onion_fields);
+ onion_fields_conv.is_owned = ptr_is_owned(onion_fields);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(onion_fields_conv);
+ onion_fields_conv = RecipientOnionFields_clone(&onion_fields_conv);
+ void* purpose_ptr = untag_ptr(purpose);
+ CHECK_ACCESS(purpose_ptr);
+ LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
+ purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
+ LDKThirtyTwoBytes via_channel_id_ref;
+ CHECK(via_channel_id->arr_len == 32);
+ memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id);
+ void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id);
+ CHECK_ACCESS(via_user_channel_id_ptr);
+ LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr);
+ via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id));
+ void* claim_deadline_ptr = untag_ptr(claim_deadline);
+ CHECK_ACCESS(claim_deadline_ptr);
+ LDKCOption_u32Z claim_deadline_conv = *(LDKCOption_u32Z*)(claim_deadline_ptr);
+ claim_deadline_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(claim_deadline));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, onion_fields_conv, amount_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv, claim_deadline_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) {
+ LDKPublicKey receiver_node_id_ref;
+ CHECK(receiver_node_id->arr_len == 33);
+ memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ void* purpose_ptr = untag_ptr(purpose);
+ CHECK_ACCESS(purpose_ptr);
+ LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr);
+ purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_payment_sent"))) TS_Event_payment_sent(int8_tArray payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, uint64_t fee_paid_msat) {
+ LDKThirtyTwoBytes payment_id_ref;
+ CHECK(payment_id->arr_len == 32);
+ memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
+ LDKThirtyTwoBytes payment_preimage_ref;
+ CHECK(payment_preimage->arr_len == 32);
+ memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ void* fee_paid_msat_ptr = untag_ptr(fee_paid_msat);
+ CHECK_ACCESS(fee_paid_msat_ptr);
+ LDKCOption_u64Z fee_paid_msat_conv = *(LDKCOption_u64Z*)(fee_paid_msat_ptr);
+ fee_paid_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_paid_msat));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_payment_sent(payment_id_ref, payment_preimage_ref, payment_hash_ref, fee_paid_msat_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_payment_failed"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t reason) {
+ LDKThirtyTwoBytes payment_id_ref;
+ CHECK(payment_id->arr_len == 32);
+ memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ void* reason_ptr = untag_ptr(reason);
+ CHECK_ACCESS(reason_ptr);
+ LDKCOption_PaymentFailureReasonZ reason_conv = *(LDKCOption_PaymentFailureReasonZ*)(reason_ptr);
+ reason_conv = COption_PaymentFailureReasonZ_clone((LDKCOption_PaymentFailureReasonZ*)untag_ptr(reason));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref, reason_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
+ LDKThirtyTwoBytes payment_id_ref;
+ CHECK(payment_id->arr_len == 32);
+ memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ LDKPath path_conv;
+ path_conv.inner = untag_ptr(path);
+ path_conv.is_owned = ptr_is_owned(path);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
+ path_conv = Path_clone(&path_conv);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, uint64_t failure, uint64_t path, uint64_t short_channel_id) {
+ LDKThirtyTwoBytes payment_id_ref;
+ CHECK(payment_id->arr_len == 32);
+ memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ void* failure_ptr = untag_ptr(failure);
+ CHECK_ACCESS(failure_ptr);
+ LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr);
+ failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure));
+ LDKPath path_conv;
+ path_conv.inner = untag_ptr(path);
+ path_conv.is_owned = ptr_is_owned(path);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
+ path_conv = Path_clone(&path_conv);
+ void* short_channel_id_ptr = untag_ptr(short_channel_id);
+ CHECK_ACCESS(short_channel_id_ptr);
+ LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
+ short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_conv, short_channel_id_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_probe_successful"))) TS_Event_probe_successful(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path) {
+ LDKThirtyTwoBytes payment_id_ref;
+ CHECK(payment_id->arr_len == 32);
+ memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ LDKPath path_conv;
+ path_conv.inner = untag_ptr(path);
+ path_conv.is_owned = ptr_is_owned(path);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
+ path_conv = Path_clone(&path_conv);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_probe_successful(payment_id_ref, payment_hash_ref, path_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_probe_failed"))) TS_Event_probe_failed(int8_tArray payment_id, int8_tArray payment_hash, uint64_t path, uint64_t short_channel_id) {
+ LDKThirtyTwoBytes payment_id_ref;
+ CHECK(payment_id->arr_len == 32);
+ memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ LDKPath path_conv;
+ path_conv.inner = untag_ptr(path);
+ path_conv.is_owned = ptr_is_owned(path);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv);
+ path_conv = Path_clone(&path_conv);
+ void* short_channel_id_ptr = untag_ptr(short_channel_id);
+ CHECK_ACCESS(short_channel_id_ptr);
+ LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(short_channel_id_ptr);
+ short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(short_channel_id));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_probe_failed(payment_id_ref, payment_hash_ref, path_conv, short_channel_id_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) {
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_pending_htlcs_forwardable(time_forwardable);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_htlcintercepted"))) TS_Event_htlcintercepted(int8_tArray intercept_id, int64_t requested_next_hop_scid, int8_tArray payment_hash, int64_t inbound_amount_msat, int64_t expected_outbound_amount_msat) {
+ LDKThirtyTwoBytes intercept_id_ref;
+ CHECK(intercept_id->arr_len == 32);
+ memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id);
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(payment_hash->arr_len == 32);
+ memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) {
+ LDKCVec_SpendableOutputDescriptorZ outputs_constr;
+ outputs_constr.datalen = outputs->arr_len;
+ if (outputs_constr.datalen > 0)
+ outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
+ else
+ outputs_constr.data = NULL;
+ uint64_t* outputs_vals = outputs->elems;
+ for (size_t b = 0; b < outputs_constr.datalen; b++) {
+ uint64_t outputs_conv_27 = outputs_vals[b];
+ void* outputs_conv_27_ptr = untag_ptr(outputs_conv_27);
+ CHECK_ACCESS(outputs_conv_27_ptr);
+ LDKSpendableOutputDescriptor outputs_conv_27_conv = *(LDKSpendableOutputDescriptor*)(outputs_conv_27_ptr);
+ outputs_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)untag_ptr(outputs_conv_27));
+ outputs_constr.data[b] = outputs_conv_27_conv;
+ }
+ FREE(outputs);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_spendable_outputs(outputs_constr);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_payment_forwarded(int8_tArray prev_channel_id, int8_tArray next_channel_id, uint64_t fee_earned_msat, jboolean claim_from_onchain_tx, uint64_t outbound_amount_forwarded_msat) {
+ LDKThirtyTwoBytes prev_channel_id_ref;
+ CHECK(prev_channel_id->arr_len == 32);
+ memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
+ LDKThirtyTwoBytes next_channel_id_ref;
+ CHECK(next_channel_id->arr_len == 32);
+ memcpy(next_channel_id_ref.data, next_channel_id->elems, 32); FREE(next_channel_id);
+ void* fee_earned_msat_ptr = untag_ptr(fee_earned_msat);
+ CHECK_ACCESS(fee_earned_msat_ptr);
+ LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(fee_earned_msat_ptr);
+ fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(fee_earned_msat));
+ void* outbound_amount_forwarded_msat_ptr = untag_ptr(outbound_amount_forwarded_msat);
+ CHECK_ACCESS(outbound_amount_forwarded_msat_ptr);
+ LDKCOption_u64Z outbound_amount_forwarded_msat_conv = *(LDKCOption_u64Z*)(outbound_amount_forwarded_msat_ptr);
+ outbound_amount_forwarded_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(outbound_amount_forwarded_msat));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_payment_forwarded(prev_channel_id_ref, next_channel_id_ref, fee_earned_msat_conv, claim_from_onchain_tx, outbound_amount_forwarded_msat_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_channel_pending"))) TS_Event_channel_pending(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray former_temporary_channel_id, int8_tArray counterparty_node_id, uint64_t funding_txo) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK(channel_id->arr_len == 32);
+ memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
+ LDKU128 user_channel_id_ref;
+ CHECK(user_channel_id->arr_len == 16);
+ memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
+ LDKThirtyTwoBytes former_temporary_channel_id_ref;
+ CHECK(former_temporary_channel_id->arr_len == 32);
+ memcpy(former_temporary_channel_id_ref.data, former_temporary_channel_id->elems, 32); FREE(former_temporary_channel_id);
+ LDKPublicKey counterparty_node_id_ref;
+ CHECK(counterparty_node_id->arr_len == 33);
+ memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
+ LDKOutPoint funding_txo_conv;
+ funding_txo_conv.inner = untag_ptr(funding_txo);
+ funding_txo_conv.is_owned = ptr_is_owned(funding_txo);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_conv);
+ funding_txo_conv = OutPoint_clone(&funding_txo_conv);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_channel_pending(channel_id_ref, user_channel_id_ref, former_temporary_channel_id_ref, counterparty_node_id_ref, funding_txo_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_channel_ready"))) TS_Event_channel_ready(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, uint64_t channel_type) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK(channel_id->arr_len == 32);
+ memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
+ LDKU128 user_channel_id_ref;
+ CHECK(user_channel_id->arr_len == 16);
+ memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
+ LDKPublicKey counterparty_node_id_ref;
+ CHECK(counterparty_node_id->arr_len == 33);
+ memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
+ LDKChannelTypeFeatures channel_type_conv;
+ channel_type_conv.inner = untag_ptr(channel_type);
+ channel_type_conv.is_owned = ptr_is_owned(channel_type);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
+ channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t reason) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK(channel_id->arr_len == 32);
+ memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
+ LDKU128 user_channel_id_ref;
+ CHECK(user_channel_id->arr_len == 16);
+ memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id);
+ void* reason_ptr = untag_ptr(reason);
+ CHECK_ACCESS(reason_ptr);
+ LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr);
+ reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_discard_funding"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK(channel_id->arr_len == 32);
+ memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id);
+ LDKTransaction transaction_ref;
+ transaction_ref.datalen = transaction->arr_len;
+ transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes");
+ memcpy(transaction_ref.data, transaction->elems, transaction_ref.datalen); FREE(transaction);
+ transaction_ref.data_is_owned = true;
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_open_channel_request"))) TS_Event_open_channel_request(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, uint64_t channel_type) {
+ LDKThirtyTwoBytes temporary_channel_id_ref;
+ CHECK(temporary_channel_id->arr_len == 32);
+ memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id);
+ LDKPublicKey counterparty_node_id_ref;
+ CHECK(counterparty_node_id->arr_len == 33);
+ memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id);
+ LDKChannelTypeFeatures channel_type_conv;
+ channel_type_conv.inner = untag_ptr(channel_type);
+ channel_type_conv.is_owned = ptr_is_owned(channel_type);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv);
+ channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv);
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_htlchandling_failed(int8_tArray prev_channel_id, uint64_t failed_next_destination) {
+ LDKThirtyTwoBytes prev_channel_id_ref;
+ CHECK(prev_channel_id->arr_len == 32);
+ memcpy(prev_channel_id_ref.data, prev_channel_id->elems, 32); FREE(prev_channel_id);
+ void* failed_next_destination_ptr = untag_ptr(failed_next_destination);
+ CHECK_ACCESS(failed_next_destination_ptr);
+ LDKHTLCDestination failed_next_destination_conv = *(LDKHTLCDestination*)(failed_next_destination_ptr);
+ failed_next_destination_conv = HTLCDestination_clone((LDKHTLCDestination*)untag_ptr(failed_next_destination));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_htlchandling_failed(prev_channel_id_ref, failed_next_destination_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+jboolean __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) {
+ LDKEvent* a_conv = (LDKEvent*)untag_ptr(a);
+ LDKEvent* b_conv = (LDKEvent*)untag_ptr(b);
+ jboolean ret_conv = Event_eq(a_conv, b_conv);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) {
+ LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj);
+ LDKCVec_u8Z ret_var = Event_write(obj_conv);
+ int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__);
+ memcpy(ret_arr->elems, ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint64_t __attribute__((export_name("TS_Event_read"))) TS_Event_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = ser->arr_len;
+ ser_ref.data = ser->elems;
+ LDKCResult_COption_EventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_EventZDecodeErrorZ), "LDKCResult_COption_EventZDecodeErrorZ");
+ *ret_conv = Event_read(ser_ref);
+ FREE(ser);
+ return tag_ptr(ret_conv, true);
+}
+
+void __attribute__((export_name("TS_MessageSendEvent_free"))) TS_MessageSendEvent_free(uint64_t this_ptr) {
+ if (!ptr_is_owned(this_ptr)) return;
+ void* this_ptr_ptr = untag_ptr(this_ptr);
+ CHECK_ACCESS(this_ptr_ptr);
+ LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(this_ptr_ptr);
+ FREE(untag_ptr(this_ptr));
+ MessageSendEvent_free(this_ptr_conv);
+}
+
+static inline uint64_t MessageSendEvent_clone_ptr(LDKMessageSendEvent *NONNULL_PTR arg) {
+ LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+ *ret_copy = MessageSendEvent_clone(arg);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+int64_t __attribute__((export_name("TS_MessageSendEvent_clone_ptr"))) TS_MessageSendEvent_clone_ptr(uint64_t arg) {
+ LDKMessageSendEvent* arg_conv = (LDKMessageSendEvent*)untag_ptr(arg);
+ int64_t ret_conv = MessageSendEvent_clone_ptr(arg_conv);
+ return ret_conv;
+}
+
+uint64_t __attribute__((export_name("TS_MessageSendEvent_clone"))) TS_MessageSendEvent_clone(uint64_t orig) {
+ LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)untag_ptr(orig);
+ LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+ *ret_copy = MessageSendEvent_clone(orig_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_MessageSendEvent_send_accept_channel"))) TS_MessageSendEvent_send_accept_channel(int8_tArray node_id, uint64_t msg) {
+ LDKPublicKey node_id_ref;
+ CHECK(node_id->arr_len == 33);
+ memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
+ LDKAcceptChannel msg_conv;
+ msg_conv.inner = untag_ptr(msg);
+ msg_conv.is_owned = ptr_is_owned(msg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
+ msg_conv = AcceptChannel_clone(&msg_conv);
+ LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+ *ret_copy = MessageSendEvent_send_accept_channel(node_id_ref, msg_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;
+}
+
+uint64_t __attribute__((export_name("TS_MessageSendEvent_send_open_channel"))) TS_MessageSendEvent_send_open_channel(int8_tArray node_id, uint64_t msg) {
+ LDKPublicKey node_id_ref;
+ CHECK(node_id->arr_len == 33);
+ memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id);
+ LDKOpenChannel msg_conv;
+ msg_conv.inner = untag_ptr(msg);
+ msg_conv.is_owned = ptr_is_owned(msg);
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv);
+ msg_conv = OpenChannel_clone(&msg_conv);
+ LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
+ *ret_copy = MessageSendEvent_send_open_channel(node_id_ref, msg_conv);
+ uint64_t ret_ref = tag_ptr(ret_copy, true);
+ return ret_ref;