From 2f0e19ab23f28c5c1bc11dc6bff24e156da3ec01 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 24 Oct 2023 17:41:55 +0000 Subject: [PATCH] [Java] Update auto-generated bindings to LDK 0.0.118 --- .../org/ldk/enums/Bolt12SemanticError.java | 4 + .../org/ldk/enums/ConfirmationTarget.java | 111 +- src/main/java/org/ldk/impl/bindings.java | 692 ++-- .../java/org/ldk/structs/BlindedPath.java | 15 +- .../org/ldk/structs/BumpTransactionEvent.java | 1 - .../java/org/ldk/structs/ChannelConfig.java | 20 +- .../structs/ChannelDerivationParameters.java | 4 - .../java/org/ldk/structs/ChannelManager.java | 156 +- .../ldk/structs/ChannelMessageHandler.java | 14 +- .../ldk/structs/CommitmentTransaction.java | 9 + .../structs/CustomOnionMessageContents.java | 102 - .../structs/CustomOnionMessageHandler.java | 55 +- .../org/ldk/structs/DefaultMessageRouter.java | 2 +- .../org/ldk/structs/EcdsaChannelSigner.java | 46 +- src/main/java/org/ldk/structs/Event.java | 35 + .../java/org/ldk/structs/HTLCDescriptor.java | 22 + .../ldk/structs/IgnoringMessageHandler.java | 13 - .../java/org/ldk/structs/InvoiceError.java | 12 + .../java/org/ldk/structs/MessageRouter.java | 6 - .../java/org/ldk/structs/NetworkGraph.java | 30 +- .../java/org/ldk/structs/OffersMessage.java | 9 - .../org/ldk/structs/OffersMessageHandler.java | 41 + .../org/ldk/structs/OnionMessageContents.java | 124 +- .../org/ldk/structs/OnionMessageHandler.java | 49 +- .../org/ldk/structs/OnionMessagePath.java | 2 +- .../org/ldk/structs/OnionMessageProvider.java | 76 - .../java/org/ldk/structs/OnionMessenger.java | 56 +- .../Option_CustomOnionMessageContentsZ.java | 97 - .../structs/Option_OnionMessageContentsZ.java | 97 + .../java/org/ldk/structs/Option_StrZ.java | 93 + .../java/org/ldk/structs/Option_boolZ.java | 93 + .../structs/ParsedOnionMessageContents.java | 127 + .../org/ldk/structs/PaymentConstraints.java | 6 +- .../java/org/ldk/structs/PeeledOnion.java | 123 + ...stomOnionMessageContentsZDecodeErrorZ.java | 96 - ...ion_OnionMessageContentsZDecodeErrorZ.java | 96 + .../Result_NoneBolt12SemanticErrorZ.java | 85 + .../ldk/structs/Result_PeeledOnionNoneZ.java | 71 + src/main/java/org/ldk/structs/SendError.java | 4 +- .../java/org/ldk/structs/SocketAddress.java | 9 + ..._OffersMessageDestinationBlindedPathZ.java | 95 + ...essageContentsDestinationBlindedPathZ.java | 95 + .../java/org/ldk/structs/UtilMethods.java | 37 +- src/main/java/org/ldk/structs/UtxoLookup.java | 20 +- src/main/jni/bindings.c | 3364 ++++++++++------- src/main/jni/bindings.c.body | 3364 ++++++++++------- src/main/jni/org_ldk_impl_bindings.h | 1680 +++++--- ...s_LDKCOption_CustomOnionMessageContentsZ.h | 21 - ...indings_LDKCOption_OnionMessageContentsZ.h | 21 + .../org_ldk_impl_bindings_LDKCOption_StrZ.h | 21 + .../org_ldk_impl_bindings_LDKCOption_boolZ.h | 21 + ...dk_impl_bindings_LDKOnionMessageContents.h | 21 - ...l_bindings_LDKParsedOnionMessageContents.h | 21 + .../org_ldk_impl_bindings_LDKPeeledOnion.h | 21 + 54 files changed, 7389 insertions(+), 4116 deletions(-) delete mode 100644 src/main/java/org/ldk/structs/CustomOnionMessageContents.java delete mode 100644 src/main/java/org/ldk/structs/OnionMessageProvider.java delete mode 100644 src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java create mode 100644 src/main/java/org/ldk/structs/Option_OnionMessageContentsZ.java create mode 100644 src/main/java/org/ldk/structs/Option_StrZ.java create mode 100644 src/main/java/org/ldk/structs/Option_boolZ.java create mode 100644 src/main/java/org/ldk/structs/ParsedOnionMessageContents.java create mode 100644 src/main/java/org/ldk/structs/PeeledOnion.java delete mode 100644 src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java create mode 100644 src/main/java/org/ldk/structs/Result_COption_OnionMessageContentsZDecodeErrorZ.java create mode 100644 src/main/java/org/ldk/structs/Result_NoneBolt12SemanticErrorZ.java create mode 100644 src/main/java/org/ldk/structs/Result_PeeledOnionNoneZ.java create mode 100644 src/main/java/org/ldk/structs/ThreeTuple_OffersMessageDestinationBlindedPathZ.java create mode 100644 src/main/java/org/ldk/structs/ThreeTuple_OnionMessageContentsDestinationBlindedPathZ.java delete mode 100644 src/main/jni/org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKCOption_StrZ.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKCOption_boolZ.h delete mode 100644 src/main/jni/org_ldk_impl_bindings_LDKOnionMessageContents.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKParsedOnionMessageContents.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKPeeledOnion.h diff --git a/src/main/java/org/ldk/enums/Bolt12SemanticError.java b/src/main/java/org/ldk/enums/Bolt12SemanticError.java index 66f2984c..80cc8592 100644 --- a/src/main/java/org/ldk/enums/Bolt12SemanticError.java +++ b/src/main/java/org/ldk/enums/Bolt12SemanticError.java @@ -88,6 +88,10 @@ public enum Bolt12SemanticError { * A payer id was expected but was missing. */ LDKBolt12SemanticError_MissingPayerId, + /** + * The payment id for a refund or request is already in use. + */ + LDKBolt12SemanticError_DuplicatePaymentId, /** * Blinded paths were expected but were missing. */ diff --git a/src/main/java/org/ldk/enums/ConfirmationTarget.java b/src/main/java/org/ldk/enums/ConfirmationTarget.java index 0bc941e1..bca6ce55 100644 --- a/src/main/java/org/ldk/enums/ConfirmationTarget.java +++ b/src/main/java/org/ldk/enums/ConfirmationTarget.java @@ -6,28 +6,111 @@ package org.ldk.enums; */ public enum ConfirmationTarget { /** - * We'd like a transaction to confirm in the future, but don't want to commit most of the fees - * required to do so yet. The remaining fees will come via a Child-Pays-For-Parent (CPFP) fee - * bump of the transaction. + * We have some funds available on chain which we need to spend prior to some expiry time at + * which point our counterparty may be able to steal them. Generally we have in the high tens + * to low hundreds of blocks to get our transaction on-chain, but we shouldn't risk too low a + * fee - this should be a relatively high priority feerate. + */ + LDKConfirmationTarget_OnChainSweep, + /** + * The highest feerate we will allow our channel counterparty to have in a non-anchor channel. + * + * This is the feerate on the transaction which we (or our counterparty) will broadcast in + * order to close the channel unilaterally. Because our counterparty must ensure they can + * always broadcast the latest state, this value being too low will cause immediate + * force-closures. * - * The feerate returned should be the absolute minimum feerate required to enter most node - * mempools across the network. Note that if you are not able to obtain this feerate estimate, - * you should likely use the furthest-out estimate allowed by your fee estimator. + * Allowing this value to be too high can allow our counterparty to burn our HTLC outputs to + * dust, which can result in HTLCs failing or force-closures (when the dust HTLCs exceed + * [`ChannelConfig::max_dust_htlc_exposure`]). + * + * Because most nodes use a feerate estimate which is based on a relatively high priority + * transaction entering the current mempool, setting this to a small multiple of your current + * high priority feerate estimate should suffice. + * + * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure */ - LDKConfirmationTarget_MempoolMinimum, + LDKConfirmationTarget_MaxAllowedNonAnchorChannelRemoteFee, /** - * We are happy with a transaction confirming slowly, at least within a day or so worth of - * blocks. + * This is the lowest feerate we will allow our channel counterparty to have in an anchor + * channel in order to close the channel if a channel party goes away. + * + * This needs to be sufficient to get into the mempool when the channel needs to + * be force-closed. Setting too high may result in force-closures if our counterparty attempts + * to use a lower feerate. Because this is for anchor channels, we can always bump the feerate + * later; the feerate here only needs to be sufficient to enter the mempool. + * + * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this + * is not an estimate which is very easy to calculate because we do not know the future. Using + * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to + * ensure you can always close the channel. A future change to Bitcoin's P2P network + * (package relay) may obviate the need for this entirely. */ - LDKConfirmationTarget_Background, + LDKConfirmationTarget_MinAllowedAnchorChannelRemoteFee, /** - * We'd like a transaction to confirm without major delayed, i.e., within the next 12-24 blocks. + * The lowest feerate we will allow our channel counterparty to have in a non-anchor channel. + * + * This is the feerate on the transaction which we (or our counterparty) will broadcast in + * order to close the channel if a channel party goes away. Setting this value too high will + * cause immediate force-closures in order to avoid having an unbroadcastable state. + * + * This feerate represents the fee we pick now, which must be sufficient to enter a block at an + * arbitrary time in the future. Obviously this is not an estimate which is very easy to + * calculate. This can leave channels subject to being unable to close if feerates rise, and in + * general you should prefer anchor channels to ensure you can increase the feerate when the + * transactions need broadcasting. + * + * Do note some fee estimators round up to the next full sat/vbyte (ie 250 sats per kw), + * causing occasional issues with feerate disagreements between an initiator that wants a + * feerate of 1.1 sat/vbyte and a receiver that wants 1.1 rounded up to 2. If your fee + * estimator rounds subtracting 250 to your desired feerate here can help avoid this issue. + * + * [`ChannelConfig::max_dust_htlc_exposure`]: crate::util::config::ChannelConfig::max_dust_htlc_exposure */ - LDKConfirmationTarget_Normal, + LDKConfirmationTarget_MinAllowedNonAnchorChannelRemoteFee, /** - * We'd like a transaction to confirm in the next few blocks. + * This is the feerate on the transaction which we (or our counterparty) will broadcast in + * order to close the channel if a channel party goes away. + * + * This needs to be sufficient to get into the mempool when the channel needs to + * be force-closed. Setting too low may result in force-closures. Because this is for anchor + * channels, it can be a low value as we can always bump the feerate later. + * + * A good estimate is the expected mempool minimum at the time of force-closure. Obviously this + * is not an estimate which is very easy to calculate because we do not know the future. Using + * a simple long-term fee estimate or tracking of the mempool minimum is a good approach to + * ensure you can always close the channel. A future change to Bitcoin's P2P network + * (package relay) may obviate the need for this entirely. + */ + LDKConfirmationTarget_AnchorChannelFee, + /** + * Lightning is built around the ability to broadcast a transaction in the future to close our + * channel and claim all pending funds. In order to do so, non-anchor channels are built with + * transactions which we need to be able to broadcast at some point in the future. + * + * This feerate represents the fee we pick now, which must be sufficient to enter a block at an + * arbitrary time in the future. Obviously this is not an estimate which is very easy to + * calculate, so most lightning nodes use some relatively high-priority feerate using the + * current mempool. This leaves channels subject to being unable to close if feerates rise, and + * in general you should prefer anchor channels to ensure you can increase the feerate when the + * transactions need broadcasting. + * + * Since this should represent the feerate of a channel close that does not need fee + * bumping, this is also used as an upper bound for our attempted feerate when doing cooperative + * closure of any channel. + */ + LDKConfirmationTarget_NonAnchorChannelFee, + /** + * When cooperatively closing a channel, this is the minimum feerate we will accept. + * Recommended at least within a day or so worth of blocks. + * + * This will also be used when initiating a cooperative close of a channel. When closing a + * channel you can override this fee by using + * [`ChannelManager::close_channel_with_feerate_and_script`]. + * + * [`ChannelManager::close_channel_with_feerate_and_script`]: crate::ln::channelmanager::ChannelManager::close_channel_with_feerate_and_script */ - LDKConfirmationTarget_HighPriority, + LDKConfirmationTarget_ChannelCloseMinimum, ; static native void init(); static { init(); } } \ No newline at end of file diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 6dc92bfc..f8f1fb61 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -319,6 +319,14 @@ public class bindings { public static native long CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_ok(long owner); // void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR owner); public static native void CResult_C2Tuple_CVec_u8ZusizeZNoneZ_get_err(long owner); + // struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_ChannelDerivationParametersDecodeErrorZ_get_err(long owner); + // struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_HTLCDescriptorDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_HTLCDescriptorDecodeErrorZ_get_err(long owner); // void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner); public static native void CResult_NoneNoneZ_get_ok(long owner); // void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner); @@ -383,7 +391,7 @@ public class bindings { public interface LDKEcdsaChannelSigner { long sign_counterparty_commitment(long commitment_tx, byte[][] preimages); long validate_counterparty_revocation(long idx, byte[] secret); - long sign_holder_commitment_and_htlcs(long commitment_tx); + long sign_holder_commitment(long commitment_tx); long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key); long sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); long sign_holder_htlc_transaction(byte[] htlc_tx, long input, long htlc_descriptor); @@ -398,8 +406,8 @@ public class bindings { public static native long EcdsaChannelSigner_sign_counterparty_commitment(long this_arg, long commitment_tx, byte[][] preimages); // LDKCResult_NoneNoneZ EcdsaChannelSigner_validate_counterparty_revocation LDKEcdsaChannelSigner *NONNULL_PTR this_arg, uint64_t idx, const uint8_t (*secret)[32] public static native long EcdsaChannelSigner_validate_counterparty_revocation(long this_arg, long idx, byte[] secret); - // LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ EcdsaChannelSigner_sign_holder_commitment_and_htlcs LDKEcdsaChannelSigner *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx - public static native long EcdsaChannelSigner_sign_holder_commitment_and_htlcs(long this_arg, long commitment_tx); + // LDKCResult_ECDSASignatureNoneZ EcdsaChannelSigner_sign_holder_commitment LDKEcdsaChannelSigner *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx + public static native long EcdsaChannelSigner_sign_holder_commitment(long this_arg, long commitment_tx); // LDKCResult_ECDSASignatureNoneZ EcdsaChannelSigner_sign_justice_revoked_output LDKEcdsaChannelSigner *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32] public static native long EcdsaChannelSigner_sign_justice_revoked_output(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key); // LDKCResult_ECDSASignatureNoneZ EcdsaChannelSigner_sign_justice_revoked_htlc LDKEcdsaChannelSigner *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc @@ -762,11 +770,11 @@ public class bindings { static { LDKUtxoResult.init(); } public static native LDKUtxoResult LDKUtxoResult_ref_from_ptr(long ptr); public interface LDKUtxoLookup { - long get_utxo(byte[] genesis_hash, long short_channel_id); + long get_utxo(byte[] chain_hash, long short_channel_id); } public static native long LDKUtxoLookup_new(LDKUtxoLookup impl); - // LDKUtxoResult UtxoLookup_get_utxo LDKUtxoLookup *NONNULL_PTR this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id - public static native long UtxoLookup_get_utxo(long this_arg, byte[] genesis_hash, long short_channel_id); + // LDKUtxoResult UtxoLookup_get_utxo LDKUtxoLookup *NONNULL_PTR this_arg, const uint8_t (*chain_hash)[32], uint64_t short_channel_id + public static native long UtxoLookup_get_utxo(long this_arg, byte[] chain_hash, long short_channel_id); public static class LDKCOption_UtxoLookupZ { private LDKCOption_UtxoLookupZ() {} public final static class Some extends LDKCOption_UtxoLookupZ { @@ -1078,14 +1086,6 @@ public class bindings { } static { LDKCOption_CVec_SocketAddressZZ.init(); } public static native LDKCOption_CVec_SocketAddressZZ LDKCOption_CVec_SocketAddressZZ_ref_from_ptr(long ptr); - // struct LDKChannelDerivationParameters CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_ChannelDerivationParametersDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_ChannelDerivationParametersDecodeErrorZ_get_err(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_ChannelDerivationParametersDecodeErrorZ_get_err(long owner); - // struct LDKHTLCDescriptor CResult_HTLCDescriptorDecodeErrorZ_get_ok(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_HTLCDescriptorDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_HTLCDescriptorDecodeErrorZ_get_err(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_HTLCDescriptorDecodeErrorZ_get_err(long owner); public static class LDKCOption_TxOutZ { private LDKCOption_TxOutZ() {} public final static class Some extends LDKCOption_TxOutZ { @@ -1239,10 +1239,78 @@ public class bindings { public static native byte[] C2Tuple_ThirtyTwoBytesPublicKeyZ_get_a(long owner); // struct LDKPublicKey C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(LDKC2Tuple_ThirtyTwoBytesPublicKeyZ *NONNULL_PTR owner); public static native byte[] C2Tuple_ThirtyTwoBytesPublicKeyZ_get_b(long owner); + public static class LDKCOption_StrZ { + private LDKCOption_StrZ() {} + public final static class Some extends LDKCOption_StrZ { + public java.lang.String some; + Some(java.lang.String some) { this.some = some; } + } + public final static class None extends LDKCOption_StrZ { + None() { } + } + static native void init(); + } + static { LDKCOption_StrZ.init(); } + public static native LDKCOption_StrZ LDKCOption_StrZ_ref_from_ptr(long ptr); + // void CResult_NoneBolt12SemanticErrorZ_get_ok(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner); + public static native void CResult_NoneBolt12SemanticErrorZ_get_ok(long owner); + // enum LDKBolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR owner); + public static native Bolt12SemanticError CResult_NoneBolt12SemanticErrorZ_get_err(long owner); // struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner); public static native long CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok(long owner); // void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR owner); public static native void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_err(long owner); + public static class LDKOffersMessage { + private LDKOffersMessage() {} + public final static class InvoiceRequest extends LDKOffersMessage { + public long invoice_request; + InvoiceRequest(long invoice_request) { this.invoice_request = invoice_request; } + } + public final static class Invoice extends LDKOffersMessage { + public long invoice; + Invoice(long invoice) { this.invoice = invoice; } + } + public final static class InvoiceError extends LDKOffersMessage { + public long invoice_error; + InvoiceError(long invoice_error) { this.invoice_error = invoice_error; } + } + static native void init(); + } + static { LDKOffersMessage.init(); } + public static native LDKOffersMessage LDKOffersMessage_ref_from_ptr(long ptr); + public static class LDKCOption_OffersMessageZ { + private LDKCOption_OffersMessageZ() {} + public final static class Some extends LDKCOption_OffersMessageZ { + public long some; + Some(long some) { this.some = some; } + } + public final static class None extends LDKCOption_OffersMessageZ { + None() { } + } + static native void init(); + } + static { LDKCOption_OffersMessageZ.init(); } + public static native LDKCOption_OffersMessageZ LDKCOption_OffersMessageZ_ref_from_ptr(long ptr); + public static class LDKDestination { + private LDKDestination() {} + public final static class Node extends LDKDestination { + public byte[] node; + Node(byte[] node) { this.node = node; } + } + public final static class BlindedPath extends LDKDestination { + public long blinded_path; + BlindedPath(long blinded_path) { this.blinded_path = blinded_path; } + } + static native void init(); + } + static { LDKDestination.init(); } + public static native LDKDestination LDKDestination_ref_from_ptr(long ptr); + // struct LDKOffersMessage C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner); + public static native long C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(long owner); + // struct LDKDestination C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner); + public static native long C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(long owner); + // struct LDKBlindedPath C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR owner); + public static native long C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(long owner); // struct LDKCounterpartyForwardingInfo CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_CounterpartyForwardingInfoDecodeErrorZ_get_err(LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR owner); @@ -1529,63 +1597,38 @@ public class bindings { public static native byte[] C2Tuple_PublicKeyTypeZ_get_a(long owner); // struct LDKType C2Tuple_PublicKeyTypeZ_get_b(LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR owner); public static native long C2Tuple_PublicKeyTypeZ_get_b(long owner); - public static class LDKOffersMessage { - private LDKOffersMessage() {} - public final static class InvoiceRequest extends LDKOffersMessage { - public long invoice_request; - InvoiceRequest(long invoice_request) { this.invoice_request = invoice_request; } - } - public final static class Invoice extends LDKOffersMessage { - public long invoice; - Invoice(long invoice) { this.invoice = invoice; } - } - public final static class InvoiceError extends LDKOffersMessage { - public long invoice_error; - InvoiceError(long invoice_error) { this.invoice_error = invoice_error; } - } - static native void init(); - } - static { LDKOffersMessage.init(); } - public static native LDKOffersMessage LDKOffersMessage_ref_from_ptr(long ptr); - public static class LDKCOption_OffersMessageZ { - private LDKCOption_OffersMessageZ() {} - public final static class Some extends LDKCOption_OffersMessageZ { - public long some; - Some(long some) { this.some = some; } - } - public final static class None extends LDKCOption_OffersMessageZ { - None() { } - } - static native void init(); - } - static { LDKCOption_OffersMessageZ.init(); } - public static native LDKCOption_OffersMessageZ LDKCOption_OffersMessageZ_ref_from_ptr(long ptr); - public interface LDKCustomOnionMessageContents { + public interface LDKOnionMessageContents { long tlv_type(); byte[] write(); } - public static native long LDKCustomOnionMessageContents_new(LDKCustomOnionMessageContents impl); - // uint64_t CustomOnionMessageContents_tlv_type LDKCustomOnionMessageContents *NONNULL_PTR this_arg - public static native long CustomOnionMessageContents_tlv_type(long this_arg); - // LDKCVec_u8Z CustomOnionMessageContents_write LDKCustomOnionMessageContents *NONNULL_PTR this_arg - public static native byte[] CustomOnionMessageContents_write(long this_arg); - public static class LDKCOption_CustomOnionMessageContentsZ { - private LDKCOption_CustomOnionMessageContentsZ() {} - public final static class Some extends LDKCOption_CustomOnionMessageContentsZ { + public static native long LDKOnionMessageContents_new(LDKOnionMessageContents impl); + // uint64_t OnionMessageContents_tlv_type LDKOnionMessageContents *NONNULL_PTR this_arg + public static native long OnionMessageContents_tlv_type(long this_arg); + // LDKCVec_u8Z OnionMessageContents_write LDKOnionMessageContents *NONNULL_PTR this_arg + public static native byte[] OnionMessageContents_write(long this_arg); + public static class LDKCOption_OnionMessageContentsZ { + private LDKCOption_OnionMessageContentsZ() {} + public final static class Some extends LDKCOption_OnionMessageContentsZ { public long some; Some(long some) { this.some = some; } } - public final static class None extends LDKCOption_CustomOnionMessageContentsZ { + public final static class None extends LDKCOption_OnionMessageContentsZ { None() { } } static native void init(); } - static { LDKCOption_CustomOnionMessageContentsZ.init(); } - public static native LDKCOption_CustomOnionMessageContentsZ LDKCOption_CustomOnionMessageContentsZ_ref_from_ptr(long ptr); - // struct LDKCOption_CustomOnionMessageContentsZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(long owner); + static { LDKCOption_OnionMessageContentsZ.init(); } + public static native LDKCOption_OnionMessageContentsZ LDKCOption_OnionMessageContentsZ_ref_from_ptr(long ptr); + // struct LDKCOption_OnionMessageContentsZ CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(long owner); + // struct LDKDecodeError CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR owner); + public static native long CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(long owner); + // struct LDKOnionMessageContents C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner); + public static native long C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(long owner); + // struct LDKDestination C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner); + public static native long C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(long owner); + // struct LDKBlindedPath C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR owner); + public static native long C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(long owner); public static class LDKCOption_TypeZ { private LDKCOption_TypeZ() {} public final static class Some extends LDKCOption_TypeZ { @@ -2219,6 +2262,10 @@ public class bindings { public long sender_intended_total_msat; PaymentClaimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, long purpose, long[] htlcs, long sender_intended_total_msat) { this.receiver_node_id = receiver_node_id; this.payment_hash = payment_hash; this.amount_msat = amount_msat; this.purpose = purpose; this.htlcs = htlcs; this.sender_intended_total_msat = sender_intended_total_msat; } } + public final static class InvoiceRequestFailed extends LDKEvent { + public byte[] payment_id; + InvoiceRequestFailed(byte[] payment_id) { this.payment_id = payment_id; } + } public final static class PaymentSent extends LDKEvent { public long payment_id; public byte[] payment_preimage; @@ -2595,6 +2642,41 @@ public class bindings { public static native long CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_ok(long owner); // struct LDKSendError CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ *NONNULL_PTR owner); public static native long CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_get_err(long owner); + public static class LDKParsedOnionMessageContents { + private LDKParsedOnionMessageContents() {} + public final static class Offers extends LDKParsedOnionMessageContents { + public long offers; + Offers(long offers) { this.offers = offers; } + } + public final static class Custom extends LDKParsedOnionMessageContents { + public long custom; + Custom(long custom) { this.custom = custom; } + } + static native void init(); + } + static { LDKParsedOnionMessageContents.init(); } + public static native LDKParsedOnionMessageContents LDKParsedOnionMessageContents_ref_from_ptr(long ptr); + public static class LDKPeeledOnion { + private LDKPeeledOnion() {} + public final static class Forward extends LDKPeeledOnion { + public byte[] _0; + public long _1; + Forward(byte[] _0, long _1) { this._0 = _0; this._1 = _1; } + } + public final static class Receive extends LDKPeeledOnion { + public long _0; + public byte[] _1; + public long _2; + Receive(long _0, byte[] _1, long _2) { this._0 = _0; this._1 = _1; this._2 = _2; } + } + static native void init(); + } + static { LDKPeeledOnion.init(); } + public static native LDKPeeledOnion LDKPeeledOnion_ref_from_ptr(long ptr); + // struct LDKPeeledOnion CResult_PeeledOnionNoneZ_get_ok(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner); + public static native long CResult_PeeledOnionNoneZ_get_ok(long owner); + // void CResult_PeeledOnionNoneZ_get_err(LDKCResult_PeeledOnionNoneZ *NONNULL_PTR owner); + public static native void CResult_PeeledOnionNoneZ_get_err(long owner); // void CResult_NoneSendErrorZ_get_ok(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner); public static native void CResult_NoneSendErrorZ_get_ok(long owner); // struct LDKSendError CResult_NoneSendErrorZ_get_err(LDKCResult_NoneSendErrorZ *NONNULL_PTR owner); @@ -2789,7 +2871,7 @@ public class bindings { void handle_error(byte[] their_node_id, long msg); long provided_node_features(); long provided_init_features(byte[] their_node_id); - long get_genesis_hashes(); + long get_chain_hashes(); } public static native long LDKChannelMessageHandler_new(LDKChannelMessageHandler impl, LDKMessageSendEventsProvider MessageSendEventsProvider); public static native long LDKChannelMessageHandler_get_MessageSendEventsProvider(long arg); @@ -2859,8 +2941,17 @@ public class bindings { public static native long ChannelMessageHandler_provided_node_features(long this_arg); // LDKInitFeatures ChannelMessageHandler_provided_init_features LDKChannelMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id public static native long ChannelMessageHandler_provided_init_features(long this_arg, byte[] their_node_id); - // LDKCOption_CVec_ThirtyTwoBytesZZ ChannelMessageHandler_get_genesis_hashes LDKChannelMessageHandler *NONNULL_PTR this_arg - public static native long ChannelMessageHandler_get_genesis_hashes(long this_arg); + // LDKCOption_CVec_ThirtyTwoBytesZZ ChannelMessageHandler_get_chain_hashes LDKChannelMessageHandler *NONNULL_PTR this_arg + public static native long ChannelMessageHandler_get_chain_hashes(long this_arg); + public interface LDKOffersMessageHandler { + long handle_message(long message); + long[] release_pending_messages(); + } + public static native long LDKOffersMessageHandler_new(LDKOffersMessageHandler impl); + // LDKCOption_OffersMessageZ OffersMessageHandler_handle_message LDKOffersMessageHandler *NONNULL_PTR this_arg, struct LDKOffersMessage message + public static native long OffersMessageHandler_handle_message(long this_arg, long message); + // LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ OffersMessageHandler_release_pending_messages LDKOffersMessageHandler *NONNULL_PTR this_arg + public static native long[] OffersMessageHandler_release_pending_messages(long this_arg); public interface LDKRoutingMessageHandler { long handle_node_announcement(long msg); long handle_channel_announcement(long msg); @@ -2904,23 +2995,19 @@ public class bindings { public static native long RoutingMessageHandler_provided_node_features(long this_arg); // LDKInitFeatures RoutingMessageHandler_provided_init_features LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id public static native long RoutingMessageHandler_provided_init_features(long this_arg, byte[] their_node_id); - public interface LDKOnionMessageProvider { - long next_onion_message_for_peer(byte[] peer_node_id); - } - public static native long LDKOnionMessageProvider_new(LDKOnionMessageProvider impl); - // LDKOnionMessage OnionMessageProvider_next_onion_message_for_peer LDKOnionMessageProvider *NONNULL_PTR this_arg, struct LDKPublicKey peer_node_id - public static native long OnionMessageProvider_next_onion_message_for_peer(long this_arg, byte[] peer_node_id); public interface LDKOnionMessageHandler { void handle_onion_message(byte[] peer_node_id, long msg); + long next_onion_message_for_peer(byte[] peer_node_id); long peer_connected(byte[] their_node_id, long init, boolean inbound); void peer_disconnected(byte[] their_node_id); long provided_node_features(); long provided_init_features(byte[] their_node_id); } - public static native long LDKOnionMessageHandler_new(LDKOnionMessageHandler impl, LDKOnionMessageProvider OnionMessageProvider); - public static native long LDKOnionMessageHandler_get_OnionMessageProvider(long arg); + public static native long LDKOnionMessageHandler_new(LDKOnionMessageHandler impl); // void OnionMessageHandler_handle_onion_message LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg public static native void OnionMessageHandler_handle_onion_message(long this_arg, byte[] peer_node_id, long msg); + // LDKOnionMessage OnionMessageHandler_next_onion_message_for_peer LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey peer_node_id + public static native long OnionMessageHandler_next_onion_message_for_peer(long this_arg, byte[] peer_node_id); // LDKCResult_NoneNoneZ OnionMessageHandler_peer_connected LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound public static native long OnionMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long init, boolean inbound); // void OnionMessageHandler_peer_disconnected LDKOnionMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id @@ -2951,21 +3038,18 @@ public class bindings { public static native long CustomMessageHandler_provided_node_features(long this_arg); // LDKInitFeatures CustomMessageHandler_provided_init_features LDKCustomMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id public static native long CustomMessageHandler_provided_init_features(long this_arg, byte[] their_node_id); - public interface LDKOffersMessageHandler { - long handle_message(long message); - } - public static native long LDKOffersMessageHandler_new(LDKOffersMessageHandler impl); - // LDKCOption_OffersMessageZ OffersMessageHandler_handle_message LDKOffersMessageHandler *NONNULL_PTR this_arg, struct LDKOffersMessage message - public static native long OffersMessageHandler_handle_message(long this_arg, long message); public interface LDKCustomOnionMessageHandler { long handle_custom_message(long msg); long read_custom_message(long message_type, byte[] buffer); + long[] release_pending_custom_messages(); } public static native long LDKCustomOnionMessageHandler_new(LDKCustomOnionMessageHandler impl); - // LDKCOption_CustomOnionMessageContentsZ CustomOnionMessageHandler_handle_custom_message LDKCustomOnionMessageHandler *NONNULL_PTR this_arg, struct LDKCustomOnionMessageContents msg + // LDKCOption_OnionMessageContentsZ CustomOnionMessageHandler_handle_custom_message LDKCustomOnionMessageHandler *NONNULL_PTR this_arg, struct LDKOnionMessageContents msg public static native long CustomOnionMessageHandler_handle_custom_message(long this_arg, long msg); - // LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CustomOnionMessageHandler_read_custom_message LDKCustomOnionMessageHandler *NONNULL_PTR this_arg, uint64_t message_type, struct LDKu8slice buffer + // LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CustomOnionMessageHandler_read_custom_message LDKCustomOnionMessageHandler *NONNULL_PTR this_arg, uint64_t message_type, struct LDKu8slice buffer public static native long CustomOnionMessageHandler_read_custom_message(long this_arg, long message_type, byte[] buffer); + // LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ CustomOnionMessageHandler_release_pending_custom_messages LDKCustomOnionMessageHandler *NONNULL_PTR this_arg + public static native long[] CustomOnionMessageHandler_release_pending_custom_messages(long this_arg); public interface LDKSocketDescriptor { long send_data(byte[] data, boolean resume_read); void disconnect_socket(); @@ -3034,40 +3118,12 @@ public class bindings { public static native long LDKScore_get_ScoreUpdate(long arg); // LDKCVec_u8Z Score_write LDKScore *NONNULL_PTR this_arg public static native byte[] Score_write(long this_arg); - public static class LDKDestination { - private LDKDestination() {} - public final static class Node extends LDKDestination { - public byte[] node; - Node(byte[] node) { this.node = node; } - } - public final static class BlindedPath extends LDKDestination { - public long blinded_path; - BlindedPath(long blinded_path) { this.blinded_path = blinded_path; } - } - static native void init(); - } - static { LDKDestination.init(); } - public static native LDKDestination LDKDestination_ref_from_ptr(long ptr); public interface LDKMessageRouter { long find_path(byte[] sender, byte[][] peers, long destination); } public static native long LDKMessageRouter_new(LDKMessageRouter impl); // LDKCResult_OnionMessagePathNoneZ MessageRouter_find_path LDKMessageRouter *NONNULL_PTR this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination public static native long MessageRouter_find_path(long this_arg, byte[] sender, byte[][] peers, long destination); - public static class LDKOnionMessageContents { - private LDKOnionMessageContents() {} - public final static class Offers extends LDKOnionMessageContents { - public long offers; - Offers(long offers) { this.offers = offers; } - } - public final static class Custom extends LDKOnionMessageContents { - public long custom; - Custom(long custom) { this.custom = custom; } - } - static native void init(); - } - static { LDKOnionMessageContents.init(); } - public static native LDKOnionMessageContents LDKOnionMessageContents_ref_from_ptr(long ptr); public interface LDKCoinSelectionSource { long select_confirmed_utxos(byte[] claim_id, long[] must_spend, long[] must_pay_to, int target_feerate_sat_per_1000_weight); long sign_tx(byte[] tx); @@ -3373,6 +3429,30 @@ public class bindings { public static native long CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone_ptr(long arg); // struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ *NONNULL_PTR orig); public static native long CResult_C2Tuple_CVec_u8ZusizeZNoneZ_clone(long orig); + // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); + public static native long CResult_ChannelDerivationParametersDecodeErrorZ_ok(long o); + // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ChannelDerivationParametersDecodeErrorZ_err(long e); + // bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(long o); + // void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res); + public static native void CResult_ChannelDerivationParametersDecodeErrorZ_free(long _res); + // uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_ChannelDerivationParametersDecodeErrorZ_clone(long orig); + // struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o); + public static native long CResult_HTLCDescriptorDecodeErrorZ_ok(long o); + // struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_HTLCDescriptorDecodeErrorZ_err(long e); + // bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_HTLCDescriptorDecodeErrorZ_is_ok(long o); + // void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); + public static native void CResult_HTLCDescriptorDecodeErrorZ_free(long _res); + // uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_HTLCDescriptorDecodeErrorZ_clone(long orig); // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); public static native long CResult_NoneNoneZ_ok(); // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); @@ -4105,30 +4185,6 @@ public class bindings { public static native long COption_CVec_SocketAddressZZ_clone_ptr(long arg); // struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig); public static native long COption_CVec_SocketAddressZZ_clone(long orig); - // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); - public static native long CResult_ChannelDerivationParametersDecodeErrorZ_ok(long o); - // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_ChannelDerivationParametersDecodeErrorZ_err(long e); - // bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(long o); - // void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res); - public static native void CResult_ChannelDerivationParametersDecodeErrorZ_free(long _res); - // uint64_t CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_ChannelDerivationParametersDecodeErrorZ_clone(long orig); - // struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o); - public static native long CResult_HTLCDescriptorDecodeErrorZ_ok(long o); - // struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_HTLCDescriptorDecodeErrorZ_err(long e); - // bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_HTLCDescriptorDecodeErrorZ_is_ok(long o); - // void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); - public static native void CResult_HTLCDescriptorDecodeErrorZ_free(long _res); - // uint64_t CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_HTLCDescriptorDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_HTLCDescriptorDecodeErrorZ_clone(long orig); // void CVec_HTLCOutputInCommitmentZ_free(struct LDKCVec_HTLCOutputInCommitmentZ _res); public static native void CVec_HTLCOutputInCommitmentZ_free(long[] _res); // void CVec_HTLCDescriptorZ_free(struct LDKCVec_HTLCDescriptorZ _res); @@ -4305,6 +4361,28 @@ public class bindings { public static native void C2Tuple_ThirtyTwoBytesPublicKeyZ_free(long _res); // void CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ _res); public static native void CVec_C2Tuple_ThirtyTwoBytesPublicKeyZZ_free(long[] _res); + // struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); + public static native long COption_StrZ_some(String o); + // struct LDKCOption_StrZ COption_StrZ_none(void); + public static native long COption_StrZ_none(); + // void COption_StrZ_free(struct LDKCOption_StrZ _res); + public static native void COption_StrZ_free(long _res); + // uint64_t COption_StrZ_clone_ptr(LDKCOption_StrZ *NONNULL_PTR arg); + public static native long COption_StrZ_clone_ptr(long arg); + // struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); + public static native long COption_StrZ_clone(long orig); + // struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void); + public static native long CResult_NoneBolt12SemanticErrorZ_ok(); + // struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + public static native long CResult_NoneBolt12SemanticErrorZ_err(Bolt12SemanticError e); + // bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o); + public static native boolean CResult_NoneBolt12SemanticErrorZ_is_ok(long o); + // void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res); + public static native void CResult_NoneBolt12SemanticErrorZ_free(long _res); + // uint64_t CResult_NoneBolt12SemanticErrorZ_clone_ptr(LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR arg); + public static native long CResult_NoneBolt12SemanticErrorZ_clone_ptr(long arg); + // struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig); + public static native long CResult_NoneBolt12SemanticErrorZ_clone(long orig); // struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); public static native long CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(long o); // struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); @@ -4317,6 +4395,26 @@ public class bindings { public static native long CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone_ptr(long arg); // struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); public static native long CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(long orig); + // struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o); + public static native long COption_OffersMessageZ_some(long o); + // struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void); + public static native long COption_OffersMessageZ_none(); + // void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res); + public static native void COption_OffersMessageZ_free(long _res); + // uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg); + public static native long COption_OffersMessageZ_clone_ptr(long arg); + // struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig); + public static native long COption_OffersMessageZ_clone(long orig); + // uint64_t C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR arg); + public static native long C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(long arg); + // struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ *NONNULL_PTR orig); + public static native long C3Tuple_OffersMessageDestinationBlindedPathZ_clone(long orig); + // struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ C3Tuple_OffersMessageDestinationBlindedPathZ_new(struct LDKOffersMessage a, struct LDKDestination b, struct LDKBlindedPath c); + public static native long C3Tuple_OffersMessageDestinationBlindedPathZ_new(long a, long b, long c); + // void C3Tuple_OffersMessageDestinationBlindedPathZ_free(struct LDKC3Tuple_OffersMessageDestinationBlindedPathZ _res); + public static native void C3Tuple_OffersMessageDestinationBlindedPathZ_free(long _res); + // void CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OffersMessageDestinationBlindedPathZZ _res); + public static native void CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free(long[] _res); // struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); public static native long CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(long o); // struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); @@ -4577,38 +4675,38 @@ public class bindings { public static native void C2Tuple_PublicKeyTypeZ_free(long _res); // void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); public static native void CVec_C2Tuple_PublicKeyTypeZZ_free(long[] _res); - // struct LDKCOption_OffersMessageZ COption_OffersMessageZ_some(struct LDKOffersMessage o); - public static native long COption_OffersMessageZ_some(long o); - // struct LDKCOption_OffersMessageZ COption_OffersMessageZ_none(void); - public static native long COption_OffersMessageZ_none(); - // void COption_OffersMessageZ_free(struct LDKCOption_OffersMessageZ _res); - public static native void COption_OffersMessageZ_free(long _res); - // uint64_t COption_OffersMessageZ_clone_ptr(LDKCOption_OffersMessageZ *NONNULL_PTR arg); - public static native long COption_OffersMessageZ_clone_ptr(long arg); - // struct LDKCOption_OffersMessageZ COption_OffersMessageZ_clone(const struct LDKCOption_OffersMessageZ *NONNULL_PTR orig); - public static native long COption_OffersMessageZ_clone(long orig); - // struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); - public static native long COption_CustomOnionMessageContentsZ_some(long o); - // struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); - public static native long COption_CustomOnionMessageContentsZ_none(); - // void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); - public static native void COption_CustomOnionMessageContentsZ_free(long _res); - // uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg); - public static native long COption_CustomOnionMessageContentsZ_clone_ptr(long arg); - // struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_clone(const struct LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR orig); - public static native long COption_CustomOnionMessageContentsZ_clone(long orig); - // struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); - public static native long CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(long o); - // struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(long e); - // bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(long o); - // void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); - public static native void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(long _res); - // uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(long orig); + // struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o); + public static native long COption_OnionMessageContentsZ_some(long o); + // struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void); + public static native long COption_OnionMessageContentsZ_none(); + // void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res); + public static native void COption_OnionMessageContentsZ_free(long _res); + // uint64_t COption_OnionMessageContentsZ_clone_ptr(LDKCOption_OnionMessageContentsZ *NONNULL_PTR arg); + public static native long COption_OnionMessageContentsZ_clone_ptr(long arg); + // struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *NONNULL_PTR orig); + public static native long COption_OnionMessageContentsZ_clone(long orig); + // struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o); + public static native long CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(long o); + // struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_COption_OnionMessageContentsZDecodeErrorZ_err(long e); + // bool CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(long o); + // void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res); + public static native void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(long _res); + // uint64_t CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg); + public static native long CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(long arg); + // struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(long orig); + // uint64_t C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR arg); + public static native long C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(long arg); + // struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(const struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ *NONNULL_PTR orig); + public static native long C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(long orig); + // struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(struct LDKOnionMessageContents a, struct LDKDestination b, struct LDKBlindedPath c); + public static native long C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(long a, long b, long c); + // void C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(struct LDKC3Tuple_OnionMessageContentsDestinationBlindedPathZ _res); + public static native void C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(long _res); + // void CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(struct LDKCVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ _res); + public static native void CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free(long[] _res); // struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); public static native long COption_TypeZ_some(long o); // struct LDKCOption_TypeZ COption_TypeZ_none(void); @@ -6023,6 +6121,14 @@ public class bindings { public static native boolean CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_is_ok(long o); // void CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ _res); public static native void CResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ_free(long _res); + // struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o); + public static native long CResult_PeeledOnionNoneZ_ok(long o); + // struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void); + public static native long CResult_PeeledOnionNoneZ_err(); + // bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o); + public static native boolean CResult_PeeledOnionNoneZ_is_ok(long o); + // void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res); + public static native void CResult_PeeledOnionNoneZ_free(long _res); // struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); public static native long CResult_NoneSendErrorZ_ok(); // struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); @@ -6607,14 +6713,20 @@ public class bindings { public static native void BroadcasterInterface_free(long this_ptr); // enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig); public static native ConfirmationTarget ConfirmationTarget_clone(long orig); - // enum LDKConfirmationTarget ConfirmationTarget_mempool_minimum(void); - public static native ConfirmationTarget ConfirmationTarget_mempool_minimum(); - // enum LDKConfirmationTarget ConfirmationTarget_background(void); - public static native ConfirmationTarget ConfirmationTarget_background(); - // enum LDKConfirmationTarget ConfirmationTarget_normal(void); - public static native ConfirmationTarget ConfirmationTarget_normal(); - // enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); - public static native ConfirmationTarget ConfirmationTarget_high_priority(); + // enum LDKConfirmationTarget ConfirmationTarget_on_chain_sweep(void); + public static native ConfirmationTarget ConfirmationTarget_on_chain_sweep(); + // enum LDKConfirmationTarget ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee(void); + public static native ConfirmationTarget ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee(); + // enum LDKConfirmationTarget ConfirmationTarget_min_allowed_anchor_channel_remote_fee(void); + public static native ConfirmationTarget ConfirmationTarget_min_allowed_anchor_channel_remote_fee(); + // enum LDKConfirmationTarget ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee(void); + public static native ConfirmationTarget ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee(); + // enum LDKConfirmationTarget ConfirmationTarget_anchor_channel_fee(void); + public static native ConfirmationTarget ConfirmationTarget_anchor_channel_fee(); + // enum LDKConfirmationTarget ConfirmationTarget_non_anchor_channel_fee(void); + public static native ConfirmationTarget ConfirmationTarget_non_anchor_channel_fee(); + // enum LDKConfirmationTarget ConfirmationTarget_channel_close_minimum(void); + public static native ConfirmationTarget ConfirmationTarget_channel_close_minimum(); // uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o); public static native long ConfirmationTarget_hash(long o); // bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b); @@ -7133,6 +7245,10 @@ public class bindings { public static native long ChannelManager_accept_inbound_channel(long this_arg, byte[] temporary_channel_id, byte[] counterparty_node_id, byte[] user_channel_id); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); public static native long ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(long this_arg, byte[] temporary_channel_id, byte[] counterparty_node_id, byte[] user_channel_id); + // MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); + public static native long ChannelManager_pay_for_offer(long this_arg, long offer, long quantity, long amount_msats, long payer_note, byte[] payment_id, long retry_strategy, long max_total_routing_fee_msat); + // MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); + public static native long ChannelManager_request_refund_payment(long this_arg, long refund); // MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); public static native long ChannelManager_create_inbound_payment(long this_arg, long min_value_msat, int invoice_expiry_delta_secs, long min_final_cltv_expiry_delta); // MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry); @@ -7171,6 +7287,8 @@ public class bindings { public static native long ChannelManager_init_features(long this_arg); // struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_as_ChannelMessageHandler(long this_arg); + // struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_as_OffersMessageHandler(long this_arg); // struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); public static native long provided_init_features(long config); // struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); @@ -8285,6 +8403,8 @@ public class bindings { public static native boolean SocketAddressParseError_eq(long a, long b); // struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port); public static native long parse_onion_address(String host, short port); + // struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o); + public static native String SocketAddress_to_str(long o); // struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s); public static native long SocketAddress_from_str(String s); // void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr); @@ -8869,8 +8989,6 @@ public class bindings { public static native long IgnoringMessageHandler_as_MessageSendEventsProvider(long this_arg); // struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); public static native long IgnoringMessageHandler_as_RoutingMessageHandler(long this_arg); - // struct LDKOnionMessageProvider IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); - public static native long IgnoringMessageHandler_as_OnionMessageProvider(long this_arg); // struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); public static native long IgnoringMessageHandler_as_OnionMessageHandler(long this_arg); // struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); @@ -9299,6 +9417,8 @@ public class bindings { public static native long CommitmentTransaction_read(byte[] ser); // MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); public static native long CommitmentTransaction_commitment_number(long this_arg); + // MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); + public static native byte[] CommitmentTransaction_per_commitment_point(long this_arg); // MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); public static native long CommitmentTransaction_to_broadcaster_value_sat(long this_arg); // MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); @@ -10271,6 +10391,8 @@ public class bindings { public static native long ErroneousField_clone_ptr(long arg); // struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig); public static native long ErroneousField_clone(long orig); + // MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s); + public static native long InvoiceError_from_string(String s); // struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR obj); public static native byte[] InvoiceError_write(long obj); // struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser); @@ -10457,6 +10579,8 @@ public class bindings { public static native Bolt12SemanticError Bolt12SemanticError_missing_payer_metadata(); // enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void); public static native Bolt12SemanticError Bolt12SemanticError_missing_payer_id(); + // enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void); + public static native Bolt12SemanticError Bolt12SemanticError_duplicate_payment_id(); // enum LDKBolt12SemanticError Bolt12SemanticError_missing_paths(void); public static native Bolt12SemanticError Bolt12SemanticError_missing_paths(); // enum LDKBolt12SemanticError Bolt12SemanticError_invalid_pay_info(void); @@ -10579,8 +10703,8 @@ public class bindings { public static native void P2PGossipSync_add_utxo_lookup(long this_arg, long utxo_lookup); // void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); public static native void NetworkGraph_handle_network_update(long this_arg, long network_update); - // MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_genesis_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); - public static native byte[] NetworkGraph_get_genesis_hash(long this_arg); + // MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); + public static native byte[] NetworkGraph_get_chain_hash(long this_arg); // struct LDKCResult_NoneLightningErrorZ verify_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg); public static native long verify_node_announcement(long msg); // struct LDKCResult_NoneLightningErrorZ verify_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg); @@ -10841,6 +10965,8 @@ public class bindings { public static native long NetworkGraph_update_channel(long this_arg, long msg); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); public static native long NetworkGraph_update_channel_unsigned(long this_arg, long msg); + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); + public static native long NetworkGraph_verify_channel_update(long this_arg, long msg); // MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); public static native long ReadOnlyNetworkGraph_channel(long this_arg, long short_channel_id); // MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); @@ -11437,6 +11563,86 @@ public class bindings { public static native long SpendableOutputDescriptor_read(byte[] ser); // MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8ZusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight, struct LDKCOption_u32Z locktime); public static native long SpendableOutputDescriptor_create_spendable_outputs_psbt(long[] descriptors, long[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, long locktime); + // void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); + public static native void ChannelDerivationParameters_free(long this_obj); + // uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); + public static native long ChannelDerivationParameters_get_value_satoshis(long this_ptr); + // void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ChannelDerivationParameters_set_value_satoshis(long this_ptr, long val); + // const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; + public static native byte[] ChannelDerivationParameters_get_keys_id(long this_ptr); + // void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + public static native void ChannelDerivationParameters_set_keys_id(long this_ptr, byte[] val); + // struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); + public static native long ChannelDerivationParameters_get_transaction_parameters(long this_ptr); + // void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); + public static native void ChannelDerivationParameters_set_transaction_parameters(long this_ptr, long val); + // MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); + public static native long ChannelDerivationParameters_new(long value_satoshis_arg, byte[] keys_id_arg, long transaction_parameters_arg); + // uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg); + public static native long ChannelDerivationParameters_clone_ptr(long arg); + // struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); + public static native long ChannelDerivationParameters_clone(long orig); + // bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); + public static native boolean ChannelDerivationParameters_eq(long a, long b); + // struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); + public static native byte[] ChannelDerivationParameters_write(long obj); + // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); + public static native long ChannelDerivationParameters_read(byte[] ser); + // void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); + public static native void HTLCDescriptor_free(long this_obj); + // struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + public static native long HTLCDescriptor_get_channel_derivation_parameters(long this_ptr); + // void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); + public static native void HTLCDescriptor_set_channel_derivation_parameters(long this_ptr, long val); + // uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + public static native long HTLCDescriptor_get_per_commitment_number(long this_ptr); + // void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); + public static native void HTLCDescriptor_set_per_commitment_number(long this_ptr, long val); + // struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + public static native byte[] HTLCDescriptor_get_per_commitment_point(long this_ptr); + // void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + public static native void HTLCDescriptor_set_per_commitment_point(long this_ptr, byte[] val); + // uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + public static native int HTLCDescriptor_get_feerate_per_kw(long this_ptr); + // void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val); + public static native void HTLCDescriptor_set_feerate_per_kw(long this_ptr, int val); + // struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + public static native long HTLCDescriptor_get_htlc(long this_ptr); + // void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); + public static native void HTLCDescriptor_set_htlc(long this_ptr, long val); + // struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + public static native long HTLCDescriptor_get_preimage(long this_ptr); + // void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); + public static native void HTLCDescriptor_set_preimage(long this_ptr, long val); + // struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); + public static native byte[] HTLCDescriptor_get_counterparty_sig(long this_ptr); + // void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); + public static native void HTLCDescriptor_set_counterparty_sig(long this_ptr, byte[] val); + // uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg); + public static native long HTLCDescriptor_clone_ptr(long arg); + // struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); + public static native long HTLCDescriptor_clone(long orig); + // bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); + public static native boolean HTLCDescriptor_eq(long a, long b); + // struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); + public static native byte[] HTLCDescriptor_write(long obj); + // struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); + public static native long HTLCDescriptor_read(byte[] ser); + // MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + public static native long HTLCDescriptor_outpoint(long this_arg); + // MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + public static native long HTLCDescriptor_previous_utxo(long this_arg); + // MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + public static native long HTLCDescriptor_unsigned_tx_input(long this_arg); + // MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + public static native long HTLCDescriptor_tx_output(long this_arg); + // MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); + public static native byte[] HTLCDescriptor_witness_script(long this_arg); + // MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); + public static native byte[] HTLCDescriptor_tx_input_witness(long this_arg, byte[] signature, byte[] witness_script); + // MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); + public static native long HTLCDescriptor_derive_channel_signer(long this_arg, long signer_provider); // void ChannelSigner_free(struct LDKChannelSigner this_ptr); public static native void ChannelSigner_free(long this_ptr); // void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); @@ -11619,16 +11825,26 @@ public class bindings { public static native boolean SendError_eq(long a, long b); // void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr); public static native void CustomOnionMessageHandler_free(long this_ptr); - // struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, struct LDKOnionMessagePath path, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path); - public static native long create_onion_message(long entropy_source, long node_signer, long path, long message, long reply_path); + // void PeeledOnion_free(struct LDKPeeledOnion this_ptr); + public static native void PeeledOnion_free(long this_ptr); + // uint64_t PeeledOnion_clone_ptr(LDKPeeledOnion *NONNULL_PTR arg); + public static native long PeeledOnion_clone_ptr(long arg); + // struct LDKPeeledOnion PeeledOnion_clone(const struct LDKPeeledOnion *NONNULL_PTR orig); + public static native long PeeledOnion_clone(long orig); + // struct LDKPeeledOnion PeeledOnion_forward(struct LDKPublicKey a, struct LDKOnionMessage b); + public static native long PeeledOnion_forward(byte[] a, long b); + // struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a, struct LDKThirtyTwoBytes b, struct LDKBlindedPath c); + public static native long PeeledOnion_receive(long a, byte[] b, long c); + // struct LDKCResult_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path); + public static native long create_onion_message(long entropy_source, long node_signer, long path, long contents, long reply_path); + // struct LDKCResult_PeeledOnionNoneZ peel_onion_message(const struct LDKOnionMessage *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler); + public static native long peel_onion_message(long msg, long node_signer, long logger, long custom_handler); // MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKCustomOnionMessageHandler custom_handler); public static native long OnionMessenger_new(long entropy_source, long node_signer, long logger, long message_router, long offers_handler, long custom_handler); - // MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessagePath path, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path); - public static native long OnionMessenger_send_onion_message(long this_arg, long path, long message, long reply_path); + // MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedPath reply_path); + public static native long OnionMessenger_send_onion_message(long this_arg, long path, long contents, long reply_path); // struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); public static native long OnionMessenger_as_OnionMessageHandler(long this_arg); - // struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); - public static native long OnionMessenger_as_OnionMessageProvider(long this_arg); // void OffersMessageHandler_free(struct LDKOffersMessageHandler this_ptr); public static native void OffersMessageHandler_free(long this_ptr); // void OffersMessage_free(struct LDKOffersMessage this_ptr); @@ -11645,8 +11861,6 @@ public class bindings { public static native long OffersMessage_invoice_error(long a); // MUST_USE_RES bool OffersMessage_is_known_type(uint64_t tlv_type); public static native boolean OffersMessage_is_known_type(long tlv_type); - // MUST_USE_RES uint64_t OffersMessage_tlv_type(const struct LDKOffersMessage *NONNULL_PTR this_arg); - public static native long OffersMessage_tlv_type(long this_arg); // struct LDKCVec_u8Z OffersMessage_write(const struct LDKOffersMessage *NONNULL_PTR obj); public static native byte[] OffersMessage_write(long obj); // struct LDKCResult_OffersMessageDecodeErrorZ OffersMessage_read(struct LDKu8slice ser, uint64_t arg_a, const struct LDKLogger *NONNULL_PTR arg_b); @@ -11679,22 +11893,26 @@ public class bindings { public static native boolean Packet_eq(long a, long b); // struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj); public static native byte[] Packet_write(long obj); - // void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); - public static native void OnionMessageContents_free(long this_ptr); + // void ParsedOnionMessageContents_free(struct LDKParsedOnionMessageContents this_ptr); + public static native void ParsedOnionMessageContents_free(long this_ptr); + // uint64_t ParsedOnionMessageContents_clone_ptr(LDKParsedOnionMessageContents *NONNULL_PTR arg); + public static native long ParsedOnionMessageContents_clone_ptr(long arg); + // struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const struct LDKParsedOnionMessageContents *NONNULL_PTR orig); + public static native long ParsedOnionMessageContents_clone(long orig); + // struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a); + public static native long ParsedOnionMessageContents_offers(long a); + // struct LDKParsedOnionMessageContents ParsedOnionMessageContents_custom(struct LDKOnionMessageContents a); + public static native long ParsedOnionMessageContents_custom(long a); + // struct LDKOnionMessageContents ParsedOnionMessageContents_as_OnionMessageContents(const struct LDKParsedOnionMessageContents *NONNULL_PTR this_arg); + public static native long ParsedOnionMessageContents_as_OnionMessageContents(long this_arg); + // struct LDKCVec_u8Z ParsedOnionMessageContents_write(const struct LDKParsedOnionMessageContents *NONNULL_PTR obj); + public static native byte[] ParsedOnionMessageContents_write(long obj); // uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg); public static native long OnionMessageContents_clone_ptr(long arg); // struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionMessageContents *NONNULL_PTR orig); public static native long OnionMessageContents_clone(long orig); - // struct LDKOnionMessageContents OnionMessageContents_offers(struct LDKOffersMessage a); - public static native long OnionMessageContents_offers(long a); - // struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a); - public static native long OnionMessageContents_custom(long a); - // uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg); - public static native long CustomOnionMessageContents_clone_ptr(long arg); - // struct LDKCustomOnionMessageContents CustomOnionMessageContents_clone(const struct LDKCustomOnionMessageContents *NONNULL_PTR orig); - public static native long CustomOnionMessageContents_clone(long orig); - // void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr); - public static native void CustomOnionMessageContents_free(long this_ptr); + // void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); + public static native void OnionMessageContents_free(long this_ptr); // void BlindedPath_free(struct LDKBlindedPath this_obj); public static native void BlindedPath_free(long this_obj); // struct LDKPublicKey BlindedPath_get_introduction_node_id(const struct LDKBlindedPath *NONNULL_PTR this_ptr); @@ -11739,6 +11957,8 @@ public class bindings { public static native long BlindedHop_hash(long o); // bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b); public static native boolean BlindedHop_eq(long a, long b); + // MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_one_hop_for_message(struct LDKPublicKey recipient_node_id, const struct LDKEntropySource *NONNULL_PTR entropy_source); + public static native long BlindedPath_one_hop_for_message(byte[] recipient_node_id, long entropy_source); // MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source); public static native long BlindedPath_new_for_message(byte[][] node_pks, long entropy_source); // MUST_USE_RES struct LDKCResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_one_hop_for_payment(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, const struct LDKEntropySource *NONNULL_PTR entropy_source); @@ -12007,6 +12227,8 @@ public class bindings { public static native long Event_payment_claimable(byte[] receiver_node_id, byte[] payment_hash, long onion_fields, long amount_msat, long counterparty_skimmed_fee_msat, long purpose, long via_channel_id, long via_user_channel_id, long claim_deadline); // struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat); public static native long Event_payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, long purpose, long[] htlcs, long sender_intended_total_msat); + // struct LDKEvent Event_invoice_request_failed(struct LDKThirtyTwoBytes payment_id); + public static native long Event_invoice_request_failed(byte[] payment_id); // struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); public static native long Event_payment_sent(long payment_id, byte[] payment_preimage, byte[] payment_hash, long fee_paid_msat); // struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_PaymentFailureReasonZ reason); @@ -12119,38 +12341,10 @@ public class bindings { public static native long MessageSendEvent_send_gossip_timestamp_filter(byte[] node_id, long msg); // void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); public static native void MessageSendEventsProvider_free(long this_ptr); - // void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr); - public static native void OnionMessageProvider_free(long this_ptr); // void EventsProvider_free(struct LDKEventsProvider this_ptr); public static native void EventsProvider_free(long this_ptr); // void EventHandler_free(struct LDKEventHandler this_ptr); public static native void EventHandler_free(long this_ptr); - // void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); - public static native void ChannelDerivationParameters_free(long this_obj); - // uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); - public static native long ChannelDerivationParameters_get_value_satoshis(long this_ptr); - // void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); - public static native void ChannelDerivationParameters_set_value_satoshis(long this_ptr, long val); - // const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; - public static native byte[] ChannelDerivationParameters_get_keys_id(long this_ptr); - // void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - public static native void ChannelDerivationParameters_set_keys_id(long this_ptr, byte[] val); - // struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); - public static native long ChannelDerivationParameters_get_transaction_parameters(long this_ptr); - // void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); - public static native void ChannelDerivationParameters_set_transaction_parameters(long this_ptr, long val); - // MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); - public static native long ChannelDerivationParameters_new(long value_satoshis_arg, byte[] keys_id_arg, long transaction_parameters_arg); - // uint64_t ChannelDerivationParameters_clone_ptr(LDKChannelDerivationParameters *NONNULL_PTR arg); - public static native long ChannelDerivationParameters_clone_ptr(long arg); - // struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); - public static native long ChannelDerivationParameters_clone(long orig); - // bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); - public static native boolean ChannelDerivationParameters_eq(long a, long b); - // struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); - public static native byte[] ChannelDerivationParameters_write(long obj); - // struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); - public static native long ChannelDerivationParameters_read(byte[] ser); // void AnchorDescriptor_free(struct LDKAnchorDescriptor this_obj); public static native void AnchorDescriptor_free(long this_obj); // struct LDKChannelDerivationParameters AnchorDescriptor_get_channel_derivation_parameters(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); @@ -12179,56 +12373,6 @@ public class bindings { public static native byte[] AnchorDescriptor_tx_input_witness(long this_arg, byte[] signature); // MUST_USE_RES struct LDKWriteableEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); public static native long AnchorDescriptor_derive_channel_signer(long this_arg, long signer_provider); - // void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); - public static native void HTLCDescriptor_free(long this_obj); - // struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - public static native long HTLCDescriptor_get_channel_derivation_parameters(long this_ptr); - // void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); - public static native void HTLCDescriptor_set_channel_derivation_parameters(long this_ptr, long val); - // uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - public static native long HTLCDescriptor_get_per_commitment_number(long this_ptr); - // void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); - public static native void HTLCDescriptor_set_per_commitment_number(long this_ptr, long val); - // struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - public static native byte[] HTLCDescriptor_get_per_commitment_point(long this_ptr); - // void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void HTLCDescriptor_set_per_commitment_point(long this_ptr, byte[] val); - // struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - public static native long HTLCDescriptor_get_htlc(long this_ptr); - // void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); - public static native void HTLCDescriptor_set_htlc(long this_ptr, long val); - // struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - public static native long HTLCDescriptor_get_preimage(long this_ptr); - // void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); - public static native void HTLCDescriptor_set_preimage(long this_ptr, long val); - // struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); - public static native byte[] HTLCDescriptor_get_counterparty_sig(long this_ptr); - // void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); - public static native void HTLCDescriptor_set_counterparty_sig(long this_ptr, byte[] val); - // uint64_t HTLCDescriptor_clone_ptr(LDKHTLCDescriptor *NONNULL_PTR arg); - public static native long HTLCDescriptor_clone_ptr(long arg); - // struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); - public static native long HTLCDescriptor_clone(long orig); - // bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); - public static native boolean HTLCDescriptor_eq(long a, long b); - // struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); - public static native byte[] HTLCDescriptor_write(long obj); - // struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); - public static native long HTLCDescriptor_read(byte[] ser); - // MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - public static native long HTLCDescriptor_outpoint(long this_arg); - // MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - public static native long HTLCDescriptor_previous_utxo(long this_arg); - // MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - public static native long HTLCDescriptor_unsigned_tx_input(long this_arg); - // MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - public static native long HTLCDescriptor_tx_output(long this_arg); - // MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); - public static native byte[] HTLCDescriptor_witness_script(long this_arg); - // MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); - public static native byte[] HTLCDescriptor_tx_input_witness(long this_arg, byte[] signature, byte[] witness_script); - // MUST_USE_RES struct LDKWriteableEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); - public static native long HTLCDescriptor_derive_channel_signer(long this_arg, long signer_provider); // void BumpTransactionEvent_free(struct LDKBumpTransactionEvent this_ptr); public static native void BumpTransactionEvent_free(long this_ptr); // uint64_t BumpTransactionEvent_clone_ptr(LDKBumpTransactionEvent *NONNULL_PTR arg); diff --git a/src/main/java/org/ldk/structs/BlindedPath.java b/src/main/java/org/ldk/structs/BlindedPath.java index 5b91ed00..fcf11431 100644 --- a/src/main/java/org/ldk/structs/BlindedPath.java +++ b/src/main/java/org/ldk/structs/BlindedPath.java @@ -160,11 +160,24 @@ public class BlindedPath extends CommonBase { if (!(o instanceof BlindedPath)) return false; return this.eq((BlindedPath)o); } + /** + * Create a one-hop blinded path for a message. + */ + public static Result_BlindedPathNoneZ one_hop_for_message(byte[] recipient_node_id, org.ldk.structs.EntropySource entropy_source) { + long ret = bindings.BlindedPath_one_hop_for_message(InternalUtils.check_arr_len(recipient_node_id, 33), entropy_source.ptr); + Reference.reachabilityFence(recipient_node_id); + Reference.reachabilityFence(entropy_source); + if (ret >= 0 && ret <= 4096) { return null; } + Result_BlindedPathNoneZ ret_hu_conv = Result_BlindedPathNoneZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; + return ret_hu_conv; + } + /** * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node * pubkey in `node_pks` will be the destination node. * - * Errors if less than two hops are provided or if `node_pk`(s) are invalid. + * Errors if no hops are provided or if `node_pk`(s) are invalid. */ public static Result_BlindedPathNoneZ new_for_message(byte[][] node_pks, org.ldk.structs.EntropySource entropy_source) { long ret = bindings.BlindedPath_new_for_message(node_pks != null ? Arrays.stream(node_pks).map(node_pks_conv_8 -> InternalUtils.check_arr_len(node_pks_conv_8, 33)).toArray(byte[][]::new) : null, entropy_source.ptr); diff --git a/src/main/java/org/ldk/structs/BumpTransactionEvent.java b/src/main/java/org/ldk/structs/BumpTransactionEvent.java index 283de3d5..dde3b289 100644 --- a/src/main/java/org/ldk/structs/BumpTransactionEvent.java +++ b/src/main/java/org/ldk/structs/BumpTransactionEvent.java @@ -158,7 +158,6 @@ public class BumpTransactionEvent extends CommonBase { * * [`EcdsaChannelSigner`]: crate::sign::EcdsaChannelSigner * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::EcdsaChannelSigner::sign_holder_htlc_transaction - * [`HTLCDescriptor::tx_input_witness`]: HTLCDescriptor::tx_input_witness */ public final static class HTLCResolution extends BumpTransactionEvent { /** diff --git a/src/main/java/org/ldk/structs/ChannelConfig.java b/src/main/java/org/ldk/structs/ChannelConfig.java index a62a8795..59018887 100644 --- a/src/main/java/org/ldk/structs/ChannelConfig.java +++ b/src/main/java/org/ldk/structs/ChannelConfig.java @@ -214,20 +214,20 @@ public class ChannelConfig extends CommonBase { * funder/initiator. * * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by + * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`Normal`] feerate during normal operation, this value represents the additional fee we're + * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our * funds. * * When we are not the funder, we require the closing transaction fee pay at least our - * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. + * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. * Thus, this value is ignored when we are not the funder. * * Default value: 1000 satoshis. * - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ public long get_force_close_avoidance_max_fee_satoshis() { long ret = bindings.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this.ptr); @@ -244,20 +244,20 @@ public class ChannelConfig extends CommonBase { * funder/initiator. * * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by + * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`Normal`] feerate during normal operation, this value represents the additional fee we're + * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our * funds. * * When we are not the funder, we require the closing transaction fee pay at least our - * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like. + * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. * Thus, this value is ignored when we are not the funder. * * Default value: 1000 satoshis. * - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ public void set_force_close_avoidance_max_fee_satoshis(long val) { bindings.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/ChannelDerivationParameters.java b/src/main/java/org/ldk/structs/ChannelDerivationParameters.java index d4407a52..8aba6e0d 100644 --- a/src/main/java/org/ldk/structs/ChannelDerivationParameters.java +++ b/src/main/java/org/ldk/structs/ChannelDerivationParameters.java @@ -59,8 +59,6 @@ public class ChannelDerivationParameters extends CommonBase { /** * The necessary channel parameters that need to be provided to the re-derived signer through * [`ChannelSigner::provide_channel_parameters`]. - * - * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters */ public ChannelTransactionParameters get_transaction_parameters() { long ret = bindings.ChannelDerivationParameters_get_transaction_parameters(this.ptr); @@ -74,8 +72,6 @@ public class ChannelDerivationParameters extends CommonBase { /** * The necessary channel parameters that need to be provided to the re-derived signer through * [`ChannelSigner::provide_channel_parameters`]. - * - * [`ChannelSigner::provide_channel_parameters`]: crate::sign::ChannelSigner::provide_channel_parameters */ public void set_transaction_parameters(org.ldk.structs.ChannelTransactionParameters val) { bindings.ChannelDerivationParameters_set_transaction_parameters(this.ptr, val == null ? 0 : val.ptr); diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index 6be766d4..08381445 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -267,11 +267,11 @@ public class ChannelManager extends CommonBase { * will be accepted on the given channel, and after additional timeout/the closing of all * pending HTLCs, the channel will be closed on chain. * - * If we are the channel initiator, we will pay between our [`Background`] and - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee - * estimate. + * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate. * If our counterparty is the channel initiator, we will require a channel closing - * transaction feerate of at least our [`Background`] feerate or the feerate which + * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which * would appear on a force-closure transaction, whichever is lower. We will allow our * counterparty to pay as much fee as they'd like, however. * @@ -283,8 +283,8 @@ public class ChannelManager extends CommonBase { * channel. * * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown */ public Result_NoneAPIErrorZ close_channel(byte[] channel_id, byte[] counterparty_node_id) { @@ -306,8 +306,8 @@ public class ChannelManager extends CommonBase { * the channel being closed or not: * If we are the channel initiator, we will pay at least this feerate on the closing * transaction. The upper-bound is set by - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee - * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). * If our counterparty is the channel initiator, we will refuse to accept a channel closure * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which * will appear on a force-closure transaction, whichever is lower). @@ -325,8 +325,7 @@ public class ChannelManager extends CommonBase { * channel. * * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background - * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown * * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -498,10 +497,20 @@ public class ChannelManager extends CommonBase { * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to * determine the ultimate status of a payment. * + * # Requested Invoices + * + * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning + * the payment prior to receiving the invoice will result in an [`Event::InvoiceRequestFailed`] + * and prevent any attempts at paying it once received. The other events may only be generated + * once the invoice has been received. + * * # Restart Behavior * * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the - * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated. + * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated; likewise for + * [`Event::InvoiceRequestFailed`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ public void abandon_payment(byte[] payment_id) { bindings.ChannelManager_abandon_payment(this.ptr, InternalUtils.check_arr_len(payment_id, 32)); @@ -842,6 +851,10 @@ public class ChannelManager extends CommonBase { * with the current [`ChannelConfig`]. * Removing peers which have disconnected but and no longer have any channels. * Force-closing and removing channels which have not completed establishment in a timely manner. + * Forgetting about stale outbound payments, either those that have already been fulfilled + * or those awaiting an invoice that hasn't been delivered in the necessary amount of time. + * The latter is determined using the system clock in `std` and the highest seen block time + * minus two hours in `no-std`. * * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate * estimate fetches. @@ -1007,6 +1020,106 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + /** + * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and + * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual + * [`Bolt12Invoice`] once it is received. + * + * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by + * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. + * The optional parameters are used in the builder, if `Some`: + * - `quantity` for [`InvoiceRequest::quantity`] which must be set if + * [`Offer::expects_quantity`] is `true`. + * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and + * - `payer_note` for [`InvoiceRequest::payer_note`]. + * + * If `max_total_routing_fee_msat` is not specified, The default from + * [`RouteParameters::from_payment_params_and_value`] is applied. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the request + * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has + * been sent. + * + * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the + * payment will fail with an [`Event::InvoiceRequestFailed`]. + * + * # Privacy + * + * Uses a one-hop [`BlindedPath`] for the reply path with [`ChannelManager::get_our_node_id`] + * as the introduction node and a derived payer id for payer privacy. As such, currently, the + * node must be announced. Otherwise, there is no way to find a path to the introduction node + * in order to send the [`Bolt12Invoice`]. + * + * # Limitations + * + * Requires a direct connection to an introduction node in [`Offer::paths`] or to + * [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding + * [`Bolt12Invoice::payment_paths`]. + * + * # Errors + * + * Errors if a duplicate `payment_id` is provided given the caveats in the aforementioned link + * or if the provided parameters are invalid for the offer. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity + * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note + * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + */ + public Result_NoneBolt12SemanticErrorZ pay_for_offer(org.ldk.structs.Offer offer, org.ldk.structs.Option_u64Z quantity, org.ldk.structs.Option_u64Z amount_msats, org.ldk.structs.Option_StrZ payer_note, byte[] payment_id, org.ldk.structs.Retry retry_strategy, org.ldk.structs.Option_u64Z max_total_routing_fee_msat) { + long ret = bindings.ChannelManager_pay_for_offer(this.ptr, offer == null ? 0 : offer.ptr, quantity.ptr, amount_msats.ptr, payer_note.ptr, InternalUtils.check_arr_len(payment_id, 32), retry_strategy.ptr, max_total_routing_fee_msat.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(offer); + Reference.reachabilityFence(quantity); + Reference.reachabilityFence(amount_msats); + Reference.reachabilityFence(payer_note); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(retry_strategy); + Reference.reachabilityFence(max_total_routing_fee_msat); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(offer); }; + if (this != null) { this.ptrs_to.add(quantity); }; + if (this != null) { this.ptrs_to.add(amount_msats); }; + if (this != null) { this.ptrs_to.add(payer_note); }; + if (this != null) { this.ptrs_to.add(retry_strategy); }; + if (this != null) { this.ptrs_to.add(max_total_routing_fee_msat); }; + return ret_hu_conv; + } + + /** + * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion + * message. + * + * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a + * [`BlindedPath`] containing the [`PaymentSecret`] needed to reconstruct the corresponding + * [`PaymentPreimage`]. + * + * # Limitations + * + * Requires a direct connection to an introduction node in [`Refund::paths`] or to + * [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each + * node meeting the aforementioned criteria, but there's no guarantee that they will be + * received and no retries will be made. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ + public Result_NoneBolt12SemanticErrorZ request_refund_payment(org.ldk.structs.Refund refund) { + long ret = bindings.ChannelManager_request_refund_payment(this.ptr, refund == null ? 0 : refund.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(refund); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(refund); }; + return ret_hu_conv; + } + /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing * to pay us. @@ -1279,7 +1392,7 @@ public class ChannelManager extends CommonBase { } /** - * Fetches the set of [`NodeFeatures`] flags which are provided by or required by + * Fetches the set of [`NodeFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ public NodeFeatures node_features() { @@ -1292,7 +1405,7 @@ public class ChannelManager extends CommonBase { } /** - * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by + * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ public ChannelFeatures channel_features() { @@ -1305,7 +1418,7 @@ public class ChannelManager extends CommonBase { } /** - * Fetches the set of [`ChannelTypeFeatures`] flags which are provided by or required by + * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ public ChannelTypeFeatures channel_type_features() { @@ -1318,7 +1431,7 @@ public class ChannelManager extends CommonBase { } /** - * Fetches the set of [`InitFeatures`] flags which are provided by or required by + * Fetches the set of [`InitFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ public InitFeatures init_features() { @@ -1343,6 +1456,19 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + /** + * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is + */ + public OffersMessageHandler as_OffersMessageHandler() { + long ret = bindings.ChannelManager_as_OffersMessageHandler(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + OffersMessageHandler ret_hu_conv = new OffersMessageHandler(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + /** * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read */ diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java index d7b6b2cc..20173f72 100644 --- a/src/main/java/org/ldk/structs/ChannelMessageHandler.java +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -184,12 +184,12 @@ public class ChannelMessageHandler extends CommonBase { */ InitFeatures provided_init_features(byte[] their_node_id); /** - * Gets the genesis hashes for this `ChannelMessageHandler` indicating which chains it supports. + * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. * * If it's `None`, then no particular network chain hash compatibility will be enforced when * connecting to peers. */ - Option_CVec_ThirtyTwoBytesZZ get_genesis_hashes(); + Option_CVec_ThirtyTwoBytesZZ get_chain_hashes(); } private static class LDKChannelMessageHandlerHolder { ChannelMessageHandler held; } public static ChannelMessageHandler new_impl(ChannelMessageHandlerInterface arg, MessageSendEventsProvider.MessageSendEventsProviderInterface MessageSendEventsProvider_impl) { @@ -363,8 +363,8 @@ public class ChannelMessageHandler extends CommonBase { long result = ret == null ? 0 : ret.clone_ptr(); return result; } - @Override public long get_genesis_hashes() { - Option_CVec_ThirtyTwoBytesZZ ret = arg.get_genesis_hashes(); + @Override public long get_chain_hashes() { + Option_CVec_ThirtyTwoBytesZZ ret = arg.get_chain_hashes(); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; @@ -762,13 +762,13 @@ public class ChannelMessageHandler extends CommonBase { } /** - * Gets the genesis hashes for this `ChannelMessageHandler` indicating which chains it supports. + * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. * * If it's `None`, then no particular network chain hash compatibility will be enforced when * connecting to peers. */ - public Option_CVec_ThirtyTwoBytesZZ get_genesis_hashes() { - long ret = bindings.ChannelMessageHandler_get_genesis_hashes(this.ptr); + public Option_CVec_ThirtyTwoBytesZZ get_chain_hashes() { + long ret = bindings.ChannelMessageHandler_get_chain_hashes(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ ret_hu_conv = org.ldk.structs.Option_CVec_ThirtyTwoBytesZZ.constr_from_ptr(ret); diff --git a/src/main/java/org/ldk/structs/CommitmentTransaction.java b/src/main/java/org/ldk/structs/CommitmentTransaction.java index 63910b51..9c1a693b 100644 --- a/src/main/java/org/ldk/structs/CommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/CommitmentTransaction.java @@ -72,6 +72,15 @@ public class CommitmentTransaction extends CommonBase { return ret; } + /** + * The per commitment point used by the broadcaster. + */ + public byte[] per_commitment_point() { + byte[] ret = bindings.CommitmentTransaction_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * The value to be sent to the broadcaster */ diff --git a/src/main/java/org/ldk/structs/CustomOnionMessageContents.java b/src/main/java/org/ldk/structs/CustomOnionMessageContents.java deleted file mode 100644 index de9e7ae0..00000000 --- a/src/main/java/org/ldk/structs/CustomOnionMessageContents.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import java.lang.ref.Reference; -import javax.annotation.Nullable; - -/** - * The contents of a custom onion message. - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class CustomOnionMessageContents extends CommonBase { - final bindings.LDKCustomOnionMessageContents bindings_instance; - CustomOnionMessageContents(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private CustomOnionMessageContents(bindings.LDKCustomOnionMessageContents arg) { - super(bindings.LDKCustomOnionMessageContents_new(arg)); - this.ptrs_to.add(arg); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CustomOnionMessageContents_free(ptr); } super.finalize(); - } - /** - * Destroys the object, freeing associated resources. After this call, any access - * to this object may result in a SEGFAULT or worse. - * - * You should generally NEVER call this method. You should let the garbage collector - * do this for you when it finalizes objects. However, it may be useful for types - * which represent locks and should be closed immediately to avoid holding locks - * until the GC runs. - */ - public void destroy() { - if (ptr != 0) { bindings.CustomOnionMessageContents_free(ptr); } - ptr = 0; - } - public static interface CustomOnionMessageContentsInterface { - /** - * Returns the TLV type identifying the message contents. MUST be >= 64. - */ - long tlv_type(); - /** - * Serialize the object into a byte array - */ - byte[] write(); - } - private static class LDKCustomOnionMessageContentsHolder { CustomOnionMessageContents held; } - public static CustomOnionMessageContents new_impl(CustomOnionMessageContentsInterface arg) { - final LDKCustomOnionMessageContentsHolder impl_holder = new LDKCustomOnionMessageContentsHolder(); - impl_holder.held = new CustomOnionMessageContents(new bindings.LDKCustomOnionMessageContents() { - @Override public long tlv_type() { - long ret = arg.tlv_type(); - Reference.reachabilityFence(arg); - return ret; - } - @Override public byte[] write() { - byte[] ret = arg.write(); - Reference.reachabilityFence(arg); - return ret; - } - }); - return impl_holder.held; - } - /** - * Returns the TLV type identifying the message contents. MUST be >= 64. - */ - public long tlv_type() { - long ret = bindings.CustomOnionMessageContents_tlv_type(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Serialize the object into a byte array - */ - public byte[] write() { - byte[] ret = bindings.CustomOnionMessageContents_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CustomOnionMessageContents_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a copy of a CustomOnionMessageContents - */ - public CustomOnionMessageContents clone() { - long ret = bindings.CustomOnionMessageContents_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - CustomOnionMessageContents ret_hu_conv = new CustomOnionMessageContents(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java b/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java index 77ea3306..4c52481f 100644 --- a/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java +++ b/src/main/java/org/ldk/structs/CustomOnionMessageHandler.java @@ -48,45 +48,62 @@ public class CustomOnionMessageHandler extends CommonBase { public static interface CustomOnionMessageHandlerInterface { /** * Called with the custom message that was received, returning a response to send, if any. + * + * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. */ - Option_CustomOnionMessageContentsZ handle_custom_message(CustomOnionMessageContents msg); + Option_OnionMessageContentsZ handle_custom_message(OnionMessageContents msg); /** * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the * message type is unknown. */ - Result_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message(long message_type, byte[] buffer); + Result_COption_OnionMessageContentsZDecodeErrorZ read_custom_message(long message_type, byte[] buffer); + /** + * Releases any [`Self::CustomMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a message flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_custom_message`]. + */ + ThreeTuple_OnionMessageContentsDestinationBlindedPathZ[] release_pending_custom_messages(); } private static class LDKCustomOnionMessageHandlerHolder { CustomOnionMessageHandler held; } public static CustomOnionMessageHandler new_impl(CustomOnionMessageHandlerInterface arg) { final LDKCustomOnionMessageHandlerHolder impl_holder = new LDKCustomOnionMessageHandlerHolder(); impl_holder.held = new CustomOnionMessageHandler(new bindings.LDKCustomOnionMessageHandler() { @Override public long handle_custom_message(long msg) { - CustomOnionMessageContents ret_hu_conv = new CustomOnionMessageContents(null, msg); + OnionMessageContents ret_hu_conv = new OnionMessageContents(null, msg); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - Option_CustomOnionMessageContentsZ ret = arg.handle_custom_message(ret_hu_conv); + Option_OnionMessageContentsZ ret = arg.handle_custom_message(ret_hu_conv); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; return result; } @Override public long read_custom_message(long message_type, byte[] buffer) { - Result_COption_CustomOnionMessageContentsZDecodeErrorZ ret = arg.read_custom_message(message_type, buffer); + Result_COption_OnionMessageContentsZDecodeErrorZ ret = arg.read_custom_message(message_type, buffer); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; } + @Override public long[] release_pending_custom_messages() { + ThreeTuple_OnionMessageContentsDestinationBlindedPathZ[] ret = arg.release_pending_custom_messages(); + Reference.reachabilityFence(arg); + long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_56 -> ret_conv_56 == null ? 0 : ret_conv_56.clone_ptr()).toArray() : null; + return result; + } }); return impl_holder.held; } /** * Called with the custom message that was received, returning a response to send, if any. + * + * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. */ - public Option_CustomOnionMessageContentsZ handle_custom_message(org.ldk.structs.CustomOnionMessageContents msg) { + public Option_OnionMessageContentsZ handle_custom_message(org.ldk.structs.OnionMessageContents msg) { long ret = bindings.CustomOnionMessageHandler_handle_custom_message(this.ptr, msg.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_CustomOnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_CustomOnionMessageContentsZ.constr_from_ptr(ret); + org.ldk.structs.Option_OnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_OnionMessageContentsZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; if (this != null) { this.ptrs_to.add(msg); }; return ret_hu_conv; @@ -96,14 +113,34 @@ public class CustomOnionMessageHandler extends CommonBase { * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the * message type is unknown. */ - public Result_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message(long message_type, byte[] buffer) { + public Result_COption_OnionMessageContentsZDecodeErrorZ read_custom_message(long message_type, byte[] buffer) { long ret = bindings.CustomOnionMessageHandler_read_custom_message(this.ptr, message_type, buffer); Reference.reachabilityFence(this); Reference.reachabilityFence(message_type); Reference.reachabilityFence(buffer); if (ret >= 0 && ret <= 4096) { return null; } - Result_COption_CustomOnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_CustomOnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); + Result_COption_OnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_OnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } + /** + * Releases any [`Self::CustomMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a message flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_custom_message`]. + */ + public ThreeTuple_OnionMessageContentsDestinationBlindedPathZ[] release_pending_custom_messages() { + long[] ret = bindings.CustomOnionMessageHandler_release_pending_custom_messages(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_56_len = ret.length; + ThreeTuple_OnionMessageContentsDestinationBlindedPathZ[] ret_conv_56_arr = new ThreeTuple_OnionMessageContentsDestinationBlindedPathZ[ret_conv_56_len]; + for (int e = 0; e < ret_conv_56_len; e++) { + long ret_conv_56 = ret[e]; + ThreeTuple_OnionMessageContentsDestinationBlindedPathZ ret_conv_56_hu_conv = new ThreeTuple_OnionMessageContentsDestinationBlindedPathZ(null, ret_conv_56); + if (ret_conv_56_hu_conv != null) { ret_conv_56_hu_conv.ptrs_to.add(this); }; + ret_conv_56_arr[e] = ret_conv_56_hu_conv; + } + return ret_conv_56_arr; + } + } diff --git a/src/main/java/org/ldk/structs/DefaultMessageRouter.java b/src/main/java/org/ldk/structs/DefaultMessageRouter.java index e8de7306..0e0b04e0 100644 --- a/src/main/java/org/ldk/structs/DefaultMessageRouter.java +++ b/src/main/java/org/ldk/structs/DefaultMessageRouter.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * A [`MessageRouter`] that always fails. + * A [`MessageRouter`] that can only route to a directly connected [`Destination`]. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class DefaultMessageRouter extends CommonBase { diff --git a/src/main/java/org/ldk/structs/EcdsaChannelSigner.java b/src/main/java/org/ldk/structs/EcdsaChannelSigner.java index 6b238aad..dd1722a8 100644 --- a/src/main/java/org/ldk/structs/EcdsaChannelSigner.java +++ b/src/main/java/org/ldk/structs/EcdsaChannelSigner.java @@ -68,23 +68,17 @@ public class EcdsaChannelSigner extends CommonBase { */ Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret); /** - * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * Creates a signature for a holder's commitment transaction. * * This will be called * - with a non-revoked `commitment_tx`. * - with the latest `commitment_tx` when we initiate a force-close. - * - with the previous `commitment_tx`, just to get claiming HTLC - * signatures, if we are reacting to a [`ChannelMonitor`] - * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) - * that decided to broadcast before it had been updated to the latest `commitment_tx`. * * This may be called multiple times for the same transaction. * * An external signer implementation should check that the commitment has not been revoked. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ - Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx); + Result_ECDSASignatureNoneZ sign_holder_commitment(HolderCommitmentTransaction commitment_tx); /** * Create a signature for the given input in a transaction spending an HTLC transaction output * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. @@ -126,11 +120,14 @@ public class EcdsaChannelSigner extends CommonBase { /** * Computes the signature for a commitment transaction's HTLC output used as an input within * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned - * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to - * sign HTLC transactions from channels supporting anchor outputs after all additional - * inputs/outputs have been added to the transaction. + * must be be computed using [`EcdsaSighashType::All`]. + * + * Note that this may be called for HTLCs in the penultimate commitment transaction if a + * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * broadcasts it before receiving the update for the latest commitment transaction. * * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, HTLCDescriptor htlc_descriptor); /** @@ -195,9 +192,9 @@ public class EcdsaChannelSigner extends CommonBase { long result = ret == null ? 0 : ret.clone_ptr(); return result; } - @Override public long sign_holder_commitment_and_htlcs(long commitment_tx) { + @Override public long sign_holder_commitment(long commitment_tx) { org.ldk.structs.HolderCommitmentTransaction commitment_tx_hu_conv = null; if (commitment_tx < 0 || commitment_tx > 4096) { commitment_tx_hu_conv = new org.ldk.structs.HolderCommitmentTransaction(null, commitment_tx); } - Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv); + Result_ECDSASignatureNoneZ ret = arg.sign_holder_commitment(commitment_tx_hu_conv); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); return result; @@ -305,28 +302,22 @@ public class EcdsaChannelSigner extends CommonBase { } /** - * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * Creates a signature for a holder's commitment transaction. * * This will be called * - with a non-revoked `commitment_tx`. * - with the latest `commitment_tx` when we initiate a force-close. - * - with the previous `commitment_tx`, just to get claiming HTLC - * signatures, if we are reacting to a [`ChannelMonitor`] - * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) - * that decided to broadcast before it had been updated to the latest `commitment_tx`. * * This may be called multiple times for the same transaction. * * An external signer implementation should check that the commitment has not been revoked. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ - public Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_holder_commitment_and_htlcs(org.ldk.structs.HolderCommitmentTransaction commitment_tx) { - long ret = bindings.EcdsaChannelSigner_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr); + public Result_ECDSASignatureNoneZ sign_holder_commitment(org.ldk.structs.HolderCommitmentTransaction commitment_tx) { + long ret = bindings.EcdsaChannelSigner_sign_holder_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(commitment_tx); if (ret >= 0 && ret <= 4096) { return null; } - Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret_hu_conv = Result_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ.constr_from_ptr(ret); + Result_ECDSASignatureNoneZ ret_hu_conv = Result_ECDSASignatureNoneZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(commitment_tx); }; return ret_hu_conv; } @@ -396,11 +387,14 @@ public class EcdsaChannelSigner extends CommonBase { /** * Computes the signature for a commitment transaction's HTLC output used as an input within * `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned - * must be be computed using [`EcdsaSighashType::All`]. Note that this should only be used to - * sign HTLC transactions from channels supporting anchor outputs after all additional - * inputs/outputs have been added to the transaction. + * must be be computed using [`EcdsaSighashType::All`]. + * + * Note that this may be called for HTLCs in the penultimate commitment transaction if a + * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * broadcasts it before receiving the update for the latest commitment transaction. * * [`EcdsaSighashType::All`]: bitcoin::blockdata::transaction::EcdsaSighashType::All + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ public Result_ECDSASignatureNoneZ sign_holder_htlc_transaction(byte[] htlc_tx, long input, org.ldk.structs.HTLCDescriptor htlc_descriptor) { long ret = bindings.EcdsaChannelSigner_sign_holder_htlc_transaction(this.ptr, htlc_tx, input, htlc_descriptor == null ? 0 : htlc_descriptor.ptr); diff --git a/src/main/java/org/ldk/structs/Event.java b/src/main/java/org/ldk/structs/Event.java index 90a5fecf..2862a7fe 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -34,6 +34,9 @@ public class Event extends CommonBase { if (raw_val.getClass() == bindings.LDKEvent.PaymentClaimed.class) { return new PaymentClaimed(ptr, (bindings.LDKEvent.PaymentClaimed)raw_val); } + if (raw_val.getClass() == bindings.LDKEvent.InvoiceRequestFailed.class) { + return new InvoiceRequestFailed(ptr, (bindings.LDKEvent.InvoiceRequestFailed)raw_val); + } if (raw_val.getClass() == bindings.LDKEvent.PaymentSent.class) { return new PaymentSent(ptr, (bindings.LDKEvent.PaymentSent)raw_val); } @@ -358,6 +361,26 @@ public class Event extends CommonBase { this.sender_intended_total_msat = sender_intended_total_msat_hu_conv; } } + /** + * Indicates a request for an invoice failed to yield a response in a reasonable amount of time + * or was explicitly abandoned by [`ChannelManager::abandon_payment`]. This may be for an + * [`InvoiceRequest`] sent for an [`Offer`] or for a [`Refund`] that hasn't been redeemed. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Offer`]: crate::offers::offer::Offer + * [`Refund`]: crate::offers::refund::Refund + */ + public final static class InvoiceRequestFailed extends Event { + /** + * The `payment_id` to have been associated with payment for the requested invoice. + */ + public final byte[] payment_id; + private InvoiceRequestFailed(long ptr, bindings.LDKEvent.InvoiceRequestFailed obj) { + super(null, ptr); + this.payment_id = obj.payment_id; + } + } /** * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target * and we got back the payment preimage for it). @@ -1206,6 +1229,18 @@ public class Event extends CommonBase { return ret_hu_conv; } + /** + * Utility method to constructs a new InvoiceRequestFailed-variant Event + */ + public static Event invoice_request_failed(byte[] payment_id) { + long ret = bindings.Event_invoice_request_failed(InternalUtils.check_arr_len(payment_id, 32)); + Reference.reachabilityFence(payment_id); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + /** * Utility method to constructs a new PaymentSent-variant Event */ diff --git a/src/main/java/org/ldk/structs/HTLCDescriptor.java b/src/main/java/org/ldk/structs/HTLCDescriptor.java index 50fddf0c..b80c2dce 100644 --- a/src/main/java/org/ldk/structs/HTLCDescriptor.java +++ b/src/main/java/org/ldk/structs/HTLCDescriptor.java @@ -86,6 +86,28 @@ public class HTLCDescriptor extends CommonBase { Reference.reachabilityFence(val); } + /** + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. + */ + public int get_feerate_per_kw() { + int ret = bindings.HTLCDescriptor_get_feerate_per_kw(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. + */ + public void set_feerate_per_kw(int val) { + bindings.HTLCDescriptor_set_feerate_per_kw(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * The details of the HTLC as it appears in the commitment transaction. */ diff --git a/src/main/java/org/ldk/structs/IgnoringMessageHandler.java b/src/main/java/org/ldk/structs/IgnoringMessageHandler.java index 48bee598..79ac5a9f 100644 --- a/src/main/java/org/ldk/structs/IgnoringMessageHandler.java +++ b/src/main/java/org/ldk/structs/IgnoringMessageHandler.java @@ -58,19 +58,6 @@ public class IgnoringMessageHandler extends CommonBase { return ret_hu_conv; } - /** - * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is - */ - public OnionMessageProvider as_OnionMessageProvider() { - long ret = bindings.IgnoringMessageHandler_as_OnionMessageProvider(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - OnionMessageProvider ret_hu_conv = new OnionMessageProvider(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - /** * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is diff --git a/src/main/java/org/ldk/structs/InvoiceError.java b/src/main/java/org/ldk/structs/InvoiceError.java index 0ac16f01..658186fe 100644 --- a/src/main/java/org/ldk/structs/InvoiceError.java +++ b/src/main/java/org/ldk/structs/InvoiceError.java @@ -113,6 +113,18 @@ public class InvoiceError extends CommonBase { return ret_hu_conv; } + /** + * Creates an [`InvoiceError`] with the given message. + */ + public static InvoiceError from_string(java.lang.String s) { + long ret = bindings.InvoiceError_from_string(s); + Reference.reachabilityFence(s); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.InvoiceError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceError(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + /** * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read */ diff --git a/src/main/java/org/ldk/structs/MessageRouter.java b/src/main/java/org/ldk/structs/MessageRouter.java index 82be8420..95bd4379 100644 --- a/src/main/java/org/ldk/structs/MessageRouter.java +++ b/src/main/java/org/ldk/structs/MessageRouter.java @@ -9,8 +9,6 @@ import javax.annotation.Nullable; /** * A trait defining behavior for routing an [`OnionMessage`]. - * - * [`OnionMessage`]: msgs::OnionMessage */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class MessageRouter extends CommonBase { @@ -41,8 +39,6 @@ public class MessageRouter extends CommonBase { public static interface MessageRouterInterface { /** * Returns a route for sending an [`OnionMessage`] to the given [`Destination`]. - * - * [`OnionMessage`]: msgs::OnionMessage */ Result_OnionMessagePathNoneZ find_path(byte[] sender, byte[][] peers, Destination destination); } @@ -63,8 +59,6 @@ public class MessageRouter extends CommonBase { } /** * Returns a route for sending an [`OnionMessage`] to the given [`Destination`]. - * - * [`OnionMessage`]: msgs::OnionMessage */ public Result_OnionMessagePathNoneZ find_path(byte[] sender, byte[][] peers, org.ldk.structs.Destination destination) { long ret = bindings.MessageRouter_find_path(this.ptr, InternalUtils.check_arr_len(sender, 33), peers != null ? Arrays.stream(peers).map(peers_conv_8 -> InternalUtils.check_arr_len(peers_conv_8, 33)).toArray(byte[][]::new) : null, destination.ptr); diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java index cfa2eeaa..adb402ff 100644 --- a/src/main/java/org/ldk/structs/NetworkGraph.java +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -22,6 +22,8 @@ public class NetworkGraph extends CommonBase { /** * Handles any network updates originating from [`Event`]s. + * Note that this will skip applying any [`NetworkUpdate::ChannelUpdateMessage`] to avoid + * leaking possibly identifying information of the sender to the public network. * * [`Event`]: crate::events::Event */ @@ -32,10 +34,10 @@ public class NetworkGraph extends CommonBase { } /** - * Gets the genesis hash for this network graph. + * Gets the chain hash for this network graph. */ - public byte[] get_genesis_hash() { - byte[] ret = bindings.NetworkGraph_get_genesis_hash(this.ptr); + public byte[] get_chain_hash() { + byte[] ret = bindings.NetworkGraph_get_chain_hash(this.ptr); Reference.reachabilityFence(this); return ret; } @@ -297,8 +299,8 @@ public class NetworkGraph extends CommonBase { * For an already known (from announcement) channel, update info about one of the directions * of the channel. * - * You probably don't want to call this directly, instead relying on a P2PGossipSync's - * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s + * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. * * If built with `no-std`, any updates with a timestamp more than two weeks in the past or @@ -332,4 +334,22 @@ public class NetworkGraph extends CommonBase { return ret_hu_conv; } + /** + * For an already known (from announcement) channel, verify the given [`ChannelUpdate`]. + * + * This checks whether the update currently is applicable by [`Self::update_channel`]. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. + */ + public Result_NoneLightningErrorZ verify_channel_update(org.ldk.structs.ChannelUpdate msg) { + long ret = bindings.NetworkGraph_verify_channel_update(this.ptr, msg == null ? 0 : msg.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(msg); }; + return ret_hu_conv; + } + } diff --git a/src/main/java/org/ldk/structs/OffersMessage.java b/src/main/java/org/ldk/structs/OffersMessage.java index 3ce53ada..8bc75f56 100644 --- a/src/main/java/org/ldk/structs/OffersMessage.java +++ b/src/main/java/org/ldk/structs/OffersMessage.java @@ -135,15 +135,6 @@ public class OffersMessage extends CommonBase { return ret_hu_conv; } - /** - * The TLV record type for the message as used in an `onionmsg_tlv` TLV stream. - */ - public long tlv_type() { - long ret = bindings.OffersMessage_tlv_type(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - /** * Serialize the OffersMessage object into a byte array which can be read by OffersMessage_read */ diff --git a/src/main/java/org/ldk/structs/OffersMessageHandler.java b/src/main/java/org/ldk/structs/OffersMessageHandler.java index 9b5553eb..a0babba3 100644 --- a/src/main/java/org/ldk/structs/OffersMessageHandler.java +++ b/src/main/java/org/ldk/structs/OffersMessageHandler.java @@ -42,8 +42,19 @@ public class OffersMessageHandler extends CommonBase { /** * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, * or replying with an error. + * + * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * + * [`OnionMessenger`]: crate::onion_message::OnionMessenger */ Option_OffersMessageZ handle_message(OffersMessage message); + /** + * Releases any [`OffersMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a payment flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_message`]. + */ + ThreeTuple_OffersMessageDestinationBlindedPathZ[] release_pending_messages(); } private static class LDKOffersMessageHandlerHolder { OffersMessageHandler held; } public static OffersMessageHandler new_impl(OffersMessageHandlerInterface arg) { @@ -58,12 +69,22 @@ public class OffersMessageHandler extends CommonBase { if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; return result; } + @Override public long[] release_pending_messages() { + ThreeTuple_OffersMessageDestinationBlindedPathZ[] ret = arg.release_pending_messages(); + Reference.reachabilityFence(arg); + long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_49 -> ret_conv_49 == null ? 0 : ret_conv_49.clone_ptr()).toArray() : null; + return result; + } }); return impl_holder.held; } /** * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, * or replying with an error. + * + * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * + * [`OnionMessenger`]: crate::onion_message::OnionMessenger */ public Option_OffersMessageZ handle_message(org.ldk.structs.OffersMessage message) { long ret = bindings.OffersMessageHandler_handle_message(this.ptr, message.ptr); @@ -76,4 +97,24 @@ public class OffersMessageHandler extends CommonBase { return ret_hu_conv; } + /** + * Releases any [`OffersMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a payment flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_message`]. + */ + public ThreeTuple_OffersMessageDestinationBlindedPathZ[] release_pending_messages() { + long[] ret = bindings.OffersMessageHandler_release_pending_messages(this.ptr); + Reference.reachabilityFence(this); + int ret_conv_49_len = ret.length; + ThreeTuple_OffersMessageDestinationBlindedPathZ[] ret_conv_49_arr = new ThreeTuple_OffersMessageDestinationBlindedPathZ[ret_conv_49_len]; + for (int x = 0; x < ret_conv_49_len; x++) { + long ret_conv_49 = ret[x]; + ThreeTuple_OffersMessageDestinationBlindedPathZ ret_conv_49_hu_conv = new ThreeTuple_OffersMessageDestinationBlindedPathZ(null, ret_conv_49); + if (ret_conv_49_hu_conv != null) { ret_conv_49_hu_conv.ptrs_to.add(this); }; + ret_conv_49_arr[x] = ret_conv_49_hu_conv; + } + return ret_conv_49_arr; + } + } diff --git a/src/main/java/org/ldk/structs/OnionMessageContents.java b/src/main/java/org/ldk/structs/OnionMessageContents.java index ae0df37d..68c83f0f 100644 --- a/src/main/java/org/ldk/structs/OnionMessageContents.java +++ b/src/main/java/org/ldk/structs/OnionMessageContents.java @@ -7,56 +7,80 @@ import java.util.Arrays; import java.lang.ref.Reference; import javax.annotation.Nullable; - /** - * The contents of an onion message. In the context of offers, this would be the invoice, invoice - * request, or invoice error. + * The contents of an onion message. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class OnionMessageContents extends CommonBase { - private OnionMessageContents(Object _dummy, long ptr) { super(ptr); } + final bindings.LDKOnionMessageContents bindings_instance; + OnionMessageContents(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private OnionMessageContents(bindings.LDKOnionMessageContents arg) { + super(bindings.LDKOnionMessageContents_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { - super.finalize(); + if (ptr != 0) { bindings.OnionMessageContents_free(ptr); } super.finalize(); + } + /** + * Destroys the object, freeing associated resources. After this call, any access + * to this object may result in a SEGFAULT or worse. + * + * You should generally NEVER call this method. You should let the garbage collector + * do this for you when it finalizes objects. However, it may be useful for types + * which represent locks and should be closed immediately to avoid holding locks + * until the GC runs. + */ + public void destroy() { if (ptr != 0) { bindings.OnionMessageContents_free(ptr); } + ptr = 0; } - static OnionMessageContents constr_from_ptr(long ptr) { - bindings.LDKOnionMessageContents raw_val = bindings.LDKOnionMessageContents_ref_from_ptr(ptr); - if (raw_val.getClass() == bindings.LDKOnionMessageContents.Offers.class) { - return new Offers(ptr, (bindings.LDKOnionMessageContents.Offers)raw_val); - } - if (raw_val.getClass() == bindings.LDKOnionMessageContents.Custom.class) { - return new Custom(ptr, (bindings.LDKOnionMessageContents.Custom)raw_val); - } - assert false; return null; // Unreachable without extending the (internal) bindings interface + public static interface OnionMessageContentsInterface { + /** + * Returns the TLV type identifying the message contents. MUST be >= 64. + */ + long tlv_type(); + /** + * Serialize the object into a byte array + */ + byte[] write(); + } + private static class LDKOnionMessageContentsHolder { OnionMessageContents held; } + public static OnionMessageContents new_impl(OnionMessageContentsInterface arg) { + final LDKOnionMessageContentsHolder impl_holder = new LDKOnionMessageContentsHolder(); + impl_holder.held = new OnionMessageContents(new bindings.LDKOnionMessageContents() { + @Override public long tlv_type() { + long ret = arg.tlv_type(); + Reference.reachabilityFence(arg); + return ret; + } + @Override public byte[] write() { + byte[] ret = arg.write(); + Reference.reachabilityFence(arg); + return ret; + } + }); + return impl_holder.held; } - /** - * A message related to BOLT 12 Offers. + * Returns the TLV type identifying the message contents. MUST be >= 64. */ - public final static class Offers extends OnionMessageContents { - public final org.ldk.structs.OffersMessage offers; - private Offers(long ptr, bindings.LDKOnionMessageContents.Offers obj) { - super(null, ptr); - long offers = obj.offers; - org.ldk.structs.OffersMessage offers_hu_conv = org.ldk.structs.OffersMessage.constr_from_ptr(offers); - if (offers_hu_conv != null) { offers_hu_conv.ptrs_to.add(this); }; - this.offers = offers_hu_conv; - } + public long tlv_type() { + long ret = bindings.OnionMessageContents_tlv_type(this.ptr); + Reference.reachabilityFence(this); + return ret; } + /** - * A custom onion message specified by the user. + * Serialize the object into a byte array */ - public final static class Custom extends OnionMessageContents { - public final org.ldk.structs.CustomOnionMessageContents custom; - private Custom(long ptr, bindings.LDKOnionMessageContents.Custom obj) { - super(null, ptr); - long custom = obj.custom; - CustomOnionMessageContents ret_hu_conv = new CustomOnionMessageContents(null, custom); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - this.custom = ret_hu_conv; - } + public byte[] write() { + byte[] ret = bindings.OnionMessageContents_write(this.ptr); + Reference.reachabilityFence(this); + return ret; } + long clone_ptr() { long ret = bindings.OnionMessageContents_clone_ptr(this.ptr); Reference.reachabilityFence(this); @@ -64,41 +88,15 @@ public class OnionMessageContents extends CommonBase { } /** - * Creates a copy of the OnionMessageContents + * Creates a copy of a OnionMessageContents */ public OnionMessageContents clone() { long ret = bindings.OnionMessageContents_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.OnionMessageContents ret_hu_conv = org.ldk.structs.OnionMessageContents.constr_from_ptr(ret); + OnionMessageContents ret_hu_conv = new OnionMessageContents(null, ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } - /** - * Utility method to constructs a new Offers-variant OnionMessageContents - */ - public static OnionMessageContents offers(org.ldk.structs.OffersMessage a) { - long ret = bindings.OnionMessageContents_offers(a.ptr); - Reference.reachabilityFence(a); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.OnionMessageContents ret_hu_conv = org.ldk.structs.OnionMessageContents.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; - return ret_hu_conv; - } - - /** - * Utility method to constructs a new Custom-variant OnionMessageContents - */ - public static OnionMessageContents custom(org.ldk.structs.CustomOnionMessageContents a) { - long ret = bindings.OnionMessageContents_custom(a.ptr); - Reference.reachabilityFence(a); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.OnionMessageContents ret_hu_conv = org.ldk.structs.OnionMessageContents.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; - return ret_hu_conv; - } - } diff --git a/src/main/java/org/ldk/structs/OnionMessageHandler.java b/src/main/java/org/ldk/structs/OnionMessageHandler.java index 46e5da4f..304e8b05 100644 --- a/src/main/java/org/ldk/structs/OnionMessageHandler.java +++ b/src/main/java/org/ldk/structs/OnionMessageHandler.java @@ -8,16 +8,15 @@ import java.lang.ref.Reference; import javax.annotation.Nullable; /** - * A trait to describe an object that can receive onion messages. + * A handler for received [`OnionMessage`]s and for providing generated ones to send. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class OnionMessageHandler extends CommonBase { final bindings.LDKOnionMessageHandler bindings_instance; OnionMessageHandler(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private OnionMessageHandler(bindings.LDKOnionMessageHandler arg, bindings.LDKOnionMessageProvider OnionMessageProvider) { - super(bindings.LDKOnionMessageHandler_new(arg, OnionMessageProvider)); + private OnionMessageHandler(bindings.LDKOnionMessageHandler arg) { + super(bindings.LDKOnionMessageHandler_new(arg)); this.ptrs_to.add(arg); - this.ptrs_to.add(OnionMessageProvider); this.bindings_instance = arg; } @Override @SuppressWarnings("deprecation") @@ -42,6 +41,12 @@ public class OnionMessageHandler extends CommonBase { * Handle an incoming `onion_message` message from the given peer. */ void handle_onion_message(byte[] peer_node_id, OnionMessage msg); + /** + * Returns the next pending onion message for the peer with the given node id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + OnionMessage next_onion_message_for_peer(byte[] peer_node_id); /** * Called when a connection is established with a peer. Can be used to track which peers * advertise onion message support and are online. @@ -72,7 +77,7 @@ public class OnionMessageHandler extends CommonBase { InitFeatures provided_init_features(byte[] their_node_id); } private static class LDKOnionMessageHandlerHolder { OnionMessageHandler held; } - public static OnionMessageHandler new_impl(OnionMessageHandlerInterface arg, OnionMessageProvider.OnionMessageProviderInterface OnionMessageProvider_impl) { + public static OnionMessageHandler new_impl(OnionMessageHandlerInterface arg) { final LDKOnionMessageHandlerHolder impl_holder = new LDKOnionMessageHandlerHolder(); impl_holder.held = new OnionMessageHandler(new bindings.LDKOnionMessageHandler() { @Override public void handle_onion_message(byte[] peer_node_id, long msg) { @@ -80,6 +85,12 @@ public class OnionMessageHandler extends CommonBase { arg.handle_onion_message(peer_node_id, msg_hu_conv); Reference.reachabilityFence(arg); } + @Override public long next_onion_message_for_peer(byte[] peer_node_id) { + OnionMessage ret = arg.next_onion_message_for_peer(peer_node_id); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } @Override public long peer_connected(byte[] their_node_id, long init, boolean inbound) { org.ldk.structs.Init init_hu_conv = null; if (init < 0 || init > 4096) { init_hu_conv = new org.ldk.structs.Init(null, init); } Result_NoneNoneZ ret = arg.peer_connected(their_node_id, init_hu_conv, inbound); @@ -103,19 +114,9 @@ public class OnionMessageHandler extends CommonBase { long result = ret == null ? 0 : ret.clone_ptr(); return result; } - }, OnionMessageProvider.new_impl(OnionMessageProvider_impl).bindings_instance); + }); return impl_holder.held; } - - /** - * Gets the underlying OnionMessageProvider. - */ - public OnionMessageProvider get_onion_message_provider() { - OnionMessageProvider res = new OnionMessageProvider(null, bindings.LDKOnionMessageHandler_get_OnionMessageProvider(this.ptr)); - res.ptrs_to.add(this); - return res; - } - /** * Handle an incoming `onion_message` message from the given peer. */ @@ -127,6 +128,22 @@ public class OnionMessageHandler extends CommonBase { if (this != null) { this.ptrs_to.add(msg); }; } + /** + * Returns the next pending onion message for the peer with the given node id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public OnionMessage next_onion_message_for_peer(byte[] peer_node_id) { + long ret = bindings.OnionMessageHandler_next_onion_message_for_peer(this.ptr, InternalUtils.check_arr_len(peer_node_id, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(peer_node_id); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.OnionMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessage(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + /** * Called when a connection is established with a peer. Can be used to track which peers * advertise onion message support and are online. diff --git a/src/main/java/org/ldk/structs/OnionMessagePath.java b/src/main/java/org/ldk/structs/OnionMessagePath.java index 9f3d8391..44c3c524 100644 --- a/src/main/java/org/ldk/structs/OnionMessagePath.java +++ b/src/main/java/org/ldk/structs/OnionMessagePath.java @@ -9,7 +9,7 @@ import javax.annotation.Nullable; /** - * A path for sending an [`msgs::OnionMessage`]. + * A path for sending an [`OnionMessage`]. */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class OnionMessagePath extends CommonBase { diff --git a/src/main/java/org/ldk/structs/OnionMessageProvider.java b/src/main/java/org/ldk/structs/OnionMessageProvider.java deleted file mode 100644 index 6c87b44b..00000000 --- a/src/main/java/org/ldk/structs/OnionMessageProvider.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import java.lang.ref.Reference; -import javax.annotation.Nullable; - -/** - * A trait indicating an object may generate onion messages to send - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class OnionMessageProvider extends CommonBase { - final bindings.LDKOnionMessageProvider bindings_instance; - OnionMessageProvider(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private OnionMessageProvider(bindings.LDKOnionMessageProvider arg) { - super(bindings.LDKOnionMessageProvider_new(arg)); - this.ptrs_to.add(arg); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.OnionMessageProvider_free(ptr); } super.finalize(); - } - /** - * Destroys the object, freeing associated resources. After this call, any access - * to this object may result in a SEGFAULT or worse. - * - * You should generally NEVER call this method. You should let the garbage collector - * do this for you when it finalizes objects. However, it may be useful for types - * which represent locks and should be closed immediately to avoid holding locks - * until the GC runs. - */ - public void destroy() { - if (ptr != 0) { bindings.OnionMessageProvider_free(ptr); } - ptr = 0; - } - public static interface OnionMessageProviderInterface { - /** - * Gets the next pending onion message for the peer with the given node id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - OnionMessage next_onion_message_for_peer(byte[] peer_node_id); - } - private static class LDKOnionMessageProviderHolder { OnionMessageProvider held; } - public static OnionMessageProvider new_impl(OnionMessageProviderInterface arg) { - final LDKOnionMessageProviderHolder impl_holder = new LDKOnionMessageProviderHolder(); - impl_holder.held = new OnionMessageProvider(new bindings.LDKOnionMessageProvider() { - @Override public long next_onion_message_for_peer(byte[] peer_node_id) { - OnionMessage ret = arg.next_onion_message_for_peer(peer_node_id); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - }); - return impl_holder.held; - } - /** - * Gets the next pending onion message for the peer with the given node id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - @Nullable - public OnionMessage next_onion_message_for_peer(byte[] peer_node_id) { - long ret = bindings.OnionMessageProvider_next_onion_message_for_peer(this.ptr, InternalUtils.check_arr_len(peer_node_id, 33)); - Reference.reachabilityFence(this); - Reference.reachabilityFence(peer_node_id); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.OnionMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OnionMessage(null, ret); } - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/OnionMessenger.java b/src/main/java/org/ldk/structs/OnionMessenger.java index 482daf66..751b292d 100644 --- a/src/main/java/org/ldk/structs/OnionMessenger.java +++ b/src/main/java/org/ldk/structs/OnionMessenger.java @@ -9,9 +9,21 @@ import javax.annotation.Nullable; /** - * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be - * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending - * and receiving custom onion messages is supported. + * A sender, receiver and forwarder of [`OnionMessage`]s. + * + * # Handling Messages + * + * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding + * messages to peers or delegating to the appropriate handler for the message type. Currently, the + * available handlers are: + * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s + * [`CustomOnionMessageHandler`], for handling user-defined message types + * + * # Sending Messages + * + * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling + * a message, the matched handler may return a response message which `OnionMessenger` will send + * on its behalf. * * # Example * @@ -23,7 +35,7 @@ import javax.annotation.Nullable; * # use lightning::sign::KeysManager; * # use lightning::ln::peer_handler::IgnoringMessageHandler; * # use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessenger, OnionMessagePath}; - * # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents}; + * # use lightning::onion_message::packet::OnionMessageContents; * # use lightning::util::logger::{Logger, Record}; * # use lightning::util::ser::{Writeable, Writer}; * # use lightning::io; @@ -65,7 +77,7 @@ import javax.annotation.Nullable; * \t\t// Write your custom onion message to `w` * \t} * } - * impl CustomOnionMessageContents for YourCustomMessage { + * impl OnionMessageContents for YourCustomMessage { * \tfn tlv_type(&self) -> u64 { * \t\t# let your_custom_message_type = 42; * \t\tyour_custom_message_type @@ -77,8 +89,7 @@ import javax.annotation.Nullable; * \tdestination: Destination::Node(destination_node_id), * }; * let reply_path = None; - * # let your_custom_message = YourCustomMessage {}; - * let message = OnionMessageContents::Custom(your_custom_message); + * # let message = YourCustomMessage {}; * onion_messenger.send_onion_message(path, message, reply_path); * * Create a blinded path to yourself, for someone to send an onion message to. @@ -92,13 +103,12 @@ import javax.annotation.Nullable; * \tdestination: Destination::BlindedPath(blinded_path), * }; * let reply_path = None; - * # let your_custom_message = YourCustomMessage {}; - * let message = OnionMessageContents::Custom(your_custom_message); + * # let message = YourCustomMessage {}; * onion_messenger.send_onion_message(path, message, reply_path); * ``` * - * [offers]: - * [`OnionMessenger`]: crate::onion_message::OnionMessenger + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class OnionMessenger extends CommonBase { @@ -134,22 +144,23 @@ public class OnionMessenger extends CommonBase { } /** - * Send an onion message with contents `message` to the destination of `path`. + * Sends an [`OnionMessage`] with the given `contents` for sending to the destination of + * `path`. * * See [`OnionMessenger`] for example usage. * * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Result_NoneSendErrorZ send_onion_message(org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents message, @Nullable org.ldk.structs.BlindedPath reply_path) { - long ret = bindings.OnionMessenger_send_onion_message(this.ptr, path == null ? 0 : path.ptr, message.ptr, reply_path == null ? 0 : reply_path.ptr); + public Result_NoneSendErrorZ send_onion_message(org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents contents, @Nullable org.ldk.structs.BlindedPath reply_path) { + long ret = bindings.OnionMessenger_send_onion_message(this.ptr, path == null ? 0 : path.ptr, contents.ptr, reply_path == null ? 0 : reply_path.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(path); - Reference.reachabilityFence(message); + Reference.reachabilityFence(contents); Reference.reachabilityFence(reply_path); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneSendErrorZ ret_hu_conv = Result_NoneSendErrorZ.constr_from_ptr(ret); if (this != null) { this.ptrs_to.add(path); }; - if (this != null) { this.ptrs_to.add(message); }; + if (this != null) { this.ptrs_to.add(contents); }; if (this != null) { this.ptrs_to.add(reply_path); }; return ret_hu_conv; } @@ -167,17 +178,4 @@ public class OnionMessenger extends CommonBase { return ret_hu_conv; } - /** - * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is - */ - public OnionMessageProvider as_OnionMessageProvider() { - long ret = bindings.OnionMessenger_as_OnionMessageProvider(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - OnionMessageProvider ret_hu_conv = new OnionMessageProvider(null, ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - } diff --git a/src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java b/src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java deleted file mode 100644 index e1a73abd..00000000 --- a/src/main/java/org/ldk/structs/Option_CustomOnionMessageContentsZ.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import java.lang.ref.Reference; -import javax.annotation.Nullable; - - -/** - * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class Option_CustomOnionMessageContentsZ extends CommonBase { - private Option_CustomOnionMessageContentsZ(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.COption_CustomOnionMessageContentsZ_free(ptr); } - } - static Option_CustomOnionMessageContentsZ constr_from_ptr(long ptr) { - bindings.LDKCOption_CustomOnionMessageContentsZ raw_val = bindings.LDKCOption_CustomOnionMessageContentsZ_ref_from_ptr(ptr); - if (raw_val.getClass() == bindings.LDKCOption_CustomOnionMessageContentsZ.Some.class) { - return new Some(ptr, (bindings.LDKCOption_CustomOnionMessageContentsZ.Some)raw_val); - } - if (raw_val.getClass() == bindings.LDKCOption_CustomOnionMessageContentsZ.None.class) { - return new None(ptr, (bindings.LDKCOption_CustomOnionMessageContentsZ.None)raw_val); - } - assert false; return null; // Unreachable without extending the (internal) bindings interface - } - - /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents - */ - public final static class Some extends Option_CustomOnionMessageContentsZ { - public final org.ldk.structs.CustomOnionMessageContents some; - private Some(long ptr, bindings.LDKCOption_CustomOnionMessageContentsZ.Some obj) { - super(null, ptr); - long some = obj.some; - CustomOnionMessageContents ret_hu_conv = new CustomOnionMessageContents(null, some); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - this.some = ret_hu_conv; - } - } - /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing - */ - public final static class None extends Option_CustomOnionMessageContentsZ { - private None(long ptr, bindings.LDKCOption_CustomOnionMessageContentsZ.None obj) { - super(null, ptr); - } - } - /** - * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents - */ - public static Option_CustomOnionMessageContentsZ some(org.ldk.structs.CustomOnionMessageContents o) { - long ret = bindings.COption_CustomOnionMessageContentsZ_some(o.ptr); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_CustomOnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_CustomOnionMessageContentsZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; - return ret_hu_conv; - } - - /** - * Constructs a new COption_CustomOnionMessageContentsZ containing nothing - */ - public static Option_CustomOnionMessageContentsZ none() { - long ret = bindings.COption_CustomOnionMessageContentsZ_none(); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_CustomOnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_CustomOnionMessageContentsZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; - return ret_hu_conv; - } - - long clone_ptr() { - long ret = bindings.COption_CustomOnionMessageContentsZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new COption_CustomOnionMessageContentsZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Option_CustomOnionMessageContentsZ clone() { - long ret = bindings.COption_CustomOnionMessageContentsZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - org.ldk.structs.Option_CustomOnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_CustomOnionMessageContentsZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Option_OnionMessageContentsZ.java b/src/main/java/org/ldk/structs/Option_OnionMessageContentsZ.java new file mode 100644 index 00000000..7250eaf8 --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_OnionMessageContentsZ.java @@ -0,0 +1,97 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_OnionMessageContentsZ extends CommonBase { + private Option_OnionMessageContentsZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_OnionMessageContentsZ_free(ptr); } + } + static Option_OnionMessageContentsZ constr_from_ptr(long ptr) { + bindings.LDKCOption_OnionMessageContentsZ raw_val = bindings.LDKCOption_OnionMessageContentsZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_OnionMessageContentsZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_OnionMessageContentsZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_OnionMessageContentsZ.None.class) { + return new None(ptr, (bindings.LDKCOption_OnionMessageContentsZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents + */ + public final static class Some extends Option_OnionMessageContentsZ { + public final org.ldk.structs.OnionMessageContents some; + private Some(long ptr, bindings.LDKCOption_OnionMessageContentsZ.Some obj) { + super(null, ptr); + long some = obj.some; + OnionMessageContents ret_hu_conv = new OnionMessageContents(null, some); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + this.some = ret_hu_conv; + } + } + /** + * When we're in this state, this COption_OnionMessageContentsZ contains nothing + */ + public final static class None extends Option_OnionMessageContentsZ { + private None(long ptr, bindings.LDKCOption_OnionMessageContentsZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents + */ + public static Option_OnionMessageContentsZ some(org.ldk.structs.OnionMessageContents o) { + long ret = bindings.COption_OnionMessageContentsZ_some(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_OnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_OnionMessageContentsZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Constructs a new COption_OnionMessageContentsZ containing nothing + */ + public static Option_OnionMessageContentsZ none() { + long ret = bindings.COption_OnionMessageContentsZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_OnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_OnionMessageContentsZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_OnionMessageContentsZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_OnionMessageContentsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_OnionMessageContentsZ clone() { + long ret = bindings.COption_OnionMessageContentsZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_OnionMessageContentsZ ret_hu_conv = org.ldk.structs.Option_OnionMessageContentsZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Option_StrZ.java b/src/main/java/org/ldk/structs/Option_StrZ.java new file mode 100644 index 00000000..0f0886dd --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_StrZ.java @@ -0,0 +1,93 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * An enum which can either contain a crate::c_types::Str or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_StrZ extends CommonBase { + private Option_StrZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_StrZ_free(ptr); } + } + static Option_StrZ constr_from_ptr(long ptr) { + bindings.LDKCOption_StrZ raw_val = bindings.LDKCOption_StrZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_StrZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_StrZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_StrZ.None.class) { + return new None(ptr, (bindings.LDKCOption_StrZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_StrZ contains a crate::c_types::Str + */ + public final static class Some extends Option_StrZ { + public final java.lang.String some; + private Some(long ptr, bindings.LDKCOption_StrZ.Some obj) { + super(null, ptr); + this.some = obj.some; + } + } + /** + * When we're in this state, this COption_StrZ contains nothing + */ + public final static class None extends Option_StrZ { + private None(long ptr, bindings.LDKCOption_StrZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_StrZ containing a crate::c_types::Str + */ + public static Option_StrZ some(java.lang.String o) { + long ret = bindings.COption_StrZ_some(o); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_StrZ ret_hu_conv = org.ldk.structs.Option_StrZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Constructs a new COption_StrZ containing nothing + */ + public static Option_StrZ none() { + long ret = bindings.COption_StrZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_StrZ ret_hu_conv = org.ldk.structs.Option_StrZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_StrZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_StrZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_StrZ clone() { + long ret = bindings.COption_StrZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_StrZ ret_hu_conv = org.ldk.structs.Option_StrZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Option_boolZ.java b/src/main/java/org/ldk/structs/Option_boolZ.java new file mode 100644 index 00000000..0e5d0900 --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_boolZ.java @@ -0,0 +1,93 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * An enum which can either contain a bool or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_boolZ extends CommonBase { + private Option_boolZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_boolZ_free(ptr); } + } + static Option_boolZ constr_from_ptr(long ptr) { + bindings.LDKCOption_boolZ raw_val = bindings.LDKCOption_boolZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_boolZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_boolZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_boolZ.None.class) { + return new None(ptr, (bindings.LDKCOption_boolZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_boolZ contains a bool + */ + public final static class Some extends Option_boolZ { + public final boolean some; + private Some(long ptr, bindings.LDKCOption_boolZ.Some obj) { + super(null, ptr); + this.some = obj.some; + } + } + /** + * When we're in this state, this COption_boolZ contains nothing + */ + public final static class None extends Option_boolZ { + private None(long ptr, bindings.LDKCOption_boolZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_boolZ containing a bool + */ + public static Option_boolZ some(boolean o) { + long ret = bindings.COption_boolZ_some(o); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_boolZ ret_hu_conv = org.ldk.structs.Option_boolZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + /** + * Constructs a new COption_boolZ containing nothing + */ + public static Option_boolZ none() { + long ret = bindings.COption_boolZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_boolZ ret_hu_conv = org.ldk.structs.Option_boolZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_boolZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_boolZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_boolZ clone() { + long ret = bindings.COption_boolZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_boolZ ret_hu_conv = org.ldk.structs.Option_boolZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ParsedOnionMessageContents.java b/src/main/java/org/ldk/structs/ParsedOnionMessageContents.java new file mode 100644 index 00000000..66e55d1b --- /dev/null +++ b/src/main/java/org/ldk/structs/ParsedOnionMessageContents.java @@ -0,0 +1,127 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * The contents of an [`OnionMessage`] as read from the wire. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ParsedOnionMessageContents extends CommonBase { + private ParsedOnionMessageContents(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.ParsedOnionMessageContents_free(ptr); } + } + static ParsedOnionMessageContents constr_from_ptr(long ptr) { + bindings.LDKParsedOnionMessageContents raw_val = bindings.LDKParsedOnionMessageContents_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKParsedOnionMessageContents.Offers.class) { + return new Offers(ptr, (bindings.LDKParsedOnionMessageContents.Offers)raw_val); + } + if (raw_val.getClass() == bindings.LDKParsedOnionMessageContents.Custom.class) { + return new Custom(ptr, (bindings.LDKParsedOnionMessageContents.Custom)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * A message related to BOLT 12 Offers. + */ + public final static class Offers extends ParsedOnionMessageContents { + public final org.ldk.structs.OffersMessage offers; + private Offers(long ptr, bindings.LDKParsedOnionMessageContents.Offers obj) { + super(null, ptr); + long offers = obj.offers; + org.ldk.structs.OffersMessage offers_hu_conv = org.ldk.structs.OffersMessage.constr_from_ptr(offers); + if (offers_hu_conv != null) { offers_hu_conv.ptrs_to.add(this); }; + this.offers = offers_hu_conv; + } + } + /** + * A custom onion message specified by the user. + */ + public final static class Custom extends ParsedOnionMessageContents { + public final org.ldk.structs.OnionMessageContents custom; + private Custom(long ptr, bindings.LDKParsedOnionMessageContents.Custom obj) { + super(null, ptr); + long custom = obj.custom; + OnionMessageContents ret_hu_conv = new OnionMessageContents(null, custom); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + this.custom = ret_hu_conv; + } + } + long clone_ptr() { + long ret = bindings.ParsedOnionMessageContents_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the ParsedOnionMessageContents + */ + public ParsedOnionMessageContents clone() { + long ret = bindings.ParsedOnionMessageContents_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParsedOnionMessageContents ret_hu_conv = org.ldk.structs.ParsedOnionMessageContents.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Offers-variant ParsedOnionMessageContents + */ + public static ParsedOnionMessageContents offers(org.ldk.structs.OffersMessage a) { + long ret = bindings.ParsedOnionMessageContents_offers(a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParsedOnionMessageContents ret_hu_conv = org.ldk.structs.ParsedOnionMessageContents.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Custom-variant ParsedOnionMessageContents + */ + public static ParsedOnionMessageContents custom(org.ldk.structs.OnionMessageContents a) { + long ret = bindings.ParsedOnionMessageContents_custom(a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParsedOnionMessageContents ret_hu_conv = org.ldk.structs.ParsedOnionMessageContents.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + return ret_hu_conv; + } + + /** + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is + */ + public OnionMessageContents as_OnionMessageContents() { + long ret = bindings.ParsedOnionMessageContents_as_OnionMessageContents(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + OnionMessageContents ret_hu_conv = new OnionMessageContents(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Serialize the ParsedOnionMessageContents object into a byte array which can be read by ParsedOnionMessageContents_read + */ + public byte[] write() { + byte[] ret = bindings.ParsedOnionMessageContents_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/PaymentConstraints.java b/src/main/java/org/ldk/structs/PaymentConstraints.java index 90953d28..3cfc1c16 100644 --- a/src/main/java/org/ldk/structs/PaymentConstraints.java +++ b/src/main/java/org/ldk/structs/PaymentConstraints.java @@ -23,8 +23,7 @@ public class PaymentConstraints extends CommonBase { } /** - * The maximum total CLTV delta that is acceptable when relaying a payment over this - * [`BlindedHop`]. + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. */ public int get_max_cltv_expiry() { int ret = bindings.PaymentConstraints_get_max_cltv_expiry(this.ptr); @@ -33,8 +32,7 @@ public class PaymentConstraints extends CommonBase { } /** - * The maximum total CLTV delta that is acceptable when relaying a payment over this - * [`BlindedHop`]. + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. */ public void set_max_cltv_expiry(int val) { bindings.PaymentConstraints_set_max_cltv_expiry(this.ptr, val); diff --git a/src/main/java/org/ldk/structs/PeeledOnion.java b/src/main/java/org/ldk/structs/PeeledOnion.java new file mode 100644 index 00000000..7787d1f4 --- /dev/null +++ b/src/main/java/org/ldk/structs/PeeledOnion.java @@ -0,0 +1,123 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * A processed incoming onion message, containing either a Forward (another onion message) + * or a Receive payload with decrypted contents. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class PeeledOnion extends CommonBase { + private PeeledOnion(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.PeeledOnion_free(ptr); } + } + static PeeledOnion constr_from_ptr(long ptr) { + bindings.LDKPeeledOnion raw_val = bindings.LDKPeeledOnion_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKPeeledOnion.Forward.class) { + return new Forward(ptr, (bindings.LDKPeeledOnion.Forward)raw_val); + } + if (raw_val.getClass() == bindings.LDKPeeledOnion.Receive.class) { + return new Receive(ptr, (bindings.LDKPeeledOnion.Receive)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * Forwarded onion, with the next node id and a new onion + */ + public final static class Forward extends PeeledOnion { + public final byte[] _0; + public final org.ldk.structs.OnionMessage _1; + private Forward(long ptr, bindings.LDKPeeledOnion.Forward obj) { + super(null, ptr); + this._0 = obj._0; + long _1 = obj._1; + org.ldk.structs.OnionMessage _1_hu_conv = null; if (_1 < 0 || _1 > 4096) { _1_hu_conv = new org.ldk.structs.OnionMessage(null, _1); } + if (_1_hu_conv != null) { _1_hu_conv.ptrs_to.add(this); }; + this._1 = _1_hu_conv; + } + } + /** + * Received onion message, with decrypted contents, path_id, and reply path + */ + public final static class Receive extends PeeledOnion { + public final org.ldk.structs.ParsedOnionMessageContents _0; + /** + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public final byte[] _1; + /** + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public final org.ldk.structs.BlindedPath _2; + private Receive(long ptr, bindings.LDKPeeledOnion.Receive obj) { + super(null, ptr); + long _0 = obj._0; + org.ldk.structs.ParsedOnionMessageContents _0_hu_conv = org.ldk.structs.ParsedOnionMessageContents.constr_from_ptr(_0); + if (_0_hu_conv != null) { _0_hu_conv.ptrs_to.add(this); }; + this._0 = _0_hu_conv; + this._1 = obj._1; + long _2 = obj._2; + org.ldk.structs.BlindedPath _2_hu_conv = null; if (_2 < 0 || _2 > 4096) { _2_hu_conv = new org.ldk.structs.BlindedPath(null, _2); } + if (_2_hu_conv != null) { _2_hu_conv.ptrs_to.add(this); }; + this._2 = _2_hu_conv; + } + } + long clone_ptr() { + long ret = bindings.PeeledOnion_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the PeeledOnion + */ + public PeeledOnion clone() { + long ret = bindings.PeeledOnion_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PeeledOnion ret_hu_conv = org.ldk.structs.PeeledOnion.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Forward-variant PeeledOnion + */ + public static PeeledOnion forward(byte[] a, org.ldk.structs.OnionMessage b) { + long ret = bindings.PeeledOnion_forward(InternalUtils.check_arr_len(a, 33), b == null ? 0 : b.ptr); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PeeledOnion ret_hu_conv = org.ldk.structs.PeeledOnion.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b); }; + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Receive-variant PeeledOnion + */ + public static PeeledOnion receive(org.ldk.structs.ParsedOnionMessageContents a, byte[] b, org.ldk.structs.BlindedPath c) { + long ret = bindings.PeeledOnion_receive(a.ptr, InternalUtils.check_arr_len(b, 32), c == null ? 0 : c.ptr); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + Reference.reachabilityFence(c); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PeeledOnion ret_hu_conv = org.ldk.structs.PeeledOnion.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(c); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java deleted file mode 100644 index 9dc69021..00000000 --- a/src/main/java/org/ldk/structs/Result_COption_CustomOnionMessageContentsZDecodeErrorZ.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import java.lang.ref.Reference; -import javax.annotation.Nullable; - -public class Result_COption_CustomOnionMessageContentsZDecodeErrorZ extends CommonBase { - private Result_COption_CustomOnionMessageContentsZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_COption_CustomOnionMessageContentsZDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(ptr)) { - return new Result_COption_CustomOnionMessageContentsZDecodeErrorZ_OK(null, ptr); - } else { - return new Result_COption_CustomOnionMessageContentsZDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_COption_CustomOnionMessageContentsZDecodeErrorZ_OK extends Result_COption_CustomOnionMessageContentsZDecodeErrorZ { - public final Option_CustomOnionMessageContentsZ res; - private Result_COption_CustomOnionMessageContentsZDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok(ptr); - org.ldk.structs.Option_CustomOnionMessageContentsZ res_hu_conv = org.ldk.structs.Option_CustomOnionMessageContentsZ.constr_from_ptr(res); - if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; - this.res = res_hu_conv; - } - } - - public static final class Result_COption_CustomOnionMessageContentsZDecodeErrorZ_Err extends Result_COption_CustomOnionMessageContentsZDecodeErrorZ { - public final DecodeError err; - private Result_COption_CustomOnionMessageContentsZDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err(ptr); - org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); - if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. - */ - public static Result_COption_CustomOnionMessageContentsZDecodeErrorZ ok(org.ldk.structs.Option_CustomOnionMessageContentsZ o) { - long ret = bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o.ptr); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_COption_CustomOnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_CustomOnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; - return ret_hu_conv; - } - - /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. - */ - public static Result_COption_CustomOnionMessageContentsZDecodeErrorZ err(org.ldk.structs.DecodeError e) { - long ret = bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e.ptr); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_COption_CustomOnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_CustomOnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; - return ret_hu_conv; - } - - /** - * Checks if the given object is currently in the success state - */ - public boolean is_ok() { - boolean ret = bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_COption_CustomOnionMessageContentsZDecodeErrorZ clone() { - long ret = bindings.CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_COption_CustomOnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_CustomOnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_COption_OnionMessageContentsZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_OnionMessageContentsZDecodeErrorZ.java new file mode 100644 index 00000000..43492616 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_COption_OnionMessageContentsZDecodeErrorZ.java @@ -0,0 +1,96 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_COption_OnionMessageContentsZDecodeErrorZ extends CommonBase { + private Result_COption_OnionMessageContentsZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_COption_OnionMessageContentsZDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(ptr)) { + return new Result_COption_OnionMessageContentsZDecodeErrorZ_OK(null, ptr); + } else { + return new Result_COption_OnionMessageContentsZDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_COption_OnionMessageContentsZDecodeErrorZ_OK extends Result_COption_OnionMessageContentsZDecodeErrorZ { + public final Option_OnionMessageContentsZ res; + private Result_COption_OnionMessageContentsZDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok(ptr); + org.ldk.structs.Option_OnionMessageContentsZ res_hu_conv = org.ldk.structs.Option_OnionMessageContentsZ.constr_from_ptr(res); + if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; + this.res = res_hu_conv; + } + } + + public static final class Result_COption_OnionMessageContentsZDecodeErrorZ_Err extends Result_COption_OnionMessageContentsZDecodeErrorZ { + public final DecodeError err; + private Result_COption_OnionMessageContentsZDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err(ptr); + org.ldk.structs.DecodeError err_hu_conv = org.ldk.structs.DecodeError.constr_from_ptr(err); + if (err_hu_conv != null) { err_hu_conv.ptrs_to.add(this); }; + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. + */ + public static Result_COption_OnionMessageContentsZDecodeErrorZ ok(org.ldk.structs.Option_OnionMessageContentsZ o) { + long ret = bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_OnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_OnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. + */ + public static Result_COption_OnionMessageContentsZDecodeErrorZ err(org.ldk.structs.DecodeError e) { + long ret = bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_OnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_OnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(e); }; + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_COption_OnionMessageContentsZDecodeErrorZ clone() { + long ret = bindings.CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_OnionMessageContentsZDecodeErrorZ ret_hu_conv = Result_COption_OnionMessageContentsZDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_NoneBolt12SemanticErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneBolt12SemanticErrorZ.java new file mode 100644 index 00000000..7e796587 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_NoneBolt12SemanticErrorZ.java @@ -0,0 +1,85 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_NoneBolt12SemanticErrorZ extends CommonBase { + private Result_NoneBolt12SemanticErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NoneBolt12SemanticErrorZ_free(ptr); } super.finalize(); + } + + static Result_NoneBolt12SemanticErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_NoneBolt12SemanticErrorZ_is_ok(ptr)) { + return new Result_NoneBolt12SemanticErrorZ_OK(null, ptr); + } else { + return new Result_NoneBolt12SemanticErrorZ_Err(null, ptr); + } + } + public static final class Result_NoneBolt12SemanticErrorZ_OK extends Result_NoneBolt12SemanticErrorZ { + private Result_NoneBolt12SemanticErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + public static final class Result_NoneBolt12SemanticErrorZ_Err extends Result_NoneBolt12SemanticErrorZ { + public final Bolt12SemanticError err; + private Result_NoneBolt12SemanticErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.CResult_NoneBolt12SemanticErrorZ_get_err(ptr); + } + } + + /** + * Creates a new CResult_NoneBolt12SemanticErrorZ in the success state. + */ + public static Result_NoneBolt12SemanticErrorZ ok() { + long ret = bindings.CResult_NoneBolt12SemanticErrorZ_ok(); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. + */ + public static Result_NoneBolt12SemanticErrorZ err(org.ldk.enums.Bolt12SemanticError e) { + long ret = bindings.CResult_NoneBolt12SemanticErrorZ_err(e); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_NoneBolt12SemanticErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_NoneBolt12SemanticErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_NoneBolt12SemanticErrorZ clone() { + long ret = bindings.CResult_NoneBolt12SemanticErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneBolt12SemanticErrorZ ret_hu_conv = Result_NoneBolt12SemanticErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PeeledOnionNoneZ.java b/src/main/java/org/ldk/structs/Result_PeeledOnionNoneZ.java new file mode 100644 index 00000000..cb22bcee --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PeeledOnionNoneZ.java @@ -0,0 +1,71 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_PeeledOnionNoneZ extends CommonBase { + private Result_PeeledOnionNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PeeledOnionNoneZ_free(ptr); } super.finalize(); + } + + static Result_PeeledOnionNoneZ constr_from_ptr(long ptr) { + if (bindings.CResult_PeeledOnionNoneZ_is_ok(ptr)) { + return new Result_PeeledOnionNoneZ_OK(null, ptr); + } else { + return new Result_PeeledOnionNoneZ_Err(null, ptr); + } + } + public static final class Result_PeeledOnionNoneZ_OK extends Result_PeeledOnionNoneZ { + public final PeeledOnion res; + private Result_PeeledOnionNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_PeeledOnionNoneZ_get_ok(ptr); + org.ldk.structs.PeeledOnion res_hu_conv = org.ldk.structs.PeeledOnion.constr_from_ptr(res); + if (res_hu_conv != null) { res_hu_conv.ptrs_to.add(this); }; + this.res = res_hu_conv; + } + } + + public static final class Result_PeeledOnionNoneZ_Err extends Result_PeeledOnionNoneZ { + private Result_PeeledOnionNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + /** + * Creates a new CResult_PeeledOnionNoneZ in the success state. + */ + public static Result_PeeledOnionNoneZ ok(org.ldk.structs.PeeledOnion o) { + long ret = bindings.CResult_PeeledOnionNoneZ_ok(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PeeledOnionNoneZ ret_hu_conv = Result_PeeledOnionNoneZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(o); }; + return ret_hu_conv; + } + + /** + * Creates a new CResult_PeeledOnionNoneZ in the error state. + */ + public static Result_PeeledOnionNoneZ err() { + long ret = bindings.CResult_PeeledOnionNoneZ_err(); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PeeledOnionNoneZ ret_hu_conv = Result_PeeledOnionNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_PeeledOnionNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/SendError.java b/src/main/java/org/ldk/structs/SendError.java index 44c877f0..73a030c8 100644 --- a/src/main/java/org/ldk/structs/SendError.java +++ b/src/main/java/org/ldk/structs/SendError.java @@ -70,8 +70,8 @@ public class SendError extends CommonBase { } } /** - * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two - * blinded hops. + * The provided [`Destination`] was an invalid [`BlindedPath`] due to not having any blinded + * hops. */ public final static class TooFewBlindedHops extends SendError { private TooFewBlindedHops(long ptr, bindings.LDKSendError.TooFewBlindedHops obj) { diff --git a/src/main/java/org/ldk/structs/SocketAddress.java b/src/main/java/org/ldk/structs/SocketAddress.java index e31cf0e3..c074f68f 100644 --- a/src/main/java/org/ldk/structs/SocketAddress.java +++ b/src/main/java/org/ldk/structs/SocketAddress.java @@ -260,6 +260,15 @@ public class SocketAddress extends CommonBase { return ret_hu_conv; } + /** + * Get the string representation of a SocketAddress object + */ + public String to_str() { + String ret = bindings.SocketAddress_to_str(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Read a SocketAddress object from a string */ diff --git a/src/main/java/org/ldk/structs/ThreeTuple_OffersMessageDestinationBlindedPathZ.java b/src/main/java/org/ldk/structs/ThreeTuple_OffersMessageDestinationBlindedPathZ.java new file mode 100644 index 00000000..65ae23c5 --- /dev/null +++ b/src/main/java/org/ldk/structs/ThreeTuple_OffersMessageDestinationBlindedPathZ.java @@ -0,0 +1,95 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * A Tuple + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ThreeTuple_OffersMessageDestinationBlindedPathZ extends CommonBase { + ThreeTuple_OffersMessageDestinationBlindedPathZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C3Tuple_OffersMessageDestinationBlindedPathZ_free(ptr); } + } + + /** + * + */ + public OffersMessage get_a() { + long ret = bindings.C3Tuple_OffersMessageDestinationBlindedPathZ_get_a(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.OffersMessage ret_hu_conv = org.ldk.structs.OffersMessage.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * + */ + public Destination get_b() { + long ret = bindings.C3Tuple_OffersMessageDestinationBlindedPathZ_get_b(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * + */ + public BlindedPath get_c() { + long ret = bindings.C3Tuple_OffersMessageDestinationBlindedPathZ_get_c(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.BlindedPath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPath(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public ThreeTuple_OffersMessageDestinationBlindedPathZ clone() { + long ret = bindings.C3Tuple_OffersMessageDestinationBlindedPathZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ThreeTuple_OffersMessageDestinationBlindedPathZ ret_hu_conv = new ThreeTuple_OffersMessageDestinationBlindedPathZ(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Creates a new C3Tuple_OffersMessageDestinationBlindedPathZ from the contained elements. + */ + public static ThreeTuple_OffersMessageDestinationBlindedPathZ of(org.ldk.structs.OffersMessage a, org.ldk.structs.Destination b, org.ldk.structs.BlindedPath c) { + long ret = bindings.C3Tuple_OffersMessageDestinationBlindedPathZ_new(a.ptr, b.ptr, c == null ? 0 : c.ptr); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + Reference.reachabilityFence(c); + if (ret >= 0 && ret <= 4096) { return null; } + ThreeTuple_OffersMessageDestinationBlindedPathZ ret_hu_conv = new ThreeTuple_OffersMessageDestinationBlindedPathZ(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(c); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ThreeTuple_OnionMessageContentsDestinationBlindedPathZ.java b/src/main/java/org/ldk/structs/ThreeTuple_OnionMessageContentsDestinationBlindedPathZ.java new file mode 100644 index 00000000..f9c41bf6 --- /dev/null +++ b/src/main/java/org/ldk/structs/ThreeTuple_OnionMessageContentsDestinationBlindedPathZ.java @@ -0,0 +1,95 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * A Tuple + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ThreeTuple_OnionMessageContentsDestinationBlindedPathZ extends CommonBase { + ThreeTuple_OnionMessageContentsDestinationBlindedPathZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free(ptr); } + } + + /** + * + */ + public OnionMessageContents get_a() { + long ret = bindings.C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + OnionMessageContents ret_hu_conv = new OnionMessageContents(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * + */ + public Destination get_b() { + long ret = bindings.C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Destination ret_hu_conv = org.ldk.structs.Destination.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * + */ + public BlindedPath get_c() { + long ret = bindings.C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.BlindedPath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPath(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public ThreeTuple_OnionMessageContentsDestinationBlindedPathZ clone() { + long ret = bindings.C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ThreeTuple_OnionMessageContentsDestinationBlindedPathZ ret_hu_conv = new ThreeTuple_OnionMessageContentsDestinationBlindedPathZ(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; + return ret_hu_conv; + } + + /** + * Creates a new C3Tuple_OnionMessageContentsDestinationBlindedPathZ from the contained elements. + */ + public static ThreeTuple_OnionMessageContentsDestinationBlindedPathZ of(org.ldk.structs.OnionMessageContents a, org.ldk.structs.Destination b, org.ldk.structs.BlindedPath c) { + long ret = bindings.C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new(a.ptr, b.ptr, c == null ? 0 : c.ptr); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + Reference.reachabilityFence(c); + if (ret >= 0 && ret <= 4096) { return null; } + ThreeTuple_OnionMessageContentsDestinationBlindedPathZ ret_hu_conv = new ThreeTuple_OnionMessageContentsDestinationBlindedPathZ(null, ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(b); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(c); }; + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index aa0110f1..b6e56253 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -144,7 +144,7 @@ public class UtilMethods { } /** - * Fetches the set of [`InitFeatures`] flags which are provided by or required by + * Fetches the set of [`InitFeatures`] flags that are provided by or required by * [`ChannelManager`]. */ public static InitFeatures provided_init_features(org.ldk.structs.UserConfig config) { @@ -649,28 +649,51 @@ public class UtilMethods { } /** - * Create an onion message with contents `message` to the destination of `path`. - * Returns (introduction_node_id, onion_msg) + * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of + * `path`. + * + * Returns both the node id of the peer to send the message to and the message itself. * * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents message, @Nullable org.ldk.structs.BlindedPath reply_path) { - long ret = bindings.create_onion_message(entropy_source.ptr, node_signer.ptr, path == null ? 0 : path.ptr, message.ptr, reply_path == null ? 0 : reply_path.ptr); + public static Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents contents, @Nullable org.ldk.structs.BlindedPath reply_path) { + long ret = bindings.create_onion_message(entropy_source.ptr, node_signer.ptr, path == null ? 0 : path.ptr, contents.ptr, reply_path == null ? 0 : reply_path.ptr); Reference.reachabilityFence(entropy_source); Reference.reachabilityFence(node_signer); Reference.reachabilityFence(path); - Reference.reachabilityFence(message); + Reference.reachabilityFence(contents); Reference.reachabilityFence(reply_path); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ ret_hu_conv = Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(message); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(contents); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reply_path); }; return ret_hu_conv; } + /** + * Decode one layer of an incoming [`OnionMessage`]. + * + * Returns either the next layer of the onion for forwarding or the decrypted content for the + * receiver. + */ + public static Result_PeeledOnionNoneZ peel_onion_message(org.ldk.structs.OnionMessage msg, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.structs.CustomOnionMessageHandler custom_handler) { + long ret = bindings.peel_onion_message(msg == null ? 0 : msg.ptr, node_signer.ptr, logger.ptr, custom_handler.ptr); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(node_signer); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(custom_handler); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PeeledOnionNoneZ ret_hu_conv = Result_PeeledOnionNoneZ.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(custom_handler); }; + return ret_hu_conv; + } + /** * Returns whether `tlv_type` corresponds to a TLV record for Offers. */ diff --git a/src/main/java/org/ldk/structs/UtxoLookup.java b/src/main/java/org/ldk/structs/UtxoLookup.java index 6087060d..c9346de4 100644 --- a/src/main/java/org/ldk/structs/UtxoLookup.java +++ b/src/main/java/org/ldk/structs/UtxoLookup.java @@ -39,19 +39,19 @@ public class UtxoLookup extends CommonBase { public static interface UtxoLookupInterface { /** * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `genesis_hash` is for a different chain or if such a transaction output - * is unknown. + * Returns an error if `chain_hash` is for a different chain or if such a transaction output is + * unknown. * * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ - UtxoResult get_utxo(byte[] genesis_hash, long short_channel_id); + UtxoResult get_utxo(byte[] chain_hash, long short_channel_id); } private static class LDKUtxoLookupHolder { UtxoLookup held; } public static UtxoLookup new_impl(UtxoLookupInterface arg) { final LDKUtxoLookupHolder impl_holder = new LDKUtxoLookupHolder(); impl_holder.held = new UtxoLookup(new bindings.LDKUtxoLookup() { - @Override public long get_utxo(byte[] genesis_hash, long short_channel_id) { - UtxoResult ret = arg.get_utxo(genesis_hash, short_channel_id); + @Override public long get_utxo(byte[] chain_hash, long short_channel_id) { + UtxoResult ret = arg.get_utxo(chain_hash, short_channel_id); Reference.reachabilityFence(arg); long result = ret == null ? 0 : ret.clone_ptr(); if (impl_holder.held != null) { impl_holder.held.ptrs_to.add(ret); }; @@ -62,15 +62,15 @@ public class UtxoLookup extends CommonBase { } /** * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `genesis_hash` is for a different chain or if such a transaction output - * is unknown. + * Returns an error if `chain_hash` is for a different chain or if such a transaction output is + * unknown. * * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ - public UtxoResult get_utxo(byte[] genesis_hash, long short_channel_id) { - long ret = bindings.UtxoLookup_get_utxo(this.ptr, InternalUtils.check_arr_len(genesis_hash, 32), short_channel_id); + public UtxoResult get_utxo(byte[] chain_hash, long short_channel_id) { + long ret = bindings.UtxoLookup_get_utxo(this.ptr, InternalUtils.check_arr_len(chain_hash, 32), short_channel_id); Reference.reachabilityFence(this); - Reference.reachabilityFence(genesis_hash); + Reference.reachabilityFence(chain_hash); Reference.reachabilityFence(short_channel_id); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.UtxoResult ret_hu_conv = org.ldk.structs.UtxoResult.constr_from_ptr(ret); diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 053b6bcd..e7ef65a1 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -357,11 +357,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 @@ -388,6 +389,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; @@ -438,6 +440,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;"); @@ -493,6 +497,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: @@ -640,41 +646,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(); } } @@ -2332,6 +2356,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; @@ -2804,7 +2880,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; @@ -2899,7 +2975,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); @@ -2915,14 +2991,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); @@ -3179,8 +3255,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"); @@ -3205,7 +3281,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, @@ -3268,7 +3344,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; @@ -3277,8 +3353,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); } @@ -5546,7 +5622,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); @@ -5555,12 +5631,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."); @@ -5600,16 +5676,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; } @@ -6693,58 +6769,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++) { @@ -7344,6 +7368,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); @@ -7364,6 +7437,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; @@ -9712,94 +9941,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); @@ -9815,8 +9965,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) { @@ -9829,15 +9979,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) { @@ -9850,7 +10000,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); @@ -9861,14 +10011,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); @@ -9877,32 +10027,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); @@ -9910,60 +10060,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; @@ -12764,6 +12956,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; @@ -12814,6 +13008,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); @@ -12955,6 +13154,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); @@ -14209,6 +14413,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; @@ -16072,7 +16369,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; @@ -16981,7 +17278,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); @@ -16992,10 +17289,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); @@ -17084,8 +17381,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, @@ -17122,7 +17419,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), }; @@ -17625,16 +17922,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; @@ -18301,14 +18748,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); @@ -18324,8 +18776,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) { @@ -18335,91 +18787,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); @@ -18430,21 +18814,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; @@ -18556,9 +18940,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"); @@ -18567,6 +18950,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"); @@ -18579,25 +18964,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); } @@ -18613,6 +18993,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); } @@ -19005,14 +19399,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); @@ -19028,8 +19424,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) { @@ -19037,90 +19433,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); @@ -19129,25 +19460,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); @@ -19156,25 +19489,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; @@ -19191,11 +19532,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; @@ -19211,12 +19555,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; @@ -19229,12 +19573,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; @@ -19649,40 +20011,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; @@ -19802,37 +20130,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; @@ -21470,6 +21767,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(); @@ -24972,114 +25377,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); @@ -25947,6 +26244,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); @@ -25996,6 +26383,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); @@ -27319,154 +27819,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) { @@ -33900,6 +34422,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(); @@ -37036,23 +37589,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; } @@ -40795,6 +41363,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); @@ -41042,6 +41665,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); @@ -47786,6 +48420,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"); @@ -51482,17 +52124,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); @@ -54273,6 +54904,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); @@ -59643,6 +60285,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); @@ -60676,6 +61327,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; @@ -61347,14 +62003,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; } @@ -63002,6 +63658,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); @@ -66930,6 +67602,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); @@ -68071,7 +69236,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; @@ -68083,17 +69311,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); } @@ -68147,7 +69410,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); @@ -68158,17 +69421,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); } @@ -68183,17 +69449,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); @@ -68273,12 +69528,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); @@ -68476,89 +69725,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) { @@ -68876,6 +70141,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); @@ -70354,6 +71631,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); @@ -71220,15 +72507,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); @@ -71247,167 +72525,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); @@ -71598,319 +72715,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); 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); diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index 5e29d5a6..cb9d5d9b 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -407,6 +407,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zus JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_NoneNoneZ_get_ok @@ -617,10 +649,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1validate_ /* * Class: org_ldk_impl_bindings - * Method: EcdsaChannelSigner_sign_holder_commitment_and_htlcs + * Method: EcdsaChannelSigner_sign_holder_commitment * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment_1and_1htlcs +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EcdsaChannelSigner_1sign_1holder_1commitment (JNIEnv *, jclass, jlong, jlong); /* @@ -1751,38 +1783,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeEr JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1SocketAddressZZ_1ref_1from_1ptr (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_get_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_get_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1get_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_get_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_get_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1get_1err - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: LDKCOption_TxOutZ_ref_from_ptr @@ -2023,6 +2023,30 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesP JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicKeyZ_1get_1b (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_StrZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_StrZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1StrZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_get_ok + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_get_err + * Signature: (J)Lorg/ldk/enums/Bolt12SemanticError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_get_ok @@ -2039,6 +2063,54 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBy JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKOffersMessage_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKOffersMessage; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_OffersMessageZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_OffersMessageZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKDestination_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKDestination; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OffersMessageDestinationBlindedPathZ_get_a + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1a + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OffersMessageDestinationBlindedPathZ_get_b + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1b + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OffersMessageDestinationBlindedPathZ_get_c + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1get_1c + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_get_ok @@ -2673,66 +2745,74 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1get_ /* * Class: org_ldk_impl_bindings - * Method: LDKOffersMessage_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKOffersMessage; + * Method: LDKOnionMessageContents_new + * Signature: (Lorg/ldk/impl/bindings/LDKOnionMessageContents;)J */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOffersMessage_1ref_1from_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1new + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: OnionMessageContents_tlv_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1tlv_1type (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCOption_OffersMessageZ_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_OffersMessageZ; + * Method: OnionMessageContents_write + * Signature: (J)[B */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OffersMessageZ_1ref_1from_1ptr +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCustomOnionMessageContents_new - * Signature: (Lorg/ldk/impl/bindings/LDKCustomOnionMessageContents;)J + * Method: LDKCOption_OnionMessageContentsZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_OnionMessageContentsZ; */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCustomOnionMessageContents_1new - (JNIEnv *, jclass, jobject); +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1OnionMessageContentsZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CustomOnionMessageContents_tlv_type + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1tlv_1type +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CustomOnionMessageContents_write - * Signature: (J)[B + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_get_err + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1write +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCOption_CustomOnionMessageContentsZ_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_CustomOnionMessageContentsZ; + * Method: C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_a + * Signature: (J)J */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CustomOnionMessageContentsZ_1ref_1from_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1a (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_ok + * Method: C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_b * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1b (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_get_err + * Method: C3Tuple_OnionMessageContentsDestinationBlindedPathZ_get_c * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1get_1c (JNIEnv *, jclass, jlong); /* @@ -4655,6 +4735,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOn JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKParsedOnionMessageContents_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKParsedOnionMessageContents; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParsedOnionMessageContents_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKPeeledOnion_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKPeeledOnion; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPeeledOnion_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PeeledOnionNoneZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PeeledOnionNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_NoneSendErrorZ_get_ok @@ -5337,10 +5449,34 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1provid /* * Class: org_ldk_impl_bindings - * Method: ChannelMessageHandler_get_genesis_hashes + * Method: ChannelMessageHandler_get_chain_hashes * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1genesis_1hashes +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1get_1chain_1hashes + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKOffersMessageHandler_new + * Signature: (Lorg/ldk/impl/bindings/LDKOffersMessageHandler;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: OffersMessageHandler_handle_message + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: OffersMessageHandler_release_pending_messages + * Signature: (J)[J + */ +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1release_1pending_1messages (JNIEnv *, jclass, jlong); /* @@ -5463,37 +5599,13 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provid JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1provided_1init_1features (JNIEnv *, jclass, jlong, jbyteArray); -/* - * Class: org_ldk_impl_bindings - * Method: LDKOnionMessageProvider_new - * Signature: (Lorg/ldk/impl/bindings/LDKOnionMessageProvider;)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageProvider_1new - (JNIEnv *, jclass, jobject); - -/* - * Class: org_ldk_impl_bindings - * Method: OnionMessageProvider_next_onion_message_for_peer - * Signature: (J[B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1next_1onion_1message_1for_1peer - (JNIEnv *, jclass, jlong, jbyteArray); - /* * Class: org_ldk_impl_bindings * Method: LDKOnionMessageHandler_new - * Signature: (Lorg/ldk/impl/bindings/LDKOnionMessageHandler;Lorg/ldk/impl/bindings/LDKOnionMessageProvider;)J + * Signature: (Lorg/ldk/impl/bindings/LDKOnionMessageHandler;)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1new - (JNIEnv *, jclass, jobject, jobject); - -/* - * Class: org_ldk_impl_bindings - * Method: LDKOnionMessageHandler_get_OnionMessageProvider - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1OnionMessageProvider - (JNIEnv *, jclass, jlong); + (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings @@ -5503,6 +5615,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageHandler_1get_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1handle_1onion_1message (JNIEnv *, jclass, jlong, jbyteArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: OnionMessageHandler_next_onion_message_for_peer + * Signature: (J[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageHandler_1next_1onion_1message_1for_1peer + (JNIEnv *, jclass, jlong, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: OnionMessageHandler_peer_connected @@ -5599,22 +5719,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provide JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1provided_1init_1features (JNIEnv *, jclass, jlong, jbyteArray); -/* - * Class: org_ldk_impl_bindings - * Method: LDKOffersMessageHandler_new - * Signature: (Lorg/ldk/impl/bindings/LDKOffersMessageHandler;)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOffersMessageHandler_1new - (JNIEnv *, jclass, jobject); - -/* - * Class: org_ldk_impl_bindings - * Method: OffersMessageHandler_handle_message - * Signature: (JJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OffersMessageHandler_1handle_1message - (JNIEnv *, jclass, jlong, jlong); - /* * Class: org_ldk_impl_bindings * Method: LDKCustomOnionMessageHandler_new @@ -5639,6 +5743,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1ha JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1read_1custom_1message (JNIEnv *, jclass, jlong, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: CustomOnionMessageHandler_release_pending_custom_messages + * Signature: (J)[J + */ +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1release_1pending_1custom_1messages + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKSocketDescriptor_new @@ -5719,14 +5831,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKScore_1get_1ScoreUpdate JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Score_1write (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: LDKDestination_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKDestination; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKDestination_1ref_1from_1ptr - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: LDKMessageRouter_new @@ -5743,14 +5847,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageRouter_1new JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageRouter_1find_1path (JNIEnv *, jclass, jlong, jbyteArray, jobjectArray, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: LDKOnionMessageContents_ref_from_ptr - * Signature: (J)Lorg/ldk/impl/bindings/LDKOnionMessageContents; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKOnionMessageContents_1ref_1from_1ptr - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: LDKCoinSelectionSource_new @@ -6815,6 +6911,102 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8Zus JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1CVec_1u8ZusizeZNoneZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelDerivationParametersDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_HTLCDescriptorDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_NoneNoneZ_ok @@ -9743,102 +9935,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1SocketAddressZZ_1clone (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ChannelDerivationParametersDecodeErrorZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelDerivationParametersDecodeErrorZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_HTLCDescriptorDecodeErrorZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCDescriptorDecodeErrorZ_1clone - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: CVec_HTLCOutputInCommitmentZ_free @@ -10543,6 +10639,94 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ThirtyTwoBytesPublicK JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1ThirtyTwoBytesPublicKeyZZ_1free (JNIEnv *, jclass, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: COption_StrZ_some + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1some + (JNIEnv *, jclass, jstring); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_StrZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_StrZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_StrZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_StrZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1StrZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_ok + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1ok + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_err + * Signature: (Lorg/ldk/enums/Bolt12SemanticError;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1err + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NoneBolt12SemanticErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneBolt12SemanticErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok @@ -10591,6 +10775,86 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBy JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1ThirtyTwoBytesThirtyTwoBytesZNoneZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: COption_OffersMessageZ_some + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_OffersMessageZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_OffersMessageZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_OffersMessageZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_OffersMessageZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OffersMessageDestinationBlindedPathZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OffersMessageDestinationBlindedPathZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OffersMessageDestinationBlindedPathZ_new + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1new + (JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C3Tuple_OffersMessageDestinationBlindedPathZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OffersMessageDestinationBlindedPathZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CVec_C3Tuple_OffersMessageDestinationBlindedPathZZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OffersMessageDestinationBlindedPathZZ_1free + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: CResult_CounterpartyForwardingInfoDecodeErrorZ_ok @@ -11633,131 +11897,131 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ /* * Class: org_ldk_impl_bindings - * Method: COption_OffersMessageZ_some + * Method: COption_OnionMessageContentsZ_some * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1some +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1some (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_OffersMessageZ_none + * Method: COption_OnionMessageContentsZ_none * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1none +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1none (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: COption_OffersMessageZ_free + * Method: COption_OnionMessageContentsZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_OffersMessageZ_clone_ptr + * Method: COption_OnionMessageContentsZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_OffersMessageZ_clone + * Method: COption_OnionMessageContentsZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OffersMessageZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1OnionMessageContentsZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_CustomOnionMessageContentsZ_some + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1some +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_CustomOnionMessageContentsZ_none - * Signature: ()J + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_err + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1none - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_CustomOnionMessageContentsZ_free - * Signature: (J)V + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok + * Signature: (J)Z */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1free +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_CustomOnionMessageContentsZ_clone_ptr - * Signature: (J)J + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone_1ptr +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: COption_CustomOnionMessageContentsZ_clone + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CustomOnionMessageContentsZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok + * Method: CResult_COption_OnionMessageContentsZDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1OnionMessageContentsZDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err + * Method: C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok - * Signature: (J)Z + * Method: C3Tuple_OnionMessageContentsDestinationBlindedPathZ_clone + * Signature: (J)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1is_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free - * Signature: (J)V + * Method: C3Tuple_OnionMessageContentsDestinationBlindedPathZ_new + * Signature: (JJJ)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1free - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1new + (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr - * Signature: (J)J + * Method: C3Tuple_OnionMessageContentsDestinationBlindedPathZ_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone_1ptr +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1OnionMessageContentsDestinationBlindedPathZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone - * Signature: (J)J + * Method: CVec_C3Tuple_OnionMessageContentsDestinationBlindedPathZZ_free + * Signature: ([J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1CustomOnionMessageContentsZDecodeErrorZ_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1OnionMessageContentsDestinationBlindedPathZZ_1free + (JNIEnv *, jclass, jlongArray); /* * Class: org_ldk_impl_bindings @@ -17415,6 +17679,38 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKe JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PublicKeyOnionMessageZSendErrorZ_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PeeledOnionNoneZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PeeledOnionNoneZ_err + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1err + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PeeledOnionNoneZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PeeledOnionNoneZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PeeledOnionNoneZ_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_NoneSendErrorZ_ok @@ -19753,34 +20049,58 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone /* * Class: org_ldk_impl_bindings - * Method: ConfirmationTarget_mempool_minimum + * Method: ConfirmationTarget_on_chain_sweep * Signature: ()Lorg/ldk/enums/ConfirmationTarget; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1mempool_1minimum +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1on_1chain_1sweep (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: ConfirmationTarget_background + * Method: ConfirmationTarget_max_allowed_non_anchor_channel_remote_fee * Signature: ()Lorg/ldk/enums/ConfirmationTarget; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1background +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1max_1allowed_1non_1anchor_1channel_1remote_1fee (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: ConfirmationTarget_normal + * Method: ConfirmationTarget_min_allowed_anchor_channel_remote_fee * Signature: ()Lorg/ldk/enums/ConfirmationTarget; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1anchor_1channel_1remote_1fee (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: ConfirmationTarget_high_priority + * Method: ConfirmationTarget_min_allowed_non_anchor_channel_remote_fee * Signature: ()Lorg/ldk/enums/ConfirmationTarget; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1min_1allowed_1non_1anchor_1channel_1remote_1fee + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ConfirmationTarget_anchor_channel_fee + * Signature: ()Lorg/ldk/enums/ConfirmationTarget; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1anchor_1channel_1fee + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ConfirmationTarget_non_anchor_channel_fee + * Signature: ()Lorg/ldk/enums/ConfirmationTarget; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1non_1anchor_1channel_1fee + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ConfirmationTarget_channel_close_minimum + * Signature: ()Lorg/ldk/enums/ConfirmationTarget; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1channel_1close_1minimum (JNIEnv *, jclass); /* @@ -21855,6 +22175,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbou JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel_1from_1trusted_1peer_10conf (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_pay_for_offer + * Signature: (JJJJJ[BJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1pay_1for_1offer + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_request_refund_payment + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1request_1refund_1payment + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_create_inbound_payment @@ -22007,6 +22343,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1init_1feature JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_as_OffersMessageHandler + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1OffersMessageHandler + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: provided_init_features @@ -26463,6 +26807,14 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SocketAddressParseError_1e JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_parse_1onion_1address (JNIEnv *, jclass, jstring, jshort); +/* + * Class: org_ldk_impl_bindings + * Method: SocketAddress_to_str + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SocketAddress_1to_1str + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: SocketAddress_from_str @@ -28799,14 +29151,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1M JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: IgnoringMessageHandler_as_OnionMessageProvider - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1OnionMessageProvider - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: IgnoringMessageHandler_as_OnionMessageHandler @@ -30519,6 +30863,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CommitmentTransaction_per_commitment_point + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1per_1commitment_1point + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CommitmentTransaction_to_broadcaster_value_sat @@ -34407,6 +34759,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone_1ptr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErroneousField_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: InvoiceError_from_string + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceError_1from_1string + (JNIEnv *, jclass, jstring); + /* * Class: org_ldk_impl_bindings * Method: InvoiceError_write @@ -35151,6 +35511,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missin JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1missing_1payer_1id (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: Bolt12SemanticError_duplicate_payment_id + * Signature: ()Lorg/ldk/enums/Bolt12SemanticError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Bolt12SemanticError_1duplicate_1payment_1id + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: Bolt12SemanticError_missing_paths @@ -35641,10 +36009,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1handle_1network_ /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_get_genesis_hash + * Method: NetworkGraph_get_chain_hash * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1genesis_1hash +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1get_1chain_1hash (JNIEnv *, jclass, jlong); /* @@ -36687,6 +37055,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: NetworkGraph_verify_channel_update + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1verify_1channel_1update + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ReadOnlyNetworkGraph_channel @@ -39071,6 +39447,326 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1re JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1create_1spendable_1outputs_1psbt (JNIEnv *, jclass, jlongArray, jlongArray, jbyteArray, jint, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_get_value_satoshis + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_set_value_satoshis + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_get_keys_id + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_set_keys_id + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_get_transaction_parameters + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_set_transaction_parameters + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_new + * Signature: (J[BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1new + (JNIEnv *, jclass, jlong, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDerivationParameters_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_get_channel_derivation_parameters + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_set_channel_derivation_parameters + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_get_per_commitment_number + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_set_per_commitment_number + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_get_per_commitment_point + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_set_per_commitment_point + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_get_feerate_per_kw + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1feerate_1per_1kw + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_set_feerate_per_kw + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1feerate_1per_1kw + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_get_htlc + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_set_htlc + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_get_preimage + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_set_preimage + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_get_counterparty_sig + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_set_counterparty_sig + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_outpoint + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_previous_utxo + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_unsigned_tx_input + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_tx_output + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_witness_script + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_tx_input_witness + * Signature: (J[B[B)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1input_1witness + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: HTLCDescriptor_derive_channel_signer + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1derive_1channel_1signer + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelSigner_free @@ -39799,6 +40495,46 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SendError_1eq JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: PeeledOnion_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PeeledOnion_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PeeledOnion_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PeeledOnion_forward + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1forward + (JNIEnv *, jclass, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PeeledOnion_receive + * Signature: (J[BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeeledOnion_1receive + (JNIEnv *, jclass, jlong, jbyteArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: create_onion_message @@ -39807,6 +40543,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageHandler_1fre JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1onion_1message (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: peel_onion_message + * Signature: (JJJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_peel_1onion_1message + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: OnionMessenger_new @@ -39831,14 +40575,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1send_1onion_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageHandler (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: OnionMessenger_as_OnionMessageProvider - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessenger_1as_1OnionMessageProvider - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: OffersMessageHandler_free @@ -39903,14 +40639,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OffersMessage_1invoice_1error JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OffersMessage_1is_1known_1type (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: OffersMessage_tlv_type - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OffersMessage_1tlv_1type - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: OffersMessage_write @@ -40041,66 +40769,82 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Packet_1write /* * Class: org_ldk_impl_bindings - * Method: OnionMessageContents_free + * Method: ParsedOnionMessageContents_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: OnionMessageContents_clone_ptr + * Method: ParsedOnionMessageContents_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: OnionMessageContents_clone + * Method: ParsedOnionMessageContents_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: OnionMessageContents_offers + * Method: ParsedOnionMessageContents_offers * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1offers +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1offers (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: OnionMessageContents_custom + * Method: ParsedOnionMessageContents_custom * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1custom +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1custom + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParsedOnionMessageContents_as_OnionMessageContents + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1as_1OnionMessageContents + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParsedOnionMessageContents_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ParsedOnionMessageContents_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CustomOnionMessageContents_clone_ptr + * Method: OnionMessageContents_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CustomOnionMessageContents_clone + * Method: OnionMessageContents_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CustomOnionMessageContents_free + * Method: OnionMessageContents_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomOnionMessageContents_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageContents_1free (JNIEnv *, jclass, jlong); /* @@ -40279,6 +41023,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlindedHop_1hash JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlindedHop_1eq (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: BlindedPath_one_hop_for_message + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlindedPath_1one_1hop_1for_1message + (JNIEnv *, jclass, jbyteArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: BlindedPath_new_for_message @@ -41351,6 +42103,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimable JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1claimed (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong, jlong, jlongArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Event_invoice_request_failed + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1invoice_1request_1failed + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: Event_payment_sent @@ -41799,14 +42559,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossi JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: OnionMessageProvider_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OnionMessageProvider_1free - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: EventsProvider_free @@ -41823,110 +42575,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_get_value_satoshis - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1value_1satoshis - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_set_value_satoshis - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1value_1satoshis - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_get_keys_id - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1keys_1id - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_set_keys_id - * Signature: (J[B)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1keys_1id - (JNIEnv *, jclass, jlong, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_get_transaction_parameters - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1get_1transaction_1parameters - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_set_transaction_parameters - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1set_1transaction_1parameters - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_new - * Signature: (J[BJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1new - (JNIEnv *, jclass, jlong, jbyteArray, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_eq - * Signature: (JJ)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1eq - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_write - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1write - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelDerivationParameters_read - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDerivationParameters_1read - (JNIEnv *, jclass, jbyteArray); - /* * Class: org_ldk_impl_bindings * Method: AnchorDescriptor_free @@ -42039,206 +42687,6 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1tx_1in JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnchorDescriptor_1derive_1channel_1signer (JNIEnv *, jclass, jlong, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_get_channel_derivation_parameters - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1channel_1derivation_1parameters - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_set_channel_derivation_parameters - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1channel_1derivation_1parameters - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_get_per_commitment_number - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1number - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_set_per_commitment_number - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1number - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_get_per_commitment_point - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1per_1commitment_1point - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_set_per_commitment_point - * Signature: (J[B)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1per_1commitment_1point - (JNIEnv *, jclass, jlong, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_get_htlc - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1htlc - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_set_htlc - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1htlc - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_get_preimage - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1preimage - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_set_preimage - * Signature: (JJ)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1preimage - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_get_counterparty_sig - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1get_1counterparty_1sig - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_set_counterparty_sig - * Signature: (J[B)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1set_1counterparty_1sig - (JNIEnv *, jclass, jlong, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_eq - * Signature: (JJ)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1eq - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_write - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1write - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_read - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1read - (JNIEnv *, jclass, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_outpoint - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1outpoint - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_previous_utxo - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1previous_1utxo - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_unsigned_tx_input - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1unsigned_1tx_1input - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_tx_output - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1output - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_witness_script - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1witness_1script - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_tx_input_witness - * Signature: (J[B[B)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1tx_1input_1witness - (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: HTLCDescriptor_derive_channel_signer - * Signature: (JJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCDescriptor_1derive_1channel_1signer - (JNIEnv *, jclass, jlong, jlong); - /* * Class: org_ldk_impl_bindings * Method: BumpTransactionEvent_free diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ.h deleted file mode 100644 index 279850d9..00000000 --- a/src/main/jni/org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ */ - -#ifndef _Included_org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ -#define _Included_org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_ldk_impl_bindings_LDKCOption_CustomOnionMessageContentsZ - * Method: init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CustomOnionMessageContentsZ_init - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ.h new file mode 100644 index 00000000..d0de9621 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ +#define _Included_org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_OnionMessageContentsZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1OnionMessageContentsZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_StrZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_StrZ.h new file mode 100644 index 00000000..ceb71989 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_StrZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_StrZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_StrZ +#define _Included_org_ldk_impl_bindings_LDKCOption_StrZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_StrZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1StrZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_boolZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_boolZ.h new file mode 100644 index 00000000..96f883a1 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_boolZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_boolZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_boolZ +#define _Included_org_ldk_impl_bindings_LDKCOption_boolZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_boolZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1boolZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKOnionMessageContents.h b/src/main/jni/org_ldk_impl_bindings_LDKOnionMessageContents.h deleted file mode 100644 index 15f0fd5f..00000000 --- a/src/main/jni/org_ldk_impl_bindings_LDKOnionMessageContents.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_ldk_impl_bindings_LDKOnionMessageContents */ - -#ifndef _Included_org_ldk_impl_bindings_LDKOnionMessageContents -#define _Included_org_ldk_impl_bindings_LDKOnionMessageContents -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_ldk_impl_bindings_LDKOnionMessageContents - * Method: init - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKOnionMessageContents_init - (JNIEnv *, jclass); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKParsedOnionMessageContents.h b/src/main/jni/org_ldk_impl_bindings_LDKParsedOnionMessageContents.h new file mode 100644 index 00000000..9d7a5865 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKParsedOnionMessageContents.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKParsedOnionMessageContents */ + +#ifndef _Included_org_ldk_impl_bindings_LDKParsedOnionMessageContents +#define _Included_org_ldk_impl_bindings_LDKParsedOnionMessageContents +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKParsedOnionMessageContents + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParsedOnionMessageContents_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKPeeledOnion.h b/src/main/jni/org_ldk_impl_bindings_LDKPeeledOnion.h new file mode 100644 index 00000000..f5d44e29 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKPeeledOnion.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKPeeledOnion */ + +#ifndef _Included_org_ldk_impl_bindings_LDKPeeledOnion +#define _Included_org_ldk_impl_bindings_LDKPeeledOnion +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKPeeledOnion + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPeeledOnion_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif -- 2.30.2