+static jclass LDKHTLCDestination_NextHopChannel_class = NULL;
+static jmethodID LDKHTLCDestination_NextHopChannel_meth = NULL;
+static jclass LDKHTLCDestination_UnknownNextHop_class = NULL;
+static jmethodID LDKHTLCDestination_UnknownNextHop_meth = NULL;
+static jclass LDKHTLCDestination_FailedPayment_class = NULL;
+static jmethodID LDKHTLCDestination_FailedPayment_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCDestination_init (JNIEnv *env, jclass clz) {
+ LDKHTLCDestination_NextHopChannel_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$NextHopChannel"));
+ CHECK(LDKHTLCDestination_NextHopChannel_class != NULL);
+ LDKHTLCDestination_NextHopChannel_meth = (*env)->GetMethodID(env, LDKHTLCDestination_NextHopChannel_class, "<init>", "([B[B)V");
+ CHECK(LDKHTLCDestination_NextHopChannel_meth != NULL);
+ LDKHTLCDestination_UnknownNextHop_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$UnknownNextHop"));
+ CHECK(LDKHTLCDestination_UnknownNextHop_class != NULL);
+ LDKHTLCDestination_UnknownNextHop_meth = (*env)->GetMethodID(env, LDKHTLCDestination_UnknownNextHop_class, "<init>", "(J)V");
+ CHECK(LDKHTLCDestination_UnknownNextHop_meth != NULL);
+ LDKHTLCDestination_FailedPayment_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKHTLCDestination$FailedPayment"));
+ CHECK(LDKHTLCDestination_FailedPayment_class != NULL);
+ LDKHTLCDestination_FailedPayment_meth = (*env)->GetMethodID(env, LDKHTLCDestination_FailedPayment_class, "<init>", "([B)V");
+ CHECK(LDKHTLCDestination_FailedPayment_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKHTLCDestination *obj = (LDKHTLCDestination*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKHTLCDestination_NextHopChannel: {
+ int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
+ (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->next_hop_channel.node_id.compressed_form);
+ int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->next_hop_channel.channel_id.data);
+ return (*env)->NewObject(env, LDKHTLCDestination_NextHopChannel_class, LDKHTLCDestination_NextHopChannel_meth, node_id_arr, channel_id_arr);
+ }
+ case LDKHTLCDestination_UnknownNextHop: {
+ int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid;
+ return (*env)->NewObject(env, LDKHTLCDestination_UnknownNextHop_class, LDKHTLCDestination_UnknownNextHop_meth, requested_forward_scid_conv);
+ }
+ case LDKHTLCDestination_FailedPayment: {
+ int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->failed_payment.payment_hash.data);
+ return (*env)->NewObject(env, LDKHTLCDestination_FailedPayment_class, LDKHTLCDestination_FailedPayment_meth, payment_hash_arr);
+ }
+ default: abort();
+ }
+}
+static jclass LDKCOption_HTLCDestinationZ_Some_class = NULL;
+static jmethodID LDKCOption_HTLCDestinationZ_Some_meth = NULL;
+static jclass LDKCOption_HTLCDestinationZ_None_class = NULL;
+static jmethodID LDKCOption_HTLCDestinationZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1HTLCDestinationZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_HTLCDestinationZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$Some"));
+ CHECK(LDKCOption_HTLCDestinationZ_Some_class != NULL);
+ LDKCOption_HTLCDestinationZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_HTLCDestinationZ_Some_meth != NULL);
+ LDKCOption_HTLCDestinationZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_HTLCDestinationZ$None"));
+ CHECK(LDKCOption_HTLCDestinationZ_None_class != NULL);
+ LDKCOption_HTLCDestinationZ_None_meth = (*env)->GetMethodID(env, LDKCOption_HTLCDestinationZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_HTLCDestinationZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1HTLCDestinationZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_HTLCDestinationZ *obj = (LDKCOption_HTLCDestinationZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_HTLCDestinationZ_Some: {
+ int64_t some_ref = ((uintptr_t)&obj->some) | 1;
+ return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_Some_class, LDKCOption_HTLCDestinationZ_Some_meth, some_ref);
+ }
+ case LDKCOption_HTLCDestinationZ_None: {
+ return (*env)->NewObject(env, LDKCOption_HTLCDestinationZ_None_class, LDKCOption_HTLCDestinationZ_None_meth);
+ }
+ default: abort();
+ }
+}
+static inline struct LDKCOption_HTLCDestinationZ CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
+CHECK(owner->result_ok);
+ return COption_HTLCDestinationZ_clone(&*owner->contents.result);
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) {
+ LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
+ LDKCOption_HTLCDestinationZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCDestinationZ), "LDKCOption_HTLCDestinationZ");
+ *ret_copy = CResult_COption_HTLCDestinationZDecodeErrorZ_get_ok(owner_conv);
+ int64_t ret_ref = (uintptr_t)ret_copy;
+ return ret_ref;
+}
+
+static inline struct LDKDecodeError CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR owner){
+CHECK(!owner->result_ok);
+ return DecodeError_clone(&*owner->contents.err);
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1HTLCDestinationZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) {
+ LDKCResult_COption_HTLCDestinationZDecodeErrorZ* owner_conv = (LDKCResult_COption_HTLCDestinationZDecodeErrorZ*)(owner & ~1);
+ LDKDecodeError ret_var = CResult_COption_HTLCDestinationZDecodeErrorZ_get_err(owner_conv);
+ int64_t ret_ref = 0;
+ CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var);
+ ret_ref = (uintptr_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+