+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_default_configuration(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKPublicKey their_network_key_ref;
+ CHECK(*((uint32_t*)their_network_key) == 33);
+ memcpy(their_network_key_ref.compressed_form, (uint8_t*)(their_network_key + 4), 33);
+ LDKUserConfig override_config_conv;
+ override_config_conv.inner = (void*)(override_config & (~1));
+ override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
+ override_config_conv = UserConfig_clone(&override_config_conv);
+ LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ");
+ *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_channels(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
+ uint32_tArray ret_arr = NULL;
+ ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t q = 0; q < ret_var.datalen; q++) {
+ LDKChannelDetails ret_conv_16_var = ret_var.data[q];
+ uint64_t ret_conv_16_ref = 0;
+ CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
+ if (ret_conv_16_var.is_owned) {
+ ret_conv_16_ref |= 1;
+ }
+ ret_arr_ptr[q] = ret_conv_16_ref;
+ }
+
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usable_channels(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
+ uint32_tArray ret_arr = NULL;
+ ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t q = 0; q < ret_var.datalen; q++) {
+ LDKChannelDetails ret_conv_16_var = ret_var.data[q];
+ uint64_t ret_conv_16_ref = 0;
+ CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
+ if (ret_conv_16_var.is_owned) {
+ ret_conv_16_ref |= 1;
+ }
+ ret_arr_ptr[q] = ret_conv_16_ref;
+ }
+
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel(uint32_t this_arg, int8_tArray channel_id) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char channel_id_arr[32];
+ CHECK(*((uint32_t*)channel_id) == 32);
+ memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
+ unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+ LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+ *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char channel_id_arr[32];
+ CHECK(*((uint32_t*)channel_id) == 32);
+ memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
+ unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+ LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+ *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char channel_id_arr[32];
+ CHECK(*((uint32_t*)channel_id) == 32);
+ memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
+ unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+ LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+ *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManager_force_close_all_channels(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ ChannelManager_force_close_all_channels(&this_arg_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKRoute route_conv;
+ route_conv.inner = (void*)(route & (~1));
+ route_conv.is_owned = false;
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(*((uint32_t*)payment_hash) == 32);
+ memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
+ LDKThirtyTwoBytes payment_secret_ref;
+ CHECK(*((uint32_t*)payment_secret) == 32);
+ memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
+ LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ");
+ *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKRoute route_conv;
+ route_conv.inner = (void*)(route & (~1));
+ route_conv.is_owned = false;
+ LDKThirtyTwoBytes payment_id_ref;
+ CHECK(*((uint32_t*)payment_id) == 32);
+ memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32);
+ LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
+ *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKRoute route_conv;
+ route_conv.inner = (void*)(route & (~1));
+ route_conv.is_owned = false;
+ LDKThirtyTwoBytes payment_preimage_ref;
+ CHECK(*((uint32_t*)payment_preimage) == 32);
+ memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
+ LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ");
+ *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char temporary_channel_id_arr[32];
+ CHECK(*((uint32_t*)temporary_channel_id) == 32);
+ memcpy(temporary_channel_id_arr, (uint8_t*)(temporary_channel_id + 4), 32);
+ unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
+ LDKTransaction funding_transaction_ref;
+ funding_transaction_ref.datalen = *((uint32_t*)funding_transaction);
+ funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
+ memcpy(funding_transaction_ref.data, (uint8_t*)(funding_transaction + 4), funding_transaction_ref.datalen);
+ funding_transaction_ref.data_is_owned = true;
+ LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+ *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_announcement(uint32_t this_arg, int8_tArray rgb, int8_tArray alias, uint32_tArray addresses) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKThreeBytes rgb_ref;
+ CHECK(*((uint32_t*)rgb) == 3);
+ memcpy(rgb_ref.data, (uint8_t*)(rgb + 4), 3);
+ LDKThirtyTwoBytes alias_ref;
+ CHECK(*((uint32_t*)alias) == 32);
+ memcpy(alias_ref.data, (uint8_t*)(alias + 4), 32);
+ LDKCVec_NetAddressZ addresses_constr;
+ addresses_constr.datalen = *((uint32_t*)addresses);
+ if (addresses_constr.datalen > 0)
+ addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
+ else
+ addresses_constr.data = NULL;
+ uint32_t* addresses_vals = (uint32_t*)(addresses + 4);
+ for (size_t m = 0; m < addresses_constr.datalen; m++) {
+ uint32_t addresses_conv_12 = addresses_vals[m];
+ void* addresses_conv_12_ptr = (void*)(((uint64_t)addresses_conv_12) & ~1);
+ CHECK_ACCESS(addresses_conv_12_ptr);
+ LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(addresses_conv_12_ptr);
+ addresses_constr.data[m] = addresses_conv_12_conv;
+ }
+ ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManager_process_pending_htlc_forwards(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManager_timer_tick_occurred(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ ChannelManager_timer_tick_occurred(&this_arg_conv);
+}
+
+jboolean __attribute__((visibility("default"))) TS_ChannelManager_fail_htlc_backwards(uint32_t this_arg, int8_tArray payment_hash) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char payment_hash_arr[32];
+ CHECK(*((uint32_t*)payment_hash) == 32);
+ memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32);
+ unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
+ jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_ChannelManager_claim_funds(uint32_t this_arg, int8_tArray payment_preimage) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKThirtyTwoBytes payment_preimage_ref;
+ CHECK(*((uint32_t*)payment_preimage) == 32);
+ memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
+ jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_node_id(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
+ CHECK_ACCESS(min_value_msat_ptr);
+ LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
+ LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
+ *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
+ return ((uint64_t)ret_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_for_hash(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKThirtyTwoBytes payment_hash_ref;
+ CHECK(*((uint32_t*)payment_hash) == 32);
+ memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
+ void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1);
+ CHECK_ACCESS(min_value_msat_ptr);
+ LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
+ LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
+ *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_MessageSendEventsProvider(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKMessageSendEventsProvider* ret_ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKEventsProvider* ret_ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKListen* ret_ret = MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKConfirm* ret_ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ ChannelManager_await_persistable_update(&this_arg_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_current_best_block(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) {
+ LDKChannelManager this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
+ LDKChannelManager obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_obj) {
+ LDKChannelManagerReadArgs this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ChannelManagerReadArgs_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_keys_manager(uint32_t this_ptr) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ // WARNING: This object doesn't live past this scope, needs clone!
+ uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv)) | 1;
+ return ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_keys_manager(uint32_t this_ptr, uint32_t val) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr);
+ ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint32_t this_ptr) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ // WARNING: This object doesn't live past this scope, needs clone!
+ uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv)) | 1;
+ return ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_fee_estimator(uint32_t this_ptr, uint32_t val) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(val_ptr);
+ ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_chain_monitor(uint32_t this_ptr) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ // WARNING: This object doesn't live past this scope, needs clone!
+ uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv)) | 1;
+ return ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_chain_monitor(uint32_t this_ptr, uint32_t val) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKWatch val_conv = *(LDKWatch*)(val_ptr);
+ ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_tx_broadcaster(uint32_t this_ptr) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ // WARNING: This object doesn't live past this scope, needs clone!
+ uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv)) | 1;
+ return ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_tx_broadcaster(uint32_t this_ptr, uint32_t val) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(val_ptr);
+ ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_logger(uint32_t this_ptr) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ // WARNING: This object doesn't live past this scope, needs clone!
+ uint64_t ret_ret = ((uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv)) | 1;
+ return ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_logger(uint32_t this_ptr, uint32_t val) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ void* val_ptr = (void*)(((uint64_t)val) & ~1);
+ CHECK_ACCESS(val_ptr);
+ LDKLogger val_conv = *(LDKLogger*)(val_ptr);
+ ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_get_default_config(uint32_t this_ptr) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_set_default_config(uint32_t this_ptr, uint32_t val) {
+ LDKChannelManagerReadArgs this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKUserConfig val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = UserConfig_clone(&val_conv);
+ ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_new(uint32_t keys_manager, uint32_t fee_estimator, uint32_t chain_monitor, uint32_t tx_broadcaster, uint32_t logger, uint32_t default_config, uint32_tArray channel_monitors) {
+ void* keys_manager_ptr = (void*)(((uint64_t)keys_manager) & ~1);
+ CHECK_ACCESS(keys_manager_ptr);
+ LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr);
+ void* fee_estimator_ptr = (void*)(((uint64_t)fee_estimator) & ~1);
+ CHECK_ACCESS(fee_estimator_ptr);
+ LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(fee_estimator_ptr);
+ void* chain_monitor_ptr = (void*)(((uint64_t)chain_monitor) & ~1);
+ CHECK_ACCESS(chain_monitor_ptr);
+ LDKWatch chain_monitor_conv = *(LDKWatch*)(chain_monitor_ptr);
+ void* tx_broadcaster_ptr = (void*)(((uint64_t)tx_broadcaster) & ~1);
+ CHECK_ACCESS(tx_broadcaster_ptr);
+ LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(tx_broadcaster_ptr);
+ void* logger_ptr = (void*)(((uint64_t)logger) & ~1);
+ CHECK_ACCESS(logger_ptr);
+ LDKLogger logger_conv = *(LDKLogger*)(logger_ptr);
+ LDKUserConfig default_config_conv;
+ default_config_conv.inner = (void*)(default_config & (~1));
+ default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
+ default_config_conv = UserConfig_clone(&default_config_conv);
+ LDKCVec_ChannelMonitorZ channel_monitors_constr;
+ channel_monitors_constr.datalen = *((uint32_t*)channel_monitors);
+ if (channel_monitors_constr.datalen > 0)
+ channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
+ else
+ channel_monitors_constr.data = NULL;
+ uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4);
+ for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
+ uint32_t channel_monitors_conv_16 = channel_monitors_vals[q];
+ LDKChannelMonitor channel_monitors_conv_16_conv;
+ channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
+ channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
+ channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
+ }
+ LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelManagerZ_read(int8_tArray ser, uint32_t arg) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKChannelManagerReadArgs arg_conv;
+ arg_conv.inner = (void*)(arg & (~1));
+ arg_conv.is_owned = (arg & 1) || (arg == 0);
+ // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
+ LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
+ *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_DecodeError_free(uint32_t this_obj) {
+ LDKDecodeError this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ DecodeError_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_DecodeError_clone(uint32_t orig) {
+ LDKDecodeError orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_obj) {
+ LDKInit this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Init_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) {
+ LDKInit this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) {
+ LDKInit this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInitFeatures val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = InitFeatures_clone(&val_conv);
+ Init_set_features(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) {
+ LDKInitFeatures features_arg_conv;
+ features_arg_conv.inner = (void*)(features_arg & (~1));
+ features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
+ features_arg_conv = InitFeatures_clone(&features_arg_conv);
+ LDKInit ret_var = Init_new(features_arg_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) {
+ LDKInit orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKInit ret_var = Init_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ErrorMessage_free(uint32_t this_obj) {
+ LDKErrorMessage this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ErrorMessage_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_get_channel_id(uint32_t this_ptr) {
+ LDKErrorMessage this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), *ErrorMessage_get_channel_id(&this_ptr_conv), 32);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_ErrorMessage_set_channel_id(uint32_t this_ptr, int8_tArray val) {
+ LDKErrorMessage this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKThirtyTwoBytes val_ref;
+ CHECK(*((uint32_t*)val) == 32);
+ memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
+ ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
+}
+
+jstring __attribute__((visibility("default"))) TS_ErrorMessage_get_data(uint32_t this_ptr) {
+ LDKErrorMessage this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
+ jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
+ Str_free(ret_str);
+ return ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_ErrorMessage_set_data(uint32_t this_ptr, jstring val) {
+ LDKErrorMessage this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKStr val_conv = str_ref_to_owned_c(val);
+ ErrorMessage_set_data(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_new(int8_tArray channel_id_arg, jstring data_arg) {
+ LDKThirtyTwoBytes channel_id_arg_ref;
+ CHECK(*((uint32_t*)channel_id_arg) == 32);
+ memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
+ LDKStr data_arg_conv = str_ref_to_owned_c(data_arg);
+ LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ErrorMessage_clone(uint32_t orig) {
+ LDKErrorMessage orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_Ping_free(uint32_t this_obj) {
+ LDKPing this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Ping_free(this_obj_conv);
+}
+
+int16_t __attribute__((visibility("default"))) TS_Ping_get_ponglen(uint32_t this_ptr) {
+ LDKPing this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_Ping_set_ponglen(uint32_t this_ptr, int16_t val) {
+ LDKPing this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ Ping_set_ponglen(&this_ptr_conv, val);
+}
+
+int16_t __attribute__((visibility("default"))) TS_Ping_get_byteslen(uint32_t this_ptr) {
+ LDKPing this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_Ping_set_byteslen(uint32_t this_ptr, int16_t val) {
+ LDKPing this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ Ping_set_byteslen(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Ping_new(int16_t ponglen_arg, int16_t byteslen_arg) {
+ LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Ping_clone(uint32_t orig) {
+ LDKPing orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKPing ret_var = Ping_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_Pong_free(uint32_t this_obj) {
+ LDKPong this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Pong_free(this_obj_conv);
+}
+
+int16_t __attribute__((visibility("default"))) TS_Pong_get_byteslen(uint32_t this_ptr) {
+ LDKPong this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_Pong_set_byteslen(uint32_t this_ptr, int16_t val) {
+ LDKPong this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ Pong_set_byteslen(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Pong_new(int16_t byteslen_arg) {
+ LDKPong ret_var = Pong_new(byteslen_arg);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Pong_clone(uint32_t orig) {
+ LDKPong orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKPong ret_var = Pong_clone(&orig_conv);
+ uint64_t ret_ref = 0;
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_free(uint32_t this_obj) {
+ LDKOpenChannel this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ OpenChannel_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_chain_hash(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_chain_hash(&this_ptr_conv), 32);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_chain_hash(uint32_t this_ptr, int8_tArray val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKThirtyTwoBytes val_ref;
+ CHECK(*((uint32_t*)val) == 32);
+ memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
+ OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_temporary_channel_id(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), *OpenChannel_get_temporary_channel_id(&this_ptr_conv), 32);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_temporary_channel_id(uint32_t this_ptr, int8_tArray val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKThirtyTwoBytes val_ref;
+ CHECK(*((uint32_t*)val) == 32);
+ memcpy(val_ref.data, (uint8_t*)(val + 4), 32);
+ OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
+}
+
+int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_funding_satoshis(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_satoshis(uint32_t this_ptr, int64_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_push_msat(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_push_msat(uint32_t this_ptr, int64_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_push_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_dust_limit_satoshis(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_dust_limit_satoshis(uint32_t this_ptr, int64_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_htlc_value_in_flight_msat(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_max_htlc_value_in_flight_msat(uint32_t this_ptr, int64_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_reserve_satoshis(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_reserve_satoshis(uint32_t this_ptr, int64_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
+}
+
+int64_t __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_minimum_msat(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
+}
+
+int32_t __attribute__((visibility("default"))) TS_OpenChannel_get_feerate_per_kw(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_feerate_per_kw(uint32_t this_ptr, int32_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
+}
+
+int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_to_self_delay(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_to_self_delay(uint32_t this_ptr, int16_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_to_self_delay(&this_ptr_conv, val);
+}
+
+int16_t __attribute__((visibility("default"))) TS_OpenChannel_get_max_accepted_htlcs(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_max_accepted_htlcs(uint32_t this_ptr, int16_t val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_pubkey(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(*((uint32_t*)val) == 33);
+ memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
+ OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocation_basepoint(uint32_t this_ptr) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) {
+ LDKOpenChannel this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;