X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjni%2Fbindings.c.body;fp=src%2Fmain%2Fjni%2Fbindings.c.body;h=40978b79007b078df0ccb1cdfba6168974fc5f98;hb=2f0e19ab23f28c5c1bc11dc6bff24e156da3ec01;hp=b25964254133a8209cd77cdf0a751c1d5cb70319;hpb=ab07d4394be144b5e7eb123655031dba5349b849;p=ldk-java diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index b2596425..40978b79 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -353,11 +353,12 @@ static inline LDKBolt12SemanticError LDKBolt12SemanticError_from_java(JNIEnv *en case 18: return LDKBolt12SemanticError_UnexpectedMetadata; case 19: return LDKBolt12SemanticError_MissingPayerMetadata; case 20: return LDKBolt12SemanticError_MissingPayerId; - case 21: return LDKBolt12SemanticError_MissingPaths; - case 22: return LDKBolt12SemanticError_InvalidPayInfo; - case 23: return LDKBolt12SemanticError_MissingCreationTime; - case 24: return LDKBolt12SemanticError_MissingPaymentHash; - case 25: return LDKBolt12SemanticError_MissingSignature; + case 21: return LDKBolt12SemanticError_DuplicatePaymentId; + case 22: return LDKBolt12SemanticError_MissingPaths; + case 23: return LDKBolt12SemanticError_InvalidPayInfo; + case 24: return LDKBolt12SemanticError_MissingCreationTime; + case 25: return LDKBolt12SemanticError_MissingPaymentHash; + case 26: return LDKBolt12SemanticError_MissingSignature; } (*env)->FatalError(env, "A call to Bolt12SemanticError.ordinal() from rust returned an invalid value."); abort(); // Unreachable, but will let the compiler know we don't return here @@ -384,6 +385,7 @@ static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidMetadata = NUL static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_UnexpectedMetadata = NULL; static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata = NULL; static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = NULL; +static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = NULL; static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = NULL; static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = NULL; static jfieldID Bolt12SemanticError_LDKBolt12SemanticError_MissingCreationTime = NULL; @@ -434,6 +436,8 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_Bolt12SemanticError_init (JNIEnv *env, CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata != NULL); Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPayerId", "Lorg/ldk/enums/Bolt12SemanticError;"); CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId != NULL); + Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_DuplicatePaymentId", "Lorg/ldk/enums/Bolt12SemanticError;"); + CHECK(Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId != NULL); Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_MissingPaths", "Lorg/ldk/enums/Bolt12SemanticError;"); CHECK(Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths != NULL); Bolt12SemanticError_LDKBolt12SemanticError_InvalidPayInfo = (*env)->GetStaticFieldID(env, Bolt12SemanticError_class, "LDKBolt12SemanticError_InvalidPayInfo", "Lorg/ldk/enums/Bolt12SemanticError;"); @@ -489,6 +493,8 @@ static inline jclass LDKBolt12SemanticError_to_java(JNIEnv *env, LDKBolt12Semant return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerMetadata); case LDKBolt12SemanticError_MissingPayerId: return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPayerId); + case LDKBolt12SemanticError_DuplicatePaymentId: + return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_DuplicatePaymentId); case LDKBolt12SemanticError_MissingPaths: return (*env)->GetStaticObjectField(env, Bolt12SemanticError_class, Bolt12SemanticError_LDKBolt12SemanticError_MissingPaths); case LDKBolt12SemanticError_InvalidPayInfo: @@ -636,41 +642,59 @@ static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception."); } switch (ord) { - case 0: return LDKConfirmationTarget_MempoolMinimum; - case 1: return LDKConfirmationTarget_Background; - case 2: return LDKConfirmationTarget_Normal; - case 3: return LDKConfirmationTarget_HighPriority; + case 0: return LDKConfirmationTarget_OnChainSweep; + case 1: return LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee; + case 2: return LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee; + case 3: return LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee; + case 4: return LDKConfirmationTarget_AnchorChannelFee; + case 5: return LDKConfirmationTarget_NonAnchorChannelFee; + case 6: return LDKConfirmationTarget_ChannelCloseMinimum; } (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value."); abort(); // Unreachable, but will let the compiler know we don't return here } static jclass ConfirmationTarget_class = NULL; -static jfieldID ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = NULL; -static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL; -static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL; -static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL; +static jfieldID ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = NULL; +static jfieldID ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee = NULL; +static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = NULL; +static jfieldID ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = NULL; +static jfieldID ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = NULL; +static jfieldID ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = NULL; +static jfieldID ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) { ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz); CHECK(ConfirmationTarget_class != NULL); - ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MempoolMinimum", "Lorg/ldk/enums/ConfirmationTarget;"); - CHECK(ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum != NULL); - ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;"); - CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL); - ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;"); - CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL); - ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;"); - CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL); + ConfirmationTarget_LDKConfirmationTarget_OnChainSweep = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_OnChainSweep", "Lorg/ldk/enums/ConfirmationTarget;"); + CHECK(ConfirmationTarget_LDKConfirmationTarget_OnChainSweep != NULL); + ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;"); + CHECK(ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee != NULL); + ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;"); + CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee != NULL); + ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee", "Lorg/ldk/enums/ConfirmationTarget;"); + CHECK(ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee != NULL); + ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_AnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;"); + CHECK(ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee != NULL); + ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_NonAnchorChannelFee", "Lorg/ldk/enums/ConfirmationTarget;"); + CHECK(ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee != NULL); + ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_ChannelCloseMinimum", "Lorg/ldk/enums/ConfirmationTarget;"); + CHECK(ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum != NULL); } static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) { switch (val) { - case LDKConfirmationTarget_MempoolMinimum: - return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MempoolMinimum); - case LDKConfirmationTarget_Background: - return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background); - case LDKConfirmationTarget_Normal: - return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal); - case LDKConfirmationTarget_HighPriority: - return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority); + case LDKConfirmationTarget_OnChainSweep: + return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_OnChainSweep); + case LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee: + return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee); + case LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee: + return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee); + case LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee: + return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee); + case LDKConfirmationTarget_AnchorChannelFee: + return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_AnchorChannelFee); + case LDKConfirmationTarget_NonAnchorChannelFee: + return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_NonAnchorChannelFee); + case LDKConfirmationTarget_ChannelCloseMinimum: + return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_ChannelCloseMinimum); default: abort(); } } @@ -2328,6 +2352,58 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zusi CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(owner_conv); } +static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){ + LDKChannelDerivationParameters ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner); + LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv); + int64_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 struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){ + LDKHTLCDescriptor ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner); + LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv); + int64_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 struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return *owner->contents.result; @@ -2800,7 +2876,7 @@ typedef struct LDKEcdsaChannelSigner_JCalls { LDKChannelSigner_JCalls* ChannelSigner; jmethodID sign_counterparty_commitment_meth; jmethodID validate_counterparty_revocation_meth; - jmethodID sign_holder_commitment_and_htlcs_meth; + jmethodID sign_holder_commitment_meth; jmethodID sign_justice_revoked_output_meth; jmethodID sign_justice_revoked_htlc_meth; jmethodID sign_holder_htlc_transaction_meth; @@ -2895,7 +2971,7 @@ LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcal } return ret_conv; } -LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { +LDKCResult_ECDSASignatureNoneZ sign_holder_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -2911,14 +2987,14 @@ LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitme commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKEcdsaChannelSigner from rust threw an exception."); + (*env)->FatalError(env, "A call to sign_holder_commitment in LDKEcdsaChannelSigner from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ*)(ret_ptr); + LDKCResult_ECDSASignatureNoneZ ret_conv = *(LDKCResult_ECDSASignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); @@ -3175,8 +3251,8 @@ static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jcl CHECK(calls->sign_counterparty_commitment_meth != NULL); calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J"); CHECK(calls->validate_counterparty_revocation_meth != NULL); - calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J"); - CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL); + calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J"); + CHECK(calls->sign_holder_commitment_meth != NULL); calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J"); CHECK(calls->sign_justice_revoked_output_meth != NULL); calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J"); @@ -3201,7 +3277,7 @@ static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JNIEnv *env, jcl .this_arg = (void*) calls, .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall, .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall, - .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall, + .sign_holder_commitment = sign_holder_commitment_LDKEcdsaChannelSigner_jcall, .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall, .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall, .sign_holder_htlc_transaction = sign_holder_htlc_transaction_LDKEcdsaChannelSigner_jcall, @@ -3264,7 +3340,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validat return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; @@ -3273,8 +3349,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1h commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx); CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_conv); commitment_tx_conv.is_owned = false; - LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ), "LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ"); - *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv); + LDKCResult_ECDSASignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_ECDSASignatureNoneZ), "LDKCResult_ECDSASignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv); return tag_ptr(ret_conv, true); } @@ -5542,7 +5618,7 @@ static void LDKUtxoLookup_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { +LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* chain_hash)[32], uint64_t short_channel_id) { LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -5551,12 +5627,12 @@ LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t ( } else { DO_ASSERT(get_jenv_res == JNI_OK); } - int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash); + int8_tArray chain_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, chain_hash_arr, 0, 32, *chain_hash); int64_t short_channel_id_conv = short_channel_id; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id_conv); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, chain_hash_arr, short_channel_id_conv); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_utxo in LDKUtxoLookup from rust threw an exception."); @@ -5596,16 +5672,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKUtxoLookup_1new(JNIEnv * *res_ptr = LDKUtxoLookup_init(env, clz, o); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UtxoLookup_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray chain_hash, int64_t short_channel_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr; - uint8_t genesis_hash_arr[32]; - CHECK((*env)->GetArrayLength(env, genesis_hash) == 32); - (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr); - uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr; + uint8_t chain_hash_arr[32]; + CHECK((*env)->GetArrayLength(env, chain_hash) == 32); + (*env)->GetByteArrayRegion(env, chain_hash, 0, 32, chain_hash_arr); + uint8_t (*chain_hash_ref)[32] = &chain_hash_arr; LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); - *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); + *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, chain_hash_ref, short_channel_id); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -6689,58 +6765,6 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAdd default: abort(); } } -static inline struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){ - LDKChannelDerivationParameters ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner); - LDKChannelDerivationParameters ret_var = CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(owner_conv); - int64_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 struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ChannelDerivationParametersDecodeErrorZ* owner_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ChannelDerivationParametersDecodeErrorZ_get_err(owner_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){ - LDKHTLCDescriptor ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner); - LDKHTLCDescriptor ret_var = CResult_HTLCDescriptorDecodeErrorZ_get_ok(owner_conv); - int64_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 struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_HTLCDescriptorDecodeErrorZ* owner_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_HTLCDescriptorDecodeErrorZ_get_err(owner_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - static inline LDKCVec_HTLCOutputInCommitmentZ CVec_HTLCOutputInCommitmentZ_clone(const LDKCVec_HTLCOutputInCommitmentZ *orig) { LDKCVec_HTLCOutputInCommitmentZ ret = { .data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * orig->datalen, "LDKCVec_HTLCOutputInCommitmentZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -7340,6 +7364,55 @@ static inline LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ CVec_C2Tuple_ThirtyTwoBy } return ret; } +static jclass LDKCOption_StrZ_Some_class = NULL; +static jmethodID LDKCOption_StrZ_Some_meth = NULL; +static jclass LDKCOption_StrZ_None_class = NULL; +static jmethodID LDKCOption_StrZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init (JNIEnv *env, jclass clz) { + LDKCOption_StrZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$Some")); + CHECK(LDKCOption_StrZ_Some_class != NULL); + LDKCOption_StrZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_Some_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKCOption_StrZ_Some_meth != NULL); + LDKCOption_StrZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_StrZ$None")); + CHECK(LDKCOption_StrZ_None_class != NULL); + LDKCOption_StrZ_None_meth = (*env)->GetMethodID(env, LDKCOption_StrZ_None_class, "", "()V"); + CHECK(LDKCOption_StrZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_StrZ *obj = (LDKCOption_StrZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_StrZ_Some: { + LDKStr some_str = obj->some; + jstring some_conv = str_ref_to_java(env, some_str.chars, some_str.len); + return (*env)->NewObject(env, LDKCOption_StrZ_Some_class, LDKCOption_StrZ_Some_meth, some_conv); + } + case LDKCOption_StrZ_None: { + return (*env)->NewObject(env, LDKCOption_StrZ_None_class, LDKCOption_StrZ_None_meth); + } + default: abort(); + } +} +static inline void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner); + CResult_NoneBolt12SemanticErrorZ_get_ok(owner_conv); +} + +static inline enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return Bolt12SemanticError_clone(&*owner->contents.err); +} +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_NoneBolt12SemanticErrorZ* owner_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(owner); + jclass ret_conv = LDKBolt12SemanticError_to_java(env, CResult_NoneBolt12SemanticErrorZ_get_err(owner_conv)); + return ret_conv; +} + static inline struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(&*owner->contents.result); @@ -7360,6 +7433,162 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoByt CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(owner_conv); } +static jclass LDKOffersMessage_InvoiceRequest_class = NULL; +static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL; +static jclass LDKOffersMessage_Invoice_class = NULL; +static jmethodID LDKOffersMessage_Invoice_meth = NULL; +static jclass LDKOffersMessage_InvoiceError_class = NULL; +static jmethodID LDKOffersMessage_InvoiceError_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) { + LDKOffersMessage_InvoiceRequest_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest")); + CHECK(LDKOffersMessage_InvoiceRequest_class != NULL); + LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "", "(J)V"); + CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL); + LDKOffersMessage_Invoice_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice")); + CHECK(LDKOffersMessage_Invoice_class != NULL); + LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "", "(J)V"); + CHECK(LDKOffersMessage_Invoice_meth != NULL); + LDKOffersMessage_InvoiceError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError")); + CHECK(LDKOffersMessage_InvoiceError_class != NULL); + LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "", "(J)V"); + CHECK(LDKOffersMessage_InvoiceError_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr); + switch(obj->tag) { + case LDKOffersMessage_InvoiceRequest: { + LDKInvoiceRequest invoice_request_var = obj->invoice_request; + int64_t invoice_request_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var); + invoice_request_ref = tag_ptr(invoice_request_var.inner, false); + return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref); + } + case LDKOffersMessage_Invoice: { + LDKBolt12Invoice invoice_var = obj->invoice; + int64_t invoice_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var); + invoice_ref = tag_ptr(invoice_var.inner, false); + return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref); + } + case LDKOffersMessage_InvoiceError: { + LDKInvoiceError invoice_error_var = obj->invoice_error; + int64_t invoice_error_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var); + invoice_error_ref = tag_ptr(invoice_error_var.inner, false); + return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref); + } + default: abort(); + } +} +static jclass LDKCOption_OffersMessageZ_Some_class = NULL; +static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL; +static jclass LDKCOption_OffersMessageZ_None_class = NULL; +static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) { + LDKCOption_OffersMessageZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some")); + CHECK(LDKCOption_OffersMessageZ_Some_class != NULL); + LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL); + LDKCOption_OffersMessageZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None")); + CHECK(LDKCOption_OffersMessageZ_None_class != NULL); + LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "", "()V"); + CHECK(LDKCOption_OffersMessageZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_OffersMessageZ_Some: { + int64_t some_ref = tag_ptr(&obj->some, false); + return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref); + } + case LDKCOption_OffersMessageZ_None: { + return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth); + } + default: abort(); + } +} +static jclass LDKDestination_Node_class = NULL; +static jmethodID LDKDestination_Node_meth = NULL; +static jclass LDKDestination_BlindedPath_class = NULL; +static jmethodID LDKDestination_BlindedPath_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) { + LDKDestination_Node_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node")); + CHECK(LDKDestination_Node_class != NULL); + LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "", "([B)V"); + CHECK(LDKDestination_Node_meth != NULL); + LDKDestination_BlindedPath_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath")); + CHECK(LDKDestination_BlindedPath_class != NULL); + LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "", "(J)V"); + CHECK(LDKDestination_BlindedPath_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); + switch(obj->tag) { + case LDKDestination_Node: { + int8_tArray node_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form); + return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr); + } + case LDKDestination_BlindedPath: { + LDKBlindedPath blinded_path_var = obj->blinded_path; + int64_t blinded_path_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var); + blinded_path_ref = tag_ptr(blinded_path_var.inner, false); + return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref); + } + default: abort(); + } +} +static inline struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){ + return OffersMessage_clone(&owner->a); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner); + LDKOffersMessage *ret_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage"); + *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){ + return Destination_clone(&owner->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner); + LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination"); + *ret_copy = C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner){ + LDKBlindedPath ret = owner->c; + ret.is_owned = false; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(owner); + LDKBlindedPath ret_var = C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(owner_conv); + int64_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 LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ *orig) { + LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(&orig->data[i]); + } + return ret; +} static inline struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner){ LDKCounterpartyForwardingInfo ret = *owner->contents.result; ret.is_owned = false; @@ -9708,94 +9937,15 @@ static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone } return ret; } -static jclass LDKOffersMessage_InvoiceRequest_class = NULL; -static jmethodID LDKOffersMessage_InvoiceRequest_meth = NULL; -static jclass LDKOffersMessage_Invoice_class = NULL; -static jmethodID LDKOffersMessage_Invoice_meth = NULL; -static jclass LDKOffersMessage_InvoiceError_class = NULL; -static jmethodID LDKOffersMessage_InvoiceError_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOffersMessage_init (JNIEnv *env, jclass clz) { - LDKOffersMessage_InvoiceRequest_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceRequest")); - CHECK(LDKOffersMessage_InvoiceRequest_class != NULL); - LDKOffersMessage_InvoiceRequest_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceRequest_class, "", "(J)V"); - CHECK(LDKOffersMessage_InvoiceRequest_meth != NULL); - LDKOffersMessage_Invoice_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$Invoice")); - CHECK(LDKOffersMessage_Invoice_class != NULL); - LDKOffersMessage_Invoice_meth = (*env)->GetMethodID(env, LDKOffersMessage_Invoice_class, "", "(J)V"); - CHECK(LDKOffersMessage_Invoice_meth != NULL); - LDKOffersMessage_InvoiceError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOffersMessage$InvoiceError")); - CHECK(LDKOffersMessage_InvoiceError_class != NULL); - LDKOffersMessage_InvoiceError_meth = (*env)->GetMethodID(env, LDKOffersMessage_InvoiceError_class, "", "(J)V"); - CHECK(LDKOffersMessage_InvoiceError_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKOffersMessage *obj = (LDKOffersMessage*)untag_ptr(ptr); - switch(obj->tag) { - case LDKOffersMessage_InvoiceRequest: { - LDKInvoiceRequest invoice_request_var = obj->invoice_request; - int64_t invoice_request_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_request_var); - invoice_request_ref = tag_ptr(invoice_request_var.inner, false); - return (*env)->NewObject(env, LDKOffersMessage_InvoiceRequest_class, LDKOffersMessage_InvoiceRequest_meth, invoice_request_ref); - } - case LDKOffersMessage_Invoice: { - LDKBolt12Invoice invoice_var = obj->invoice; - int64_t invoice_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_var); - invoice_ref = tag_ptr(invoice_var.inner, false); - return (*env)->NewObject(env, LDKOffersMessage_Invoice_class, LDKOffersMessage_Invoice_meth, invoice_ref); - } - case LDKOffersMessage_InvoiceError: { - LDKInvoiceError invoice_error_var = obj->invoice_error; - int64_t invoice_error_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_error_var); - invoice_error_ref = tag_ptr(invoice_error_var.inner, false); - return (*env)->NewObject(env, LDKOffersMessage_InvoiceError_class, LDKOffersMessage_InvoiceError_meth, invoice_error_ref); - } - default: abort(); - } -} -static jclass LDKCOption_OffersMessageZ_Some_class = NULL; -static jmethodID LDKCOption_OffersMessageZ_Some_meth = NULL; -static jclass LDKCOption_OffersMessageZ_None_class = NULL; -static jmethodID LDKCOption_OffersMessageZ_None_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OffersMessageZ_init (JNIEnv *env, jclass clz) { - LDKCOption_OffersMessageZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$Some")); - CHECK(LDKCOption_OffersMessageZ_Some_class != NULL); - LDKCOption_OffersMessageZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_Some_class, "", "(J)V"); - CHECK(LDKCOption_OffersMessageZ_Some_meth != NULL); - LDKCOption_OffersMessageZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OffersMessageZ$None")); - CHECK(LDKCOption_OffersMessageZ_None_class != NULL); - LDKCOption_OffersMessageZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OffersMessageZ_None_class, "", "()V"); - CHECK(LDKCOption_OffersMessageZ_None_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKCOption_OffersMessageZ *obj = (LDKCOption_OffersMessageZ*)untag_ptr(ptr); - switch(obj->tag) { - case LDKCOption_OffersMessageZ_Some: { - int64_t some_ref = tag_ptr(&obj->some, false); - return (*env)->NewObject(env, LDKCOption_OffersMessageZ_Some_class, LDKCOption_OffersMessageZ_Some_meth, some_ref); - } - case LDKCOption_OffersMessageZ_None: { - return (*env)->NewObject(env, LDKCOption_OffersMessageZ_None_class, LDKCOption_OffersMessageZ_None_meth); - } - default: abort(); - } -} -typedef struct LDKCustomOnionMessageContents_JCalls { +typedef struct LDKOnionMessageContents_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; jmethodID tlv_type_meth; jmethodID write_meth; -} LDKCustomOnionMessageContents_JCalls; -static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) { - LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg; +} LDKOnionMessageContents_JCalls; +static void LDKOnionMessageContents_JCalls_free(void* this_arg) { + LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -9811,8 +9961,8 @@ static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) { - LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg; +uint64_t tlv_type_LDKOnionMessageContents_jcall(const void* this_arg) { + LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); if (get_jenv_res == JNI_EDETACHED) { @@ -9825,15 +9975,15 @@ uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) { int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->tlv_type_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to tlv_type in LDKCustomOnionMessageContents from rust threw an exception."); + (*env)->FatalError(env, "A call to tlv_type in LDKOnionMessageContents from rust threw an exception."); } if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret; } -LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) { - LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg; +LDKCVec_u8Z write_LDKOnionMessageContents_jcall(const void* this_arg) { + LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); if (get_jenv_res == JNI_EDETACHED) { @@ -9846,7 +9996,7 @@ LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) { int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to write in LDKCustomOnionMessageContents from rust threw an exception."); + (*env)->FatalError(env, "A call to write in LDKOnionMessageContents from rust threw an exception."); } LDKCVec_u8Z ret_ref; ret_ref.datalen = (*env)->GetArrayLength(env, ret); @@ -9857,14 +10007,14 @@ LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) { } return ret_ref; } -static void LDKCustomOnionMessageContents_JCalls_cloned(LDKCustomOnionMessageContents* new_obj) { - LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) new_obj->this_arg; +static void LDKOnionMessageContents_JCalls_cloned(LDKOnionMessageContents* new_obj) { + LDKOnionMessageContents_JCalls *j_calls = (LDKOnionMessageContents_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) { +static inline LDKOnionMessageContents LDKOnionMessageContents_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKCustomOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKCustomOnionMessageContents_JCalls), "LDKCustomOnionMessageContents_JCalls"); + LDKOnionMessageContents_JCalls *calls = MALLOC(sizeof(LDKOnionMessageContents_JCalls), "LDKOnionMessageContents_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); @@ -9873,32 +10023,32 @@ static inline LDKCustomOnionMessageContents LDKCustomOnionMessageContents_init ( calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B"); CHECK(calls->write_meth != NULL); - LDKCustomOnionMessageContents ret = { + LDKOnionMessageContents ret = { .this_arg = (void*) calls, - .tlv_type = tlv_type_LDKCustomOnionMessageContents_jcall, - .write = write_LDKCustomOnionMessageContents_jcall, - .cloned = LDKCustomOnionMessageContents_JCalls_cloned, - .free = LDKCustomOnionMessageContents_JCalls_free, + .tlv_type = tlv_type_LDKOnionMessageContents_jcall, + .write = write_LDKOnionMessageContents_jcall, + .cloned = LDKOnionMessageContents_JCalls_cloned, + .free = LDKOnionMessageContents_JCalls_free, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) { - LDKCustomOnionMessageContents *res_ptr = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents"); - *res_ptr = LDKCustomOnionMessageContents_init(env, clz, o); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new(JNIEnv *env, jclass clz, jobject o) { + LDKOnionMessageContents *res_ptr = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *res_ptr = LDKOnionMessageContents_init(env, clz, o); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr; + LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr; int64_t ret_conv = (this_arg_conv->tlv_type)(this_arg_conv->this_arg); return ret_conv; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKCustomOnionMessageContents* this_arg_conv = (LDKCustomOnionMessageContents*)this_arg_ptr; + LDKOnionMessageContents* this_arg_conv = (LDKOnionMessageContents*)this_arg_ptr; LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); @@ -9906,60 +10056,102 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageConte return ret_arr; } -static jclass LDKCOption_CustomOnionMessageContentsZ_Some_class = NULL; -static jmethodID LDKCOption_CustomOnionMessageContentsZ_Some_meth = NULL; -static jclass LDKCOption_CustomOnionMessageContentsZ_None_class = NULL; -static jmethodID LDKCOption_CustomOnionMessageContentsZ_None_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CustomOnionMessageContentsZ_init (JNIEnv *env, jclass clz) { - LDKCOption_CustomOnionMessageContentsZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$Some")); - CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_class != NULL); - LDKCOption_CustomOnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, "", "(J)V"); - CHECK(LDKCOption_CustomOnionMessageContentsZ_Some_meth != NULL); - LDKCOption_CustomOnionMessageContentsZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CustomOnionMessageContentsZ$None")); - CHECK(LDKCOption_CustomOnionMessageContentsZ_None_class != NULL); - LDKCOption_CustomOnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CustomOnionMessageContentsZ_None_class, "", "()V"); - CHECK(LDKCOption_CustomOnionMessageContentsZ_None_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CustomOnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKCOption_CustomOnionMessageContentsZ *obj = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(ptr); +static jclass LDKCOption_OnionMessageContentsZ_Some_class = NULL; +static jmethodID LDKCOption_OnionMessageContentsZ_Some_meth = NULL; +static jclass LDKCOption_OnionMessageContentsZ_None_class = NULL; +static jmethodID LDKCOption_OnionMessageContentsZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init (JNIEnv *env, jclass clz) { + LDKCOption_OnionMessageContentsZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$Some")); + CHECK(LDKCOption_OnionMessageContentsZ_Some_class != NULL); + LDKCOption_OnionMessageContentsZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_OnionMessageContentsZ_Some_meth != NULL); + LDKCOption_OnionMessageContentsZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_OnionMessageContentsZ$None")); + CHECK(LDKCOption_OnionMessageContentsZ_None_class != NULL); + LDKCOption_OnionMessageContentsZ_None_meth = (*env)->GetMethodID(env, LDKCOption_OnionMessageContentsZ_None_class, "", "()V"); + CHECK(LDKCOption_OnionMessageContentsZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_OnionMessageContentsZ *obj = (LDKCOption_OnionMessageContentsZ*)untag_ptr(ptr); switch(obj->tag) { - case LDKCOption_CustomOnionMessageContentsZ_Some: { - LDKCustomOnionMessageContents* some_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents"); - *some_ret = CustomOnionMessageContents_clone(&obj->some); - return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_Some_class, LDKCOption_CustomOnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true)); + case LDKCOption_OnionMessageContentsZ_Some: { + LDKOnionMessageContents* some_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *some_ret = OnionMessageContents_clone(&obj->some); + return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_Some_class, LDKCOption_OnionMessageContentsZ_Some_meth, tag_ptr(some_ret, true)); } - case LDKCOption_CustomOnionMessageContentsZ_None: { - return (*env)->NewObject(env, LDKCOption_CustomOnionMessageContentsZ_None_class, LDKCOption_CustomOnionMessageContentsZ_None_meth); + case LDKCOption_OnionMessageContentsZ_None: { + return (*env)->NewObject(env, LDKCOption_OnionMessageContentsZ_None_class, LDKCOption_OnionMessageContentsZ_None_meth); } default: abort(); } } -static inline struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return COption_CustomOnionMessageContentsZ_clone(&*owner->contents.result); + return COption_OnionMessageContentsZ_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner); - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); - *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ"); + *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(owner); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* owner_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(owner_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } +static inline struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){ + return OnionMessageContents_clone(&owner->a); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner); + LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *ret_ret = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(owner_conv); + return tag_ptr(ret_ret, true); +} + +static inline struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){ + return Destination_clone(&owner->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner); + LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination"); + *ret_copy = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner){ + LDKBlindedPath ret = owner->c; + ret.is_owned = false; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c(JNIEnv *env, jclass clz, int64_t owner) { + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* owner_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(owner); + LDKBlindedPath ret_var = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(owner_conv); + int64_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 LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_clone(const LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ *orig) { + LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ) * orig->datalen, "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(&orig->data[i]); + } + return ret; +} static jclass LDKCOption_TypeZ_Some_class = NULL; static jmethodID LDKCOption_TypeZ_Some_meth = NULL; static jclass LDKCOption_TypeZ_None_class = NULL; @@ -12760,6 +12952,8 @@ static jclass LDKEvent_PaymentClaimable_class = NULL; static jmethodID LDKEvent_PaymentClaimable_meth = NULL; static jclass LDKEvent_PaymentClaimed_class = NULL; static jmethodID LDKEvent_PaymentClaimed_meth = NULL; +static jclass LDKEvent_InvoiceRequestFailed_class = NULL; +static jmethodID LDKEvent_InvoiceRequestFailed_meth = NULL; static jclass LDKEvent_PaymentSent_class = NULL; static jmethodID LDKEvent_PaymentSent_meth = NULL; static jclass LDKEvent_PaymentFailed_class = NULL; @@ -12810,6 +13004,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en CHECK(LDKEvent_PaymentClaimed_class != NULL); LDKEvent_PaymentClaimed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentClaimed_class, "", "([B[BJJ[JJ)V"); CHECK(LDKEvent_PaymentClaimed_meth != NULL); + LDKEvent_InvoiceRequestFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$InvoiceRequestFailed")); + CHECK(LDKEvent_InvoiceRequestFailed_class != NULL); + LDKEvent_InvoiceRequestFailed_meth = (*env)->GetMethodID(env, LDKEvent_InvoiceRequestFailed_class, "", "([B)V"); + CHECK(LDKEvent_InvoiceRequestFailed_meth != NULL); LDKEvent_PaymentSent_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent")); CHECK(LDKEvent_PaymentSent_class != NULL); @@ -12951,6 +13150,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int64_t sender_intended_total_msat_ref = tag_ptr(&obj->payment_claimed.sender_intended_total_msat, false); return (*env)->NewObject(env, LDKEvent_PaymentClaimed_class, LDKEvent_PaymentClaimed_meth, receiver_node_id_arr, payment_hash_arr, amount_msat_conv, purpose_ref, htlcs_arr, sender_intended_total_msat_ref); } + case LDKEvent_InvoiceRequestFailed: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->invoice_request_failed.payment_id.data); + return (*env)->NewObject(env, LDKEvent_InvoiceRequestFailed_class, LDKEvent_InvoiceRequestFailed_meth, payment_id_arr); + } case LDKEvent_PaymentSent: { int64_t payment_id_ref = tag_ptr(&obj->payment_sent.payment_id, false); int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); @@ -14205,6 +14409,99 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKey return ret_ref; } +static jclass LDKParsedOnionMessageContents_Offers_class = NULL; +static jmethodID LDKParsedOnionMessageContents_Offers_meth = NULL; +static jclass LDKParsedOnionMessageContents_Custom_class = NULL; +static jmethodID LDKParsedOnionMessageContents_Custom_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init (JNIEnv *env, jclass clz) { + LDKParsedOnionMessageContents_Offers_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Offers")); + CHECK(LDKParsedOnionMessageContents_Offers_class != NULL); + LDKParsedOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Offers_class, "", "(J)V"); + CHECK(LDKParsedOnionMessageContents_Offers_meth != NULL); + LDKParsedOnionMessageContents_Custom_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParsedOnionMessageContents$Custom")); + CHECK(LDKParsedOnionMessageContents_Custom_class != NULL); + LDKParsedOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKParsedOnionMessageContents_Custom_class, "", "(J)V"); + CHECK(LDKParsedOnionMessageContents_Custom_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKParsedOnionMessageContents *obj = (LDKParsedOnionMessageContents*)untag_ptr(ptr); + switch(obj->tag) { + case LDKParsedOnionMessageContents_Offers: { + int64_t offers_ref = tag_ptr(&obj->offers, false); + return (*env)->NewObject(env, LDKParsedOnionMessageContents_Offers_class, LDKParsedOnionMessageContents_Offers_meth, offers_ref); + } + case LDKParsedOnionMessageContents_Custom: { + LDKOnionMessageContents* custom_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *custom_ret = OnionMessageContents_clone(&obj->custom); + return (*env)->NewObject(env, LDKParsedOnionMessageContents_Custom_class, LDKParsedOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true)); + } + default: abort(); + } +} +static jclass LDKPeeledOnion_Forward_class = NULL; +static jmethodID LDKPeeledOnion_Forward_meth = NULL; +static jclass LDKPeeledOnion_Receive_class = NULL; +static jmethodID LDKPeeledOnion_Receive_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init (JNIEnv *env, jclass clz) { + LDKPeeledOnion_Forward_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Forward")); + CHECK(LDKPeeledOnion_Forward_class != NULL); + LDKPeeledOnion_Forward_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Forward_class, "", "([BJ)V"); + CHECK(LDKPeeledOnion_Forward_meth != NULL); + LDKPeeledOnion_Receive_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPeeledOnion$Receive")); + CHECK(LDKPeeledOnion_Receive_class != NULL); + LDKPeeledOnion_Receive_meth = (*env)->GetMethodID(env, LDKPeeledOnion_Receive_class, "", "(J[BJ)V"); + CHECK(LDKPeeledOnion_Receive_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKPeeledOnion *obj = (LDKPeeledOnion*)untag_ptr(ptr); + switch(obj->tag) { + case LDKPeeledOnion_Forward: { + int8_tArray _0_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, _0_arr, 0, 33, obj->forward._0.compressed_form); + LDKOnionMessage _1_var = obj->forward._1; + int64_t _1_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(_1_var); + _1_ref = tag_ptr(_1_var.inner, false); + return (*env)->NewObject(env, LDKPeeledOnion_Forward_class, LDKPeeledOnion_Forward_meth, _0_arr, _1_ref); + } + case LDKPeeledOnion_Receive: { + int64_t _0_ref = tag_ptr(&obj->receive._0, false); + int8_tArray _1_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, _1_arr, 0, 32, obj->receive._1.data); + LDKBlindedPath _2_var = obj->receive._2; + int64_t _2_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(_2_var); + _2_ref = tag_ptr(_2_var.inner, false); + return (*env)->NewObject(env, LDKPeeledOnion_Receive_class, LDKPeeledOnion_Receive_meth, _0_ref, _1_arr, _2_ref); + } + default: abort(); + } +} +static inline struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return PeeledOnion_clone(&*owner->contents.result); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner); + LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion"); + *ret_copy = CResult_PeeledOnionNoneZ_get_ok(owner_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_PeeledOnionNoneZ* owner_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(owner); + CResult_PeeledOnionNoneZ_get_err(owner_conv); +} + static inline void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return *owner->contents.result; @@ -16068,7 +16365,7 @@ typedef struct LDKChannelMessageHandler_JCalls { jmethodID handle_error_meth; jmethodID provided_node_features_meth; jmethodID provided_init_features_meth; - jmethodID get_genesis_hashes_meth; + jmethodID get_chain_hashes_meth; } LDKChannelMessageHandler_JCalls; static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -16977,7 +17274,7 @@ LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void } return ret_conv; } -LDKCOption_CVec_ThirtyTwoBytesZZ get_genesis_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) { +LDKCOption_CVec_ThirtyTwoBytesZZ get_chain_hashes_LDKChannelMessageHandler_jcall(const void* this_arg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -16988,10 +17285,10 @@ LDKCOption_CVec_ThirtyTwoBytesZZ get_genesis_hashes_LDKChannelMessageHandler_jca } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_genesis_hashes_meth); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_chain_hashes_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to get_genesis_hashes in LDKChannelMessageHandler from rust threw an exception."); + (*env)->FatalError(env, "A call to get_chain_hashes in LDKChannelMessageHandler from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); @@ -17080,8 +17377,8 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en CHECK(calls->provided_node_features_meth != NULL); calls->provided_init_features_meth = (*env)->GetMethodID(env, c, "provided_init_features", "([B)J"); CHECK(calls->provided_init_features_meth != NULL); - calls->get_genesis_hashes_meth = (*env)->GetMethodID(env, c, "get_genesis_hashes", "()J"); - CHECK(calls->get_genesis_hashes_meth != NULL); + calls->get_chain_hashes_meth = (*env)->GetMethodID(env, c, "get_chain_hashes", "()J"); + CHECK(calls->get_chain_hashes_meth != NULL); LDKChannelMessageHandler ret = { .this_arg = (void*) calls, @@ -17118,7 +17415,7 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en .handle_error = handle_error_LDKChannelMessageHandler_jcall, .provided_node_features = provided_node_features_LDKChannelMessageHandler_jcall, .provided_init_features = provided_init_features_LDKChannelMessageHandler_jcall, - .get_genesis_hashes = get_genesis_hashes_LDKChannelMessageHandler_jcall, + .get_chain_hashes = get_chain_hashes_LDKChannelMessageHandler_jcall, .free = LDKChannelMessageHandler_JCalls_free, .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider), }; @@ -17621,16 +17918,166 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1prov return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1genesis_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKCOption_CVec_ThirtyTwoBytesZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_ThirtyTwoBytesZZ), "LDKCOption_CVec_ThirtyTwoBytesZZ"); - *ret_copy = (this_arg_conv->get_genesis_hashes)(this_arg_conv->this_arg); + *ret_copy = (this_arg_conv->get_chain_hashes)(this_arg_conv->this_arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +typedef struct LDKOffersMessageHandler_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID handle_message_meth; + jmethodID release_pending_messages_meth; +} LDKOffersMessageHandler_JCalls; +static void LDKOffersMessageHandler_JCalls_free(void* this_arg) { + LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) { + LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage"); + *message_copy = message; + int64_t message_ref = tag_ptr(message_copy, true); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception."); + } + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr); + FREE(untag_ptr(ret)); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ release_pending_messages_LDKOffersMessageHandler_jcall(const void* this_arg) { + LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_messages_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to release_pending_messages in LDKOffersMessageHandler from rust threw an exception."); + } + LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements"); + else + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t x = 0; x < ret_constr.datalen; x++) { + int64_t ret_conv_49 = ret_vals[x]; + void* ret_conv_49_ptr = untag_ptr(ret_conv_49); + CHECK_ACCESS(ret_conv_49_ptr); + LDKC3Tuple_OffersMessageDestinationBlindedPathZ ret_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(ret_conv_49_ptr); + FREE(untag_ptr(ret_conv_49)); + ret_constr.data[x] = ret_conv_49_conv; + } + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_constr; +} +static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) { + LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J"); + CHECK(calls->handle_message_meth != NULL); + calls->release_pending_messages_meth = (*env)->GetMethodID(env, c, "release_pending_messages", "()[J"); + CHECK(calls->release_pending_messages_meth != NULL); + + LDKOffersMessageHandler ret = { + .this_arg = (void*) calls, + .handle_message = handle_message_LDKOffersMessageHandler_jcall, + .release_pending_messages = release_pending_messages_LDKOffersMessageHandler_jcall, + .free = LDKOffersMessageHandler_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) { + LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler"); + *res_ptr = LDKOffersMessageHandler_init(env, clz, o); + return tag_ptr(res_ptr, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr; + void* message_ptr = untag_ptr(message); + CHECK_ACCESS(message_ptr); + LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr); + message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message)); + LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); + *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr; + LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_messages)(this_arg_conv->this_arg); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); + for (size_t x = 0; x < ret_var.datalen; x++) { + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv_49_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ"); + *ret_conv_49_conv = ret_var.data[x]; + ret_arr_ptr[x] = tag_ptr(ret_conv_49_conv, true); + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + typedef struct LDKRoutingMessageHandler_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -18297,14 +18744,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1prov return ret_ref; } -typedef struct LDKOnionMessageProvider_JCalls { +typedef struct LDKOnionMessageHandler_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; + jmethodID handle_onion_message_meth; jmethodID next_onion_message_for_peer_meth; -} LDKOnionMessageProvider_JCalls; -static void LDKOnionMessageProvider_JCalls_free(void* this_arg) { - LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg; + jmethodID peer_connected_meth; + jmethodID peer_disconnected_meth; + jmethodID provided_node_features_meth; + jmethodID provided_init_features_meth; +} LDKOnionMessageHandler_JCalls; +static void LDKOnionMessageHandler_JCalls_free(void* this_arg) { + LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -18320,8 +18772,8 @@ static void LDKOnionMessageProvider_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const void* this_arg, LDKPublicKey peer_node_id) { - LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg; +void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) { + LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); if (get_jenv_res == JNI_EDETACHED) { @@ -18331,91 +18783,23 @@ LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const } int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form); + LDKOnionMessage msg_var = *msg; + int64_t msg_ref = 0; + msg_var = OnionMessage_clone(&msg_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr); + (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageProvider from rust threw an exception."); + (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception."); } - LDKOnionMessage ret_conv; - ret_conv.inner = untag_ptr(ret); - ret_conv.is_owned = ptr_is_owned(ret); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_conv; -} -static void LDKOnionMessageProvider_JCalls_cloned(LDKOnionMessageProvider* new_obj) { - LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) new_obj->this_arg; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKOnionMessageProvider LDKOnionMessageProvider_init (JNIEnv *env, jclass clz, jobject o) { - jclass c = (*env)->GetObjectClass(env, o); - CHECK(c != NULL); - LDKOnionMessageProvider_JCalls *calls = MALLOC(sizeof(LDKOnionMessageProvider_JCalls), "LDKOnionMessageProvider_JCalls"); - atomic_init(&calls->refcnt, 1); - DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); - calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J"); - CHECK(calls->next_onion_message_for_peer_meth != NULL); - - LDKOnionMessageProvider ret = { - .this_arg = (void*) calls, - .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageProvider_jcall, - .free = LDKOnionMessageProvider_JCalls_free, - }; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new(JNIEnv *env, jclass clz, jobject o) { - LDKOnionMessageProvider *res_ptr = MALLOC(sizeof(LDKOnionMessageProvider), "LDKOnionMessageProvider"); - *res_ptr = LDKOnionMessageProvider_init(env, clz, o); - return tag_ptr(res_ptr, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKOnionMessageProvider* this_arg_conv = (LDKOnionMessageProvider*)this_arg_ptr; - LDKPublicKey peer_node_id_ref; - CHECK((*env)->GetArrayLength(env, peer_node_id) == 33); - (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form); - LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref); - int64_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; } - -typedef struct LDKOnionMessageHandler_JCalls { - atomic_size_t refcnt; - JavaVM *vm; - jweak o; - LDKOnionMessageProvider_JCalls* OnionMessageProvider; - jmethodID handle_onion_message_meth; - jmethodID peer_connected_meth; - jmethodID peer_disconnected_meth; - jmethodID provided_node_features_meth; - jmethodID provided_init_features_meth; -} LDKOnionMessageHandler_JCalls; -static void LDKOnionMessageHandler_JCalls_free(void* this_arg) { - LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - JNIEnv *env; - jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); - } else { - DO_ASSERT(get_jenv_res == JNI_OK); - } - (*env)->DeleteWeakGlobalRef(env, j_calls->o); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - FREE(j_calls); - } -} -void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id, const LDKOnionMessage * msg) { +LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey peer_node_id) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -18426,21 +18810,21 @@ void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDK } int8_tArray peer_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, peer_node_id_arr, 0, 33, peer_node_id.compressed_form); - LDKOnionMessage msg_var = *msg; - int64_t msg_ref = 0; - msg_var = OnionMessage_clone(&msg_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); - msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->handle_onion_message_meth, peer_node_id_arr, msg_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->next_onion_message_for_peer_meth, peer_node_id_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to handle_onion_message in LDKOnionMessageHandler from rust threw an exception."); + (*env)->FatalError(env, "A call to next_onion_message_for_peer in LDKOnionMessageHandler from rust threw an exception."); } + LDKOnionMessage ret_conv; + ret_conv.inner = untag_ptr(ret); + ret_conv.is_owned = ptr_is_owned(ret); + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } + return ret_conv; } LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; @@ -18552,9 +18936,8 @@ LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* static void LDKOnionMessageHandler_JCalls_cloned(LDKOnionMessageHandler* new_obj) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); - atomic_fetch_add_explicit(&j_calls->OnionMessageProvider->refcnt, 1, memory_order_release); } -static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) { +static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); LDKOnionMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOnionMessageHandler_JCalls), "LDKOnionMessageHandler_JCalls"); @@ -18563,6 +18946,8 @@ static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, j calls->o = (*env)->NewWeakGlobalRef(env, o); calls->handle_onion_message_meth = (*env)->GetMethodID(env, c, "handle_onion_message", "([BJ)V"); CHECK(calls->handle_onion_message_meth != NULL); + calls->next_onion_message_for_peer_meth = (*env)->GetMethodID(env, c, "next_onion_message_for_peer", "([B)J"); + CHECK(calls->next_onion_message_for_peer_meth != NULL); calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJZ)J"); CHECK(calls->peer_connected_meth != NULL); calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([B)V"); @@ -18575,25 +18960,20 @@ static inline LDKOnionMessageHandler LDKOnionMessageHandler_init (JNIEnv *env, j LDKOnionMessageHandler ret = { .this_arg = (void*) calls, .handle_onion_message = handle_onion_message_LDKOnionMessageHandler_jcall, + .next_onion_message_for_peer = next_onion_message_for_peer_LDKOnionMessageHandler_jcall, .peer_connected = peer_connected_LDKOnionMessageHandler_jcall, .peer_disconnected = peer_disconnected_LDKOnionMessageHandler_jcall, .provided_node_features = provided_node_features_LDKOnionMessageHandler_jcall, .provided_init_features = provided_init_features_LDKOnionMessageHandler_jcall, .free = LDKOnionMessageHandler_JCalls_free, - .OnionMessageProvider = LDKOnionMessageProvider_init(env, clz, OnionMessageProvider), }; - calls->OnionMessageProvider = ret.OnionMessageProvider.this_arg; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject OnionMessageProvider) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) { LDKOnionMessageHandler *res_ptr = MALLOC(sizeof(LDKOnionMessageHandler), "LDKOnionMessageHandler"); - *res_ptr = LDKOnionMessageHandler_init(env, clz, o, OnionMessageProvider); + *res_ptr = LDKOnionMessageHandler_init(env, clz, o); return tag_ptr(res_ptr, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t arg) { - LDKOnionMessageHandler *inp = (LDKOnionMessageHandler *)untag_ptr(arg); - return tag_ptr(&inp->OnionMessageProvider, false); -} JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id, int64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } @@ -18609,6 +18989,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1o (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1next_1onion_1message_1for_1peer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray peer_node_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr; + LDKPublicKey peer_node_id_ref; + CHECK((*env)->GetArrayLength(env, peer_node_id) == 33); + (*env)->GetByteArrayRegion(env, peer_node_id, 0, 33, peer_node_id_ref.compressed_form); + LDKOnionMessage ret_var = (this_arg_conv->next_onion_message_for_peer)(this_arg_conv->this_arg, peer_node_id_ref); + int64_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; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } @@ -19001,14 +19395,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provi return ret_ref; } -typedef struct LDKOffersMessageHandler_JCalls { +typedef struct LDKCustomOnionMessageHandler_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; - jmethodID handle_message_meth; -} LDKOffersMessageHandler_JCalls; -static void LDKOffersMessageHandler_JCalls_free(void* this_arg) { - LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg; + jmethodID handle_custom_message_meth; + jmethodID read_custom_message_meth; + jmethodID release_pending_custom_messages_meth; +} LDKCustomOnionMessageHandler_JCalls; +static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) { + LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -19024,8 +19420,8 @@ static void LDKOffersMessageHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const void* this_arg, LDKOffersMessage message) { - LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) this_arg; +LDKCOption_OnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKOnionMessageContents msg) { + LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); if (get_jenv_res == JNI_EDETACHED) { @@ -19033,90 +19429,25 @@ LDKCOption_OffersMessageZ handle_message_LDKOffersMessageHandler_jcall(const voi } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKOffersMessage *message_copy = MALLOC(sizeof(LDKOffersMessage), "LDKOffersMessage"); - *message_copy = message; - int64_t message_ref = tag_ptr(message_copy, true); + LDKOnionMessageContents* msg_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *msg_ret = msg; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_message_meth, message_ref); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true)); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to handle_message in LDKOffersMessageHandler from rust threw an exception."); + (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCOption_OffersMessageZ ret_conv = *(LDKCOption_OffersMessageZ*)(ret_ptr); + LDKCOption_OnionMessageContentsZ ret_conv = *(LDKCOption_OnionMessageContentsZ*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -static void LDKOffersMessageHandler_JCalls_cloned(LDKOffersMessageHandler* new_obj) { - LDKOffersMessageHandler_JCalls *j_calls = (LDKOffersMessageHandler_JCalls*) new_obj->this_arg; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKOffersMessageHandler LDKOffersMessageHandler_init (JNIEnv *env, jclass clz, jobject o) { - jclass c = (*env)->GetObjectClass(env, o); - CHECK(c != NULL); - LDKOffersMessageHandler_JCalls *calls = MALLOC(sizeof(LDKOffersMessageHandler_JCalls), "LDKOffersMessageHandler_JCalls"); - atomic_init(&calls->refcnt, 1); - DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); - calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->handle_message_meth = (*env)->GetMethodID(env, c, "handle_message", "(J)J"); - CHECK(calls->handle_message_meth != NULL); - - LDKOffersMessageHandler ret = { - .this_arg = (void*) calls, - .handle_message = handle_message_LDKOffersMessageHandler_jcall, - .free = LDKOffersMessageHandler_JCalls_free, - }; - return ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new(JNIEnv *env, jclass clz, jobject o) { - LDKOffersMessageHandler *res_ptr = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler"); - *res_ptr = LDKOffersMessageHandler_init(env, clz, o); - return tag_ptr(res_ptr, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t message) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKOffersMessageHandler* this_arg_conv = (LDKOffersMessageHandler*)this_arg_ptr; - void* message_ptr = untag_ptr(message); - CHECK_ACCESS(message_ptr); - LDKOffersMessage message_conv = *(LDKOffersMessage*)(message_ptr); - message_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(message)); - LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); - *ret_copy = (this_arg_conv->handle_message)(this_arg_conv->this_arg, message_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -typedef struct LDKCustomOnionMessageHandler_JCalls { - atomic_size_t refcnt; - JavaVM *vm; - jweak o; - jmethodID handle_custom_message_meth; - jmethodID read_custom_message_meth; -} LDKCustomOnionMessageHandler_JCalls; -static void LDKCustomOnionMessageHandler_JCalls_free(void* this_arg) { - LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - JNIEnv *env; - jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); - } else { - DO_ASSERT(get_jenv_res == JNI_OK); - } - (*env)->DeleteWeakGlobalRef(env, j_calls->o); - if (get_jenv_res == JNI_EDETACHED) { - DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); - } - FREE(j_calls); - } -} -LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, LDKCustomOnionMessageContents msg) { +LDKCResult_COption_OnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) { LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -19125,25 +19456,27 @@ LDKCOption_CustomOnionMessageContentsZ handle_custom_message_LDKCustomOnionMessa } else { DO_ASSERT(get_jenv_res == JNI_OK); } - LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents"); - *msg_ret = msg; + int64_t message_type_conv = message_type; + LDKu8slice buffer_var = buffer; + int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen); + (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, tag_ptr(msg_ret, true)); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomOnionMessageHandler from rust threw an exception."); + (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception."); } void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCOption_CustomOnionMessageContentsZ ret_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(ret_ptr); + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(ret_ptr); FREE(untag_ptr(ret)); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } return ret_conv; } -LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) { +LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall(const void* this_arg) { LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -19152,25 +19485,33 @@ LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_L } else { DO_ASSERT(get_jenv_res == JNI_OK); } - int64_t message_type_conv = message_type; - LDKu8slice buffer_var = buffer; - int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen); - (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_custom_message_meth, message_type_conv, buffer_arr); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_custom_messages_meth); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to read_custom_message in LDKCustomOnionMessageHandler from rust threw an exception."); + (*env)->FatalError(env, "A call to release_pending_custom_messages in LDKCustomOnionMessageHandler from rust threw an exception."); } - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr); - FREE(untag_ptr(ret)); + LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements"); + else + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t e = 0; e < ret_constr.datalen; e++) { + int64_t ret_conv_56 = ret_vals[e]; + void* ret_conv_56_ptr = untag_ptr(ret_conv_56); + CHECK_ACCESS(ret_conv_56_ptr); + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(ret_conv_56_ptr); + FREE(untag_ptr(ret_conv_56)); + ret_constr.data[e] = ret_conv_56_conv; + } + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } - return ret_conv; + return ret_constr; } static void LDKCustomOnionMessageHandler_JCalls_cloned(LDKCustomOnionMessageHandler* new_obj) { LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) new_obj->this_arg; @@ -19187,11 +19528,14 @@ static inline LDKCustomOnionMessageHandler LDKCustomOnionMessageHandler_init (JN CHECK(calls->handle_custom_message_meth != NULL); calls->read_custom_message_meth = (*env)->GetMethodID(env, c, "read_custom_message", "(J[B)J"); CHECK(calls->read_custom_message_meth != NULL); + calls->release_pending_custom_messages_meth = (*env)->GetMethodID(env, c, "release_pending_custom_messages", "()[J"); + CHECK(calls->release_pending_custom_messages_meth != NULL); LDKCustomOnionMessageHandler ret = { .this_arg = (void*) calls, .handle_custom_message = handle_custom_message_LDKCustomOnionMessageHandler_jcall, .read_custom_message = read_custom_message_LDKCustomOnionMessageHandler_jcall, + .release_pending_custom_messages = release_pending_custom_messages_LDKCustomOnionMessageHandler_jcall, .free = LDKCustomOnionMessageHandler_JCalls_free, }; return ret; @@ -19207,12 +19551,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1 LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr; void* msg_ptr = untag_ptr(msg); CHECK_ACCESS(msg_ptr); - LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr); - if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) { + LDKOnionMessageContents msg_conv = *(LDKOnionMessageContents*)(msg_ptr); + if (msg_conv.free == LDKOnionMessageContents_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv); + LDKOnionMessageContents_JCalls_cloned(&msg_conv); } - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); + LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ"); *ret_copy = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; @@ -19225,12 +19569,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1 LDKu8slice buffer_ref; buffer_ref.datalen = (*env)->GetArrayLength(env, buffer); buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ"); *ret_conv = (this_arg_conv->read_custom_message)(this_arg_conv->this_arg, message_type, buffer_ref); (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0); return tag_ptr(ret_conv, true); } +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKCustomOnionMessageHandler* this_arg_conv = (LDKCustomOnionMessageHandler*)this_arg_ptr; + LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ ret_var = (this_arg_conv->release_pending_custom_messages)(this_arg_conv->this_arg); + int64_tArray ret_arr = NULL; + ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); + for (size_t e = 0; e < ret_var.datalen; e++) { + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv_56_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ"); + *ret_conv_56_conv = ret_var.data[e]; + ret_arr_ptr[e] = tag_ptr(ret_conv_56_conv, true); + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + typedef struct LDKSocketDescriptor_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -19645,40 +20007,6 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *en return ret_arr; } -static jclass LDKDestination_Node_class = NULL; -static jmethodID LDKDestination_Node_meth = NULL; -static jclass LDKDestination_BlindedPath_class = NULL; -static jmethodID LDKDestination_BlindedPath_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKDestination_init (JNIEnv *env, jclass clz) { - LDKDestination_Node_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$Node")); - CHECK(LDKDestination_Node_class != NULL); - LDKDestination_Node_meth = (*env)->GetMethodID(env, LDKDestination_Node_class, "", "([B)V"); - CHECK(LDKDestination_Node_meth != NULL); - LDKDestination_BlindedPath_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKDestination$BlindedPath")); - CHECK(LDKDestination_BlindedPath_class != NULL); - LDKDestination_BlindedPath_meth = (*env)->GetMethodID(env, LDKDestination_BlindedPath_class, "", "(J)V"); - CHECK(LDKDestination_BlindedPath_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); - switch(obj->tag) { - case LDKDestination_Node: { - int8_tArray node_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, node_arr, 0, 33, obj->node.compressed_form); - return (*env)->NewObject(env, LDKDestination_Node_class, LDKDestination_Node_meth, node_arr); - } - case LDKDestination_BlindedPath: { - LDKBlindedPath blinded_path_var = obj->blinded_path; - int64_t blinded_path_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var); - blinded_path_ref = tag_ptr(blinded_path_var.inner, false); - return (*env)->NewObject(env, LDKDestination_BlindedPath_class, LDKDestination_BlindedPath_meth, blinded_path_ref); - } - default: abort(); - } -} typedef struct LDKMessageRouter_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -19798,37 +20126,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageRouter_1find_1path(J return tag_ptr(ret_conv, true); } -static jclass LDKOnionMessageContents_Offers_class = NULL; -static jmethodID LDKOnionMessageContents_Offers_meth = NULL; -static jclass LDKOnionMessageContents_Custom_class = NULL; -static jmethodID LDKOnionMessageContents_Custom_meth = NULL; -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOnionMessageContents_init (JNIEnv *env, jclass clz) { - LDKOnionMessageContents_Offers_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Offers")); - CHECK(LDKOnionMessageContents_Offers_class != NULL); - LDKOnionMessageContents_Offers_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Offers_class, "", "(J)V"); - CHECK(LDKOnionMessageContents_Offers_meth != NULL); - LDKOnionMessageContents_Custom_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKOnionMessageContents$Custom")); - CHECK(LDKOnionMessageContents_Custom_class != NULL); - LDKOnionMessageContents_Custom_meth = (*env)->GetMethodID(env, LDKOnionMessageContents_Custom_class, "", "(J)V"); - CHECK(LDKOnionMessageContents_Custom_meth != NULL); -} -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { - LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr); - switch(obj->tag) { - case LDKOnionMessageContents_Offers: { - int64_t offers_ref = tag_ptr(&obj->offers, false); - return (*env)->NewObject(env, LDKOnionMessageContents_Offers_class, LDKOnionMessageContents_Offers_meth, offers_ref); - } - case LDKOnionMessageContents_Custom: { - LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents"); - *custom_ret = CustomOnionMessageContents_clone(&obj->custom); - return (*env)->NewObject(env, LDKOnionMessageContents_Custom_class, LDKOnionMessageContents_Custom_meth, tag_ptr(custom_ret, true)); - } - default: abort(); - } -} typedef struct LDKCoinSelectionSource_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -21466,6 +21763,114 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Z return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelDerivationParameters 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 = ChannelDerivationParameters_clone(&o_conv); + LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); + *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); + *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); + *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig); + LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); + *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKHTLCDescriptor 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 = HTLCDescriptor_clone(&o_conv); + LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); + *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); + *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); + *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig); + LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); + *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = CResult_NoneNoneZ_ok(); @@ -24968,114 +25373,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddres return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKChannelDerivationParameters 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 = ChannelDerivationParameters_clone(&o_conv); - LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); - *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); - *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ChannelDerivationParametersDecodeErrorZ* o_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_ChannelDerivationParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelDerivationParametersDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_ChannelDerivationParametersDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); - *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ChannelDerivationParametersDecodeErrorZ* arg_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_ChannelDerivationParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelDerivationParametersDecodeErrorZ*)untag_ptr(orig); - LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); - *ret_conv = CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKHTLCDescriptor 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 = HTLCDescriptor_clone(&o_conv); - LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); - *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); - *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_HTLCDescriptorDecodeErrorZ* o_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_HTLCDescriptorDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_HTLCDescriptorDecodeErrorZ _res_conv = *(LDKCResult_HTLCDescriptorDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_HTLCDescriptorDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); - *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_HTLCDescriptorDecodeErrorZ* arg_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_HTLCDescriptorDecodeErrorZ* orig_conv = (LDKCResult_HTLCDescriptorDecodeErrorZ*)untag_ptr(orig); - LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); - *ret_conv = CResult_HTLCDescriptorDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_HTLCOutputInCommitmentZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -25943,6 +26240,96 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesP CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(_res_constr); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some(JNIEnv *env, jclass clz, jstring o) { + LDKStr o_conv = java_to_owned_str(env, o); + LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ"); + *ret_copy = COption_StrZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ"); + *ret_copy = COption_StrZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_StrZ _res_conv = *(LDKCOption_StrZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_StrZ_free(_res_conv); +} + +static inline uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg) { + LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ"); + *ret_copy = COption_StrZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_StrZ* arg_conv = (LDKCOption_StrZ*)untag_ptr(arg); + int64_t ret_conv = COption_StrZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_StrZ* orig_conv = (LDKCOption_StrZ*)untag_ptr(orig); + LDKCOption_StrZ *ret_copy = MALLOC(sizeof(LDKCOption_StrZ), "LDKCOption_StrZ"); + *ret_copy = COption_StrZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok(JNIEnv *env, jclass clz) { + LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ"); + *ret_conv = CResult_NoneBolt12SemanticErrorZ_ok(); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) { + LDKBolt12SemanticError e_conv = LDKBolt12SemanticError_from_java(env, e); + LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ"); + *ret_conv = CResult_NoneBolt12SemanticErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NoneBolt12SemanticErrorZ* o_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneBolt12SemanticErrorZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneBolt12SemanticErrorZ _res_conv = *(LDKCResult_NoneBolt12SemanticErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneBolt12SemanticErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg) { + LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ"); + *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NoneBolt12SemanticErrorZ* arg_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneBolt12SemanticErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NoneBolt12SemanticErrorZ* orig_conv = (LDKCResult_NoneBolt12SemanticErrorZ*)untag_ptr(orig); + LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ"); + *ret_conv = CResult_NoneBolt12SemanticErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); @@ -25992,6 +26379,119 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwo return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr); + o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o)); + LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); + *ret_copy = COption_OffersMessageZ_some(o_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); + *ret_copy = COption_OffersMessageZ_none(); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_OffersMessageZ_free(_res_conv); +} + +static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) { + LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); + *ret_copy = COption_OffersMessageZ_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg); + int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig); + LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); + *ret_copy = COption_OffersMessageZ_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg) { + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ"); + *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(arg); + return tag_ptr(ret_conv, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(arg); + int64_t ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)untag_ptr(orig); + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ"); + *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr); + a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a)); + void* b_ptr = untag_ptr(b); + CHECK_ACCESS(b_ptr); + LDKDestination b_conv = *(LDKDestination*)(b_ptr); + b_conv = Destination_clone((LDKDestination*)untag_ptr(b)); + LDKBlindedPath c_conv; + c_conv.inner = untag_ptr(c); + c_conv.is_owned = ptr_is_owned(c); + CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv); + c_conv = BlindedPath_clone(&c_conv); + LDKC3Tuple_OffersMessageDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKC3Tuple_OffersMessageDestinationBlindedPathZ"); + *ret_conv = C3Tuple_OffersMessageDestinationBlindedPathZ_new(a_conv, b_conv, c_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_ptr); + FREE(untag_ptr(_res)); + C3Tuple_OffersMessageDestinationBlindedPathZ_free(_res_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OffersMessageDestinationBlindedPathZ), "LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t x = 0; x < _res_constr.datalen; x++) { + int64_t _res_conv_49 = _res_vals[x]; + void* _res_conv_49_ptr = untag_ptr(_res_conv_49); + CHECK_ACCESS(_res_conv_49_ptr); + LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res_conv_49_conv = *(LDKC3Tuple_OffersMessageDestinationBlindedPathZ*)(_res_conv_49_ptr); + FREE(untag_ptr(_res_conv_49)); + _res_constr.data[x] = _res_conv_49_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(_res_constr); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyForwardingInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKCounterpartyForwardingInfo o_conv; o_conv.inner = untag_ptr(o); @@ -27315,154 +27815,176 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); - LDKOffersMessage o_conv = *(LDKOffersMessage*)(o_ptr); - o_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(o)); - LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); - *ret_copy = COption_OffersMessageZ_some(o_conv); + LDKOnionMessageContents o_conv = *(LDKOnionMessageContents*)(o_ptr); + if (o_conv.free == LDKOnionMessageContents_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKOnionMessageContents_JCalls_cloned(&o_conv); + } + LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ"); + *ret_copy = COption_OnionMessageContentsZ_some(o_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none(JNIEnv *env, jclass clz) { - LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); - *ret_copy = COption_OffersMessageZ_none(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ"); + *ret_copy = COption_OnionMessageContentsZ_none(); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCOption_OffersMessageZ _res_conv = *(LDKCOption_OffersMessageZ*)(_res_ptr); + LDKCOption_OnionMessageContentsZ _res_conv = *(LDKCOption_OnionMessageContentsZ*)(_res_ptr); FREE(untag_ptr(_res)); - COption_OffersMessageZ_free(_res_conv); + COption_OnionMessageContentsZ_free(_res_conv); } -static inline uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg) { - LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); - *ret_copy = COption_OffersMessageZ_clone(arg); +static inline uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg) { + LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ"); + *ret_copy = COption_OnionMessageContentsZ_clone(arg); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCOption_OffersMessageZ* arg_conv = (LDKCOption_OffersMessageZ*)untag_ptr(arg); - int64_t ret_conv = COption_OffersMessageZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_OnionMessageContentsZ* arg_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(arg); + int64_t ret_conv = COption_OnionMessageContentsZ_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCOption_OffersMessageZ* orig_conv = (LDKCOption_OffersMessageZ*)untag_ptr(orig); - LDKCOption_OffersMessageZ *ret_copy = MALLOC(sizeof(LDKCOption_OffersMessageZ), "LDKCOption_OffersMessageZ"); - *ret_copy = COption_OffersMessageZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_OnionMessageContentsZ* orig_conv = (LDKCOption_OnionMessageContentsZ*)untag_ptr(orig); + LDKCOption_OnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_OnionMessageContentsZ), "LDKCOption_OnionMessageContentsZ"); + *ret_copy = COption_OnionMessageContentsZ_clone(orig_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1some(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); - LDKCustomOnionMessageContents o_conv = *(LDKCustomOnionMessageContents*)(o_ptr); - if (o_conv.free == LDKCustomOnionMessageContents_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKCustomOnionMessageContents_JCalls_cloned(&o_conv); - } - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); - *ret_copy = COption_CustomOnionMessageContentsZ_some(o_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; + LDKCOption_OnionMessageContentsZ o_conv = *(LDKCOption_OnionMessageContentsZ*)(o_ptr); + o_conv = COption_OnionMessageContentsZ_clone((LDKCOption_OnionMessageContentsZ*)untag_ptr(o)); + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1none(JNIEnv *env, jclass clz) { - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); - *ret_copy = COption_CustomOnionMessageContentsZ_none(); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o_conv); + return ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr); + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - COption_CustomOnionMessageContentsZ_free(_res_conv); + CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res_conv); } -static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) { - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); - *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +static inline uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg); - int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig); - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); - *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_OnionMessageContentsZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_OnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr); - o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o)); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv); +static inline uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg) { + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ"); + *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(arg); return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* arg_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(arg); + int64_t ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(arg_conv); + return ret_conv; +} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* orig_conv = (LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)untag_ptr(orig); + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ"); + *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv); - return ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr); + if (a_conv.free == LDKOnionMessageContents_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKOnionMessageContents_JCalls_cloned(&a_conv); + } + void* b_ptr = untag_ptr(b); + CHECK_ACCESS(b_ptr); + LDKDestination b_conv = *(LDKDestination*)(b_ptr); + b_conv = Destination_clone((LDKDestination*)untag_ptr(b)); + LDKBlindedPath c_conv; + c_conv.inner = untag_ptr(c); + c_conv.is_owned = ptr_is_owned(c); + CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv); + c_conv = BlindedPath_clone(&c_conv); + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ"); + *ret_conv = C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a_conv, b_conv, c_conv); + return tag_ptr(ret_conv, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr); + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv); + C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(_res_conv); } -static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ), "LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t e = 0; e < _res_constr.datalen; e++) { + int64_t _res_conv_56 = _res_vals[e]; + void* _res_conv_56_ptr = untag_ptr(_res_conv_56); + CHECK_ACCESS(_res_conv_56_ptr); + LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res_conv_56_conv = *(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ*)(_res_conv_56_ptr); + FREE(untag_ptr(_res_conv_56)); + _res_constr.data[e] = _res_conv_56_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(_res_constr); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) { @@ -33896,6 +34418,37 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOni CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKPeeledOnion o_conv = *(LDKPeeledOnion*)(o_ptr); + o_conv = PeeledOnion_clone((LDKPeeledOnion*)untag_ptr(o)); + LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ"); + *ret_conv = CResult_PeeledOnionNoneZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ"); + *ret_conv = CResult_PeeledOnionNoneZ_err(); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PeeledOnionNoneZ* o_conv = (LDKCResult_PeeledOnionNoneZ*)untag_ptr(o); + jboolean ret_conv = CResult_PeeledOnionNoneZ_is_ok(o_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_PeeledOnionNoneZ _res_conv = *(LDKCResult_PeeledOnionNoneZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_PeeledOnionNoneZ_free(_res_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSendErrorZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); *ret_conv = CResult_NoneSendErrorZ_ok(); @@ -37032,23 +37585,38 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JN return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1mempool_1minimum(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_mempool_minimum()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_on_chain_sweep()); return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_background()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1max_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee()); return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_normal()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_anchor_channel_remote_fee()); return ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_high_priority()); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_anchor_channel_fee()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_non_anchor_channel_fee()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_channel_close_minimum()); return ret_conv; } @@ -40791,6 +41359,61 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1pay_1for_1offer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t offer, int64_t quantity, int64_t amount_msats, int64_t payer_note, int8_tArray payment_id, int64_t retry_strategy, int64_t max_total_routing_fee_msat) { + LDKChannelManager 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; + LDKOffer offer_conv; + offer_conv.inner = untag_ptr(offer); + offer_conv.is_owned = ptr_is_owned(offer); + CHECK_INNER_FIELD_ACCESS_OR_NULL(offer_conv); + offer_conv.is_owned = false; + void* quantity_ptr = untag_ptr(quantity); + CHECK_ACCESS(quantity_ptr); + LDKCOption_u64Z quantity_conv = *(LDKCOption_u64Z*)(quantity_ptr); + quantity_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(quantity)); + void* amount_msats_ptr = untag_ptr(amount_msats); + CHECK_ACCESS(amount_msats_ptr); + LDKCOption_u64Z amount_msats_conv = *(LDKCOption_u64Z*)(amount_msats_ptr); + amount_msats_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amount_msats)); + void* payer_note_ptr = untag_ptr(payer_note); + CHECK_ACCESS(payer_note_ptr); + LDKCOption_StrZ payer_note_conv = *(LDKCOption_StrZ*)(payer_note_ptr); + payer_note_conv = COption_StrZ_clone((LDKCOption_StrZ*)untag_ptr(payer_note)); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + void* max_total_routing_fee_msat_ptr = untag_ptr(max_total_routing_fee_msat); + CHECK_ACCESS(max_total_routing_fee_msat_ptr); + LDKCOption_u64Z max_total_routing_fee_msat_conv = *(LDKCOption_u64Z*)(max_total_routing_fee_msat_ptr); + max_total_routing_fee_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(max_total_routing_fee_msat)); + LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ"); + *ret_conv = ChannelManager_pay_for_offer(&this_arg_conv, &offer_conv, quantity_conv, amount_msats_conv, payer_note_conv, payment_id_ref, retry_strategy_conv, max_total_routing_fee_msat_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t refund) { + LDKChannelManager 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; + LDKRefund refund_conv; + refund_conv.inner = untag_ptr(refund); + refund_conv.is_owned = ptr_is_owned(refund); + CHECK_INNER_FIELD_ACCESS_OR_NULL(refund_conv); + refund_conv.is_owned = false; + LDKCResult_NoneBolt12SemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneBolt12SemanticErrorZ), "LDKCResult_NoneBolt12SemanticErrorZ"); + *ret_conv = ChannelManager_request_refund_payment(&this_arg_conv, &refund_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t min_final_cltv_expiry_delta) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -41038,6 +41661,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Channel return tag_ptr(ret_ret, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager 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; + LDKOffersMessageHandler* ret_ret = MALLOC(sizeof(LDKOffersMessageHandler), "LDKOffersMessageHandler"); + *ret_ret = ChannelManager_as_OffersMessageHandler(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_provided_1init_1features(JNIEnv *env, jclass clz, int64_t config) { LDKUserConfig config_conv; config_conv.inner = untag_ptr(config); @@ -47782,6 +48416,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address(JNIEn return tag_ptr(ret_conv, true); } +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str(JNIEnv *env, jclass clz, int64_t o) { + LDKSocketAddress* o_conv = (LDKSocketAddress*)untag_ptr(o); + LDKStr ret_str = SocketAddress_to_str(o_conv); + jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); + Str_free(ret_str); + return ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketAddress_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); LDKCResult_SocketAddressSocketAddressParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SocketAddressSocketAddressParseErrorZ), "LDKCResult_SocketAddressSocketAddressParseErrorZ"); @@ -51478,17 +52120,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_ return tag_ptr(ret_ret, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKIgnoringMessageHandler 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 = IgnoringMessageHandler_as_OnionMessageProvider(&this_arg_conv); - return tag_ptr(ret_ret, true); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { LDKIgnoringMessageHandler this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -54269,6 +54900,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1comm return ret_conv; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKCommitmentTransaction 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; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, CommitmentTransaction_per_commitment_point(&this_arg_conv).compressed_form); + return ret_arr; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) { LDKCommitmentTransaction this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -59639,6 +60281,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone(JNIEn return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string(JNIEnv *env, jclass clz, jstring s) { + LDKStr s_conv = java_to_owned_str(env, s); + LDKInvoiceError ret_var = InvoiceError_from_string(s_conv); + int64_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; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceError_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKInvoiceError obj_conv; obj_conv.inner = untag_ptr(obj); @@ -60672,6 +61323,11 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing return ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_duplicate_payment_id()); + return ret_conv; +} + JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1paths(JNIEnv *env, jclass clz) { jclass ret_conv = LDKBolt12SemanticError_to_java(env, Bolt12SemanticError_missing_paths()); return ret_conv; @@ -61343,14 +61999,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_ NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1genesis_1hash(JNIEnv *env, jclass clz, int64_t this_arg) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_arg) { LDKNetworkGraph 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; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_genesis_hash(&this_arg_conv).data); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, NetworkGraph_get_chain_hash(&this_arg_conv).data); return ret_arr; } @@ -62998,6 +63654,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann return tag_ptr(ret_conv, true); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { + LDKNetworkGraph 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; + LDKChannelUpdate 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.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_verify_channel_update(&this_arg_conv, &msg_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) { LDKReadOnlyNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -66926,6 +67598,499 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1 return tag_ptr(ret_conv, true); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKChannelDerivationParameters 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); + ChannelDerivationParameters_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDerivationParameters 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 = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDerivationParameters 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; + ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDerivationParameters 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 = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv)); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKChannelDerivationParameters 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; + LDKThirtyTwoBytes val_ref; + CHECK((*env)->GetArrayLength(env, val) == 32); + (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); + ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDerivationParameters 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; + LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv); + int64_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; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDerivationParameters 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; + LDKChannelTransactionParameters 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 = ChannelTransactionParameters_clone(&val_conv); + ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1new(JNIEnv *env, jclass clz, int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) { + LDKThirtyTwoBytes keys_id_arg_ref; + CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32); + (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data); + LDKChannelTransactionParameters transaction_parameters_arg_conv; + transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg); + transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv); + transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv); + LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv); + int64_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 ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) { + LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg); + int64_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; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKChannelDerivationParameters 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 = ChannelDerivationParameters_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelDerivationParameters 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; + LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv); + int64_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; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKChannelDerivationParameters 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; + LDKChannelDerivationParameters 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 = ChannelDerivationParameters_eq(&a_conv, &b_conv); + return ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelDerivationParameters 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 = ChannelDerivationParameters_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); + *ret_conv = ChannelDerivationParameters_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKHTLCDescriptor 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); + HTLCDescriptor_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKHTLCDescriptor 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; + LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv); + int64_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; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKHTLCDescriptor 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; + LDKChannelDerivationParameters 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 = ChannelDerivationParameters_clone(&val_conv); + HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKHTLCDescriptor 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 = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKHTLCDescriptor 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; + HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKHTLCDescriptor 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 = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKHTLCDescriptor 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((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref); +} + +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKHTLCDescriptor 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 = HTLCDescriptor_get_feerate_per_kw(&this_ptr_conv); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKHTLCDescriptor 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; + HTLCDescriptor_set_feerate_per_kw(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKHTLCDescriptor 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; + LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv); + int64_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; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKHTLCDescriptor 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; + LDKHTLCOutputInCommitment 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 = HTLCOutputInCommitment_clone(&val_conv); + HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKHTLCDescriptor 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_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ"); + *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKHTLCDescriptor 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_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr); + val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val)); + HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKHTLCDescriptor 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 = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKHTLCDescriptor 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; + LDKECDSASignature val_ref; + CHECK((*env)->GetArrayLength(env, val) == 64); + (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form); + HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref); +} + +static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) { + LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg); + int64_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; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKHTLCDescriptor 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 = HTLCDescriptor_clone_ptr(&arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKHTLCDescriptor 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; + LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv); + int64_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; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKHTLCDescriptor 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; + LDKHTLCDescriptor 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 = HTLCDescriptor_eq(&a_conv, &b_conv); + return ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKHTLCDescriptor 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 = HTLCDescriptor_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); + *ret_conv = HTLCDescriptor_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKHTLCDescriptor 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; + LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv); + int64_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; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKHTLCDescriptor 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; + LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); + *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv); + return tag_ptr(ret_ref, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKHTLCDescriptor 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; + LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn"); + *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv); + return tag_ptr(ret_ref, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKHTLCDescriptor 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; + LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); + *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv); + return tag_ptr(ret_ref, true); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKHTLCDescriptor 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_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature, int8_tArray witness_script) { + LDKHTLCDescriptor 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; + LDKECDSASignature signature_ref; + CHECK((*env)->GetArrayLength(env, signature) == 64); + (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form); + LDKu8slice witness_script_ref; + witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script); + witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL); + LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + Witness_free(ret_var); + (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) { + LDKHTLCDescriptor 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; + void* signer_provider_ptr = untag_ptr(signer_provider); + if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); } + LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr; + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv); + return tag_ptr(ret_ret, true); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelSigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -68067,7 +69232,70 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1fre CustomOnionMessageHandler_free(this_ptr_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t path, int64_t message, int64_t reply_path) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKPeeledOnion this_ptr_conv = *(LDKPeeledOnion*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + PeeledOnion_free(this_ptr_conv); +} + +static inline uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg) { + LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion"); + *ret_copy = PeeledOnion_clone(arg); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKPeeledOnion* arg_conv = (LDKPeeledOnion*)untag_ptr(arg); + int64_t ret_conv = PeeledOnion_clone_ptr(arg_conv); + return ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPeeledOnion* orig_conv = (LDKPeeledOnion*)untag_ptr(orig); + LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion"); + *ret_copy = PeeledOnion_clone(orig_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { + LDKPublicKey a_ref; + CHECK((*env)->GetArrayLength(env, a) == 33); + (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form); + LDKOnionMessage 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 = OnionMessage_clone(&b_conv); + LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion"); + *ret_copy = PeeledOnion_forward(a_ref, b_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKParsedOnionMessageContents a_conv = *(LDKParsedOnionMessageContents*)(a_ptr); + a_conv = ParsedOnionMessageContents_clone((LDKParsedOnionMessageContents*)untag_ptr(a)); + LDKThirtyTwoBytes b_ref; + CHECK((*env)->GetArrayLength(env, b) == 32); + (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data); + LDKBlindedPath c_conv; + c_conv.inner = untag_ptr(c); + c_conv.is_owned = ptr_is_owned(c); + CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv); + c_conv = BlindedPath_clone(&c_conv); + LDKPeeledOnion *ret_copy = MALLOC(sizeof(LDKPeeledOnion), "LDKPeeledOnion"); + *ret_copy = PeeledOnion_receive(a_conv, b_ref, c_conv); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIEnv *env, jclass clz, int64_t entropy_source, int64_t node_signer, int64_t path, int64_t contents, int64_t reply_path) { 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; @@ -68079,17 +69307,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1onion_1message(JNIE path_conv.is_owned = ptr_is_owned(path); CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv); path_conv = OnionMessagePath_clone(&path_conv); - void* message_ptr = untag_ptr(message); - CHECK_ACCESS(message_ptr); - LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr); - message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message)); + void* contents_ptr = untag_ptr(contents); + CHECK_ACCESS(contents_ptr); + LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr); + if (contents_conv.free == LDKOnionMessageContents_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKOnionMessageContents_JCalls_cloned(&contents_conv); + } 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_C2Tuple_PublicKeyOnionMessageZSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ), "LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ"); - *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, message_conv, reply_path_conv); + *ret_conv = create_onion_message(entropy_source_conv, node_signer_conv, path_conv, contents_conv, reply_path_conv); + return tag_ptr(ret_conv, true); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_peel_1onion_1message(JNIEnv *env, jclass clz, int64_t msg, int64_t node_signer, int64_t logger, int64_t custom_handler) { + LDKOnionMessage 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.is_owned = false; + 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); + } + LDKCResult_PeeledOnionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PeeledOnionNoneZ), "LDKCResult_PeeledOnionNoneZ"); + *ret_conv = peel_onion_message(&msg_conv, node_signer_conv, logger_conv, custom_handler_conv); return tag_ptr(ret_conv, true); } @@ -68143,7 +69406,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1new(JNIEnv return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t message, int64_t reply_path) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t path, int64_t contents, int64_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); @@ -68154,17 +69417,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion path_conv.is_owned = ptr_is_owned(path); CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv); path_conv = OnionMessagePath_clone(&path_conv); - void* message_ptr = untag_ptr(message); - CHECK_ACCESS(message_ptr); - LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr); - message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message)); + void* contents_ptr = untag_ptr(contents); + CHECK_ACCESS(contents_ptr); + LDKOnionMessageContents contents_conv = *(LDKOnionMessageContents*)(contents_ptr); + if (contents_conv.free == LDKOnionMessageContents_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKOnionMessageContents_JCalls_cloned(&contents_conv); + } 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, path_conv, message_conv, reply_path_conv); + *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, path_conv, contents_conv, reply_path_conv); return tag_ptr(ret_conv, true); } @@ -68179,17 +69445,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMe return tag_ptr(ret_ret, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider(JNIEnv *env, jclass clz, int64_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); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -68269,12 +69524,6 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1 return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OffersMessage_1tlv_1type(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKOffersMessage* this_arg_conv = (LDKOffersMessage*)untag_ptr(this_arg); - int64_t ret_conv = OffersMessage_tlv_type(this_arg_conv); - return ret_conv; -} - JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OffersMessage_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKOffersMessage* obj_conv = (LDKOffersMessage*)untag_ptr(obj); LDKCVec_u8Z ret_var = OffersMessage_write(obj_conv); @@ -68472,89 +69721,105 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Packet_1write(JNIEnv *e return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_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); + LDKParsedOnionMessageContents this_ptr_conv = *(LDKParsedOnionMessageContents*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - OnionMessageContents_free(this_ptr_conv); + ParsedOnionMessageContents_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); +static inline uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg) { + LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents"); + *ret_copy = ParsedOnionMessageContents_clone(arg); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg); - int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKParsedOnionMessageContents* arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(arg); + int64_t ret_conv = ParsedOnionMessageContents_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig); - LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); - *ret_copy = OnionMessageContents_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKParsedOnionMessageContents* orig_conv = (LDKParsedOnionMessageContents*)untag_ptr(orig); + LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents"); + *ret_copy = ParsedOnionMessageContents_clone(orig_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers(JNIEnv *env, jclass clz, int64_t a) { void* a_ptr = untag_ptr(a); CHECK_ACCESS(a_ptr); LDKOffersMessage a_conv = *(LDKOffersMessage*)(a_ptr); a_conv = OffersMessage_clone((LDKOffersMessage*)untag_ptr(a)); - LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); - *ret_copy = OnionMessageContents_offers(a_conv); + LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents"); + *ret_copy = ParsedOnionMessageContents_offers(a_conv); int64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_t a) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom(JNIEnv *env, jclass clz, int64_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) { + LDKOnionMessageContents a_conv = *(LDKOnionMessageContents*)(a_ptr); + if (a_conv.free == LDKOnionMessageContents_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKCustomOnionMessageContents_JCalls_cloned(&a_conv); + LDKOnionMessageContents_JCalls_cloned(&a_conv); } - LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); - *ret_copy = OnionMessageContents_custom(a_conv); + LDKParsedOnionMessageContents *ret_copy = MALLOC(sizeof(LDKParsedOnionMessageContents), "LDKParsedOnionMessageContents"); + *ret_copy = ParsedOnionMessageContents_custom(a_conv); int64_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); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKParsedOnionMessageContents* this_arg_conv = (LDKParsedOnionMessageContents*)untag_ptr(this_arg); + LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *ret_ret = ParsedOnionMessageContents_as_OnionMessageContents(this_arg_conv); return tag_ptr(ret_ret, true); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKParsedOnionMessageContents* obj_conv = (LDKParsedOnionMessageContents*)untag_ptr(obj); + LDKCVec_u8Z ret_var = ParsedOnionMessageContents_write(obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) { + LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *ret_ret = OnionMessageContents_clone(arg); + return tag_ptr(ret_ret, true); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr(JNIEnv *env, jclass clz, int64_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); + LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)arg_ptr; + int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv); return ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_t orig) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone(JNIEnv *env, jclass clz, int64_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); + LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)orig_ptr; + LDKOnionMessageContents* ret_ret = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *ret_ret = OnionMessageContents_clone(orig_conv); return tag_ptr(ret_ret, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free(JNIEnv *env, jclass clz, int64_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); + LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - CustomOnionMessageContents_free(this_ptr_conv); + OnionMessageContents_free(this_ptr_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlindedPath_1free(JNIEnv *env, jclass clz, int64_t this_obj) { @@ -68872,6 +70137,18 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq(JNIEnv *env return ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1message(JNIEnv *env, jclass clz, int8_tArray recipient_node_id, int64_t entropy_source) { + LDKPublicKey recipient_node_id_ref; + CHECK((*env)->GetArrayLength(env, recipient_node_id) == 33); + (*env)->GetByteArrayRegion(env, recipient_node_id, 0, 33, recipient_node_id_ref.compressed_form); + 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_one_hop_for_message(recipient_node_id_ref, entropy_source_conv); + return tag_ptr(ret_conv, true); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BlindedPath_1new_1for_1message(JNIEnv *env, jclass clz, jobjectArray node_pks, int64_t entropy_source) { LDKCVec_PublicKeyZ node_pks_constr; node_pks_constr.datalen = (*env)->GetArrayLength(env, node_pks); @@ -70350,6 +71627,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimed(JNI return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_invoice_request_failed(payment_id_ref); + int64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int64_t payment_id, int8_tArray payment_preimage, int8_tArray payment_hash, int64_t fee_paid_msat) { void* payment_id_ptr = untag_ptr(payment_id); CHECK_ACCESS(payment_id_ptr); @@ -71216,15 +72503,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1fre MessageSendEventsProvider_free(this_ptr_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKOnionMessageProvider this_ptr_conv = *(LDKOnionMessageProvider*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - OnionMessageProvider_free(this_ptr_conv); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -71243,167 +72521,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env EventHandler_free(this_ptr_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKChannelDerivationParameters 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); - ChannelDerivationParameters_free(this_obj_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelDerivationParameters 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 = ChannelDerivationParameters_get_value_satoshis(&this_ptr_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelDerivationParameters 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; - ChannelDerivationParameters_set_value_satoshis(&this_ptr_conv, val); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelDerivationParameters 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 = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDerivationParameters_get_keys_id(&this_ptr_conv)); - return ret_arr; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKChannelDerivationParameters 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; - LDKThirtyTwoBytes val_ref; - CHECK((*env)->GetArrayLength(env, val) == 32); - (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); - ChannelDerivationParameters_set_keys_id(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelDerivationParameters 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; - LDKChannelTransactionParameters ret_var = ChannelDerivationParameters_get_transaction_parameters(&this_ptr_conv); - int64_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; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelDerivationParameters 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; - LDKChannelTransactionParameters 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 = ChannelTransactionParameters_clone(&val_conv); - ChannelDerivationParameters_set_transaction_parameters(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1new(JNIEnv *env, jclass clz, int64_t value_satoshis_arg, int8_tArray keys_id_arg, int64_t transaction_parameters_arg) { - LDKThirtyTwoBytes keys_id_arg_ref; - CHECK((*env)->GetArrayLength(env, keys_id_arg) == 32); - (*env)->GetByteArrayRegion(env, keys_id_arg, 0, 32, keys_id_arg_ref.data); - LDKChannelTransactionParameters transaction_parameters_arg_conv; - transaction_parameters_arg_conv.inner = untag_ptr(transaction_parameters_arg); - transaction_parameters_arg_conv.is_owned = ptr_is_owned(transaction_parameters_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(transaction_parameters_arg_conv); - transaction_parameters_arg_conv = ChannelTransactionParameters_clone(&transaction_parameters_arg_conv); - LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_new(value_satoshis_arg, keys_id_arg_ref, transaction_parameters_arg_conv); - int64_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 ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg) { - LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(arg); - int64_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; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKChannelDerivationParameters 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 = ChannelDerivationParameters_clone_ptr(&arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKChannelDerivationParameters 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; - LDKChannelDerivationParameters ret_var = ChannelDerivationParameters_clone(&orig_conv); - int64_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; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKChannelDerivationParameters 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; - LDKChannelDerivationParameters 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 = ChannelDerivationParameters_eq(&a_conv, &b_conv); - return ret_conv; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKChannelDerivationParameters 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 = ChannelDerivationParameters_write(&obj_conv); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = (*env)->GetArrayLength(env, ser); - ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_ChannelDerivationParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelDerivationParametersDecodeErrorZ), "LDKCResult_ChannelDerivationParametersDecodeErrorZ"); - *ret_conv = ChannelDerivationParameters_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return tag_ptr(ret_conv, true); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKAnchorDescriptor this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -71594,319 +72711,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1derive_1c return tag_ptr(ret_ret, true); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKHTLCDescriptor 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); - HTLCDescriptor_free(this_obj_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKHTLCDescriptor 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; - LDKChannelDerivationParameters ret_var = HTLCDescriptor_get_channel_derivation_parameters(&this_ptr_conv); - int64_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; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKHTLCDescriptor 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; - LDKChannelDerivationParameters 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 = ChannelDerivationParameters_clone(&val_conv); - HTLCDescriptor_set_channel_derivation_parameters(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKHTLCDescriptor 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 = HTLCDescriptor_get_per_commitment_number(&this_ptr_conv); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKHTLCDescriptor 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; - HTLCDescriptor_set_per_commitment_number(&this_ptr_conv, val); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKHTLCDescriptor 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 = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, HTLCDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form); - return ret_arr; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKHTLCDescriptor 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((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - HTLCDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKHTLCDescriptor 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; - LDKHTLCOutputInCommitment ret_var = HTLCDescriptor_get_htlc(&this_ptr_conv); - int64_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; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKHTLCDescriptor 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; - LDKHTLCOutputInCommitment 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 = HTLCOutputInCommitment_clone(&val_conv); - HTLCDescriptor_set_htlc(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKHTLCDescriptor 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_ThirtyTwoBytesZ *ret_copy = MALLOC(sizeof(LDKCOption_ThirtyTwoBytesZ), "LDKCOption_ThirtyTwoBytesZ"); - *ret_copy = HTLCDescriptor_get_preimage(&this_ptr_conv); - int64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKHTLCDescriptor 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_ThirtyTwoBytesZ val_conv = *(LDKCOption_ThirtyTwoBytesZ*)(val_ptr); - val_conv = COption_ThirtyTwoBytesZ_clone((LDKCOption_ThirtyTwoBytesZ*)untag_ptr(val)); - HTLCDescriptor_set_preimage(&this_ptr_conv, val_conv); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKHTLCDescriptor 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 = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HTLCDescriptor_get_counterparty_sig(&this_ptr_conv).compact_form); - return ret_arr; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKHTLCDescriptor 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; - LDKECDSASignature val_ref; - CHECK((*env)->GetArrayLength(env, val) == 64); - (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form); - HTLCDescriptor_set_counterparty_sig(&this_ptr_conv, val_ref); -} - -static inline uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg) { - LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(arg); - int64_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; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKHTLCDescriptor 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 = HTLCDescriptor_clone_ptr(&arg_conv); - return ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKHTLCDescriptor 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; - LDKHTLCDescriptor ret_var = HTLCDescriptor_clone(&orig_conv); - int64_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; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKHTLCDescriptor 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; - LDKHTLCDescriptor 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 = HTLCDescriptor_eq(&a_conv, &b_conv); - return ret_conv; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKHTLCDescriptor 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 = HTLCDescriptor_write(&obj_conv); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = (*env)->GetArrayLength(env, ser); - ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_HTLCDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCDescriptorDecodeErrorZ), "LDKCResult_HTLCDescriptorDecodeErrorZ"); - *ret_conv = HTLCDescriptor_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return tag_ptr(ret_conv, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKHTLCDescriptor 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; - LDKOutPoint ret_var = HTLCDescriptor_outpoint(&this_arg_conv); - int64_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; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKHTLCDescriptor 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; - LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); - *ret_ref = HTLCDescriptor_previous_utxo(&this_arg_conv); - return tag_ptr(ret_ref, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKHTLCDescriptor 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; - LDKTxIn* ret_ref = MALLOC(sizeof(LDKTxIn), "LDKTxIn"); - *ret_ref = HTLCDescriptor_unsigned_tx_input(&this_arg_conv); - return tag_ptr(ret_ref, true); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKHTLCDescriptor 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; - LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); - *ret_ref = HTLCDescriptor_tx_output(&this_arg_conv); - return tag_ptr(ret_ref, true); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKHTLCDescriptor 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_u8Z ret_var = HTLCDescriptor_witness_script(&this_arg_conv); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1input_1witness(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray signature, int8_tArray witness_script) { - LDKHTLCDescriptor 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; - LDKECDSASignature signature_ref; - CHECK((*env)->GetArrayLength(env, signature) == 64); - (*env)->GetByteArrayRegion(env, signature, 0, 64, signature_ref.compact_form); - LDKu8slice witness_script_ref; - witness_script_ref.datalen = (*env)->GetArrayLength(env, witness_script); - witness_script_ref.data = (*env)->GetByteArrayElements (env, witness_script, NULL); - LDKWitness ret_var = HTLCDescriptor_tx_input_witness(&this_arg_conv, signature_ref, witness_script_ref); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - Witness_free(ret_var); - (*env)->ReleaseByteArrayElements(env, witness_script, (int8_t*)witness_script_ref.data, 0); - return ret_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1derive_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int64_t signer_provider) { - LDKHTLCDescriptor 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; - void* signer_provider_ptr = untag_ptr(signer_provider); - if (ptr_is_owned(signer_provider)) { CHECK_ACCESS(signer_provider_ptr); } - LDKSignerProvider* signer_provider_conv = (LDKSignerProvider*)signer_provider_ptr; - LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); - *ret_ret = HTLCDescriptor_derive_channel_signer(&this_arg_conv, signer_provider_conv); - return tag_ptr(ret_ret, true); -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BumpTransactionEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr);