From: Matt Corallo Date: Wed, 13 Apr 2022 17:07:02 +0000 (+0000) Subject: [Java] Update auto-generated bindings X-Git-Tag: v0.0.106.0~1^2~9 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=ff3dacec3be60f870d81f6df11bd9fff92aa6047;p=ldk-java [Java] Update auto-generated bindings --- diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 2417e565..24f73377 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -79,6 +79,35 @@ public class bindings { static { Secp256k1Error.values(); /* Force enum statics to run */ } static { SemanticError.values(); /* Force enum statics to run */ } static { SiPrefix.values(); /* Force enum statics to run */ } + public static class LDKBech32Error { + private LDKBech32Error() {} + public final static class MissingSeparator extends LDKBech32Error { + MissingSeparator() { } + } + public final static class InvalidChecksum extends LDKBech32Error { + InvalidChecksum() { } + } + public final static class InvalidLength extends LDKBech32Error { + InvalidLength() { } + } + public final static class InvalidChar extends LDKBech32Error { + public int invalid_char; + InvalidChar(int invalid_char) { this.invalid_char = invalid_char; } + } + public final static class InvalidData extends LDKBech32Error { + public byte invalid_data; + InvalidData(byte invalid_data) { this.invalid_data = invalid_data; } + } + public final static class InvalidPadding extends LDKBech32Error { + InvalidPadding() { } + } + public final static class MixedCase extends LDKBech32Error { + MixedCase() { } + } + static native void init(); + } + static { LDKBech32Error.init(); } + public static native LDKBech32Error LDKBech32Error_ref_from_ptr(long ptr); // struct LDKCVec_u8Z TxOut_get_script_pubkey (struct LDKTxOut* thing) public static native byte[] TxOut_get_script_pubkey(long thing); // uint64_t TxOut_get_value (struct LDKTxOut* thing) @@ -264,8 +293,8 @@ public class bindings { public static class LDKClosureReason { private LDKClosureReason() {} public final static class CounterpartyForceClosed extends LDKClosureReason { - public String peer_msg; - CounterpartyForceClosed(String peer_msg) { this.peer_msg = peer_msg; } + public java.lang.String peer_msg; + CounterpartyForceClosed(java.lang.String peer_msg) { this.peer_msg = peer_msg; } } public final static class HolderForceClosed extends LDKClosureReason { HolderForceClosed() { } @@ -280,8 +309,8 @@ public class bindings { FundingTimedOut() { } } public final static class ProcessingError extends LDKClosureReason { - public String err; - ProcessingError(String err) { this.err = err; } + public java.lang.String err; + ProcessingError(java.lang.String err) { this.err = err; } } public final static class DisconnectedPeer extends LDKClosureReason { DisconnectedPeer() { } @@ -450,7 +479,8 @@ public class bindings { public byte[] counterparty_node_id; public long funding_satoshis; public long push_msat; - OpenChannelRequest(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat) { this.temporary_channel_id = temporary_channel_id; this.counterparty_node_id = counterparty_node_id; this.funding_satoshis = funding_satoshis; this.push_msat = push_msat; } + public long channel_type; + OpenChannelRequest(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, long channel_type) { this.temporary_channel_id = temporary_channel_id; this.counterparty_node_id = counterparty_node_id; this.funding_satoshis = funding_satoshis; this.push_msat = push_msat; this.channel_type = channel_type; } } static native void init(); } @@ -483,8 +513,8 @@ public class bindings { IgnoreError() { } } public final static class IgnoreAndLog extends LDKErrorAction { - public Level ignore_and_log; - IgnoreAndLog(Level ignore_and_log) { this.ignore_and_log = ignore_and_log; } + public org.ldk.enums.Level ignore_and_log; + IgnoreAndLog(org.ldk.enums.Level ignore_and_log) { this.ignore_and_log = ignore_and_log; } } public final static class IgnoreDuplicateGossip extends LDKErrorAction { IgnoreDuplicateGossip() { } @@ -495,8 +525,8 @@ public class bindings { } public final static class SendWarningMessage extends LDKErrorAction { public long msg; - public Level log_level; - SendWarningMessage(long msg, Level log_level) { this.msg = msg; this.log_level = log_level; } + public org.ldk.enums.Level log_level; + SendWarningMessage(long msg, org.ldk.enums.Level log_level) { this.msg = msg; this.log_level = log_level; } } static native void init(); } @@ -597,6 +627,11 @@ public class bindings { public long msg; SendReplyChannelRange(byte[] node_id, long msg) { this.node_id = node_id; this.msg = msg; } } + public final static class SendGossipTimestampFilter extends LDKMessageSendEvent { + public byte[] node_id; + public long msg; + SendGossipTimestampFilter(byte[] node_id, long msg) { this.node_id = node_id; this.msg = msg; } + } static native void init(); } static { LDKMessageSendEvent.init(); } @@ -613,14 +648,6 @@ public class bindings { public static native long CResult_ScorerDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ScorerDecodeErrorZ_get_err(LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ScorerDecodeErrorZ_get_err(long owner); - // struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(long owner); - // struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner); - public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(long owner); - // struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner); - public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(long owner); - // struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner); - public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(long owner); // struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner); public static native long CResult_ProbabilisticScorerDecodeErrorZ_get_ok(long owner); // struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner); @@ -776,21 +803,21 @@ public class bindings { public static class LDKAPIError { private LDKAPIError() {} public final static class APIMisuseError extends LDKAPIError { - public String err; - APIMisuseError(String err) { this.err = err; } + public java.lang.String err; + APIMisuseError(java.lang.String err) { this.err = err; } } public final static class FeeRateTooHigh extends LDKAPIError { - public String err; + public java.lang.String err; public int feerate; - FeeRateTooHigh(String err, int feerate) { this.err = err; this.feerate = feerate; } + FeeRateTooHigh(java.lang.String err, int feerate) { this.err = err; this.feerate = feerate; } } public final static class RouteError extends LDKAPIError { - public String err; - RouteError(String err) { this.err = err; } + public java.lang.String err; + RouteError(java.lang.String err) { this.err = err; } } public final static class ChannelUnavailable extends LDKAPIError { - public String err; - ChannelUnavailable(String err) { this.err = err; } + public java.lang.String err; + ChannelUnavailable(java.lang.String err) { this.err = err; } } public final static class MonitorUpdateFailed extends LDKAPIError { MonitorUpdateFailed() { } @@ -1021,8 +1048,8 @@ public class bindings { public static class LDKPaymentError { private LDKPaymentError() {} public final static class Invoice extends LDKPaymentError { - public String invoice; - Invoice(String invoice) { this.invoice = invoice; } + public java.lang.String invoice; + Invoice(java.lang.String invoice) { this.invoice = invoice; } } public final static class Routing extends LDKPaymentError { public long routing; @@ -1040,18 +1067,97 @@ public class bindings { public static native byte[] CResult_PaymentIdPaymentErrorZ_get_ok(long owner); // struct LDKPaymentError CResult_PaymentIdPaymentErrorZ_get_err(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner); public static native long CResult_PaymentIdPaymentErrorZ_get_err(long owner); - // enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner); - public static native SiPrefix CResult_SiPrefixNoneZ_get_ok(long owner); - // void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner); - public static native void CResult_SiPrefixNoneZ_get_err(long owner); - // struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner); - public static native long CResult_InvoiceNoneZ_get_ok(long owner); - // void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner); - public static native void CResult_InvoiceNoneZ_get_err(long owner); - // struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner); - public static native long CResult_SignedRawInvoiceNoneZ_get_ok(long owner); - // void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner); - public static native void CResult_SignedRawInvoiceNoneZ_get_err(long owner); + public static class LDKParseError { + private LDKParseError() {} + public final static class Bech32Error extends LDKParseError { + public long bech32_error; + Bech32Error(long bech32_error) { this.bech32_error = bech32_error; } + } + public final static class ParseAmountError extends LDKParseError { + public int parse_amount_error; + ParseAmountError(int parse_amount_error) { this.parse_amount_error = parse_amount_error; } + } + public final static class MalformedSignature extends LDKParseError { + public org.ldk.enums.Secp256k1Error malformed_signature; + MalformedSignature(org.ldk.enums.Secp256k1Error malformed_signature) { this.malformed_signature = malformed_signature; } + } + public final static class BadPrefix extends LDKParseError { + BadPrefix() { } + } + public final static class UnknownCurrency extends LDKParseError { + UnknownCurrency() { } + } + public final static class UnknownSiPrefix extends LDKParseError { + UnknownSiPrefix() { } + } + public final static class MalformedHRP extends LDKParseError { + MalformedHRP() { } + } + public final static class TooShortDataPart extends LDKParseError { + TooShortDataPart() { } + } + public final static class UnexpectedEndOfTaggedFields extends LDKParseError { + UnexpectedEndOfTaggedFields() { } + } + public final static class DescriptionDecodeError extends LDKParseError { + public int description_decode_error; + DescriptionDecodeError(int description_decode_error) { this.description_decode_error = description_decode_error; } + } + public final static class PaddingError extends LDKParseError { + PaddingError() { } + } + public final static class IntegerOverflowError extends LDKParseError { + IntegerOverflowError() { } + } + public final static class InvalidSegWitProgramLength extends LDKParseError { + InvalidSegWitProgramLength() { } + } + public final static class InvalidPubKeyHashLength extends LDKParseError { + InvalidPubKeyHashLength() { } + } + public final static class InvalidScriptHashLength extends LDKParseError { + InvalidScriptHashLength() { } + } + public final static class InvalidRecoveryId extends LDKParseError { + InvalidRecoveryId() { } + } + public final static class InvalidSliceLength extends LDKParseError { + public java.lang.String invalid_slice_length; + InvalidSliceLength(java.lang.String invalid_slice_length) { this.invalid_slice_length = invalid_slice_length; } + } + public final static class Skip extends LDKParseError { + Skip() { } + } + static native void init(); + } + static { LDKParseError.init(); } + public static native LDKParseError LDKParseError_ref_from_ptr(long ptr); + // enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner); + public static native SiPrefix CResult_SiPrefixParseErrorZ_get_ok(long owner); + // struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner); + public static native long CResult_SiPrefixParseErrorZ_get_err(long owner); + public static class LDKParseOrSemanticError { + private LDKParseOrSemanticError() {} + public final static class ParseError extends LDKParseOrSemanticError { + public long parse_error; + ParseError(long parse_error) { this.parse_error = parse_error; } + } + public final static class SemanticError extends LDKParseOrSemanticError { + public org.ldk.enums.SemanticError semantic_error; + SemanticError(org.ldk.enums.SemanticError semantic_error) { this.semantic_error = semantic_error; } + } + static native void init(); + } + static { LDKParseOrSemanticError.init(); } + public static native LDKParseOrSemanticError LDKParseOrSemanticError_ref_from_ptr(long ptr); + // struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner); + public static native long CResult_InvoiceParseOrSemanticErrorZ_get_ok(long owner); + // struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner); + public static native long CResult_InvoiceParseOrSemanticErrorZ_get_err(long owner); + // struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner); + public static native long CResult_SignedRawInvoiceParseErrorZ_get_ok(long owner); + // struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner); + public static native long CResult_SignedRawInvoiceParseErrorZ_get_err(long owner); // struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner); public static native long C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(long owner); // struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner); @@ -1178,6 +1284,19 @@ public class bindings { public static native long C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(long owner); // struct LDKChannelUpdate C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR owner); public static native long C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(long owner); + public static class LDKCOption_NetAddressZ { + private LDKCOption_NetAddressZ() {} + public final static class Some extends LDKCOption_NetAddressZ { + public long some; + Some(long some) { this.some = some; } + } + public final static class None extends LDKCOption_NetAddressZ { + None() { } + } + static native void init(); + } + static { LDKCOption_NetAddressZ.init(); } + public static native LDKCOption_NetAddressZ LDKCOption_NetAddressZ_ref_from_ptr(long ptr); // struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner); public static native byte[] CResult_CVec_u8ZPeerHandleErrorZ_get_ok(long owner); // struct LDKPeerHandleError CResult_CVec_u8ZPeerHandleErrorZ_get_err(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner); @@ -1554,7 +1673,7 @@ public class bindings { long handle_channel_update(long msg); long[] get_next_channel_announcements(long starting_point, byte batch_amount); long[] get_next_node_announcements(byte[] starting_point, byte batch_amount); - void sync_routing_table(byte[] their_node_id, long init); + void peer_connected(byte[] their_node_id, long init); long handle_reply_channel_range(byte[] their_node_id, long msg); long handle_reply_short_channel_ids_end(byte[] their_node_id, long msg); long handle_query_channel_range(byte[] their_node_id, long msg); @@ -1572,8 +1691,8 @@ public class bindings { public static native long[] RoutingMessageHandler_get_next_channel_announcements(long this_arg, long starting_point, byte batch_amount); // LDKCVec_NodeAnnouncementZ RoutingMessageHandler_get_next_node_announcements LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount public static native long[] RoutingMessageHandler_get_next_node_announcements(long this_arg, byte[] starting_point, byte batch_amount); - // void RoutingMessageHandler_sync_routing_table LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init - public static native void RoutingMessageHandler_sync_routing_table(long this_arg, byte[] their_node_id, long init); + // void RoutingMessageHandler_peer_connected LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init + public static native void RoutingMessageHandler_peer_connected(long this_arg, byte[] their_node_id, long init); // LDKCResult_NoneLightningErrorZ RoutingMessageHandler_handle_reply_channel_range LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg public static native long RoutingMessageHandler_handle_reply_channel_range(long this_arg, byte[] their_node_id, long msg); // LDKCResult_NoneLightningErrorZ RoutingMessageHandler_handle_reply_short_channel_ids_end LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg @@ -1656,12 +1775,15 @@ public class bindings { public static native long LDKLockableScore_new(LDKLockableScore impl); // LDKScore LockableScore_lock LDKLockableScore *NONNULL_PTR this_arg public static native long LockableScore_lock(long this_arg); - public interface LDKChannelManagerPersister { + public interface LDKPersister { long persist_manager(long channel_manager); + long persist_graph(long network_graph); } - public static native long LDKChannelManagerPersister_new(LDKChannelManagerPersister impl); - // LDKCResult_NoneErrorZ ChannelManagerPersister_persist_manager LDKChannelManagerPersister *NONNULL_PTR this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager - public static native long ChannelManagerPersister_persist_manager(long this_arg, long channel_manager); + public static native long LDKPersister_new(LDKPersister impl); + // LDKCResult_NoneErrorZ Persister_persist_manager LDKPersister *NONNULL_PTR this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager + public static native long Persister_persist_manager(long this_arg, long channel_manager); + // LDKCResult_NoneErrorZ Persister_persist_graph LDKPersister *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph + public static native long Persister_persist_graph(long this_arg, long network_graph); public static class LDKFallback { private LDKFallback() {} public final static class SegWitProgram extends LDKFallback { @@ -1712,6 +1834,12 @@ public class bindings { public static native String _ldk_get_compiled_version(); // struct LDKStr _ldk_c_bindings_get_compiled_version(void); public static native String _ldk_c_bindings_get_compiled_version(); + // uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg); + public static native long Bech32Error_clone_ptr(long arg); + // struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); + public static native long Bech32Error_clone(long orig); + // void Bech32Error_free(struct LDKBech32Error o); + public static native void Bech32Error_free(long o); // void Transaction_free(struct LDKTransaction _res); public static native void Transaction_free(byte[] _res); // struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); @@ -2204,26 +2332,6 @@ public class bindings { public static native boolean CResult_ScorerDecodeErrorZ_is_ok(long o); // void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); public static native void CResult_ScorerDecodeErrorZ_free(long _res); - // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(struct LDKProbabilisticScoringParameters o); - public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(long o); - // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_err(long e); - // bool CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(long o); - // void CResult_ProbabilisticScoringParametersDecodeErrorZ_free(struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res); - public static native void CResult_ProbabilisticScoringParametersDecodeErrorZ_free(long _res); - // uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg); - public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(long arg); - // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(long orig); - // uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg); - public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(long arg); - // struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(const struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR orig); - public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(long orig); - // struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(struct LDKProbabilisticScoringParameters a, const struct LDKNetworkGraph *NONNULL_PTR b); - public static native long C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(long a, long b); - // void C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res); - public static native void C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(long _res); // struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); public static native long CResult_ProbabilisticScorerDecodeErrorZ_ok(long o); // struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); @@ -2736,42 +2844,42 @@ public class bindings { public static native long CResult_PaymentIdPaymentErrorZ_clone_ptr(long arg); // struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); public static native long CResult_PaymentIdPaymentErrorZ_clone(long orig); - // struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o); - public static native long CResult_SiPrefixNoneZ_ok(SiPrefix o); - // struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void); - public static native long CResult_SiPrefixNoneZ_err(); - // bool CResult_SiPrefixNoneZ_is_ok(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR o); - public static native boolean CResult_SiPrefixNoneZ_is_ok(long o); - // void CResult_SiPrefixNoneZ_free(struct LDKCResult_SiPrefixNoneZ _res); - public static native void CResult_SiPrefixNoneZ_free(long _res); - // uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg); - public static native long CResult_SiPrefixNoneZ_clone_ptr(long arg); - // struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_clone(const struct LDKCResult_SiPrefixNoneZ *NONNULL_PTR orig); - public static native long CResult_SiPrefixNoneZ_clone(long orig); - // struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_ok(struct LDKInvoice o); - public static native long CResult_InvoiceNoneZ_ok(long o); - // struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_err(void); - public static native long CResult_InvoiceNoneZ_err(); - // bool CResult_InvoiceNoneZ_is_ok(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR o); - public static native boolean CResult_InvoiceNoneZ_is_ok(long o); - // void CResult_InvoiceNoneZ_free(struct LDKCResult_InvoiceNoneZ _res); - public static native void CResult_InvoiceNoneZ_free(long _res); - // uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg); - public static native long CResult_InvoiceNoneZ_clone_ptr(long arg); - // struct LDKCResult_InvoiceNoneZ CResult_InvoiceNoneZ_clone(const struct LDKCResult_InvoiceNoneZ *NONNULL_PTR orig); - public static native long CResult_InvoiceNoneZ_clone(long orig); - // struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_ok(struct LDKSignedRawInvoice o); - public static native long CResult_SignedRawInvoiceNoneZ_ok(long o); - // struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_err(void); - public static native long CResult_SignedRawInvoiceNoneZ_err(); - // bool CResult_SignedRawInvoiceNoneZ_is_ok(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR o); - public static native boolean CResult_SignedRawInvoiceNoneZ_is_ok(long o); - // void CResult_SignedRawInvoiceNoneZ_free(struct LDKCResult_SignedRawInvoiceNoneZ _res); - public static native void CResult_SignedRawInvoiceNoneZ_free(long _res); - // uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg); - public static native long CResult_SignedRawInvoiceNoneZ_clone_ptr(long arg); - // struct LDKCResult_SignedRawInvoiceNoneZ CResult_SignedRawInvoiceNoneZ_clone(const struct LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR orig); - public static native long CResult_SignedRawInvoiceNoneZ_clone(long orig); + // struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); + public static native long CResult_SiPrefixParseErrorZ_ok(SiPrefix o); + // struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); + public static native long CResult_SiPrefixParseErrorZ_err(long e); + // bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); + public static native boolean CResult_SiPrefixParseErrorZ_is_ok(long o); + // void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); + public static native void CResult_SiPrefixParseErrorZ_free(long _res); + // uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg); + public static native long CResult_SiPrefixParseErrorZ_clone_ptr(long arg); + // struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig); + public static native long CResult_SiPrefixParseErrorZ_clone(long orig); + // struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); + public static native long CResult_InvoiceParseOrSemanticErrorZ_ok(long o); + // struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); + public static native long CResult_InvoiceParseOrSemanticErrorZ_err(long e); + // bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); + public static native boolean CResult_InvoiceParseOrSemanticErrorZ_is_ok(long o); + // void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); + public static native void CResult_InvoiceParseOrSemanticErrorZ_free(long _res); + // uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg); + public static native long CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(long arg); + // struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); + public static native long CResult_InvoiceParseOrSemanticErrorZ_clone(long orig); + // struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); + public static native long CResult_SignedRawInvoiceParseErrorZ_ok(long o); + // struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); + public static native long CResult_SignedRawInvoiceParseErrorZ_err(long e); + // bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); + public static native boolean CResult_SignedRawInvoiceParseErrorZ_is_ok(long o); + // void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); + public static native void CResult_SignedRawInvoiceParseErrorZ_free(long _res); + // uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg); + public static native long CResult_SignedRawInvoiceParseErrorZ_clone_ptr(long arg); + // struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); + public static native long CResult_SignedRawInvoiceParseErrorZ_clone(long orig); // uintptr_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg); public static native long C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(long arg); // struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); @@ -3022,6 +3130,16 @@ public class bindings { public static native void CVec_NodeAnnouncementZ_free(long[] _res); // void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); public static native void CVec_PublicKeyZ_free(byte[][] _res); + // struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); + public static native long COption_NetAddressZ_some(long o); + // struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); + public static native long COption_NetAddressZ_none(); + // void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); + public static native void COption_NetAddressZ_free(long _res); + // uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg); + public static native long COption_NetAddressZ_clone_ptr(long arg); + // struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); + public static native long COption_NetAddressZ_clone(long orig); // struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); public static native long CResult_CVec_u8ZPeerHandleErrorZ_ok(byte[] o); // struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); @@ -3682,8 +3800,8 @@ public class bindings { public static native long Event_discard_funding(byte[] channel_id, byte[] transaction); // struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); public static native long Event_payment_path_successful(byte[] payment_id, byte[] payment_hash, long[] path); - // struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat); - public static native long Event_open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat); + // struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type); + public static native long Event_open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, long channel_type); // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); public static native byte[] Event_write(long obj); // struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); @@ -3732,6 +3850,8 @@ public class bindings { public static native long MessageSendEvent_send_short_ids_query(byte[] node_id, long msg); // struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); public static native long MessageSendEvent_send_reply_channel_range(byte[] node_id, long msg); + // struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg); + 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 EventsProvider_free(struct LDKEventsProvider this_ptr); @@ -3826,8 +3946,12 @@ public class bindings { public static native long ChannelHandshakeConfig_get_our_htlc_minimum_msat(long this_ptr); // void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); public static native void ChannelHandshakeConfig_set_our_htlc_minimum_msat(long this_ptr, long val); - // MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg); - public static native long ChannelHandshakeConfig_new(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg); + // bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + public static native boolean ChannelHandshakeConfig_get_negotiate_scid_privacy(long this_ptr); + // void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); + public static native void ChannelHandshakeConfig_set_negotiate_scid_privacy(long this_ptr, boolean val); + // MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, bool negotiate_scid_privacy_arg); + public static native long ChannelHandshakeConfig_new(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg, boolean negotiate_scid_privacy_arg); // uintptr_t ChannelHandshakeConfig_clone_ptr(LDKChannelHandshakeConfig *NONNULL_PTR arg); public static native long ChannelHandshakeConfig_clone_ptr(long arg); // struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); @@ -4434,10 +4558,18 @@ public class bindings { public static native long ChannelDetails_get_funding_txo(long this_ptr); // void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); public static native void ChannelDetails_set_funding_txo(long this_ptr, long val); + // struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + public static native long ChannelDetails_get_channel_type(long this_ptr); + // void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); + public static native void ChannelDetails_set_channel_type(long this_ptr, long val); // struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); public static native long ChannelDetails_get_short_channel_id(long this_ptr); // void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); public static native void ChannelDetails_set_short_channel_id(long this_ptr, long val); + // struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + public static native long ChannelDetails_get_inbound_scid_alias(long this_ptr); + // void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + public static native void ChannelDetails_set_inbound_scid_alias(long this_ptr, long val); // uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); public static native long ChannelDetails_get_channel_value_satoshis(long this_ptr); // void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); @@ -4486,12 +4618,14 @@ public class bindings { public static native boolean ChannelDetails_get_is_public(long this_ptr); // void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); public static native void ChannelDetails_set_is_public(long this_ptr, boolean val); - // MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); - public static native long ChannelDetails_new(byte[] channel_id_arg, long counterparty_arg, long funding_txo_arg, long short_channel_id_arg, long channel_value_satoshis_arg, long unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, long confirmations_required_arg, long force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg); + // MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); + public static native long ChannelDetails_new(byte[] channel_id_arg, long counterparty_arg, long funding_txo_arg, long channel_type_arg, long short_channel_id_arg, long inbound_scid_alias_arg, long channel_value_satoshis_arg, long unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, long confirmations_required_arg, long force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg); // uintptr_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg); public static native long ChannelDetails_clone_ptr(long arg); // struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); public static native long ChannelDetails_clone(long orig); + // MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); + public static native long ChannelDetails_get_inbound_payment_scid(long this_arg); // void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); public static native void PaymentSendFailure_free(long this_ptr); // uintptr_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg); @@ -4566,8 +4700,8 @@ public class bindings { public static native boolean ChannelManager_claim_funds(long this_arg, byte[] payment_preimage); // MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native byte[] ChannelManager_get_our_node_id(long this_arg); - // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32]); - public static native long ChannelManager_accept_inbound_channel(long this_arg, byte[] temporary_channel_id); + // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], uint64_t user_channel_id); + public static native long ChannelManager_accept_inbound_channel(long this_arg, byte[] temporary_channel_id, long user_channel_id); // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); public static native long ChannelManager_create_inbound_payment(long this_arg, long min_value_msat, int invoice_expiry_delta_secs); // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); @@ -4658,8 +4792,12 @@ public class bindings { public static native long Init_get_features(long this_ptr); // void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); public static native void Init_set_features(long this_ptr, long val); - // MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); - public static native long Init_new(long features_arg); + // struct LDKCOption_NetAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); + public static native long Init_get_remote_network_address(long this_ptr); + // void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_NetAddressZ val); + public static native void Init_set_remote_network_address(long this_ptr, long val); + // MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_NetAddressZ remote_network_address_arg); + public static native long Init_new(long features_arg, long remote_network_address_arg); // uintptr_t Init_clone_ptr(LDKInit *NONNULL_PTR arg); public static native long Init_clone_ptr(long arg); // struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); @@ -4922,8 +5060,12 @@ public class bindings { public static native byte[] FundingLocked_get_next_per_commitment_point(long this_ptr); // void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val); public static native void FundingLocked_set_next_per_commitment_point(long this_ptr, byte[] val); - // MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg); - public static native long FundingLocked_new(byte[] channel_id_arg, byte[] next_per_commitment_point_arg); + // struct LDKCOption_u64Z FundingLocked_get_short_channel_id_alias(const struct LDKFundingLocked *NONNULL_PTR this_ptr); + public static native long FundingLocked_get_short_channel_id_alias(long this_ptr); + // void FundingLocked_set_short_channel_id_alias(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + public static native void FundingLocked_set_short_channel_id_alias(long this_ptr, long val); + // MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); + public static native long FundingLocked_new(byte[] channel_id_arg, byte[] next_per_commitment_point_arg, long short_channel_id_alias_arg); // uintptr_t FundingLocked_clone_ptr(LDKFundingLocked *NONNULL_PTR arg); public static native long FundingLocked_clone_ptr(long arg); // struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); @@ -5710,10 +5852,10 @@ public class bindings { public static native long PeerManager_new(long message_handler, byte[] our_node_secret, byte[] ephemeral_random_data, long logger, long custom_message_handler); // MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg); public static native byte[][] PeerManager_get_peer_node_ids(long this_arg); - // MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor); - public static native long PeerManager_new_outbound_connection(long this_arg, byte[] their_node_id, long descriptor); - // MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor); - public static native long PeerManager_new_inbound_connection(long this_arg, long descriptor); + // MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); + public static native long PeerManager_new_outbound_connection(long this_arg, byte[] their_node_id, long descriptor, long remote_network_address); + // MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address); + public static native long PeerManager_new_inbound_connection(long this_arg, long descriptor, long remote_network_address); // MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); public static native long PeerManager_write_buffer_space_avail(long this_arg, long descriptor); // MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); @@ -6650,8 +6792,8 @@ public class bindings { public static native byte[] RouteHintHop_write(long obj); // struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); public static native long RouteHintHop_read(byte[] ser); - // struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); - public static native long find_route(byte[] our_node_pubkey, long route_params, long network, long[] first_hops, long logger, long scorer); + // struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]); + public static native long find_route(byte[] our_node_pubkey, long route_params, long network, long[] first_hops, long logger, long scorer, byte[] random_seed_bytes); // void Score_free(struct LDKScore this_ptr); public static native void Score_free(long this_ptr); // void LockableScore_free(struct LDKLockableScore this_ptr); @@ -6666,14 +6808,14 @@ public class bindings { public static native long FixedPenaltyScorer_clone_ptr(long arg); // struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); public static native long FixedPenaltyScorer_clone(long orig); - // struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); - public static native byte[] FixedPenaltyScorer_write(long obj); - // struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser); - public static native long FixedPenaltyScorer_read(byte[] ser); // MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); public static native long FixedPenaltyScorer_with_penalty(long penalty_msat); // struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); public static native long FixedPenaltyScorer_as_Score(long this_arg); + // struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); + public static native byte[] FixedPenaltyScorer_write(long obj); + // struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); + public static native long FixedPenaltyScorer_read(byte[] ser, long arg); // void Scorer_free(struct LDKScorer this_obj); public static native void Scorer_free(long this_obj); // void ScoringParameters_free(struct LDKScoringParameters this_obj); @@ -6724,6 +6866,10 @@ public class bindings { public static native void ProbabilisticScorer_free(long this_obj); // void ProbabilisticScoringParameters_free(struct LDKProbabilisticScoringParameters this_obj); public static native void ProbabilisticScoringParameters_free(long this_obj); + // uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + public static native long ProbabilisticScoringParameters_get_base_penalty_msat(long this_ptr); + // void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ProbabilisticScoringParameters_set_base_penalty_msat(long this_ptr, long val); // uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); public static native long ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat(long this_ptr); // void ProbabilisticScoringParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); @@ -6732,16 +6878,16 @@ public class bindings { public static native long ProbabilisticScoringParameters_get_liquidity_offset_half_life(long this_ptr); // void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); public static native void ProbabilisticScoringParameters_set_liquidity_offset_half_life(long this_ptr, long val); - // MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg); - public static native long ProbabilisticScoringParameters_new(long liquidity_penalty_multiplier_msat_arg, long liquidity_offset_half_life_arg); + // uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + public static native long ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(long this_ptr); + // void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(long this_ptr, long val); + // MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg, uint64_t amount_penalty_multiplier_msat_arg); + public static native long ProbabilisticScoringParameters_new(long base_penalty_msat_arg, long liquidity_penalty_multiplier_msat_arg, long liquidity_offset_half_life_arg, long amount_penalty_multiplier_msat_arg); // uintptr_t ProbabilisticScoringParameters_clone_ptr(LDKProbabilisticScoringParameters *NONNULL_PTR arg); public static native long ProbabilisticScoringParameters_clone_ptr(long arg); // struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(const struct LDKProbabilisticScoringParameters *NONNULL_PTR orig); public static native long ProbabilisticScoringParameters_clone(long orig); - // struct LDKCVec_u8Z ProbabilisticScoringParameters_write(const struct LDKProbabilisticScoringParameters *NONNULL_PTR obj); - public static native byte[] ProbabilisticScoringParameters_write(long obj); - // struct LDKCResult_ProbabilisticScoringParametersDecodeErrorZ ProbabilisticScoringParameters_read(struct LDKu8slice ser); - public static native long ProbabilisticScoringParameters_read(byte[] ser); // MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph); public static native long ProbabilisticScorer_new(long params, long network_graph); // MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_default(void); @@ -6750,8 +6896,8 @@ public class bindings { public static native long ProbabilisticScorer_as_Score(long this_arg); // struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); public static native byte[] ProbabilisticScorer_write(long obj); - // struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg); - public static native long ProbabilisticScorer_read(byte[] ser, long arg); + // struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b); + public static native long ProbabilisticScorer_read(byte[] ser, long arg_a, long arg_b); // void FilesystemPersister_free(struct LDKFilesystemPersister this_obj); public static native void FilesystemPersister_free(long this_obj); // MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr path_to_channel_data); @@ -6760,20 +6906,74 @@ public class bindings { public static native String FilesystemPersister_get_data_dir(long this_arg); // MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager); public static native long FilesystemPersister_persist_manager(String data_dir, long manager); + // MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_network_graph(struct LDKStr data_dir, const struct LDKNetworkGraph *NONNULL_PTR network_graph); + public static native long FilesystemPersister_persist_network_graph(String data_dir, long network_graph); // MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager); public static native long FilesystemPersister_read_channelmonitors(long this_arg, long keys_manager); // struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg); public static native long FilesystemPersister_as_Persist(long this_arg); // void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj); public static native void BackgroundProcessor_free(long this_obj); - // void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr); - public static native void ChannelManagerPersister_free(long this_ptr); - // MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger); + // void Persister_free(struct LDKPersister this_ptr); + public static native void Persister_free(long this_ptr); + // MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger); public static native long BackgroundProcessor_start(long persister, long event_handler, long chain_monitor, long channel_manager, long net_graph_msg_handler, long peer_manager, long logger); // MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg); public static native long BackgroundProcessor_join(long this_arg); // MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); public static native long BackgroundProcessor_stop(long this_arg); + // void ParseError_free(struct LDKParseError this_ptr); + public static native void ParseError_free(long this_ptr); + // uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg); + public static native long ParseError_clone_ptr(long arg); + // struct LDKParseError ParseError_clone(const struct LDKParseError *NONNULL_PTR orig); + public static native long ParseError_clone(long orig); + // struct LDKParseError ParseError_bech32_error(struct LDKBech32Error a); + public static native long ParseError_bech32_error(long a); + // struct LDKParseError ParseError_parse_amount_error(struct LDKError a); + public static native long ParseError_parse_amount_error(int a); + // struct LDKParseError ParseError_malformed_signature(enum LDKSecp256k1Error a); + public static native long ParseError_malformed_signature(Secp256k1Error a); + // struct LDKParseError ParseError_bad_prefix(void); + public static native long ParseError_bad_prefix(); + // struct LDKParseError ParseError_unknown_currency(void); + public static native long ParseError_unknown_currency(); + // struct LDKParseError ParseError_unknown_si_prefix(void); + public static native long ParseError_unknown_si_prefix(); + // struct LDKParseError ParseError_malformed_hrp(void); + public static native long ParseError_malformed_hrp(); + // struct LDKParseError ParseError_too_short_data_part(void); + public static native long ParseError_too_short_data_part(); + // struct LDKParseError ParseError_unexpected_end_of_tagged_fields(void); + public static native long ParseError_unexpected_end_of_tagged_fields(); + // struct LDKParseError ParseError_description_decode_error(struct LDKError a); + public static native long ParseError_description_decode_error(int a); + // struct LDKParseError ParseError_padding_error(void); + public static native long ParseError_padding_error(); + // struct LDKParseError ParseError_integer_overflow_error(void); + public static native long ParseError_integer_overflow_error(); + // struct LDKParseError ParseError_invalid_seg_wit_program_length(void); + public static native long ParseError_invalid_seg_wit_program_length(); + // struct LDKParseError ParseError_invalid_pub_key_hash_length(void); + public static native long ParseError_invalid_pub_key_hash_length(); + // struct LDKParseError ParseError_invalid_script_hash_length(void); + public static native long ParseError_invalid_script_hash_length(); + // struct LDKParseError ParseError_invalid_recovery_id(void); + public static native long ParseError_invalid_recovery_id(); + // struct LDKParseError ParseError_invalid_slice_length(struct LDKStr a); + public static native long ParseError_invalid_slice_length(String a); + // struct LDKParseError ParseError_skip(void); + public static native long ParseError_skip(); + // void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr); + public static native void ParseOrSemanticError_free(long this_ptr); + // uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg); + public static native long ParseOrSemanticError_clone_ptr(long arg); + // struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig); + public static native long ParseOrSemanticError_clone(long orig); + // struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKParseError a); + public static native long ParseOrSemanticError_parse_error(long a); + // struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKSemanticError a); + public static native long ParseOrSemanticError_semantic_error(SemanticError a); // void Invoice_free(struct LDKInvoice this_obj); public static native void Invoice_free(long this_obj); // bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice *NONNULL_PTR b); @@ -7152,24 +7352,34 @@ public class bindings { public static native long InvoicePayer_as_EventHandler(long this_arg); // struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKStr description, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network); public static native long create_phantom_invoice(long amt_msat, String description, byte[] payment_hash, byte[] payment_secret, long[] phantom_route_hints, long keys_manager, Currency network); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network); + public static native long create_phantom_invoice_with_description_hash(long amt_msat, long description_hash, byte[] payment_hash, byte[] payment_secret, long[] phantom_route_hints, long keys_manager, Currency network); // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description); public static native long create_invoice_from_channelmanager(long channelmanager, long keys_manager, Currency network, long amt_msat, String description); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash); + public static native long create_invoice_from_channelmanager_with_description_hash(long channelmanager, long keys_manager, Currency network, long amt_msat, long description_hash); + // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch); + public static native long create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(long channelmanager, long keys_manager, Currency network, long amt_msat, long description_hash, long duration_since_epoch); // struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch); public static native long create_invoice_from_channelmanager_and_duration_since_epoch(long channelmanager, long keys_manager, Currency network, long amt_msat, String description, long duration_since_epoch); // void DefaultRouter_free(struct LDKDefaultRouter this_obj); public static native void DefaultRouter_free(long this_obj); - // MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); - public static native long DefaultRouter_new(long network_graph, long logger); + // MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes); + public static native long DefaultRouter_new(long network_graph, long logger, byte[] random_seed_bytes); // struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); public static native long DefaultRouter_as_Router(long this_arg); // struct LDKPayer ChannelManager_as_Payer(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_as_Payer(long this_arg); - // struct LDKCResult_SiPrefixNoneZ SiPrefix_from_str(struct LDKStr s); + // struct LDKCResult_SiPrefixParseErrorZ SiPrefix_from_str(struct LDKStr s); public static native long SiPrefix_from_str(String s); - // struct LDKCResult_InvoiceNoneZ Invoice_from_str(struct LDKStr s); + // struct LDKCResult_InvoiceParseOrSemanticErrorZ Invoice_from_str(struct LDKStr s); public static native long Invoice_from_str(String s); - // struct LDKCResult_SignedRawInvoiceNoneZ SignedRawInvoice_from_str(struct LDKStr s); + // struct LDKCResult_SignedRawInvoiceParseErrorZ SignedRawInvoice_from_str(struct LDKStr s); public static native long SignedRawInvoice_from_str(String s); + // struct LDKStr ParseError_to_str(const struct LDKParseError *NONNULL_PTR o); + public static native String ParseError_to_str(long o); + // struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o); + public static native String ParseOrSemanticError_to_str(long o); // struct LDKStr Invoice_to_str(const struct LDKInvoice *NONNULL_PTR o); public static native String Invoice_to_str(long o); // struct LDKStr SignedRawInvoice_to_str(const struct LDKSignedRawInvoice *NONNULL_PTR o); diff --git a/src/main/java/org/ldk/structs/APIError.java b/src/main/java/org/ldk/structs/APIError.java index a2e070f9..f226ddcc 100644 --- a/src/main/java/org/ldk/structs/APIError.java +++ b/src/main/java/org/ldk/structs/APIError.java @@ -51,7 +51,7 @@ public class APIError extends CommonBase { /** * A human-readable error message */ - public final String err; + public final java.lang.String err; private APIMisuseError(long ptr, bindings.LDKAPIError.APIMisuseError obj) { super(null, ptr); this.err = obj.err; @@ -66,7 +66,7 @@ public class APIError extends CommonBase { /** * A human-readable error message */ - public final String err; + public final java.lang.String err; /** * The feerate which was too high. */ @@ -85,7 +85,7 @@ public class APIError extends CommonBase { /** * A human-readable error message */ - public final String err; + public final java.lang.String err; private RouteError(long ptr, bindings.LDKAPIError.RouteError obj) { super(null, ptr); this.err = obj.err; @@ -100,7 +100,7 @@ public class APIError extends CommonBase { /** * A human-readable error message */ - public final String err; + public final java.lang.String err; private ChannelUnavailable(long ptr, bindings.LDKAPIError.ChannelUnavailable obj) { super(null, ptr); this.err = obj.err; @@ -129,7 +129,7 @@ public class APIError extends CommonBase { /** * The incompatible shutdown script. */ - public final ShutdownScript script; + public final org.ldk.structs.ShutdownScript script; private IncompatibleShutdownScript(long ptr, bindings.LDKAPIError.IncompatibleShutdownScript obj) { super(null, ptr); long script = obj.script; @@ -151,7 +151,7 @@ public class APIError extends CommonBase { long ret = bindings.APIError_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - APIError ret_hu_conv = APIError.constr_from_ptr(ret); + org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -163,7 +163,7 @@ public class APIError extends CommonBase { long ret = bindings.APIError_apimisuse_error(err); Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } - APIError ret_hu_conv = APIError.constr_from_ptr(ret); + org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -176,7 +176,7 @@ public class APIError extends CommonBase { Reference.reachabilityFence(err); Reference.reachabilityFence(feerate); if (ret >= 0 && ret <= 4096) { return null; } - APIError ret_hu_conv = APIError.constr_from_ptr(ret); + org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -188,7 +188,7 @@ public class APIError extends CommonBase { long ret = bindings.APIError_route_error(err); Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } - APIError ret_hu_conv = APIError.constr_from_ptr(ret); + org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -200,7 +200,7 @@ public class APIError extends CommonBase { long ret = bindings.APIError_channel_unavailable(err); Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } - APIError ret_hu_conv = APIError.constr_from_ptr(ret); + org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -211,7 +211,7 @@ public class APIError extends CommonBase { public static APIError monitor_update_failed() { long ret = bindings.APIError_monitor_update_failed(); if (ret >= 0 && ret <= 4096) { return null; } - APIError ret_hu_conv = APIError.constr_from_ptr(ret); + org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -223,7 +223,7 @@ public class APIError extends CommonBase { long ret = bindings.APIError_incompatible_shutdown_script(script == null ? 0 : script.ptr & ~1); Reference.reachabilityFence(script); if (ret >= 0 && ret <= 4096) { return null; } - APIError ret_hu_conv = APIError.constr_from_ptr(ret); + org.ldk.structs.APIError ret_hu_conv = org.ldk.structs.APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/BackgroundProcessor.java b/src/main/java/org/ldk/structs/BackgroundProcessor.java index e66111bf..af09b461 100644 --- a/src/main/java/org/ldk/structs/BackgroundProcessor.java +++ b/src/main/java/org/ldk/structs/BackgroundProcessor.java @@ -49,17 +49,21 @@ public class BackgroundProcessor extends CommonBase { * documentation]. * * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or - * `persist_manager` returns an error. In case of an error, the error is retrieved by calling + * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling * either [`join`] or [`stop`]. * * # Data Persistence * - * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or + * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's * provided implementation. * - * Typically, users should either implement [`ChannelManagerPersister`] to never return an + * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk. See + * [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. See [`FilesystemPersister::persist_network_graph`] + * for Rust-Lightning's provided implementation. + * + * Typically, users should either implement [`Persister::persist_manager`] to never return an * error or call [`join`] and handle any error that may arise. For the latter case, * `BackgroundProcessor` must be restarted by calling `start` again after handling the error. * @@ -76,11 +80,13 @@ public class BackgroundProcessor extends CommonBase { * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager + * [`FilesystemPersister::persist_network_graph`]: lightning_persister::FilesystemPersister::persist_network_graph * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph + * [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable * * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static BackgroundProcessor start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, @Nullable NetGraphMsgHandler net_graph_msg_handler, PeerManager peer_manager, Logger logger) { + public static BackgroundProcessor start(Persister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, @Nullable NetGraphMsgHandler net_graph_msg_handler, PeerManager peer_manager, Logger logger) { long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, net_graph_msg_handler == null ? 0 : net_graph_msg_handler.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr); Reference.reachabilityFence(persister); Reference.reachabilityFence(event_handler); diff --git a/src/main/java/org/ldk/structs/Balance.java b/src/main/java/org/ldk/structs/Balance.java index 2640ac69..e6957ac2 100644 --- a/src/main/java/org/ldk/structs/Balance.java +++ b/src/main/java/org/ldk/structs/Balance.java @@ -137,7 +137,7 @@ public class Balance extends CommonBase { long ret = bindings.Balance_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Balance ret_hu_conv = Balance.constr_from_ptr(ret); + org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -149,7 +149,7 @@ public class Balance extends CommonBase { long ret = bindings.Balance_claimable_on_channel_close(claimable_amount_satoshis); Reference.reachabilityFence(claimable_amount_satoshis); if (ret >= 0 && ret <= 4096) { return null; } - Balance ret_hu_conv = Balance.constr_from_ptr(ret); + org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -162,7 +162,7 @@ public class Balance extends CommonBase { Reference.reachabilityFence(claimable_amount_satoshis); Reference.reachabilityFence(confirmation_height); if (ret >= 0 && ret <= 4096) { return null; } - Balance ret_hu_conv = Balance.constr_from_ptr(ret); + org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -175,7 +175,7 @@ public class Balance extends CommonBase { Reference.reachabilityFence(claimable_amount_satoshis); Reference.reachabilityFence(timeout_height); if (ret >= 0 && ret <= 4096) { return null; } - Balance ret_hu_conv = Balance.constr_from_ptr(ret); + org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -188,7 +188,7 @@ public class Balance extends CommonBase { Reference.reachabilityFence(claimable_amount_satoshis); Reference.reachabilityFence(claimable_height); if (ret >= 0 && ret <= 4096) { return null; } - Balance ret_hu_conv = Balance.constr_from_ptr(ret); + org.ldk.structs.Balance ret_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Bech32Error.java b/src/main/java/org/ldk/structs/Bech32Error.java new file mode 100644 index 00000000..bf81f878 --- /dev/null +++ b/src/main/java/org/ldk/structs/Bech32Error.java @@ -0,0 +1,126 @@ +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; + + +/** + * Represents an error returned from the bech32 library during validation of some bech32 data + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Bech32Error extends CommonBase { + private Bech32Error(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.Bech32Error_free(ptr); } + } + static Bech32Error constr_from_ptr(long ptr) { + bindings.LDKBech32Error raw_val = bindings.LDKBech32Error_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKBech32Error.MissingSeparator.class) { + return new MissingSeparator(ptr, (bindings.LDKBech32Error.MissingSeparator)raw_val); + } + if (raw_val.getClass() == bindings.LDKBech32Error.InvalidChecksum.class) { + return new InvalidChecksum(ptr, (bindings.LDKBech32Error.InvalidChecksum)raw_val); + } + if (raw_val.getClass() == bindings.LDKBech32Error.InvalidLength.class) { + return new InvalidLength(ptr, (bindings.LDKBech32Error.InvalidLength)raw_val); + } + if (raw_val.getClass() == bindings.LDKBech32Error.InvalidChar.class) { + return new InvalidChar(ptr, (bindings.LDKBech32Error.InvalidChar)raw_val); + } + if (raw_val.getClass() == bindings.LDKBech32Error.InvalidData.class) { + return new InvalidData(ptr, (bindings.LDKBech32Error.InvalidData)raw_val); + } + if (raw_val.getClass() == bindings.LDKBech32Error.InvalidPadding.class) { + return new InvalidPadding(ptr, (bindings.LDKBech32Error.InvalidPadding)raw_val); + } + if (raw_val.getClass() == bindings.LDKBech32Error.MixedCase.class) { + return new MixedCase(ptr, (bindings.LDKBech32Error.MixedCase)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * String does not contain the separator character + */ + public final static class MissingSeparator extends Bech32Error { + private MissingSeparator(long ptr, bindings.LDKBech32Error.MissingSeparator obj) { + super(null, ptr); + } + } + /** + * The checksum does not match the rest of the data + */ + public final static class InvalidChecksum extends Bech32Error { + private InvalidChecksum(long ptr, bindings.LDKBech32Error.InvalidChecksum obj) { + super(null, ptr); + } + } + /** + * The data or human-readable part is too long or too short + */ + public final static class InvalidLength extends Bech32Error { + private InvalidLength(long ptr, bindings.LDKBech32Error.InvalidLength obj) { + super(null, ptr); + } + } + /** + * Some part of the string contains an invalid character + */ + public final static class InvalidChar extends Bech32Error { + public final int invalid_char; + private InvalidChar(long ptr, bindings.LDKBech32Error.InvalidChar obj) { + super(null, ptr); + this.invalid_char = obj.invalid_char; + } + } + /** + * Some part of the data has an invalid value + */ + public final static class InvalidData extends Bech32Error { + public final byte invalid_data; + private InvalidData(long ptr, bindings.LDKBech32Error.InvalidData obj) { + super(null, ptr); + this.invalid_data = obj.invalid_data; + } + } + /** + * The bit conversion failed due to a padding issue + */ + public final static class InvalidPadding extends Bech32Error { + private InvalidPadding(long ptr, bindings.LDKBech32Error.InvalidPadding obj) { + super(null, ptr); + } + } + /** + * The whole string must be of one case + */ + public final static class MixedCase extends Bech32Error { + private MixedCase(long ptr, bindings.LDKBech32Error.MixedCase obj) { + super(null, ptr); + } + } + long clone_ptr() { + long ret = bindings.Bech32Error_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new Bech32Error which has the same data as `orig` + */ + public Bech32Error clone() { + long ret = bindings.Bech32Error_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Bech32Error ret_hu_conv = org.ldk.structs.Bech32Error.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ChainMonitor.java b/src/main/java/org/ldk/structs/ChainMonitor.java index e1b160a3..df02a761 100644 --- a/src/main/java/org/ldk/structs/ChainMonitor.java +++ b/src/main/java/org/ldk/structs/ChainMonitor.java @@ -74,7 +74,7 @@ public class ChainMonitor extends CommonBase { Balance[] ret_conv_9_arr = new Balance[ret_conv_9_len]; for (int j = 0; j < ret_conv_9_len; j++) { long ret_conv_9 = ret[j]; - Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9); + org.ldk.structs.Balance ret_conv_9_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret_conv_9); ret_conv_9_hu_conv.ptrs_to.add(this); ret_conv_9_arr[j] = ret_conv_9_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ChannelDetails.java b/src/main/java/org/ldk/structs/ChannelDetails.java index be561479..e56f706c 100644 --- a/src/main/java/org/ldk/structs/ChannelDetails.java +++ b/src/main/java/org/ldk/structs/ChannelDetails.java @@ -99,15 +99,51 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(val); } + /** + * The features which this channel operates with. See individual features for more info. + * + * `None` until negotiation completes and the channel type is finalized. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public ChannelTypeFeatures get_channel_type() { + long ret = bindings.ChannelDetails_get_channel_type(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTypeFeatures(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * The features which this channel operates with. See individual features for more info. + * + * `None` until negotiation completes and the channel type is finalized. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public void set_channel_type(@Nullable ChannelTypeFeatures val) { + bindings.ChannelDetails_set_channel_type(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * The position of the funding transaction in the chain. None if the funding transaction has * not yet been confirmed and the channel fully opened. + * + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. + * + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid */ public Option_u64Z get_short_channel_id() { long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -115,6 +151,12 @@ public class ChannelDetails extends CommonBase { /** * The position of the funding transaction in the chain. None if the funding transaction has * not yet been confirmed and the channel fully opened. + * + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. + * + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid */ public void set_short_channel_id(Option_u64Z val) { bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr); @@ -122,6 +164,43 @@ public class ChannelDetails extends CommonBase { Reference.reachabilityFence(val); } + /** + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. + * + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. + * + * [`short_channel_id`]: Self::short_channel_id + */ + public Option_u64Z get_inbound_scid_alias() { + long ret = bindings.ChannelDetails_get_inbound_scid_alias(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. + * + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. + * + * [`short_channel_id`]: Self::short_channel_id + */ + public void set_inbound_scid_alias(Option_u64Z val) { + bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * The value, in satoshis, of this channel as appears in the funding output */ @@ -155,7 +234,7 @@ public class ChannelDetails extends CommonBase { long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -318,7 +397,7 @@ public class ChannelDetails extends CommonBase { long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); + org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -355,7 +434,7 @@ public class ChannelDetails extends CommonBase { long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret); + org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -468,12 +547,14 @@ public class ChannelDetails extends CommonBase { /** * Constructs a new ChannelDetails given each field */ - public static ChannelDetails of(byte[] channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg) { - long ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, short_channel_id_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + public static ChannelDetails of(byte[] channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, ChannelTypeFeatures channel_type_arg, Option_u64Z short_channel_id_arg, Option_u64Z inbound_scid_alias_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg) { + long ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, channel_type_arg == null ? 0 : channel_type_arg.ptr & ~1, short_channel_id_arg.ptr, inbound_scid_alias_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); Reference.reachabilityFence(channel_id_arg); Reference.reachabilityFence(counterparty_arg); Reference.reachabilityFence(funding_txo_arg); + Reference.reachabilityFence(channel_type_arg); Reference.reachabilityFence(short_channel_id_arg); + Reference.reachabilityFence(inbound_scid_alias_arg); Reference.reachabilityFence(channel_value_satoshis_arg); Reference.reachabilityFence(unspendable_punishment_reserve_arg); Reference.reachabilityFence(user_channel_id_arg); @@ -510,6 +591,23 @@ public class ChannelDetails extends CommonBase { return ret_hu_conv; } + /** + * Gets the current SCID which should be used to identify this channel for inbound payments. + * This should be used for providing invoice hints or in any other context where our + * counterparty will forward a payment to us. + * + * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the + * [`ChannelDetails::short_channel_id`]. See those for more information. + */ + public Option_u64Z get_inbound_payment_scid() { + long ret = bindings.ChannelDetails_get_inbound_payment_scid(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + /** * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read */ diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java index 9f42abad..f6a3bfb6 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -124,14 +124,73 @@ public class ChannelHandshakeConfig extends CommonBase { Reference.reachabilityFence(val); } + /** + * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the + * BOLTs) option for outbound private channels. This provides better privacy by not including + * our real on-chain channel UTXO in each invoice and requiring that our counterparty only + * relay HTLCs to us using the channel's SCID alias. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a + * [`DecodeError:InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `scid_alias` option; we will simply fall back to a + * private channel without that option. + * + * Ignored if the channel is negotiated to be announced, see + * [`ChannelConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. + * + * Default value: false. This value is likely to change to true in the future. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + */ + public boolean get_negotiate_scid_privacy() { + boolean ret = bindings.ChannelHandshakeConfig_get_negotiate_scid_privacy(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the + * BOLTs) option for outbound private channels. This provides better privacy by not including + * our real on-chain channel UTXO in each invoice and requiring that our counterparty only + * relay HTLCs to us using the channel's SCID alias. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a + * [`DecodeError:InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `scid_alias` option; we will simply fall back to a + * private channel without that option. + * + * Ignored if the channel is negotiated to be announced, see + * [`ChannelConfig::announced_channel`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. + * + * Default value: false. This value is likely to change to true in the future. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + */ + public void set_negotiate_scid_privacy(boolean val) { + bindings.ChannelHandshakeConfig_set_negotiate_scid_privacy(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * Constructs a new ChannelHandshakeConfig given each field */ - public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg) { - long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg); + public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg, boolean negotiate_scid_privacy_arg) { + long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, negotiate_scid_privacy_arg); Reference.reachabilityFence(minimum_depth_arg); Reference.reachabilityFence(our_to_self_delay_arg); Reference.reachabilityFence(our_htlc_minimum_msat_arg); + Reference.reachabilityFence(negotiate_scid_privacy_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index a8d680c1..aad7e4c0 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -143,7 +143,7 @@ public class ChannelInfo extends CommonBase { long ret = bindings.ChannelInfo_get_capacity_sats(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index 25f79c39..ea569eb0 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -537,12 +537,18 @@ public class ChannelManager extends CommonBase { * * The `temporary_channel_id` parameter indicates which inbound channel should be accepted. * - * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest + * For inbound channels, the `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel` call. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ - public Result_NoneAPIErrorZ accept_inbound_channel(byte[] temporary_channel_id) { - long ret = bindings.ChannelManager_accept_inbound_channel(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32)); + public Result_NoneAPIErrorZ accept_inbound_channel(byte[] temporary_channel_id, long user_channel_id) { + long ret = bindings.ChannelManager_accept_inbound_channel(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), user_channel_id); Reference.reachabilityFence(this); Reference.reachabilityFence(temporary_channel_id); + Reference.reachabilityFence(user_channel_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -590,6 +596,8 @@ public class ChannelManager extends CommonBase { * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share * serialized state with LDK node(s) running 0.0.103 and earlier. * + * May panic if `invoice_expiry_delta_secs` is greater than one year. + * * # Note * This method is deprecated and will be removed soon. * @@ -634,8 +642,6 @@ public class ChannelManager extends CommonBase { * If you need exact expiry semantics, you should enforce them upon receipt of * [`PaymentReceived`]. * - * May panic if `invoice_expiry_delta_secs` is greater than one year. - * * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` * set to at least [`MIN_FINAL_CLTV_EXPIRY`]. * @@ -667,6 +673,8 @@ public class ChannelManager extends CommonBase { * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share * serialized state with LDK node(s) running 0.0.103 and earlier. * + * May panic if `invoice_expiry_delta_secs` is greater than one year. + * * # Note * This method is deprecated and will be removed soon. * diff --git a/src/main/java/org/ldk/structs/ChannelManagerPersister.java b/src/main/java/org/ldk/structs/ChannelManagerPersister.java deleted file mode 100644 index 0e3cf347..00000000 --- a/src/main/java/org/ldk/structs/ChannelManagerPersister.java +++ /dev/null @@ -1,68 +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; - -/** - * Trait which handles persisting a [`ChannelManager`] to disk. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class ChannelManagerPersister extends CommonBase { - final bindings.LDKChannelManagerPersister bindings_instance; - ChannelManagerPersister(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private ChannelManagerPersister(bindings.LDKChannelManagerPersister arg) { - super(bindings.LDKChannelManagerPersister_new(arg)); - this.ptrs_to.add(arg); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.ChannelManagerPersister_free(ptr); } super.finalize(); - } - - public static interface ChannelManagerPersisterInterface { - /** - * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed - * (which will cause the [`BackgroundProcessor`] which called this method to exit. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager - */ - Result_NoneErrorZ persist_manager(ChannelManager channel_manager); - } - private static class LDKChannelManagerPersisterHolder { ChannelManagerPersister held; } - public static ChannelManagerPersister new_impl(ChannelManagerPersisterInterface arg) { - final LDKChannelManagerPersisterHolder impl_holder = new LDKChannelManagerPersisterHolder(); - impl_holder.held = new ChannelManagerPersister(new bindings.LDKChannelManagerPersister() { - @Override public long persist_manager(long channel_manager) { - ChannelManager channel_manager_hu_conv = null; if (channel_manager < 0 || channel_manager > 4096) { channel_manager_hu_conv = new ChannelManager(null, channel_manager); } - Result_NoneErrorZ ret = arg.persist_manager(channel_manager_hu_conv); - Reference.reachabilityFence(arg); - long result = ret == null ? 0 : ret.clone_ptr(); - return result; - } - }); - return impl_holder.held; - } - /** - * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed - * (which will cause the [`BackgroundProcessor`] which called this method to exit. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager - */ - public Result_NoneErrorZ persist_manager(ChannelManager channel_manager) { - long ret = bindings.ChannelManagerPersister_persist_manager(this.ptr, channel_manager == null ? 0 : channel_manager.ptr & ~1); - Reference.reachabilityFence(this); - Reference.reachabilityFence(channel_manager); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); - this.ptrs_to.add(channel_manager); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/ChannelMonitor.java b/src/main/java/org/ldk/structs/ChannelMonitor.java index 2f5b4d2e..ff48891e 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitor.java +++ b/src/main/java/org/ldk/structs/ChannelMonitor.java @@ -147,7 +147,7 @@ public class ChannelMonitor extends CommonBase { MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret_conv_14_len]; for (int o = 0; o < ret_conv_14_len; o++) { long ret_conv_14 = ret[o]; - MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14); + org.ldk.structs.MonitorEvent ret_conv_14_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret_conv_14); ret_conv_14_hu_conv.ptrs_to.add(this); ret_conv_14_arr[o] = ret_conv_14_hu_conv; } @@ -169,7 +169,7 @@ public class ChannelMonitor extends CommonBase { Event[] ret_conv_7_arr = new Event[ret_conv_7_len]; for (int h = 0; h < ret_conv_7_len; h++) { long ret_conv_7 = ret[h]; - Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7); + org.ldk.structs.Event ret_conv_7_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret_conv_7); ret_conv_7_hu_conv.ptrs_to.add(this); ret_conv_7_arr[h] = ret_conv_7_hu_conv; } @@ -376,7 +376,7 @@ public class ChannelMonitor extends CommonBase { Balance[] ret_conv_9_arr = new Balance[ret_conv_9_len]; for (int j = 0; j < ret_conv_9_len; j++) { long ret_conv_9 = ret[j]; - Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9); + org.ldk.structs.Balance ret_conv_9_hu_conv = org.ldk.structs.Balance.constr_from_ptr(ret_conv_9); ret_conv_9_hu_conv.ptrs_to.add(this); ret_conv_9_arr[j] = ret_conv_9_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java index 4503cdb6..a6f51a13 100644 --- a/src/main/java/org/ldk/structs/ChannelUpdateInfo.java +++ b/src/main/java/org/ldk/structs/ChannelUpdateInfo.java @@ -101,7 +101,7 @@ public class ChannelUpdateInfo extends CommonBase { long ret = bindings.ChannelUpdateInfo_get_htlc_maximum_msat(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ClosureReason.java b/src/main/java/org/ldk/structs/ClosureReason.java index ad198c32..519ac61b 100644 --- a/src/main/java/org/ldk/structs/ClosureReason.java +++ b/src/main/java/org/ldk/structs/ClosureReason.java @@ -62,7 +62,7 @@ public class ClosureReason extends CommonBase { * or printed to stdout). Otherwise, a well crafted error message may exploit * a security vulnerability in the terminal emulator or the logging subsystem. */ - public final String peer_msg; + public final java.lang.String peer_msg; private CounterpartyForceClosed(long ptr, bindings.LDKClosureReason.CounterpartyForceClosed obj) { super(null, ptr); this.peer_msg = obj.peer_msg; @@ -112,7 +112,7 @@ public class ClosureReason extends CommonBase { /** * A developer-readable error message which we generated. */ - public final String err; + public final java.lang.String err; private ProcessingError(long ptr, bindings.LDKClosureReason.ProcessingError obj) { super(null, ptr); this.err = obj.err; @@ -152,7 +152,7 @@ public class ClosureReason extends CommonBase { long ret = bindings.ClosureReason_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -164,7 +164,7 @@ public class ClosureReason extends CommonBase { long ret = bindings.ClosureReason_counterparty_force_closed(peer_msg); Reference.reachabilityFence(peer_msg); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -175,7 +175,7 @@ public class ClosureReason extends CommonBase { public static ClosureReason holder_force_closed() { long ret = bindings.ClosureReason_holder_force_closed(); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -186,7 +186,7 @@ public class ClosureReason extends CommonBase { public static ClosureReason cooperative_closure() { long ret = bindings.ClosureReason_cooperative_closure(); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -197,7 +197,7 @@ public class ClosureReason extends CommonBase { public static ClosureReason commitment_tx_confirmed() { long ret = bindings.ClosureReason_commitment_tx_confirmed(); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -208,7 +208,7 @@ public class ClosureReason extends CommonBase { public static ClosureReason funding_timed_out() { long ret = bindings.ClosureReason_funding_timed_out(); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -220,7 +220,7 @@ public class ClosureReason extends CommonBase { long ret = bindings.ClosureReason_processing_error(err); Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -231,7 +231,7 @@ public class ClosureReason extends CommonBase { public static ClosureReason disconnected_peer() { long ret = bindings.ClosureReason_disconnected_peer(); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -242,7 +242,7 @@ public class ClosureReason extends CommonBase { public static ClosureReason outdated_channel_manager() { long ret = bindings.ClosureReason_outdated_channel_manager(); if (ret >= 0 && ret <= 4096) { return null; } - ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + org.ldk.structs.ClosureReason ret_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/DefaultRouter.java b/src/main/java/org/ldk/structs/DefaultRouter.java index 964a0cf5..4e444c78 100644 --- a/src/main/java/org/ldk/structs/DefaultRouter.java +++ b/src/main/java/org/ldk/structs/DefaultRouter.java @@ -21,12 +21,14 @@ public class DefaultRouter extends CommonBase { } /** - * Creates a new router using the given [`NetworkGraph`] and [`Logger`]. + * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source + * `random_seed_bytes`. */ - public static DefaultRouter of(NetworkGraph network_graph, Logger logger) { - long ret = bindings.DefaultRouter_new(network_graph == null ? 0 : network_graph.ptr & ~1, logger == null ? 0 : logger.ptr); + public static DefaultRouter of(NetworkGraph network_graph, Logger logger, byte[] random_seed_bytes) { + long ret = bindings.DefaultRouter_new(network_graph == null ? 0 : network_graph.ptr & ~1, logger == null ? 0 : logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32)); Reference.reachabilityFence(network_graph); Reference.reachabilityFence(logger); + Reference.reachabilityFence(random_seed_bytes); if (ret >= 0 && ret <= 4096) { return null; } DefaultRouter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DefaultRouter(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/DirectedChannelInfo.java b/src/main/java/org/ldk/structs/DirectedChannelInfo.java index 5dea625f..be7271b4 100644 --- a/src/main/java/org/ldk/structs/DirectedChannelInfo.java +++ b/src/main/java/org/ldk/structs/DirectedChannelInfo.java @@ -77,7 +77,7 @@ public class DirectedChannelInfo extends CommonBase { long ret = bindings.DirectedChannelInfo_effective_capacity(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/EffectiveCapacity.java b/src/main/java/org/ldk/structs/EffectiveCapacity.java index 777c3b66..7357afd1 100644 --- a/src/main/java/org/ldk/structs/EffectiveCapacity.java +++ b/src/main/java/org/ldk/structs/EffectiveCapacity.java @@ -114,7 +114,7 @@ public class EffectiveCapacity extends CommonBase { long ret = bindings.EffectiveCapacity_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -126,7 +126,7 @@ public class EffectiveCapacity extends CommonBase { long ret = bindings.EffectiveCapacity_exact_liquidity(liquidity_msat); Reference.reachabilityFence(liquidity_msat); if (ret >= 0 && ret <= 4096) { return null; } - EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -138,7 +138,7 @@ public class EffectiveCapacity extends CommonBase { long ret = bindings.EffectiveCapacity_maximum_htlc(amount_msat); Reference.reachabilityFence(amount_msat); if (ret >= 0 && ret <= 4096) { return null; } - EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -150,7 +150,7 @@ public class EffectiveCapacity extends CommonBase { long ret = bindings.EffectiveCapacity_total(capacity_msat); Reference.reachabilityFence(capacity_msat); if (ret >= 0 && ret <= 4096) { return null; } - EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -161,7 +161,7 @@ public class EffectiveCapacity extends CommonBase { public static EffectiveCapacity infinite() { long ret = bindings.EffectiveCapacity_infinite(); if (ret >= 0 && ret <= 4096) { return null; } - EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -172,7 +172,7 @@ public class EffectiveCapacity extends CommonBase { public static EffectiveCapacity unknown() { long ret = bindings.EffectiveCapacity_unknown(); if (ret >= 0 && ret <= 4096) { return null; } - EffectiveCapacity ret_hu_conv = EffectiveCapacity.constr_from_ptr(ret); + org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ErrorAction.java b/src/main/java/org/ldk/structs/ErrorAction.java index bb9b7e44..f5769f87 100644 --- a/src/main/java/org/ldk/structs/ErrorAction.java +++ b/src/main/java/org/ldk/structs/ErrorAction.java @@ -51,7 +51,7 @@ public class ErrorAction extends CommonBase { * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - @Nullable public final ErrorMessage msg; + @Nullable public final org.ldk.structs.ErrorMessage msg; private DisconnectPeer(long ptr, bindings.LDKErrorAction.DisconnectPeer obj) { super(null, ptr); long msg = obj.msg; @@ -73,7 +73,7 @@ public class ErrorAction extends CommonBase { * If the error is logged, log it at the given level. */ public final static class IgnoreAndLog extends ErrorAction { - public final Level ignore_and_log; + public final org.ldk.enums.Level ignore_and_log; private IgnoreAndLog(long ptr, bindings.LDKErrorAction.IgnoreAndLog obj) { super(null, ptr); this.ignore_and_log = obj.ignore_and_log; @@ -96,7 +96,7 @@ public class ErrorAction extends CommonBase { /** * The message to send. */ - public final ErrorMessage msg; + public final org.ldk.structs.ErrorMessage msg; private SendErrorMessage(long ptr, bindings.LDKErrorAction.SendErrorMessage obj) { super(null, ptr); long msg = obj.msg; @@ -112,13 +112,13 @@ public class ErrorAction extends CommonBase { /** * The message to send. */ - public final WarningMessage msg; + public final org.ldk.structs.WarningMessage msg; /** * The peer may have done something harmless that we weren't able to meaningfully process, * though we should still tell them about it. * If this event is logged, log it at the given level. */ - public final Level log_level; + public final org.ldk.enums.Level log_level; private SendWarningMessage(long ptr, bindings.LDKErrorAction.SendWarningMessage obj) { super(null, ptr); long msg = obj.msg; @@ -141,7 +141,7 @@ public class ErrorAction extends CommonBase { long ret = bindings.ErrorAction_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -153,7 +153,7 @@ public class ErrorAction extends CommonBase { long ret = bindings.ErrorAction_disconnect_peer(msg == null ? 0 : msg.ptr & ~1); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -164,7 +164,7 @@ public class ErrorAction extends CommonBase { public static ErrorAction ignore_error() { long ret = bindings.ErrorAction_ignore_error(); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -176,7 +176,7 @@ public class ErrorAction extends CommonBase { long ret = bindings.ErrorAction_ignore_and_log(a); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -187,7 +187,7 @@ public class ErrorAction extends CommonBase { public static ErrorAction ignore_duplicate_gossip() { long ret = bindings.ErrorAction_ignore_duplicate_gossip(); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -199,7 +199,7 @@ public class ErrorAction extends CommonBase { long ret = bindings.ErrorAction_send_error_message(msg == null ? 0 : msg.ptr & ~1); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -212,7 +212,7 @@ public class ErrorAction extends CommonBase { Reference.reachabilityFence(msg); Reference.reachabilityFence(log_level); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Event.java b/src/main/java/org/ldk/structs/Event.java index 149e1a1d..f0e7bbc2 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -134,13 +134,13 @@ public class Event extends CommonBase { * Information for claiming this received payment, based on whether the purpose of the * payment is to pay an invoice or to send a spontaneous payment. */ - public final PaymentPurpose purpose; + public final org.ldk.structs.PaymentPurpose purpose; private PaymentReceived(long ptr, bindings.LDKEvent.PaymentReceived obj) { super(null, ptr); this.payment_hash = obj.payment_hash; this.amt = obj.amt; long purpose = obj.purpose; - PaymentPurpose purpose_hu_conv = PaymentPurpose.constr_from_ptr(purpose); + org.ldk.structs.PaymentPurpose purpose_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(purpose); purpose_hu_conv.ptrs_to.add(this); this.purpose = purpose_hu_conv; } @@ -186,14 +186,14 @@ public class Event extends CommonBase { * * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees */ - public final Option_u64Z fee_paid_msat; + public final org.ldk.structs.Option_u64Z fee_paid_msat; private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) { super(null, ptr); this.payment_id = obj.payment_id; this.payment_preimage = obj.payment_preimage; this.payment_hash = obj.payment_hash; long fee_paid_msat = obj.fee_paid_msat; - Option_u64Z fee_paid_msat_hu_conv = Option_u64Z.constr_from_ptr(fee_paid_msat); + org.ldk.structs.Option_u64Z fee_paid_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_paid_msat); fee_paid_msat_hu_conv.ptrs_to.add(this); this.fee_paid_msat = fee_paid_msat_hu_conv; } @@ -241,7 +241,7 @@ public class Event extends CommonBase { * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler */ - public final Option_NetworkUpdateZ network_update; + public final org.ldk.structs.Option_NetworkUpdateZ network_update; /** * For both single-path and multi-path payments, this is set if all paths of the payment have * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the @@ -272,7 +272,7 @@ public class Event extends CommonBase { * If this is `Some`, then the corresponding channel should be avoided when the payment is * retried. May be `None` for older [`Event`] serializations. */ - public final Option_u64Z short_channel_id; + public final org.ldk.structs.Option_u64Z short_channel_id; /** * Parameters needed to compute a new [`Route`] when retrying the failed payment path. * @@ -283,14 +283,14 @@ public class Event extends CommonBase { * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - @Nullable public final RouteParameters retry; + @Nullable public final org.ldk.structs.RouteParameters retry; private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) { super(null, ptr); this.payment_id = obj.payment_id; this.payment_hash = obj.payment_hash; this.rejected_by_dest = obj.rejected_by_dest; long network_update = obj.network_update; - Option_NetworkUpdateZ network_update_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(network_update); + org.ldk.structs.Option_NetworkUpdateZ network_update_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(network_update); network_update_hu_conv.ptrs_to.add(this); this.network_update = network_update_hu_conv; this.all_paths_failed = obj.all_paths_failed; @@ -305,7 +305,7 @@ public class Event extends CommonBase { } this.path = path_conv_10_arr; long short_channel_id = obj.short_channel_id; - Option_u64Z short_channel_id_hu_conv = Option_u64Z.constr_from_ptr(short_channel_id); + org.ldk.structs.Option_u64Z short_channel_id_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(short_channel_id); short_channel_id_hu_conv.ptrs_to.add(this); this.short_channel_id = short_channel_id_hu_conv; long retry = obj.retry; @@ -384,7 +384,7 @@ public class Event extends CommonBase { SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs_conv_27_len]; for (int b = 0; b < outputs_conv_27_len; b++) { long outputs_conv_27 = outputs[b]; - SpendableOutputDescriptor outputs_conv_27_hu_conv = SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27); + org.ldk.structs.SpendableOutputDescriptor outputs_conv_27_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27); outputs_conv_27_hu_conv.ptrs_to.add(this); outputs_conv_27_arr[b] = outputs_conv_27_hu_conv; } @@ -411,7 +411,7 @@ public class Event extends CommonBase { * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is * `None`. */ - public final Option_u64Z fee_earned_msat; + public final org.ldk.structs.Option_u64Z fee_earned_msat; /** * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain * transaction. @@ -420,7 +420,7 @@ public class Event extends CommonBase { private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) { super(null, ptr); long fee_earned_msat = obj.fee_earned_msat; - Option_u64Z fee_earned_msat_hu_conv = Option_u64Z.constr_from_ptr(fee_earned_msat); + org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat); fee_earned_msat_hu_conv.ptrs_to.add(this); this.fee_earned_msat = fee_earned_msat_hu_conv; this.claim_from_onchain_tx = obj.claim_from_onchain_tx; @@ -436,23 +436,27 @@ public class Event extends CommonBase { */ public final byte[] channel_id; /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for - * an inbound channel. This will always be zero for objects serialized with LDK versions - * prior to 0.0.102. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be 0 for an inbound channel. + * This will always be zero for objects serialized with LDK versions prior to 0.0.102. * * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ public final long user_channel_id; /** * The reason the channel was closed. */ - public final ClosureReason reason; + public final org.ldk.structs.ClosureReason reason; private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) { super(null, ptr); this.channel_id = obj.channel_id; this.user_channel_id = obj.user_channel_id; long reason = obj.reason; - ClosureReason reason_hu_conv = ClosureReason.constr_from_ptr(reason); + org.ldk.structs.ClosureReason reason_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(reason); reason_hu_conv.ptrs_to.add(this); this.reason = reason_hu_conv; } @@ -558,12 +562,28 @@ public class Event extends CommonBase { * Our starting balance in the channel if the request is accepted, in milli-satoshi. */ public final long push_msat; + /** + * The features that this channel will operate with. If you reject the channel, a + * well-behaved counterparty may automatically re-attempt the channel with a new set of + * feature flags. + * + * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type, + * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to + * 0.0.106. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + */ + public final org.ldk.structs.ChannelTypeFeatures channel_type; private OpenChannelRequest(long ptr, bindings.LDKEvent.OpenChannelRequest obj) { super(null, ptr); this.temporary_channel_id = obj.temporary_channel_id; this.counterparty_node_id = obj.counterparty_node_id; this.funding_satoshis = obj.funding_satoshis; this.push_msat = obj.push_msat; + long channel_type = obj.channel_type; + ChannelTypeFeatures channel_type_hu_conv = null; if (channel_type < 0 || channel_type > 4096) { channel_type_hu_conv = new ChannelTypeFeatures(null, channel_type); } + channel_type_hu_conv.ptrs_to.add(this); + this.channel_type = channel_type_hu_conv; } } long clone_ptr() { @@ -579,7 +599,7 @@ public class Event extends CommonBase { long ret = bindings.Event_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -594,7 +614,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(output_script); Reference.reachabilityFence(user_channel_id); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -608,7 +628,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(amt); Reference.reachabilityFence(purpose); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -623,7 +643,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(fee_paid_msat); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -642,7 +662,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(short_channel_id); Reference.reachabilityFence(retry); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -655,7 +675,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(payment_id); Reference.reachabilityFence(payment_hash); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -667,7 +687,7 @@ public class Event extends CommonBase { long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable); Reference.reachabilityFence(time_forwardable); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -679,7 +699,7 @@ public class Event extends CommonBase { long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null); Reference.reachabilityFence(outputs); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -692,7 +712,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(fee_earned_msat); Reference.reachabilityFence(claim_from_onchain_tx); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -706,7 +726,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(user_channel_id); Reference.reachabilityFence(reason); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -719,7 +739,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(channel_id); Reference.reachabilityFence(transaction); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -733,7 +753,7 @@ public class Event extends CommonBase { Reference.reachabilityFence(payment_hash); Reference.reachabilityFence(path); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -741,14 +761,15 @@ public class Event extends CommonBase { /** * Utility method to constructs a new OpenChannelRequest-variant Event */ - public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat) { - long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat); + public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, ChannelTypeFeatures channel_type) { + long ret = bindings.Event_open_channel_request(InternalUtils.check_arr_len(temporary_channel_id, 32), InternalUtils.check_arr_len(counterparty_node_id, 33), funding_satoshis, push_msat, channel_type == null ? 0 : channel_type.ptr & ~1); Reference.reachabilityFence(temporary_channel_id); Reference.reachabilityFence(counterparty_node_id); Reference.reachabilityFence(funding_satoshis); Reference.reachabilityFence(push_msat); + Reference.reachabilityFence(channel_type); if (ret >= 0 && ret <= 4096) { return null; } - Event ret_hu_conv = Event.constr_from_ptr(ret); + org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Fallback.java b/src/main/java/org/ldk/structs/Fallback.java index a94becab..17661f8b 100644 --- a/src/main/java/org/ldk/structs/Fallback.java +++ b/src/main/java/org/ldk/structs/Fallback.java @@ -34,7 +34,7 @@ public class Fallback extends CommonBase { } public final static class SegWitProgram extends Fallback { - public final UInt5 version; + public final org.ldk.util.UInt5 version; public final byte[] program; private SegWitProgram(long ptr, bindings.LDKFallback.SegWitProgram obj) { super(null, ptr); @@ -71,7 +71,7 @@ public class Fallback extends CommonBase { long ret = bindings.Fallback_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); + org.ldk.structs.Fallback ret_hu_conv = org.ldk.structs.Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -84,7 +84,7 @@ public class Fallback extends CommonBase { Reference.reachabilityFence(version); Reference.reachabilityFence(program); if (ret >= 0 && ret <= 4096) { return null; } - Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); + org.ldk.structs.Fallback ret_hu_conv = org.ldk.structs.Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -96,7 +96,7 @@ public class Fallback extends CommonBase { long ret = bindings.Fallback_pub_key_hash(InternalUtils.check_arr_len(a, 20)); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); + org.ldk.structs.Fallback ret_hu_conv = org.ldk.structs.Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -108,7 +108,7 @@ public class Fallback extends CommonBase { long ret = bindings.Fallback_script_hash(InternalUtils.check_arr_len(a, 20)); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); + org.ldk.structs.Fallback ret_hu_conv = org.ldk.structs.Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java index 340da1b9..8d3e19fb 100644 --- a/src/main/java/org/ldk/structs/Filter.java +++ b/src/main/java/org/ldk/structs/Filter.java @@ -108,7 +108,7 @@ public class Filter extends CommonBase { Reference.reachabilityFence(this); Reference.reachabilityFence(output); if (ret >= 0 && ret <= 4096) { return null; } - Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); + org.ldk.structs.Option_C2Tuple_usizeTransactionZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/FixedPenaltyScorer.java b/src/main/java/org/ldk/structs/FixedPenaltyScorer.java index ca8b6acb..c2e427d1 100644 --- a/src/main/java/org/ldk/structs/FixedPenaltyScorer.java +++ b/src/main/java/org/ldk/structs/FixedPenaltyScorer.java @@ -38,26 +38,6 @@ public class FixedPenaltyScorer extends CommonBase { return ret_hu_conv; } - /** - * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read - */ - public byte[] write() { - byte[] ret = bindings.FixedPenaltyScorer_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write - */ - public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser) { - long ret = bindings.FixedPenaltyScorer_read(ser); - Reference.reachabilityFence(ser); - if (ret >= 0 && ret <= 4096) { return null; } - Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - /** * Creates a new scorer using `penalty_msat`. */ @@ -83,4 +63,25 @@ public class FixedPenaltyScorer extends CommonBase { return ret_hu_conv; } + /** + * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read + */ + public byte[] write() { + byte[] ret = bindings.FixedPenaltyScorer_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write + */ + public static Result_FixedPenaltyScorerDecodeErrorZ read(byte[] ser, long arg) { + long ret = bindings.FixedPenaltyScorer_read(ser, arg); + Reference.reachabilityFence(ser); + Reference.reachabilityFence(arg); + if (ret >= 0 && ret <= 4096) { return null; } + Result_FixedPenaltyScorerDecodeErrorZ ret_hu_conv = Result_FixedPenaltyScorerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + } diff --git a/src/main/java/org/ldk/structs/FundingLocked.java b/src/main/java/org/ldk/structs/FundingLocked.java index faebaa23..924a31fa 100644 --- a/src/main/java/org/ldk/structs/FundingLocked.java +++ b/src/main/java/org/ldk/structs/FundingLocked.java @@ -56,13 +56,37 @@ public class FundingLocked extends CommonBase { Reference.reachabilityFence(val); } + /** + * If set, provides a short_channel_id alias for this channel. The sender will accept payments + * to be forwarded over this SCID and forward them to this messages' recipient. + */ + public Option_u64Z get_short_channel_id_alias() { + long ret = bindings.FundingLocked_get_short_channel_id_alias(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * If set, provides a short_channel_id alias for this channel. The sender will accept payments + * to be forwarded over this SCID and forward them to this messages' recipient. + */ + public void set_short_channel_id_alias(Option_u64Z val) { + bindings.FundingLocked_set_short_channel_id_alias(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * Constructs a new FundingLocked given each field */ - public static FundingLocked of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg) { - long ret = bindings.FundingLocked_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33)); + public static FundingLocked of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg, Option_u64Z short_channel_id_alias_arg) { + long ret = bindings.FundingLocked_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33), short_channel_id_alias_arg.ptr); Reference.reachabilityFence(channel_id_arg); Reference.reachabilityFence(next_per_commitment_point_arg); + Reference.reachabilityFence(short_channel_id_alias_arg); if (ret >= 0 && ret <= 4096) { return null; } FundingLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingLocked(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java index 87aa7f55..91c2e6f4 100644 --- a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java +++ b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java @@ -109,7 +109,7 @@ public class HTLCOutputInCommitment extends CommonBase { long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); + org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index fd91adc0..35d54038 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -41,12 +41,40 @@ public class Init extends CommonBase { Reference.reachabilityFence(val); } + /** + * The receipient's network address. This adds the option to report a remote IP address + * back to a connecting peer using the init message. A node can decide to use that information + * to discover a potential update to its public IPv4 address (NAT) and use + * that for a node_announcement update message containing the new address. + */ + public Option_NetAddressZ get_remote_network_address() { + long ret = bindings.Init_get_remote_network_address(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * The receipient's network address. This adds the option to report a remote IP address + * back to a connecting peer using the init message. A node can decide to use that information + * to discover a potential update to its public IPv4 address (NAT) and use + * that for a node_announcement update message containing the new address. + */ + public void set_remote_network_address(Option_NetAddressZ val) { + bindings.Init_set_remote_network_address(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * Constructs a new Init given each field */ - public static Init of(InitFeatures features_arg) { - long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1); + public static Init of(InitFeatures features_arg, Option_NetAddressZ remote_network_address_arg) { + long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1, remote_network_address_arg.ptr); Reference.reachabilityFence(features_arg); + Reference.reachabilityFence(remote_network_address_arg); if (ret >= 0 && ret <= 4096) { return null; } Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Init(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/Invoice.java b/src/main/java/org/ldk/structs/Invoice.java index e46ac174..3f209e3d 100644 --- a/src/main/java/org/ldk/structs/Invoice.java +++ b/src/main/java/org/ldk/structs/Invoice.java @@ -275,7 +275,7 @@ public class Invoice extends CommonBase { long ret = bindings.Invoice_amount_milli_satoshis(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -283,11 +283,11 @@ public class Invoice extends CommonBase { /** * Read a Invoice object from a string */ - public static Result_InvoiceNoneZ from_str(java.lang.String s) { + public static Result_InvoiceParseOrSemanticErrorZ from_str(java.lang.String s) { long ret = bindings.Invoice_from_str(s); Reference.reachabilityFence(s); if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); + Result_InvoiceParseOrSemanticErrorZ ret_hu_conv = Result_InvoiceParseOrSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java index 6c511c7f..9934b424 100644 --- a/src/main/java/org/ldk/structs/LightningError.java +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -45,7 +45,7 @@ public class LightningError extends CommonBase { long ret = bindings.LightningError_get_action(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + org.ldk.structs.ErrorAction ret_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/MessageSendEvent.java b/src/main/java/org/ldk/structs/MessageSendEvent.java index 535c80c7..4d9633c1 100644 --- a/src/main/java/org/ldk/structs/MessageSendEvent.java +++ b/src/main/java/org/ldk/structs/MessageSendEvent.java @@ -80,6 +80,9 @@ public class MessageSendEvent extends CommonBase { if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendReplyChannelRange.class) { return new SendReplyChannelRange(ptr, (bindings.LDKMessageSendEvent.SendReplyChannelRange)raw_val); } + if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendGossipTimestampFilter.class) { + return new SendGossipTimestampFilter(ptr, (bindings.LDKMessageSendEvent.SendGossipTimestampFilter)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -95,7 +98,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final AcceptChannel msg; + public final org.ldk.structs.AcceptChannel msg; private SendAcceptChannel(long ptr, bindings.LDKMessageSendEvent.SendAcceptChannel obj) { super(null, ptr); this.node_id = obj.node_id; @@ -117,7 +120,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final OpenChannel msg; + public final org.ldk.structs.OpenChannel msg; private SendOpenChannel(long ptr, bindings.LDKMessageSendEvent.SendOpenChannel obj) { super(null, ptr); this.node_id = obj.node_id; @@ -138,7 +141,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final FundingCreated msg; + public final org.ldk.structs.FundingCreated msg; private SendFundingCreated(long ptr, bindings.LDKMessageSendEvent.SendFundingCreated obj) { super(null, ptr); this.node_id = obj.node_id; @@ -159,7 +162,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final FundingSigned msg; + public final org.ldk.structs.FundingSigned msg; private SendFundingSigned(long ptr, bindings.LDKMessageSendEvent.SendFundingSigned obj) { super(null, ptr); this.node_id = obj.node_id; @@ -180,7 +183,7 @@ public class MessageSendEvent extends CommonBase { /** * The funding_locked message which should be sent. */ - public final FundingLocked msg; + public final org.ldk.structs.FundingLocked msg; private SendFundingLocked(long ptr, bindings.LDKMessageSendEvent.SendFundingLocked obj) { super(null, ptr); this.node_id = obj.node_id; @@ -201,7 +204,7 @@ public class MessageSendEvent extends CommonBase { /** * The announcement_signatures message which should be sent. */ - public final AnnouncementSignatures msg; + public final org.ldk.structs.AnnouncementSignatures msg; private SendAnnouncementSignatures(long ptr, bindings.LDKMessageSendEvent.SendAnnouncementSignatures obj) { super(null, ptr); this.node_id = obj.node_id; @@ -223,7 +226,7 @@ public class MessageSendEvent extends CommonBase { /** * The update messages which should be sent. ALL messages in the struct should be sent! */ - public final CommitmentUpdate updates; + public final org.ldk.structs.CommitmentUpdate updates; private UpdateHTLCs(long ptr, bindings.LDKMessageSendEvent.UpdateHTLCs obj) { super(null, ptr); this.node_id = obj.node_id; @@ -244,7 +247,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final RevokeAndACK msg; + public final org.ldk.structs.RevokeAndACK msg; private SendRevokeAndACK(long ptr, bindings.LDKMessageSendEvent.SendRevokeAndACK obj) { super(null, ptr); this.node_id = obj.node_id; @@ -265,7 +268,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final ClosingSigned msg; + public final org.ldk.structs.ClosingSigned msg; private SendClosingSigned(long ptr, bindings.LDKMessageSendEvent.SendClosingSigned obj) { super(null, ptr); this.node_id = obj.node_id; @@ -286,7 +289,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final Shutdown msg; + public final org.ldk.structs.Shutdown msg; private SendShutdown(long ptr, bindings.LDKMessageSendEvent.SendShutdown obj) { super(null, ptr); this.node_id = obj.node_id; @@ -307,7 +310,7 @@ public class MessageSendEvent extends CommonBase { /** * The message which should be sent. */ - public final ChannelReestablish msg; + public final org.ldk.structs.ChannelReestablish msg; private SendChannelReestablish(long ptr, bindings.LDKMessageSendEvent.SendChannelReestablish obj) { super(null, ptr); this.node_id = obj.node_id; @@ -331,11 +334,11 @@ public class MessageSendEvent extends CommonBase { /** * The channel_announcement which should be sent. */ - public final ChannelAnnouncement msg; + public final org.ldk.structs.ChannelAnnouncement msg; /** * The followup channel_update which should be sent. */ - public final ChannelUpdate update_msg; + public final org.ldk.structs.ChannelUpdate update_msg; private BroadcastChannelAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelAnnouncement obj) { super(null, ptr); long msg = obj.msg; @@ -355,7 +358,7 @@ public class MessageSendEvent extends CommonBase { /** * The node_announcement which should be sent. */ - public final NodeAnnouncement msg; + public final org.ldk.structs.NodeAnnouncement msg; private BroadcastNodeAnnouncement(long ptr, bindings.LDKMessageSendEvent.BroadcastNodeAnnouncement obj) { super(null, ptr); long msg = obj.msg; @@ -371,7 +374,7 @@ public class MessageSendEvent extends CommonBase { /** * The channel_update which should be sent. */ - public final ChannelUpdate msg; + public final org.ldk.structs.ChannelUpdate msg; private BroadcastChannelUpdate(long ptr, bindings.LDKMessageSendEvent.BroadcastChannelUpdate obj) { super(null, ptr); long msg = obj.msg; @@ -393,7 +396,7 @@ public class MessageSendEvent extends CommonBase { /** * The channel_update which should be sent. */ - public final ChannelUpdate msg; + public final org.ldk.structs.ChannelUpdate msg; private SendChannelUpdate(long ptr, bindings.LDKMessageSendEvent.SendChannelUpdate obj) { super(null, ptr); this.node_id = obj.node_id; @@ -414,12 +417,12 @@ public class MessageSendEvent extends CommonBase { /** * The action which should be taken. */ - public final ErrorAction action; + public final org.ldk.structs.ErrorAction action; private HandleError(long ptr, bindings.LDKMessageSendEvent.HandleError obj) { super(null, ptr); this.node_id = obj.node_id; long action = obj.action; - ErrorAction action_hu_conv = ErrorAction.constr_from_ptr(action); + org.ldk.structs.ErrorAction action_hu_conv = org.ldk.structs.ErrorAction.constr_from_ptr(action); action_hu_conv.ptrs_to.add(this); this.action = action_hu_conv; } @@ -435,7 +438,7 @@ public class MessageSendEvent extends CommonBase { /** * The query_channel_range which should be sent. */ - public final QueryChannelRange msg; + public final org.ldk.structs.QueryChannelRange msg; private SendChannelRangeQuery(long ptr, bindings.LDKMessageSendEvent.SendChannelRangeQuery obj) { super(null, ptr); this.node_id = obj.node_id; @@ -457,7 +460,7 @@ public class MessageSendEvent extends CommonBase { /** * The query_short_channel_ids which should be sent. */ - public final QueryShortChannelIds msg; + public final org.ldk.structs.QueryShortChannelIds msg; private SendShortIdsQuery(long ptr, bindings.LDKMessageSendEvent.SendShortIdsQuery obj) { super(null, ptr); this.node_id = obj.node_id; @@ -479,7 +482,7 @@ public class MessageSendEvent extends CommonBase { /** * The reply_channel_range which should be sent. */ - public final ReplyChannelRange msg; + public final org.ldk.structs.ReplyChannelRange msg; private SendReplyChannelRange(long ptr, bindings.LDKMessageSendEvent.SendReplyChannelRange obj) { super(null, ptr); this.node_id = obj.node_id; @@ -489,6 +492,28 @@ public class MessageSendEvent extends CommonBase { this.msg = msg_hu_conv; } } + /** + * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to + * enable receiving gossip messages from the peer. + */ + public final static class SendGossipTimestampFilter extends MessageSendEvent { + /** + * The node_id of this message recipient + */ + public final byte[] node_id; + /** + * The gossip_timestamp_filter which should be sent. + */ + public final org.ldk.structs.GossipTimestampFilter msg; + private SendGossipTimestampFilter(long ptr, bindings.LDKMessageSendEvent.SendGossipTimestampFilter obj) { + super(null, ptr); + this.node_id = obj.node_id; + long msg = obj.msg; + GossipTimestampFilter msg_hu_conv = null; if (msg < 0 || msg > 4096) { msg_hu_conv = new GossipTimestampFilter(null, msg); } + msg_hu_conv.ptrs_to.add(this); + this.msg = msg_hu_conv; + } + } long clone_ptr() { long ret = bindings.MessageSendEvent_clone_ptr(this.ptr); Reference.reachabilityFence(this); @@ -502,7 +527,7 @@ public class MessageSendEvent extends CommonBase { long ret = bindings.MessageSendEvent_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -515,7 +540,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -528,7 +553,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -541,7 +566,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -554,7 +579,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -567,7 +592,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -580,7 +605,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -593,7 +618,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(updates); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -606,7 +631,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -619,7 +644,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -632,7 +657,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -645,7 +670,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -658,7 +683,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(msg); Reference.reachabilityFence(update_msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -670,7 +695,7 @@ public class MessageSendEvent extends CommonBase { long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -682,7 +707,7 @@ public class MessageSendEvent extends CommonBase { long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -695,7 +720,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -708,7 +733,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(action); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -721,7 +746,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -734,7 +759,7 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -747,7 +772,20 @@ public class MessageSendEvent extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent + */ + public static MessageSendEvent send_gossip_timestamp_filter(byte[] node_id, GossipTimestampFilter msg) { + long ret = bindings.MessageSendEvent_send_gossip_timestamp_filter(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.MessageSendEvent ret_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java index 046acfed..57e61032 100644 --- a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java +++ b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java @@ -55,7 +55,7 @@ public class MessageSendEventsProvider extends CommonBase { MessageSendEvent[] ret_conv_18_arr = new MessageSendEvent[ret_conv_18_len]; for (int s = 0; s < ret_conv_18_len; s++) { long ret_conv_18 = ret[s]; - MessageSendEvent ret_conv_18_hu_conv = MessageSendEvent.constr_from_ptr(ret_conv_18); + org.ldk.structs.MessageSendEvent ret_conv_18_hu_conv = org.ldk.structs.MessageSendEvent.constr_from_ptr(ret_conv_18); ret_conv_18_hu_conv.ptrs_to.add(this); ret_conv_18_arr[s] = ret_conv_18_hu_conv; } diff --git a/src/main/java/org/ldk/structs/MonitorEvent.java b/src/main/java/org/ldk/structs/MonitorEvent.java index 5ba0cc37..0beb6f64 100644 --- a/src/main/java/org/ldk/structs/MonitorEvent.java +++ b/src/main/java/org/ldk/structs/MonitorEvent.java @@ -40,7 +40,7 @@ public class MonitorEvent extends CommonBase { * A monitor event containing an HTLCUpdate. */ public final static class HTLCEvent extends MonitorEvent { - public final HTLCUpdate htlc_event; + public final org.ldk.structs.HTLCUpdate htlc_event; private HTLCEvent(long ptr, bindings.LDKMonitorEvent.HTLCEvent obj) { super(null, ptr); long htlc_event = obj.htlc_event; @@ -53,7 +53,7 @@ public class MonitorEvent extends CommonBase { * A monitor event that the Channel's commitment transaction was confirmed. */ public final static class CommitmentTxConfirmed extends MonitorEvent { - public final OutPoint commitment_tx_confirmed; + public final org.ldk.structs.OutPoint commitment_tx_confirmed; private CommitmentTxConfirmed(long ptr, bindings.LDKMonitorEvent.CommitmentTxConfirmed obj) { super(null, ptr); long commitment_tx_confirmed = obj.commitment_tx_confirmed; @@ -72,7 +72,7 @@ public class MonitorEvent extends CommonBase { /** * The funding outpoint of the [`ChannelMonitor`] that was updated */ - public final OutPoint funding_txo; + public final org.ldk.structs.OutPoint funding_txo; /** * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or * [`ChannelMonitor::get_latest_update_id`]. @@ -97,7 +97,7 @@ public class MonitorEvent extends CommonBase { * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure */ public final static class UpdateFailed extends MonitorEvent { - public final OutPoint update_failed; + public final org.ldk.structs.OutPoint update_failed; private UpdateFailed(long ptr, bindings.LDKMonitorEvent.UpdateFailed obj) { super(null, ptr); long update_failed = obj.update_failed; @@ -119,7 +119,7 @@ public class MonitorEvent extends CommonBase { long ret = bindings.MonitorEvent_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); + org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -131,7 +131,7 @@ public class MonitorEvent extends CommonBase { long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr & ~1); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); + org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -143,7 +143,7 @@ public class MonitorEvent extends CommonBase { long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); + org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -156,7 +156,7 @@ public class MonitorEvent extends CommonBase { Reference.reachabilityFence(funding_txo); Reference.reachabilityFence(monitor_update_id); if (ret >= 0 && ret <= 4096) { return null; } - MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); + org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -168,7 +168,7 @@ public class MonitorEvent extends CommonBase { long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr & ~1); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); + org.ldk.structs.MonitorEvent ret_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/NetAddress.java b/src/main/java/org/ldk/structs/NetAddress.java index 55851a71..73f5bc32 100644 --- a/src/main/java/org/ldk/structs/NetAddress.java +++ b/src/main/java/org/ldk/structs/NetAddress.java @@ -128,7 +128,7 @@ public class NetAddress extends CommonBase { long ret = bindings.NetAddress_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + org.ldk.structs.NetAddress ret_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -141,7 +141,7 @@ public class NetAddress extends CommonBase { Reference.reachabilityFence(addr); Reference.reachabilityFence(port); if (ret >= 0 && ret <= 4096) { return null; } - NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + org.ldk.structs.NetAddress ret_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -154,7 +154,7 @@ public class NetAddress extends CommonBase { Reference.reachabilityFence(addr); Reference.reachabilityFence(port); if (ret >= 0 && ret <= 4096) { return null; } - NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + org.ldk.structs.NetAddress ret_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -166,7 +166,7 @@ public class NetAddress extends CommonBase { long ret = bindings.NetAddress_onion_v2(InternalUtils.check_arr_len(a, 12)); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + org.ldk.structs.NetAddress ret_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -181,7 +181,7 @@ public class NetAddress extends CommonBase { Reference.reachabilityFence(version); Reference.reachabilityFence(port); if (ret >= 0 && ret <= 4096) { return null; } - NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); + org.ldk.structs.NetAddress ret_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/NetworkUpdate.java b/src/main/java/org/ldk/structs/NetworkUpdate.java index a8638f3c..0a85f072 100644 --- a/src/main/java/org/ldk/structs/NetworkUpdate.java +++ b/src/main/java/org/ldk/structs/NetworkUpdate.java @@ -44,7 +44,7 @@ public class NetworkUpdate extends CommonBase { /** * The update to apply via [`NetworkGraph::update_channel`]. */ - public final ChannelUpdate msg; + public final org.ldk.structs.ChannelUpdate msg; private ChannelUpdateMessage(long ptr, bindings.LDKNetworkUpdate.ChannelUpdateMessage obj) { super(null, ptr); long msg = obj.msg; @@ -106,7 +106,7 @@ public class NetworkUpdate extends CommonBase { long ret = bindings.NetworkUpdate_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); + org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -118,7 +118,7 @@ public class NetworkUpdate extends CommonBase { long ret = bindings.NetworkUpdate_channel_update_message(msg == null ? 0 : msg.ptr & ~1); Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } - NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); + org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -131,7 +131,7 @@ public class NetworkUpdate extends CommonBase { Reference.reachabilityFence(short_channel_id); Reference.reachabilityFence(is_permanent); if (ret >= 0 && ret <= 4096) { return null; } - NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); + org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -144,7 +144,7 @@ public class NetworkUpdate extends CommonBase { Reference.reachabilityFence(node_id); Reference.reachabilityFence(is_permanent); if (ret >= 0 && ret <= 4096) { return null; } - NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); + org.ldk.structs.NetworkUpdate ret_hu_conv = org.ldk.structs.NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_AccessZ.java b/src/main/java/org/ldk/structs/Option_AccessZ.java index 78ea0c38..a44962f3 100644 --- a/src/main/java/org/ldk/structs/Option_AccessZ.java +++ b/src/main/java/org/ldk/structs/Option_AccessZ.java @@ -34,7 +34,7 @@ public class Option_AccessZ extends CommonBase { * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access */ public final static class Some extends Option_AccessZ { - public final Access some; + public final org.ldk.structs.Access some; private Some(long ptr, bindings.LDKCOption_AccessZ.Some obj) { super(null, ptr); long some = obj.some; @@ -58,7 +58,7 @@ public class Option_AccessZ extends CommonBase { long ret = bindings.COption_AccessZ_some(o == null ? 0 : o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret); + org.ldk.structs.Option_AccessZ ret_hu_conv = org.ldk.structs.Option_AccessZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(o); return ret_hu_conv; @@ -70,7 +70,7 @@ public class Option_AccessZ extends CommonBase { public static Option_AccessZ none() { long ret = bindings.COption_AccessZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret); + org.ldk.structs.Option_AccessZ ret_hu_conv = org.ldk.structs.Option_AccessZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java b/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java index bb51e9d8..526b06c5 100644 --- a/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java +++ b/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java @@ -34,7 +34,7 @@ public class Option_C2Tuple_usizeTransactionZZ extends CommonBase { * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ */ public final static class Some extends Option_C2Tuple_usizeTransactionZZ { - public final TwoTuple_usizeTransactionZ some; + public final org.ldk.structs.TwoTuple_usizeTransactionZ some; private Some(long ptr, bindings.LDKCOption_C2Tuple_usizeTransactionZZ.Some obj) { super(null, ptr); long some = obj.some; @@ -58,7 +58,7 @@ public class Option_C2Tuple_usizeTransactionZZ extends CommonBase { long ret = bindings.COption_C2Tuple_usizeTransactionZZ_some(o != null ? o.ptr : 0); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); + org.ldk.structs.Option_C2Tuple_usizeTransactionZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -69,7 +69,7 @@ public class Option_C2Tuple_usizeTransactionZZ extends CommonBase { public static Option_C2Tuple_usizeTransactionZZ none() { long ret = bindings.COption_C2Tuple_usizeTransactionZZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); + org.ldk.structs.Option_C2Tuple_usizeTransactionZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -88,7 +88,7 @@ public class Option_C2Tuple_usizeTransactionZZ extends CommonBase { long ret = bindings.COption_C2Tuple_usizeTransactionZZ_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); + org.ldk.structs.Option_C2Tuple_usizeTransactionZZ ret_hu_conv = org.ldk.structs.Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java b/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java index 3ecf1dfa..66907b32 100644 --- a/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java +++ b/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java @@ -42,7 +42,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { NetAddress[] some_conv_12_arr = new NetAddress[some_conv_12_len]; for (int m = 0; m < some_conv_12_len; m++) { long some_conv_12 = some[m]; - NetAddress some_conv_12_hu_conv = NetAddress.constr_from_ptr(some_conv_12); + org.ldk.structs.NetAddress some_conv_12_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(some_conv_12); some_conv_12_hu_conv.ptrs_to.add(this); some_conv_12_arr[m] = some_conv_12_hu_conv; } @@ -64,7 +64,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { long ret = bindings.COption_CVec_NetAddressZZ_some(o != null ? Arrays.stream(o).mapToLong(o_conv_12 -> o_conv_12.ptr).toArray() : null); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -75,7 +75,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { public static Option_CVec_NetAddressZZ none() { long ret = bindings.COption_CVec_NetAddressZZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -94,7 +94,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { long ret = bindings.COption_CVec_NetAddressZZ_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java b/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java index c7f3d09d..6a74d328 100644 --- a/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java +++ b/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java @@ -34,11 +34,11 @@ public class Option_ClosureReasonZ extends CommonBase { * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason */ public final static class Some extends Option_ClosureReasonZ { - public final ClosureReason some; + public final org.ldk.structs.ClosureReason some; private Some(long ptr, bindings.LDKCOption_ClosureReasonZ.Some obj) { super(null, ptr); long some = obj.some; - ClosureReason some_hu_conv = ClosureReason.constr_from_ptr(some); + org.ldk.structs.ClosureReason some_hu_conv = org.ldk.structs.ClosureReason.constr_from_ptr(some); some_hu_conv.ptrs_to.add(this); this.some = some_hu_conv; } @@ -58,7 +58,7 @@ public class Option_ClosureReasonZ extends CommonBase { long ret = bindings.COption_ClosureReasonZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret); + org.ldk.structs.Option_ClosureReasonZ ret_hu_conv = org.ldk.structs.Option_ClosureReasonZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -69,7 +69,7 @@ public class Option_ClosureReasonZ extends CommonBase { public static Option_ClosureReasonZ none() { long ret = bindings.COption_ClosureReasonZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret); + org.ldk.structs.Option_ClosureReasonZ ret_hu_conv = org.ldk.structs.Option_ClosureReasonZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -88,7 +88,7 @@ public class Option_ClosureReasonZ extends CommonBase { long ret = bindings.COption_ClosureReasonZ_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret); + org.ldk.structs.Option_ClosureReasonZ ret_hu_conv = org.ldk.structs.Option_ClosureReasonZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_EventZ.java b/src/main/java/org/ldk/structs/Option_EventZ.java index 079431a4..b1516c87 100644 --- a/src/main/java/org/ldk/structs/Option_EventZ.java +++ b/src/main/java/org/ldk/structs/Option_EventZ.java @@ -34,11 +34,11 @@ public class Option_EventZ extends CommonBase { * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event */ public final static class Some extends Option_EventZ { - public final Event some; + public final org.ldk.structs.Event some; private Some(long ptr, bindings.LDKCOption_EventZ.Some obj) { super(null, ptr); long some = obj.some; - Event some_hu_conv = Event.constr_from_ptr(some); + org.ldk.structs.Event some_hu_conv = org.ldk.structs.Event.constr_from_ptr(some); some_hu_conv.ptrs_to.add(this); this.some = some_hu_conv; } @@ -58,7 +58,7 @@ public class Option_EventZ extends CommonBase { long ret = bindings.COption_EventZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_EventZ ret_hu_conv = Option_EventZ.constr_from_ptr(ret); + org.ldk.structs.Option_EventZ ret_hu_conv = org.ldk.structs.Option_EventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -69,7 +69,7 @@ public class Option_EventZ extends CommonBase { public static Option_EventZ none() { long ret = bindings.COption_EventZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_EventZ ret_hu_conv = Option_EventZ.constr_from_ptr(ret); + org.ldk.structs.Option_EventZ ret_hu_conv = org.ldk.structs.Option_EventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -88,7 +88,7 @@ public class Option_EventZ extends CommonBase { long ret = bindings.COption_EventZ_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_EventZ ret_hu_conv = Option_EventZ.constr_from_ptr(ret); + org.ldk.structs.Option_EventZ ret_hu_conv = org.ldk.structs.Option_EventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_FilterZ.java b/src/main/java/org/ldk/structs/Option_FilterZ.java index d94c6de2..c76e868e 100644 --- a/src/main/java/org/ldk/structs/Option_FilterZ.java +++ b/src/main/java/org/ldk/structs/Option_FilterZ.java @@ -34,7 +34,7 @@ public class Option_FilterZ extends CommonBase { * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter */ public final static class Some extends Option_FilterZ { - public final Filter some; + public final org.ldk.structs.Filter some; private Some(long ptr, bindings.LDKCOption_FilterZ.Some obj) { super(null, ptr); long some = obj.some; @@ -58,7 +58,7 @@ public class Option_FilterZ extends CommonBase { long ret = bindings.COption_FilterZ_some(o == null ? 0 : o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_FilterZ ret_hu_conv = Option_FilterZ.constr_from_ptr(ret); + org.ldk.structs.Option_FilterZ ret_hu_conv = org.ldk.structs.Option_FilterZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(o); return ret_hu_conv; @@ -70,7 +70,7 @@ public class Option_FilterZ extends CommonBase { public static Option_FilterZ none() { long ret = bindings.COption_FilterZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_FilterZ ret_hu_conv = Option_FilterZ.constr_from_ptr(ret); + org.ldk.structs.Option_FilterZ ret_hu_conv = org.ldk.structs.Option_FilterZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_MonitorEventZ.java b/src/main/java/org/ldk/structs/Option_MonitorEventZ.java index ab23d228..6d0f9587 100644 --- a/src/main/java/org/ldk/structs/Option_MonitorEventZ.java +++ b/src/main/java/org/ldk/structs/Option_MonitorEventZ.java @@ -34,11 +34,11 @@ public class Option_MonitorEventZ extends CommonBase { * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent */ public final static class Some extends Option_MonitorEventZ { - public final MonitorEvent some; + public final org.ldk.structs.MonitorEvent some; private Some(long ptr, bindings.LDKCOption_MonitorEventZ.Some obj) { super(null, ptr); long some = obj.some; - MonitorEvent some_hu_conv = MonitorEvent.constr_from_ptr(some); + org.ldk.structs.MonitorEvent some_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(some); some_hu_conv.ptrs_to.add(this); this.some = some_hu_conv; } @@ -58,7 +58,7 @@ public class Option_MonitorEventZ extends CommonBase { long ret = bindings.COption_MonitorEventZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret); + org.ldk.structs.Option_MonitorEventZ ret_hu_conv = org.ldk.structs.Option_MonitorEventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -69,7 +69,7 @@ public class Option_MonitorEventZ extends CommonBase { public static Option_MonitorEventZ none() { long ret = bindings.COption_MonitorEventZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret); + org.ldk.structs.Option_MonitorEventZ ret_hu_conv = org.ldk.structs.Option_MonitorEventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -88,7 +88,7 @@ public class Option_MonitorEventZ extends CommonBase { long ret = bindings.COption_MonitorEventZ_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret); + org.ldk.structs.Option_MonitorEventZ ret_hu_conv = org.ldk.structs.Option_MonitorEventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_NetAddressZ.java b/src/main/java/org/ldk/structs/Option_NetAddressZ.java new file mode 100644 index 00000000..a88c5b73 --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_NetAddressZ.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; + + +/** + * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_NetAddressZ extends CommonBase { + private Option_NetAddressZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_NetAddressZ_free(ptr); } + } + static Option_NetAddressZ constr_from_ptr(long ptr) { + bindings.LDKCOption_NetAddressZ raw_val = bindings.LDKCOption_NetAddressZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_NetAddressZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_NetAddressZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_NetAddressZ.None.class) { + return new None(ptr, (bindings.LDKCOption_NetAddressZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress + */ + public final static class Some extends Option_NetAddressZ { + public final org.ldk.structs.NetAddress some; + private Some(long ptr, bindings.LDKCOption_NetAddressZ.Some obj) { + super(null, ptr); + long some = obj.some; + org.ldk.structs.NetAddress some_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(some); + some_hu_conv.ptrs_to.add(this); + this.some = some_hu_conv; + } + } + /** + * When we're in this state, this COption_NetAddressZ contains nothing + */ + public final static class None extends Option_NetAddressZ { + private None(long ptr, bindings.LDKCOption_NetAddressZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + */ + public static Option_NetAddressZ some(NetAddress o) { + long ret = bindings.COption_NetAddressZ_some(o.ptr); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Constructs a new COption_NetAddressZ containing nothing + */ + public static Option_NetAddressZ none() { + long ret = bindings.COption_NetAddressZ_none(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + long clone_ptr() { + long ret = bindings.COption_NetAddressZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new COption_NetAddressZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_NetAddressZ clone() { + long ret = bindings.COption_NetAddressZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_NetAddressZ ret_hu_conv = org.ldk.structs.Option_NetAddressZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java b/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java index 2c2137ad..2dd9b7ed 100644 --- a/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java +++ b/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java @@ -34,11 +34,11 @@ public class Option_NetworkUpdateZ extends CommonBase { * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate */ public final static class Some extends Option_NetworkUpdateZ { - public final NetworkUpdate some; + public final org.ldk.structs.NetworkUpdate some; private Some(long ptr, bindings.LDKCOption_NetworkUpdateZ.Some obj) { super(null, ptr); long some = obj.some; - NetworkUpdate some_hu_conv = NetworkUpdate.constr_from_ptr(some); + org.ldk.structs.NetworkUpdate some_hu_conv = org.ldk.structs.NetworkUpdate.constr_from_ptr(some); some_hu_conv.ptrs_to.add(this); this.some = some_hu_conv; } @@ -58,7 +58,7 @@ public class Option_NetworkUpdateZ extends CommonBase { long ret = bindings.COption_NetworkUpdateZ_some(o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret); + org.ldk.structs.Option_NetworkUpdateZ ret_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -69,7 +69,7 @@ public class Option_NetworkUpdateZ extends CommonBase { public static Option_NetworkUpdateZ none() { long ret = bindings.COption_NetworkUpdateZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret); + org.ldk.structs.Option_NetworkUpdateZ ret_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -88,7 +88,7 @@ public class Option_NetworkUpdateZ extends CommonBase { long ret = bindings.COption_NetworkUpdateZ_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret); + org.ldk.structs.Option_NetworkUpdateZ ret_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_TypeZ.java b/src/main/java/org/ldk/structs/Option_TypeZ.java index 2a777b0a..f58fb1fc 100644 --- a/src/main/java/org/ldk/structs/Option_TypeZ.java +++ b/src/main/java/org/ldk/structs/Option_TypeZ.java @@ -34,7 +34,7 @@ public class Option_TypeZ extends CommonBase { * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type */ public final static class Some extends Option_TypeZ { - public final Type some; + public final org.ldk.structs.Type some; private Some(long ptr, bindings.LDKCOption_TypeZ.Some obj) { super(null, ptr); long some = obj.some; @@ -58,7 +58,7 @@ public class Option_TypeZ extends CommonBase { long ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret); + org.ldk.structs.Option_TypeZ ret_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(o); return ret_hu_conv; @@ -70,7 +70,7 @@ public class Option_TypeZ extends CommonBase { public static Option_TypeZ none() { long ret = bindings.COption_TypeZ_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret); + org.ldk.structs.Option_TypeZ ret_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -89,7 +89,7 @@ public class Option_TypeZ extends CommonBase { long ret = bindings.COption_TypeZ_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret); + org.ldk.structs.Option_TypeZ ret_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_u16Z.java b/src/main/java/org/ldk/structs/Option_u16Z.java index 238d0c39..f7503077 100644 --- a/src/main/java/org/ldk/structs/Option_u16Z.java +++ b/src/main/java/org/ldk/structs/Option_u16Z.java @@ -55,7 +55,7 @@ public class Option_u16Z extends CommonBase { long ret = bindings.COption_u16Z_some(o); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret); + org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -66,7 +66,7 @@ public class Option_u16Z extends CommonBase { public static Option_u16Z none() { long ret = bindings.COption_u16Z_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret); + org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -85,7 +85,7 @@ public class Option_u16Z extends CommonBase { long ret = bindings.COption_u16Z_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret); + org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_u32Z.java b/src/main/java/org/ldk/structs/Option_u32Z.java index a54048ed..053356d5 100644 --- a/src/main/java/org/ldk/structs/Option_u32Z.java +++ b/src/main/java/org/ldk/structs/Option_u32Z.java @@ -55,7 +55,7 @@ public class Option_u32Z extends CommonBase { long ret = bindings.COption_u32Z_some(o); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); + org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -66,7 +66,7 @@ public class Option_u32Z extends CommonBase { public static Option_u32Z none() { long ret = bindings.COption_u32Z_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); + org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -85,7 +85,7 @@ public class Option_u32Z extends CommonBase { long ret = bindings.COption_u32Z_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); + org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Option_u64Z.java b/src/main/java/org/ldk/structs/Option_u64Z.java index b344a6b1..6a75dabf 100644 --- a/src/main/java/org/ldk/structs/Option_u64Z.java +++ b/src/main/java/org/ldk/structs/Option_u64Z.java @@ -55,7 +55,7 @@ public class Option_u64Z extends CommonBase { long ret = bindings.COption_u64Z_some(o); Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -66,7 +66,7 @@ public class Option_u64Z extends CommonBase { public static Option_u64Z none() { long ret = bindings.COption_u64Z_none(); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -85,7 +85,7 @@ public class Option_u64Z extends CommonBase { long ret = bindings.COption_u64Z_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ParseError.java b/src/main/java/org/ldk/structs/ParseError.java new file mode 100644 index 00000000..940362e0 --- /dev/null +++ b/src/main/java/org/ldk/structs/ParseError.java @@ -0,0 +1,423 @@ +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; + + +/** + * Errors that indicate what is wrong with the invoice. They have some granularity for debug + * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ParseError extends CommonBase { + private ParseError(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.ParseError_free(ptr); } + } + static ParseError constr_from_ptr(long ptr) { + bindings.LDKParseError raw_val = bindings.LDKParseError_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKParseError.Bech32Error.class) { + return new Bech32Error(ptr, (bindings.LDKParseError.Bech32Error)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.ParseAmountError.class) { + return new ParseAmountError(ptr, (bindings.LDKParseError.ParseAmountError)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.MalformedSignature.class) { + return new MalformedSignature(ptr, (bindings.LDKParseError.MalformedSignature)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.BadPrefix.class) { + return new BadPrefix(ptr, (bindings.LDKParseError.BadPrefix)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.UnknownCurrency.class) { + return new UnknownCurrency(ptr, (bindings.LDKParseError.UnknownCurrency)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.UnknownSiPrefix.class) { + return new UnknownSiPrefix(ptr, (bindings.LDKParseError.UnknownSiPrefix)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.MalformedHRP.class) { + return new MalformedHRP(ptr, (bindings.LDKParseError.MalformedHRP)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.TooShortDataPart.class) { + return new TooShortDataPart(ptr, (bindings.LDKParseError.TooShortDataPart)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.UnexpectedEndOfTaggedFields.class) { + return new UnexpectedEndOfTaggedFields(ptr, (bindings.LDKParseError.UnexpectedEndOfTaggedFields)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.DescriptionDecodeError.class) { + return new DescriptionDecodeError(ptr, (bindings.LDKParseError.DescriptionDecodeError)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.PaddingError.class) { + return new PaddingError(ptr, (bindings.LDKParseError.PaddingError)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.IntegerOverflowError.class) { + return new IntegerOverflowError(ptr, (bindings.LDKParseError.IntegerOverflowError)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.InvalidSegWitProgramLength.class) { + return new InvalidSegWitProgramLength(ptr, (bindings.LDKParseError.InvalidSegWitProgramLength)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.InvalidPubKeyHashLength.class) { + return new InvalidPubKeyHashLength(ptr, (bindings.LDKParseError.InvalidPubKeyHashLength)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.InvalidScriptHashLength.class) { + return new InvalidScriptHashLength(ptr, (bindings.LDKParseError.InvalidScriptHashLength)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.InvalidRecoveryId.class) { + return new InvalidRecoveryId(ptr, (bindings.LDKParseError.InvalidRecoveryId)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.InvalidSliceLength.class) { + return new InvalidSliceLength(ptr, (bindings.LDKParseError.InvalidSliceLength)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseError.Skip.class) { + return new Skip(ptr, (bindings.LDKParseError.Skip)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + public final static class Bech32Error extends ParseError { + public final org.ldk.structs.Bech32Error bech32_error; + private Bech32Error(long ptr, bindings.LDKParseError.Bech32Error obj) { + super(null, ptr); + long bech32_error = obj.bech32_error; + org.ldk.structs.Bech32Error bech32_error_hu_conv = org.ldk.structs.Bech32Error.constr_from_ptr(bech32_error); + bech32_error_hu_conv.ptrs_to.add(this); + this.bech32_error = bech32_error_hu_conv; + } + } + public final static class ParseAmountError extends ParseError { + public final org.ldk.util.UnqualifiedError parse_amount_error; + private ParseAmountError(long ptr, bindings.LDKParseError.ParseAmountError obj) { + super(null, ptr); + int parse_amount_error = obj.parse_amount_error; + UnqualifiedError parse_amount_error_conv = new UnqualifiedError(parse_amount_error); + this.parse_amount_error = parse_amount_error_conv; + } + } + public final static class MalformedSignature extends ParseError { + public final org.ldk.enums.Secp256k1Error malformed_signature; + private MalformedSignature(long ptr, bindings.LDKParseError.MalformedSignature obj) { + super(null, ptr); + this.malformed_signature = obj.malformed_signature; + } + } + public final static class BadPrefix extends ParseError { + private BadPrefix(long ptr, bindings.LDKParseError.BadPrefix obj) { + super(null, ptr); + } + } + public final static class UnknownCurrency extends ParseError { + private UnknownCurrency(long ptr, bindings.LDKParseError.UnknownCurrency obj) { + super(null, ptr); + } + } + public final static class UnknownSiPrefix extends ParseError { + private UnknownSiPrefix(long ptr, bindings.LDKParseError.UnknownSiPrefix obj) { + super(null, ptr); + } + } + public final static class MalformedHRP extends ParseError { + private MalformedHRP(long ptr, bindings.LDKParseError.MalformedHRP obj) { + super(null, ptr); + } + } + public final static class TooShortDataPart extends ParseError { + private TooShortDataPart(long ptr, bindings.LDKParseError.TooShortDataPart obj) { + super(null, ptr); + } + } + public final static class UnexpectedEndOfTaggedFields extends ParseError { + private UnexpectedEndOfTaggedFields(long ptr, bindings.LDKParseError.UnexpectedEndOfTaggedFields obj) { + super(null, ptr); + } + } + public final static class DescriptionDecodeError extends ParseError { + public final org.ldk.util.UnqualifiedError description_decode_error; + private DescriptionDecodeError(long ptr, bindings.LDKParseError.DescriptionDecodeError obj) { + super(null, ptr); + int description_decode_error = obj.description_decode_error; + UnqualifiedError description_decode_error_conv = new UnqualifiedError(description_decode_error); + this.description_decode_error = description_decode_error_conv; + } + } + public final static class PaddingError extends ParseError { + private PaddingError(long ptr, bindings.LDKParseError.PaddingError obj) { + super(null, ptr); + } + } + public final static class IntegerOverflowError extends ParseError { + private IntegerOverflowError(long ptr, bindings.LDKParseError.IntegerOverflowError obj) { + super(null, ptr); + } + } + public final static class InvalidSegWitProgramLength extends ParseError { + private InvalidSegWitProgramLength(long ptr, bindings.LDKParseError.InvalidSegWitProgramLength obj) { + super(null, ptr); + } + } + public final static class InvalidPubKeyHashLength extends ParseError { + private InvalidPubKeyHashLength(long ptr, bindings.LDKParseError.InvalidPubKeyHashLength obj) { + super(null, ptr); + } + } + public final static class InvalidScriptHashLength extends ParseError { + private InvalidScriptHashLength(long ptr, bindings.LDKParseError.InvalidScriptHashLength obj) { + super(null, ptr); + } + } + public final static class InvalidRecoveryId extends ParseError { + private InvalidRecoveryId(long ptr, bindings.LDKParseError.InvalidRecoveryId obj) { + super(null, ptr); + } + } + public final static class InvalidSliceLength extends ParseError { + public final java.lang.String invalid_slice_length; + private InvalidSliceLength(long ptr, bindings.LDKParseError.InvalidSliceLength obj) { + super(null, ptr); + this.invalid_slice_length = obj.invalid_slice_length; + } + } + /** + * Not an error, but used internally to signal that a part of the invoice should be ignored + * according to BOLT11 + */ + public final static class Skip extends ParseError { + private Skip(long ptr, bindings.LDKParseError.Skip obj) { + super(null, ptr); + } + } + long clone_ptr() { + long ret = bindings.ParseError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the ParseError + */ + public ParseError clone() { + long ret = bindings.ParseError_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Bech32Error-variant ParseError + */ + public static ParseError bech32_error(Bech32Error a) { + long ret = bindings.ParseError_bech32_error(a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new ParseAmountError-variant ParseError + */ + public static ParseError parse_amount_error(UnqualifiedError a) { + long ret = bindings.ParseError_parse_amount_error(0); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new MalformedSignature-variant ParseError + */ + public static ParseError malformed_signature(org.ldk.enums.Secp256k1Error a) { + long ret = bindings.ParseError_malformed_signature(a); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new BadPrefix-variant ParseError + */ + public static ParseError bad_prefix() { + long ret = bindings.ParseError_bad_prefix(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new UnknownCurrency-variant ParseError + */ + public static ParseError unknown_currency() { + long ret = bindings.ParseError_unknown_currency(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new UnknownSiPrefix-variant ParseError + */ + public static ParseError unknown_si_prefix() { + long ret = bindings.ParseError_unknown_si_prefix(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new MalformedHRP-variant ParseError + */ + public static ParseError malformed_hrp() { + long ret = bindings.ParseError_malformed_hrp(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new TooShortDataPart-variant ParseError + */ + public static ParseError too_short_data_part() { + long ret = bindings.ParseError_too_short_data_part(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant ParseError + */ + public static ParseError unexpected_end_of_tagged_fields() { + long ret = bindings.ParseError_unexpected_end_of_tagged_fields(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new DescriptionDecodeError-variant ParseError + */ + public static ParseError description_decode_error(UnqualifiedError a) { + long ret = bindings.ParseError_description_decode_error(0); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new PaddingError-variant ParseError + */ + public static ParseError padding_error() { + long ret = bindings.ParseError_padding_error(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new IntegerOverflowError-variant ParseError + */ + public static ParseError integer_overflow_error() { + long ret = bindings.ParseError_integer_overflow_error(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new InvalidSegWitProgramLength-variant ParseError + */ + public static ParseError invalid_seg_wit_program_length() { + long ret = bindings.ParseError_invalid_seg_wit_program_length(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new InvalidPubKeyHashLength-variant ParseError + */ + public static ParseError invalid_pub_key_hash_length() { + long ret = bindings.ParseError_invalid_pub_key_hash_length(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new InvalidScriptHashLength-variant ParseError + */ + public static ParseError invalid_script_hash_length() { + long ret = bindings.ParseError_invalid_script_hash_length(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new InvalidRecoveryId-variant ParseError + */ + public static ParseError invalid_recovery_id() { + long ret = bindings.ParseError_invalid_recovery_id(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new InvalidSliceLength-variant ParseError + */ + public static ParseError invalid_slice_length(java.lang.String a) { + long ret = bindings.ParseError_invalid_slice_length(a); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new Skip-variant ParseError + */ + public static ParseError skip() { + long ret = bindings.ParseError_skip(); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Get the string representation of a ParseError object + */ + public String to_str() { + String ret = bindings.ParseError_to_str(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/ParseOrSemanticError.java b/src/main/java/org/ldk/structs/ParseOrSemanticError.java new file mode 100644 index 00000000..968358a5 --- /dev/null +++ b/src/main/java/org/ldk/structs/ParseOrSemanticError.java @@ -0,0 +1,109 @@ +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; + + +/** + * Indicates that something went wrong while parsing or validating the invoice. Parsing errors + * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors + * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ParseOrSemanticError extends CommonBase { + private ParseOrSemanticError(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.ParseOrSemanticError_free(ptr); } + } + static ParseOrSemanticError constr_from_ptr(long ptr) { + bindings.LDKParseOrSemanticError raw_val = bindings.LDKParseOrSemanticError_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKParseOrSemanticError.ParseError.class) { + return new ParseError(ptr, (bindings.LDKParseOrSemanticError.ParseError)raw_val); + } + if (raw_val.getClass() == bindings.LDKParseOrSemanticError.SemanticError.class) { + return new SemanticError(ptr, (bindings.LDKParseOrSemanticError.SemanticError)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + /** + * The invoice couldn't be decoded + */ + public final static class ParseError extends ParseOrSemanticError { + public final org.ldk.structs.ParseError parse_error; + private ParseError(long ptr, bindings.LDKParseOrSemanticError.ParseError obj) { + super(null, ptr); + long parse_error = obj.parse_error; + org.ldk.structs.ParseError parse_error_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(parse_error); + parse_error_hu_conv.ptrs_to.add(this); + this.parse_error = parse_error_hu_conv; + } + } + /** + * The invoice could be decoded but violates the BOLT11 standard + */ + public final static class SemanticError extends ParseOrSemanticError { + public final org.ldk.enums.SemanticError semantic_error; + private SemanticError(long ptr, bindings.LDKParseOrSemanticError.SemanticError obj) { + super(null, ptr); + this.semantic_error = obj.semantic_error; + } + } + long clone_ptr() { + long ret = bindings.ParseOrSemanticError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the ParseOrSemanticError + */ + public ParseOrSemanticError clone() { + long ret = bindings.ParseOrSemanticError_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new ParseError-variant ParseOrSemanticError + */ + public static ParseOrSemanticError parse_error(ParseError a) { + long ret = bindings.ParseOrSemanticError_parse_error(a.ptr); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new SemanticError-variant ParseOrSemanticError + */ + public static ParseOrSemanticError semantic_error(org.ldk.enums.SemanticError a) { + long ret = bindings.ParseOrSemanticError_semantic_error(a); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Get the string representation of a ParseOrSemanticError object + */ + public String to_str() { + String ret = bindings.ParseOrSemanticError_to_str(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/PaymentError.java b/src/main/java/org/ldk/structs/PaymentError.java index 32b3ebc3..95f9705a 100644 --- a/src/main/java/org/ldk/structs/PaymentError.java +++ b/src/main/java/org/ldk/structs/PaymentError.java @@ -37,7 +37,7 @@ public class PaymentError extends CommonBase { * An error resulting from the provided [`Invoice`] or payment hash. */ public final static class Invoice extends PaymentError { - public final String invoice; + public final java.lang.String invoice; private Invoice(long ptr, bindings.LDKPaymentError.Invoice obj) { super(null, ptr); this.invoice = obj.invoice; @@ -47,7 +47,7 @@ public class PaymentError extends CommonBase { * An error occurring when finding a route. */ public final static class Routing extends PaymentError { - public final LightningError routing; + public final org.ldk.structs.LightningError routing; private Routing(long ptr, bindings.LDKPaymentError.Routing obj) { super(null, ptr); long routing = obj.routing; @@ -60,11 +60,11 @@ public class PaymentError extends CommonBase { * An error occurring when sending a payment. */ public final static class Sending extends PaymentError { - public final PaymentSendFailure sending; + public final org.ldk.structs.PaymentSendFailure sending; private Sending(long ptr, bindings.LDKPaymentError.Sending obj) { super(null, ptr); long sending = obj.sending; - PaymentSendFailure sending_hu_conv = PaymentSendFailure.constr_from_ptr(sending); + org.ldk.structs.PaymentSendFailure sending_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(sending); sending_hu_conv.ptrs_to.add(this); this.sending = sending_hu_conv; } @@ -82,7 +82,7 @@ public class PaymentError extends CommonBase { long ret = bindings.PaymentError_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); + org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -94,7 +94,7 @@ public class PaymentError extends CommonBase { long ret = bindings.PaymentError_invoice(a); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); + org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -106,7 +106,7 @@ public class PaymentError extends CommonBase { long ret = bindings.PaymentError_routing(a == null ? 0 : a.ptr & ~1); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); + org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -118,7 +118,7 @@ public class PaymentError extends CommonBase { long ret = bindings.PaymentError_sending(a.ptr); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); + org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/PaymentParameters.java b/src/main/java/org/ldk/structs/PaymentParameters.java index 91e78d6f..7baa07ce 100644 --- a/src/main/java/org/ldk/structs/PaymentParameters.java +++ b/src/main/java/org/ldk/structs/PaymentParameters.java @@ -107,7 +107,7 @@ public class PaymentParameters extends CommonBase { long ret = bindings.PaymentParameters_get_expiry_time(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/PaymentPurpose.java b/src/main/java/org/ldk/structs/PaymentPurpose.java index 10bce274..50412c60 100644 --- a/src/main/java/org/ldk/structs/PaymentPurpose.java +++ b/src/main/java/org/ldk/structs/PaymentPurpose.java @@ -89,7 +89,7 @@ public class PaymentPurpose extends CommonBase { long ret = bindings.PaymentPurpose_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret); + org.ldk.structs.PaymentPurpose ret_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -102,7 +102,7 @@ public class PaymentPurpose extends CommonBase { Reference.reachabilityFence(payment_preimage); Reference.reachabilityFence(payment_secret); if (ret >= 0 && ret <= 4096) { return null; } - PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret); + org.ldk.structs.PaymentPurpose ret_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -114,7 +114,7 @@ public class PaymentPurpose extends CommonBase { long ret = bindings.PaymentPurpose_spontaneous_payment(InternalUtils.check_arr_len(a, 32)); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret); + org.ldk.structs.PaymentPurpose ret_hu_conv = org.ldk.structs.PaymentPurpose.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/PaymentSendFailure.java b/src/main/java/org/ldk/structs/PaymentSendFailure.java index a21a5449..69375c1f 100644 --- a/src/main/java/org/ldk/structs/PaymentSendFailure.java +++ b/src/main/java/org/ldk/structs/PaymentSendFailure.java @@ -44,11 +44,11 @@ public class PaymentSendFailure extends CommonBase { * once you've changed the parameter at error, you can freely retry the payment in full. */ public final static class ParameterError extends PaymentSendFailure { - public final APIError parameter_error; + public final org.ldk.structs.APIError parameter_error; private ParameterError(long ptr, bindings.LDKPaymentSendFailure.ParameterError obj) { super(null, ptr); long parameter_error = obj.parameter_error; - APIError parameter_error_hu_conv = APIError.constr_from_ptr(parameter_error); + org.ldk.structs.APIError parameter_error_hu_conv = org.ldk.structs.APIError.constr_from_ptr(parameter_error); parameter_error_hu_conv.ptrs_to.add(this); this.parameter_error = parameter_error_hu_conv; } @@ -91,7 +91,7 @@ public class PaymentSendFailure extends CommonBase { APIError[] all_failed_retry_safe_conv_10_arr = new APIError[all_failed_retry_safe_conv_10_len]; for (int k = 0; k < all_failed_retry_safe_conv_10_len; k++) { long all_failed_retry_safe_conv_10 = all_failed_retry_safe[k]; - APIError all_failed_retry_safe_conv_10_hu_conv = APIError.constr_from_ptr(all_failed_retry_safe_conv_10); + org.ldk.structs.APIError all_failed_retry_safe_conv_10_hu_conv = org.ldk.structs.APIError.constr_from_ptr(all_failed_retry_safe_conv_10); all_failed_retry_safe_conv_10_hu_conv.ptrs_to.add(this); all_failed_retry_safe_conv_10_arr[k] = all_failed_retry_safe_conv_10_hu_conv; } @@ -124,7 +124,7 @@ public class PaymentSendFailure extends CommonBase { * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - @Nullable public final RouteParameters failed_paths_retry; + @Nullable public final org.ldk.structs.RouteParameters failed_paths_retry; /** * The payment id for the payment, which is now at least partially pending. */ @@ -160,7 +160,7 @@ public class PaymentSendFailure extends CommonBase { long ret = bindings.PaymentSendFailure_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); + org.ldk.structs.PaymentSendFailure ret_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -172,7 +172,7 @@ public class PaymentSendFailure extends CommonBase { long ret = bindings.PaymentSendFailure_parameter_error(a.ptr); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); + org.ldk.structs.PaymentSendFailure ret_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -184,7 +184,7 @@ public class PaymentSendFailure extends CommonBase { long ret = bindings.PaymentSendFailure_path_parameter_error(a != null ? Arrays.stream(a).mapToLong(a_conv_22 -> a_conv_22 != null ? a_conv_22.ptr : 0).toArray() : null); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); + org.ldk.structs.PaymentSendFailure ret_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -196,7 +196,7 @@ public class PaymentSendFailure extends CommonBase { long ret = bindings.PaymentSendFailure_all_failed_retry_safe(a != null ? Arrays.stream(a).mapToLong(a_conv_10 -> a_conv_10.ptr).toArray() : null); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); + org.ldk.structs.PaymentSendFailure ret_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -210,7 +210,7 @@ public class PaymentSendFailure extends CommonBase { Reference.reachabilityFence(failed_paths_retry); Reference.reachabilityFence(payment_id); if (ret >= 0 && ret <= 4096) { return null; } - PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); + org.ldk.structs.PaymentSendFailure ret_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/PeerManager.java b/src/main/java/org/ldk/structs/PeerManager.java index be267b56..e41024f8 100644 --- a/src/main/java/org/ldk/structs/PeerManager.java +++ b/src/main/java/org/ldk/structs/PeerManager.java @@ -75,7 +75,13 @@ public class PeerManager extends CommonBase { } /** - * Indicates a new outbound connection has been established to a node with the given node_id. + * Indicates a new outbound connection has been established to a node with the given node_id + * and an optional remote network address. + * + * The remote network address adds the option to report a remote IP address back to a connecting + * peer using the init message. + * The user should pass the remote network address of the host they are connected to. + * * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new * descriptor but must disconnect the connection immediately. * @@ -86,11 +92,12 @@ public class PeerManager extends CommonBase { * * [`socket_disconnected()`]: PeerManager::socket_disconnected */ - public Result_CVec_u8ZPeerHandleErrorZ new_outbound_connection(byte[] their_node_id, SocketDescriptor descriptor) { - long ret = bindings.PeerManager_new_outbound_connection(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), descriptor == null ? 0 : descriptor.ptr); + public Result_CVec_u8ZPeerHandleErrorZ new_outbound_connection(byte[] their_node_id, SocketDescriptor descriptor, Option_NetAddressZ remote_network_address) { + long ret = bindings.PeerManager_new_outbound_connection(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), descriptor == null ? 0 : descriptor.ptr, remote_network_address.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); Reference.reachabilityFence(descriptor); + Reference.reachabilityFence(remote_network_address); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret); this.ptrs_to.add(descriptor); @@ -98,7 +105,12 @@ public class PeerManager extends CommonBase { } /** - * Indicates a new inbound connection has been established. + * Indicates a new inbound connection has been established to a node with an optional remote + * network address. + * + * The remote network address adds the option to report a remote IP address back to a connecting + * peer using the init message. + * The user should pass the remote network address of the host they are connected to. * * May refuse the connection by returning an Err, but will never write bytes to the remote end * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT @@ -110,10 +122,11 @@ public class PeerManager extends CommonBase { * * [`socket_disconnected()`]: PeerManager::socket_disconnected */ - public Result_NonePeerHandleErrorZ new_inbound_connection(SocketDescriptor descriptor) { - long ret = bindings.PeerManager_new_inbound_connection(this.ptr, descriptor == null ? 0 : descriptor.ptr); + public Result_NonePeerHandleErrorZ new_inbound_connection(SocketDescriptor descriptor, Option_NetAddressZ remote_network_address) { + long ret = bindings.PeerManager_new_inbound_connection(this.ptr, descriptor == null ? 0 : descriptor.ptr, remote_network_address.ptr); Reference.reachabilityFence(this); Reference.reachabilityFence(descriptor); + Reference.reachabilityFence(remote_network_address); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePeerHandleErrorZ ret_hu_conv = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); this.ptrs_to.add(descriptor); @@ -230,9 +243,9 @@ public class PeerManager extends CommonBase { * Send pings to each peer and disconnect those which did not respond to the last round of * pings. * - * This may be called on any timescale you want, however, roughly once every five to ten - * seconds is preferred. The call rate determines both how often we send a ping to our peers - * and how much time they have to respond before we disconnect them. + * This may be called on any timescale you want, however, roughly once every ten seconds is + * preferred. The call rate determines both how often we send a ping to our peers and how much + * time they have to respond before we disconnect them. * * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy * issues! diff --git a/src/main/java/org/ldk/structs/Persister.java b/src/main/java/org/ldk/structs/Persister.java new file mode 100644 index 00000000..d8ffc858 --- /dev/null +++ b/src/main/java/org/ldk/structs/Persister.java @@ -0,0 +1,86 @@ +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; + +/** + * Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Persister extends CommonBase { + final bindings.LDKPersister bindings_instance; + Persister(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private Persister(bindings.LDKPersister arg) { + super(bindings.LDKPersister_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.Persister_free(ptr); } super.finalize(); + } + + public static interface PersisterInterface { + /** + * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed + * (which will cause the [`BackgroundProcessor`] which called this method to exit). + */ + Result_NoneErrorZ persist_manager(ChannelManager channel_manager); + /** + * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. + */ + Result_NoneErrorZ persist_graph(NetworkGraph network_graph); + } + private static class LDKPersisterHolder { Persister held; } + public static Persister new_impl(PersisterInterface arg) { + final LDKPersisterHolder impl_holder = new LDKPersisterHolder(); + impl_holder.held = new Persister(new bindings.LDKPersister() { + @Override public long persist_manager(long channel_manager) { + ChannelManager channel_manager_hu_conv = null; if (channel_manager < 0 || channel_manager > 4096) { channel_manager_hu_conv = new ChannelManager(null, channel_manager); } + Result_NoneErrorZ ret = arg.persist_manager(channel_manager_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + @Override public long persist_graph(long network_graph) { + NetworkGraph network_graph_hu_conv = null; if (network_graph < 0 || network_graph > 4096) { network_graph_hu_conv = new NetworkGraph(null, network_graph); } + Result_NoneErrorZ ret = arg.persist_graph(network_graph_hu_conv); + Reference.reachabilityFence(arg); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } + }); + return impl_holder.held; + } + /** + * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed + * (which will cause the [`BackgroundProcessor`] which called this method to exit). + */ + public Result_NoneErrorZ persist_manager(ChannelManager channel_manager) { + long ret = bindings.Persister_persist_manager(this.ptr, channel_manager == null ? 0 : channel_manager.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_manager); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); + this.ptrs_to.add(channel_manager); + return ret_hu_conv; + } + + /** + * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. + */ + public Result_NoneErrorZ persist_graph(NetworkGraph network_graph) { + long ret = bindings.Persister_persist_graph(this.ptr, network_graph == null ? 0 : network_graph.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(network_graph); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); + this.ptrs_to.add(network_graph); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ProbabilisticScorer.java b/src/main/java/org/ldk/structs/ProbabilisticScorer.java index effcc77d..3cb99706 100644 --- a/src/main/java/org/ldk/structs/ProbabilisticScorer.java +++ b/src/main/java/org/ldk/structs/ProbabilisticScorer.java @@ -81,12 +81,14 @@ public class ProbabilisticScorer extends CommonBase { /** * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write */ - public static Result_ProbabilisticScorerDecodeErrorZ read(byte[] ser, TwoTuple_ProbabilisticScoringParametersNetworkGraphZ arg) { - long ret = bindings.ProbabilisticScorer_read(ser, arg != null ? arg.ptr : 0); + public static Result_ProbabilisticScorerDecodeErrorZ read(byte[] ser, ProbabilisticScoringParameters arg_a, NetworkGraph arg_b) { + long ret = bindings.ProbabilisticScorer_read(ser, arg_a == null ? 0 : arg_a.ptr & ~1, arg_b == null ? 0 : arg_b.ptr & ~1); Reference.reachabilityFence(ser); - Reference.reachabilityFence(arg); + Reference.reachabilityFence(arg_a); + Reference.reachabilityFence(arg_b); if (ret >= 0 && ret <= 4096) { return null; } Result_ProbabilisticScorerDecodeErrorZ ret_hu_conv = Result_ProbabilisticScorerDecodeErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(arg_b); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java b/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java index ebace911..4aa7a119 100644 --- a/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java +++ b/src/main/java/org/ldk/structs/ProbabilisticScoringParameters.java @@ -10,6 +10,9 @@ import javax.annotation.Nullable; /** * Parameters for configuring [`ProbabilisticScorer`]. + * + * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel + * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel). */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class ProbabilisticScoringParameters extends CommonBase { @@ -21,17 +24,39 @@ public class ProbabilisticScoringParameters extends CommonBase { } /** - * A multiplier used to determine the amount in msats willing to be paid to avoid routing - * through a channel, as per multiplying by the negative `log10` of the channel's success - * probability for a payment. + * A fixed penalty in msats to apply to each channel. * - * The success probability is determined by the effective channel capacity, the payment amount, - * and knowledge learned from prior successful and unsuccessful payments. The lower bound of - * the success probability is 0.01, effectively limiting the penalty to the range - * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based - * on [`liquidity_offset_half_life`]. + * Default value: 500 msat + */ + public long get_base_penalty_msat() { + long ret = bindings.ProbabilisticScoringParameters_get_base_penalty_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A fixed penalty in msats to apply to each channel. * - * Default value: 10,000 msat + * Default value: 500 msat + */ + public void set_base_penalty_msat(long val) { + bindings.ProbabilisticScoringParameters_set_base_penalty_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for a payment to determine the liquidity penalty. + * + * The penalty is based in part on the knowledge learned from prior successful and unsuccessful + * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The + * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to + * lower bounding the success probability to `0.01`) when the amount falls within the + * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will + * result in a `u64::max_value` penalty, however. + * + * Default value: 40,000 msat * * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life */ @@ -42,17 +67,17 @@ public class ProbabilisticScoringParameters extends CommonBase { } /** - * A multiplier used to determine the amount in msats willing to be paid to avoid routing - * through a channel, as per multiplying by the negative `log10` of the channel's success - * probability for a payment. + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for a payment to determine the liquidity penalty. * - * The success probability is determined by the effective channel capacity, the payment amount, - * and knowledge learned from prior successful and unsuccessful payments. The lower bound of - * the success probability is 0.01, effectively limiting the penalty to the range - * `0..=2*liquidity_penalty_multiplier_msat`. The knowledge learned is decayed over time based - * on [`liquidity_offset_half_life`]. + * The penalty is based in part on the knowledge learned from prior successful and unsuccessful + * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The + * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to + * lower bounding the success probability to `0.01`) when the amount falls within the + * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will + * result in a `u64::max_value` penalty, however. * - * Default value: 10,000 msat + * Default value: 40,000 msat * * [`liquidity_offset_half_life`]: Self::liquidity_offset_half_life */ @@ -104,13 +129,65 @@ public class ProbabilisticScoringParameters extends CommonBase { Reference.reachabilityFence(val); } + /** + * A multiplier used in conjunction with a payment amount and the negative `log10` of the + * channel's success probability for the payment to determine the amount penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the + * success probability. + * + * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` + * + * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of + * the amount will result in a penalty of the multiplier. And, as the success probability + * decreases, the negative `log10` weighting will increase dramatically. For higher success + * probabilities, the multiplier will have a decreasing effect as the negative `log10` will + * fall below `1`. + * + * Default value: 256 msat + */ + public long get_amount_penalty_multiplier_msat() { + long ret = bindings.ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A multiplier used in conjunction with a payment amount and the negative `log10` of the + * channel's success probability for the payment to determine the amount penalty. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the + * success probability. + * + * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` + * + * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of + * the amount will result in a penalty of the multiplier. And, as the success probability + * decreases, the negative `log10` weighting will increase dramatically. For higher success + * probabilities, the multiplier will have a decreasing effect as the negative `log10` will + * fall below `1`. + * + * Default value: 256 msat + */ + public void set_amount_penalty_multiplier_msat(long val) { + bindings.ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + /** * Constructs a new ProbabilisticScoringParameters given each field */ - public static ProbabilisticScoringParameters of(long liquidity_penalty_multiplier_msat_arg, long liquidity_offset_half_life_arg) { - long ret = bindings.ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg); + public static ProbabilisticScoringParameters of(long base_penalty_msat_arg, long liquidity_penalty_multiplier_msat_arg, long liquidity_offset_half_life_arg, long amount_penalty_multiplier_msat_arg) { + long ret = bindings.ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg); + Reference.reachabilityFence(base_penalty_msat_arg); Reference.reachabilityFence(liquidity_penalty_multiplier_msat_arg); Reference.reachabilityFence(liquidity_offset_half_life_arg); + Reference.reachabilityFence(amount_penalty_multiplier_msat_arg); if (ret >= 0 && ret <= 4096) { return null; } ProbabilisticScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ProbabilisticScoringParameters(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -135,26 +212,6 @@ public class ProbabilisticScoringParameters extends CommonBase { return ret_hu_conv; } - /** - * Serialize the ProbabilisticScoringParameters object into a byte array which can be read by ProbabilisticScoringParameters_read - */ - public byte[] write() { - byte[] ret = bindings.ProbabilisticScoringParameters_write(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Read a ProbabilisticScoringParameters from a byte array, created by ProbabilisticScoringParameters_write - */ - public static Result_ProbabilisticScoringParametersDecodeErrorZ read(byte[] ser) { - long ret = bindings.ProbabilisticScoringParameters_read(ser); - Reference.reachabilityFence(ser); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - /** * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used. */ diff --git a/src/main/java/org/ldk/structs/RawInvoice.java b/src/main/java/org/ldk/structs/RawInvoice.java index e370352d..3bdb47c1 100644 --- a/src/main/java/org/ldk/structs/RawInvoice.java +++ b/src/main/java/org/ldk/structs/RawInvoice.java @@ -208,7 +208,7 @@ public class RawInvoice extends CommonBase { long ret = bindings.RawInvoice_amount_pico_btc(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java index 5817a099..80bc7bb9 100644 --- a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java +++ b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java @@ -30,7 +30,7 @@ public class ReadOnlyNetworkGraph extends CommonBase { Reference.reachabilityFence(this); Reference.reachabilityFence(pubkey); if (ret >= 0 && ret <= 4096) { return null; } - Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + org.ldk.structs.Option_CVec_NetAddressZZ ret_hu_conv = org.ldk.structs.Option_CVec_NetAddressZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java index c79da690..faae7807 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java @@ -36,7 +36,7 @@ public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends Com private Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(ptr); - PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); + org.ldk.structs.PaymentSendFailure err_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java index e4ce56bd..863dd5f7 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java @@ -36,7 +36,7 @@ public class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ extends CommonBas private Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(ptr); - APIError err_hu_conv = APIError.constr_from_ptr(err); + org.ldk.structs.APIError err_hu_conv = org.ldk.structs.APIError.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java index 499a76b3..badb260d 100644 --- a/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java @@ -25,7 +25,7 @@ public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { private Result_COption_ClosureReasonZDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.CResult_COption_ClosureReasonZDecodeErrorZ_get_ok(ptr); - Option_ClosureReasonZ res_hu_conv = Option_ClosureReasonZ.constr_from_ptr(res); + org.ldk.structs.Option_ClosureReasonZ res_hu_conv = org.ldk.structs.Option_ClosureReasonZ.constr_from_ptr(res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java index 23c9f266..50c5a69f 100644 --- a/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java @@ -25,7 +25,7 @@ public class Result_COption_EventZDecodeErrorZ extends CommonBase { private Result_COption_EventZDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.CResult_COption_EventZDecodeErrorZ_get_ok(ptr); - Option_EventZ res_hu_conv = Option_EventZ.constr_from_ptr(res); + org.ldk.structs.Option_EventZ res_hu_conv = org.ldk.structs.Option_EventZ.constr_from_ptr(res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java index 9831d5cc..dc2c2b8b 100644 --- a/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java @@ -25,7 +25,7 @@ public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { private Result_COption_MonitorEventZDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.CResult_COption_MonitorEventZDecodeErrorZ_get_ok(ptr); - Option_MonitorEventZ res_hu_conv = Option_MonitorEventZ.constr_from_ptr(res); + org.ldk.structs.Option_MonitorEventZ res_hu_conv = org.ldk.structs.Option_MonitorEventZ.constr_from_ptr(res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java index dbe54350..61dee22c 100644 --- a/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java @@ -25,7 +25,7 @@ public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { private Result_COption_NetworkUpdateZDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_get_ok(ptr); - Option_NetworkUpdateZ res_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(res); + org.ldk.structs.Option_NetworkUpdateZ res_hu_conv = org.ldk.structs.Option_NetworkUpdateZ.constr_from_ptr(res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java index 400a7bc0..0e65ec7b 100644 --- a/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java @@ -25,7 +25,7 @@ public class Result_COption_TypeZDecodeErrorZ extends CommonBase { private Result_COption_TypeZDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.CResult_COption_TypeZDecodeErrorZ_get_ok(ptr); - Option_TypeZ res_hu_conv = Option_TypeZ.constr_from_ptr(res); + org.ldk.structs.Option_TypeZ res_hu_conv = org.ldk.structs.Option_TypeZ.constr_from_ptr(res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java b/src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java deleted file mode 100644 index 1387fafa..00000000 --- a/src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java +++ /dev/null @@ -1,88 +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_InvoiceNoneZ extends CommonBase { - private Result_InvoiceNoneZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_InvoiceNoneZ_free(ptr); } super.finalize(); - } - - static Result_InvoiceNoneZ constr_from_ptr(long ptr) { - if (bindings.CResult_InvoiceNoneZ_is_ok(ptr)) { - return new Result_InvoiceNoneZ_OK(null, ptr); - } else { - return new Result_InvoiceNoneZ_Err(null, ptr); - } - } - public static final class Result_InvoiceNoneZ_OK extends Result_InvoiceNoneZ { - public final Invoice res; - private Result_InvoiceNoneZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_InvoiceNoneZ_get_ok(ptr); - Invoice res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new Invoice(null, res); } - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - } - - public static final class Result_InvoiceNoneZ_Err extends Result_InvoiceNoneZ { - private Result_InvoiceNoneZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - } - } - - /** - * Creates a new CResult_InvoiceNoneZ in the success state. - */ - public static Result_InvoiceNoneZ ok(Invoice o) { - long ret = bindings.CResult_InvoiceNoneZ_ok(o == null ? 0 : o.ptr & ~1); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_InvoiceNoneZ in the error state. - */ - public static Result_InvoiceNoneZ err() { - long ret = bindings.CResult_InvoiceNoneZ_err(); - if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.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_InvoiceNoneZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_InvoiceNoneZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_InvoiceNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_InvoiceNoneZ clone() { - long ret = bindings.CResult_InvoiceNoneZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_InvoiceParseOrSemanticErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceParseOrSemanticErrorZ.java new file mode 100644 index 00000000..597e1cfc --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_InvoiceParseOrSemanticErrorZ.java @@ -0,0 +1,94 @@ +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_InvoiceParseOrSemanticErrorZ extends CommonBase { + private Result_InvoiceParseOrSemanticErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_InvoiceParseOrSemanticErrorZ_free(ptr); } super.finalize(); + } + + static Result_InvoiceParseOrSemanticErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_InvoiceParseOrSemanticErrorZ_is_ok(ptr)) { + return new Result_InvoiceParseOrSemanticErrorZ_OK(null, ptr); + } else { + return new Result_InvoiceParseOrSemanticErrorZ_Err(null, ptr); + } + } + public static final class Result_InvoiceParseOrSemanticErrorZ_OK extends Result_InvoiceParseOrSemanticErrorZ { + public final Invoice res; + private Result_InvoiceParseOrSemanticErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_InvoiceParseOrSemanticErrorZ_get_ok(ptr); + Invoice res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new Invoice(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_InvoiceParseOrSemanticErrorZ_Err extends Result_InvoiceParseOrSemanticErrorZ { + public final ParseOrSemanticError err; + private Result_InvoiceParseOrSemanticErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_InvoiceParseOrSemanticErrorZ_get_err(ptr); + org.ldk.structs.ParseOrSemanticError err_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. + */ + public static Result_InvoiceParseOrSemanticErrorZ ok(Invoice o) { + long ret = bindings.CResult_InvoiceParseOrSemanticErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceParseOrSemanticErrorZ ret_hu_conv = Result_InvoiceParseOrSemanticErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. + */ + public static Result_InvoiceParseOrSemanticErrorZ err(ParseOrSemanticError e) { + long ret = bindings.CResult_InvoiceParseOrSemanticErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceParseOrSemanticErrorZ ret_hu_conv = Result_InvoiceParseOrSemanticErrorZ.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_InvoiceParseOrSemanticErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_InvoiceParseOrSemanticErrorZ clone() { + long ret = bindings.CResult_InvoiceParseOrSemanticErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceParseOrSemanticErrorZ ret_hu_conv = Result_InvoiceParseOrSemanticErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java index 24d8d418..3d91088d 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java @@ -36,7 +36,7 @@ public class Result_InvoiceSignOrCreationErrorZ extends CommonBase { private Result_InvoiceSignOrCreationErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_InvoiceSignOrCreationErrorZ_get_err(ptr); - SignOrCreationError err_hu_conv = SignOrCreationError.constr_from_ptr(err); + org.ldk.structs.SignOrCreationError err_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java index a678c2ea..eb44c631 100644 --- a/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java @@ -25,7 +25,7 @@ public class Result_NetAddressDecodeErrorZ extends CommonBase { private Result_NetAddressDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.CResult_NetAddressDecodeErrorZ_get_ok(ptr); - NetAddress res_hu_conv = NetAddress.constr_from_ptr(res); + org.ldk.structs.NetAddress res_hu_conv = org.ldk.structs.NetAddress.constr_from_ptr(res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java index 2ebdee92..8430bb8c 100644 --- a/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java @@ -31,7 +31,7 @@ public class Result_NoneAPIErrorZ extends CommonBase { private Result_NoneAPIErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_NoneAPIErrorZ_get_err(ptr); - APIError err_hu_conv = APIError.constr_from_ptr(err); + org.ldk.structs.APIError err_hu_conv = org.ldk.structs.APIError.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java index f277cbd8..97344798 100644 --- a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java @@ -31,7 +31,7 @@ public class Result_NonePaymentSendFailureZ extends CommonBase { private Result_NonePaymentSendFailureZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_NonePaymentSendFailureZ_get_err(ptr); - PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); + org.ldk.structs.PaymentSendFailure err_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java index 47659ec0..004812ed 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java @@ -33,7 +33,7 @@ public class Result_PaymentIdPaymentErrorZ extends CommonBase { private Result_PaymentIdPaymentErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_PaymentIdPaymentErrorZ_get_err(ptr); - PaymentError err_hu_conv = PaymentError.constr_from_ptr(err); + org.ldk.structs.PaymentError err_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java index 10b17ced..ddd007f1 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java @@ -33,7 +33,7 @@ public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { private Result_PaymentIdPaymentSendFailureZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_PaymentIdPaymentSendFailureZ_get_err(ptr); - PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); + org.ldk.structs.PaymentSendFailure err_hu_conv = org.ldk.structs.PaymentSendFailure.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java index 875f4ecc..44cae5f1 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java @@ -33,7 +33,7 @@ public class Result_PaymentPreimageAPIErrorZ extends CommonBase { private Result_PaymentPreimageAPIErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_PaymentPreimageAPIErrorZ_get_err(ptr); - APIError err_hu_conv = APIError.constr_from_ptr(err); + org.ldk.structs.APIError err_hu_conv = org.ldk.structs.APIError.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java index acb6d201..a2b89535 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java @@ -33,7 +33,7 @@ public class Result_PaymentSecretAPIErrorZ extends CommonBase { private Result_PaymentSecretAPIErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult_PaymentSecretAPIErrorZ_get_err(ptr); - APIError err_hu_conv = APIError.constr_from_ptr(err); + org.ldk.structs.APIError err_hu_conv = org.ldk.structs.APIError.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result_ProbabilisticScoringParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ProbabilisticScoringParametersDecodeErrorZ.java deleted file mode 100644 index 1f4fb41c..00000000 --- a/src/main/java/org/ldk/structs/Result_ProbabilisticScoringParametersDecodeErrorZ.java +++ /dev/null @@ -1,94 +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_ProbabilisticScoringParametersDecodeErrorZ extends CommonBase { - private Result_ProbabilisticScoringParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_ProbabilisticScoringParametersDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(ptr)) { - return new Result_ProbabilisticScoringParametersDecodeErrorZ_OK(null, ptr); - } else { - return new Result_ProbabilisticScoringParametersDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_ProbabilisticScoringParametersDecodeErrorZ_OK extends Result_ProbabilisticScoringParametersDecodeErrorZ { - public final ProbabilisticScoringParameters res; - private Result_ProbabilisticScoringParametersDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(ptr); - ProbabilisticScoringParameters res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ProbabilisticScoringParameters(null, res); } - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - } - - public static final class Result_ProbabilisticScoringParametersDecodeErrorZ_Err extends Result_ProbabilisticScoringParametersDecodeErrorZ { - public final DecodeError err; - private Result_ProbabilisticScoringParametersDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(ptr); - DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the success state. - */ - public static Result_ProbabilisticScoringParametersDecodeErrorZ ok(ProbabilisticScoringParameters o) { - long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ in the error state. - */ - public static Result_ProbabilisticScoringParametersDecodeErrorZ err(DecodeError e) { - long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); - Reference.reachabilityFence(e); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.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_ProbabilisticScoringParametersDecodeErrorZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_ProbabilisticScoringParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_ProbabilisticScoringParametersDecodeErrorZ clone() { - long ret = bindings.CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_ProbabilisticScoringParametersDecodeErrorZ ret_hu_conv = Result_ProbabilisticScoringParametersDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_SiPrefixNoneZ.java b/src/main/java/org/ldk/structs/Result_SiPrefixNoneZ.java deleted file mode 100644 index 72700577..00000000 --- a/src/main/java/org/ldk/structs/Result_SiPrefixNoneZ.java +++ /dev/null @@ -1,85 +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_SiPrefixNoneZ extends CommonBase { - private Result_SiPrefixNoneZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_SiPrefixNoneZ_free(ptr); } super.finalize(); - } - - static Result_SiPrefixNoneZ constr_from_ptr(long ptr) { - if (bindings.CResult_SiPrefixNoneZ_is_ok(ptr)) { - return new Result_SiPrefixNoneZ_OK(null, ptr); - } else { - return new Result_SiPrefixNoneZ_Err(null, ptr); - } - } - public static final class Result_SiPrefixNoneZ_OK extends Result_SiPrefixNoneZ { - public final SiPrefix res; - private Result_SiPrefixNoneZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - this.res = bindings.CResult_SiPrefixNoneZ_get_ok(ptr); - } - } - - public static final class Result_SiPrefixNoneZ_Err extends Result_SiPrefixNoneZ { - private Result_SiPrefixNoneZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - } - } - - /** - * Creates a new CResult_SiPrefixNoneZ in the success state. - */ - public static Result_SiPrefixNoneZ ok(org.ldk.enums.SiPrefix o) { - long ret = bindings.CResult_SiPrefixNoneZ_ok(o); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SiPrefixNoneZ ret_hu_conv = Result_SiPrefixNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_SiPrefixNoneZ in the error state. - */ - public static Result_SiPrefixNoneZ err() { - long ret = bindings.CResult_SiPrefixNoneZ_err(); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SiPrefixNoneZ ret_hu_conv = Result_SiPrefixNoneZ.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_SiPrefixNoneZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_SiPrefixNoneZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_SiPrefixNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_SiPrefixNoneZ clone() { - long ret = bindings.CResult_SiPrefixNoneZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SiPrefixNoneZ ret_hu_conv = Result_SiPrefixNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_SiPrefixParseErrorZ.java b/src/main/java/org/ldk/structs/Result_SiPrefixParseErrorZ.java new file mode 100644 index 00000000..6f038e49 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_SiPrefixParseErrorZ.java @@ -0,0 +1,91 @@ +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_SiPrefixParseErrorZ extends CommonBase { + private Result_SiPrefixParseErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_SiPrefixParseErrorZ_free(ptr); } super.finalize(); + } + + static Result_SiPrefixParseErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_SiPrefixParseErrorZ_is_ok(ptr)) { + return new Result_SiPrefixParseErrorZ_OK(null, ptr); + } else { + return new Result_SiPrefixParseErrorZ_Err(null, ptr); + } + } + public static final class Result_SiPrefixParseErrorZ_OK extends Result_SiPrefixParseErrorZ { + public final SiPrefix res; + private Result_SiPrefixParseErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.CResult_SiPrefixParseErrorZ_get_ok(ptr); + } + } + + public static final class Result_SiPrefixParseErrorZ_Err extends Result_SiPrefixParseErrorZ { + public final ParseError err; + private Result_SiPrefixParseErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_SiPrefixParseErrorZ_get_err(ptr); + org.ldk.structs.ParseError err_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_SiPrefixParseErrorZ in the success state. + */ + public static Result_SiPrefixParseErrorZ ok(org.ldk.enums.SiPrefix o) { + long ret = bindings.CResult_SiPrefixParseErrorZ_ok(o); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SiPrefixParseErrorZ ret_hu_conv = Result_SiPrefixParseErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_SiPrefixParseErrorZ in the error state. + */ + public static Result_SiPrefixParseErrorZ err(ParseError e) { + long ret = bindings.CResult_SiPrefixParseErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SiPrefixParseErrorZ ret_hu_conv = Result_SiPrefixParseErrorZ.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_SiPrefixParseErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_SiPrefixParseErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_SiPrefixParseErrorZ clone() { + long ret = bindings.CResult_SiPrefixParseErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SiPrefixParseErrorZ ret_hu_conv = Result_SiPrefixParseErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_SignedRawInvoiceNoneZ.java b/src/main/java/org/ldk/structs/Result_SignedRawInvoiceNoneZ.java deleted file mode 100644 index d22a7a81..00000000 --- a/src/main/java/org/ldk/structs/Result_SignedRawInvoiceNoneZ.java +++ /dev/null @@ -1,88 +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_SignedRawInvoiceNoneZ extends CommonBase { - private Result_SignedRawInvoiceNoneZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_SignedRawInvoiceNoneZ_free(ptr); } super.finalize(); - } - - static Result_SignedRawInvoiceNoneZ constr_from_ptr(long ptr) { - if (bindings.CResult_SignedRawInvoiceNoneZ_is_ok(ptr)) { - return new Result_SignedRawInvoiceNoneZ_OK(null, ptr); - } else { - return new Result_SignedRawInvoiceNoneZ_Err(null, ptr); - } - } - public static final class Result_SignedRawInvoiceNoneZ_OK extends Result_SignedRawInvoiceNoneZ { - public final SignedRawInvoice res; - private Result_SignedRawInvoiceNoneZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.CResult_SignedRawInvoiceNoneZ_get_ok(ptr); - SignedRawInvoice res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new SignedRawInvoice(null, res); } - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - } - - public static final class Result_SignedRawInvoiceNoneZ_Err extends Result_SignedRawInvoiceNoneZ { - private Result_SignedRawInvoiceNoneZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - } - } - - /** - * Creates a new CResult_SignedRawInvoiceNoneZ in the success state. - */ - public static Result_SignedRawInvoiceNoneZ ok(SignedRawInvoice o) { - long ret = bindings.CResult_SignedRawInvoiceNoneZ_ok(o == null ? 0 : o.ptr & ~1); - Reference.reachabilityFence(o); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_SignedRawInvoiceNoneZ in the error state. - */ - public static Result_SignedRawInvoiceNoneZ err() { - long ret = bindings.CResult_SignedRawInvoiceNoneZ_err(); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.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_SignedRawInvoiceNoneZ_is_ok(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_SignedRawInvoiceNoneZ_clone_ptr(this.ptr); - Reference.reachabilityFence(this); - return ret; - } - - /** - * Creates a new CResult_SignedRawInvoiceNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_SignedRawInvoiceNoneZ clone() { - long ret = bindings.CResult_SignedRawInvoiceNoneZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_SignedRawInvoiceParseErrorZ.java b/src/main/java/org/ldk/structs/Result_SignedRawInvoiceParseErrorZ.java new file mode 100644 index 00000000..6d21088f --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_SignedRawInvoiceParseErrorZ.java @@ -0,0 +1,94 @@ +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_SignedRawInvoiceParseErrorZ extends CommonBase { + private Result_SignedRawInvoiceParseErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_SignedRawInvoiceParseErrorZ_free(ptr); } super.finalize(); + } + + static Result_SignedRawInvoiceParseErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_SignedRawInvoiceParseErrorZ_is_ok(ptr)) { + return new Result_SignedRawInvoiceParseErrorZ_OK(null, ptr); + } else { + return new Result_SignedRawInvoiceParseErrorZ_Err(null, ptr); + } + } + public static final class Result_SignedRawInvoiceParseErrorZ_OK extends Result_SignedRawInvoiceParseErrorZ { + public final SignedRawInvoice res; + private Result_SignedRawInvoiceParseErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.CResult_SignedRawInvoiceParseErrorZ_get_ok(ptr); + SignedRawInvoice res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new SignedRawInvoice(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_SignedRawInvoiceParseErrorZ_Err extends Result_SignedRawInvoiceParseErrorZ { + public final ParseError err; + private Result_SignedRawInvoiceParseErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.CResult_SignedRawInvoiceParseErrorZ_get_err(ptr); + org.ldk.structs.ParseError err_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. + */ + public static Result_SignedRawInvoiceParseErrorZ ok(SignedRawInvoice o) { + long ret = bindings.CResult_SignedRawInvoiceParseErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignedRawInvoiceParseErrorZ ret_hu_conv = Result_SignedRawInvoiceParseErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. + */ + public static Result_SignedRawInvoiceParseErrorZ err(ParseError e) { + long ret = bindings.CResult_SignedRawInvoiceParseErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignedRawInvoiceParseErrorZ ret_hu_conv = Result_SignedRawInvoiceParseErrorZ.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_SignedRawInvoiceParseErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_SignedRawInvoiceParseErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_SignedRawInvoiceParseErrorZ clone() { + long ret = bindings.CResult_SignedRawInvoiceParseErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_SignedRawInvoiceParseErrorZ ret_hu_conv = Result_SignedRawInvoiceParseErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java index ca79867c..c3ecc783 100644 --- a/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java @@ -25,7 +25,7 @@ public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { private Result_SpendableOutputDescriptorDecodeErrorZ_OK(Object _dummy, long ptr) { super(_dummy, ptr); long res = bindings.CResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(ptr); - SpendableOutputDescriptor res_hu_conv = SpendableOutputDescriptor.constr_from_ptr(res); + org.ldk.structs.SpendableOutputDescriptor res_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(res); res_hu_conv.ptrs_to.add(this); this.res = res_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java index ac943868..67e3a97a 100644 --- a/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java @@ -33,7 +33,7 @@ public class Result__u832APIErrorZ extends CommonBase { private Result__u832APIErrorZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.CResult__u832APIErrorZ_get_err(ptr); - APIError err_hu_conv = APIError.constr_from_ptr(err); + org.ldk.structs.APIError err_hu_conv = org.ldk.structs.APIError.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } diff --git a/src/main/java/org/ldk/structs/RouteHintHop.java b/src/main/java/org/ldk/structs/RouteHintHop.java index d7ed5a4a..e59be65b 100644 --- a/src/main/java/org/ldk/structs/RouteHintHop.java +++ b/src/main/java/org/ldk/structs/RouteHintHop.java @@ -102,7 +102,7 @@ public class RouteHintHop extends CommonBase { long ret = bindings.RouteHintHop_get_htlc_minimum_msat(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -123,7 +123,7 @@ public class RouteHintHop extends CommonBase { long ret = bindings.RouteHintHop_get_htlc_maximum_msat(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java index 67254708..bd31e4e3 100644 --- a/src/main/java/org/ldk/structs/RoutingMessageHandler.java +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -67,7 +67,7 @@ public class RoutingMessageHandler extends CommonBase { * perform routing table synchronization using a strategy defined by the * implementor. */ - void sync_routing_table(byte[] their_node_id, Init init); + void peer_connected(byte[] their_node_id, Init init); /** * Handles the reply of a query we initiated to learn about channels * for a given range of blocks. We can expect to receive one or more @@ -129,9 +129,9 @@ public class RoutingMessageHandler extends CommonBase { long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_18 -> ret_conv_18 == null ? 0 : ret_conv_18.clone_ptr()).toArray() : null; return result; } - @Override public void sync_routing_table(byte[] their_node_id, long init) { + @Override public void peer_connected(byte[] their_node_id, long init) { Init init_hu_conv = null; if (init < 0 || init > 4096) { init_hu_conv = new Init(null, init); } - arg.sync_routing_table(their_node_id, init_hu_conv); + arg.peer_connected(their_node_id, init_hu_conv); Reference.reachabilityFence(arg); } @Override public long handle_reply_channel_range(byte[] their_node_id, long msg) { @@ -271,8 +271,8 @@ public class RoutingMessageHandler extends CommonBase { * perform routing table synchronization using a strategy defined by the * implementor. */ - public void sync_routing_table(byte[] their_node_id, Init init) { - bindings.RoutingMessageHandler_sync_routing_table(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr & ~1); + public void peer_connected(byte[] their_node_id, Init init) { + bindings.RoutingMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr & ~1); Reference.reachabilityFence(this); Reference.reachabilityFence(their_node_id); Reference.reachabilityFence(init); diff --git a/src/main/java/org/ldk/structs/SignOrCreationError.java b/src/main/java/org/ldk/structs/SignOrCreationError.java index 7d1eddbb..f532df40 100644 --- a/src/main/java/org/ldk/structs/SignOrCreationError.java +++ b/src/main/java/org/ldk/structs/SignOrCreationError.java @@ -62,7 +62,7 @@ public class SignOrCreationError extends CommonBase { long ret = bindings.SignOrCreationError_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret); + org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -73,7 +73,7 @@ public class SignOrCreationError extends CommonBase { public static SignOrCreationError sign_error() { long ret = bindings.SignOrCreationError_sign_error(); if (ret >= 0 && ret <= 4096) { return null; } - SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret); + org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -85,7 +85,7 @@ public class SignOrCreationError extends CommonBase { long ret = bindings.SignOrCreationError_creation_error(a); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret); + org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/SignedRawInvoice.java b/src/main/java/org/ldk/structs/SignedRawInvoice.java index d214d549..5325d42f 100644 --- a/src/main/java/org/ldk/structs/SignedRawInvoice.java +++ b/src/main/java/org/ldk/structs/SignedRawInvoice.java @@ -132,11 +132,11 @@ public class SignedRawInvoice extends CommonBase { /** * Read a SignedRawInvoice object from a string */ - public static Result_SignedRawInvoiceNoneZ from_str(java.lang.String s) { + public static Result_SignedRawInvoiceParseErrorZ from_str(java.lang.String s) { long ret = bindings.SignedRawInvoice_from_str(s); Reference.reachabilityFence(s); if (ret >= 0 && ret <= 4096) { return null; } - Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret); + Result_SignedRawInvoiceParseErrorZ ret_hu_conv = Result_SignedRawInvoiceParseErrorZ.constr_from_ptr(ret); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java index d07fb081..40d06ee0 100644 --- a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java @@ -48,11 +48,11 @@ public class SpendableOutputDescriptor extends CommonBase { /** * The outpoint which is spendable */ - public final OutPoint outpoint; + public final org.ldk.structs.OutPoint outpoint; /** * The output which is referenced by the given outpoint. */ - public final TxOut output; + public final org.ldk.structs.TxOut output; private StaticOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticOutput obj) { super(null, ptr); long outpoint = obj.outpoint; @@ -95,7 +95,7 @@ public class SpendableOutputDescriptor extends CommonBase { * chan_utils::get_revokeable_redeemscript. */ public final static class DelayedPaymentOutput extends SpendableOutputDescriptor { - public final DelayedPaymentOutputDescriptor delayed_payment_output; + public final org.ldk.structs.DelayedPaymentOutputDescriptor delayed_payment_output; private DelayedPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput obj) { super(null, ptr); long delayed_payment_output = obj.delayed_payment_output; @@ -114,7 +114,7 @@ public class SpendableOutputDescriptor extends CommonBase { * allowing us to claim the non-HTLC-encumbered outputs immediately. */ public final static class StaticPaymentOutput extends SpendableOutputDescriptor { - public final StaticPaymentOutputDescriptor static_payment_output; + public final org.ldk.structs.StaticPaymentOutputDescriptor static_payment_output; private StaticPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput obj) { super(null, ptr); long static_payment_output = obj.static_payment_output; @@ -136,7 +136,7 @@ public class SpendableOutputDescriptor extends CommonBase { long ret = bindings.SpendableOutputDescriptor_clone(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); + org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -149,7 +149,7 @@ public class SpendableOutputDescriptor extends CommonBase { Reference.reachabilityFence(outpoint); Reference.reachabilityFence(output); if (ret >= 0 && ret <= 4096) { return null; } - SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); + org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -161,7 +161,7 @@ public class SpendableOutputDescriptor extends CommonBase { long ret = bindings.SpendableOutputDescriptor_delayed_payment_output(a == null ? 0 : a.ptr & ~1); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); + org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } @@ -173,7 +173,7 @@ public class SpendableOutputDescriptor extends CommonBase { long ret = bindings.SpendableOutputDescriptor_static_payment_output(a == null ? 0 : a.ptr & ~1); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } - SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); + org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/TwoTuple_ProbabilisticScoringParametersNetworkGraphZ.java b/src/main/java/org/ldk/structs/TwoTuple_ProbabilisticScoringParametersNetworkGraphZ.java deleted file mode 100644 index 017b3e05..00000000 --- a/src/main/java/org/ldk/structs/TwoTuple_ProbabilisticScoringParametersNetworkGraphZ.java +++ /dev/null @@ -1,80 +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 Tuple - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class TwoTuple_ProbabilisticScoringParametersNetworkGraphZ extends CommonBase { - TwoTuple_ProbabilisticScoringParametersNetworkGraphZ(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(ptr); } - } - - /** - * - */ - public ProbabilisticScoringParameters get_a() { - long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - ProbabilisticScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ProbabilisticScoringParameters(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * - */ - public NetworkGraph get_b() { - long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - NetworkGraph ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NetworkGraph(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - long clone_ptr() { - long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_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 TwoTuple_ProbabilisticScoringParametersNetworkGraphZ clone() { - long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(this.ptr); - Reference.reachabilityFence(this); - if (ret >= 0 && ret <= 4096) { return null; } - TwoTuple_ProbabilisticScoringParametersNetworkGraphZ ret_hu_conv = new TwoTuple_ProbabilisticScoringParametersNetworkGraphZ(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - /** - * Creates a new C2Tuple_ProbabilisticScoringParametersNetworkGraphZ from the contained elements. - */ - public static TwoTuple_ProbabilisticScoringParametersNetworkGraphZ of(ProbabilisticScoringParameters a, NetworkGraph b) { - long ret = bindings.C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a == null ? 0 : a.ptr & ~1, b == null ? 0 : b.ptr & ~1); - Reference.reachabilityFence(a); - Reference.reachabilityFence(b); - if (ret >= 0 && ret <= 4096) { return null; } - TwoTuple_ProbabilisticScoringParametersNetworkGraphZ ret_hu_conv = new TwoTuple_ProbabilisticScoringParametersNetworkGraphZ(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(b); - 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 ef8ba801..7c53034a 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -388,14 +388,15 @@ public class UtilMethods { * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, RouteParameters route_params, NetworkGraph network, @Nullable ChannelDetails[] first_hops, Logger logger, Score scorer) { - long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr & ~1, network == null ? 0 : network.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); + public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, RouteParameters route_params, NetworkGraph network, @Nullable ChannelDetails[] first_hops, Logger logger, Score scorer, byte[] random_seed_bytes) { + long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr & ~1, network == null ? 0 : network.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32)); Reference.reachabilityFence(our_node_pubkey); Reference.reachabilityFence(route_params); Reference.reachabilityFence(network); Reference.reachabilityFence(first_hops); Reference.reachabilityFence(logger); Reference.reachabilityFence(scorer); + Reference.reachabilityFence(random_seed_bytes); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(route_params); @@ -420,6 +421,20 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Write the provided `NetworkGraph` to the path provided at `FilesystemPersister` + * initialization, within a file called \"network_graph\" + */ + public static Result_NoneErrorZ FilesystemPersister_persist_network_graph(java.lang.String data_dir, NetworkGraph network_graph) { + long ret = bindings.FilesystemPersister_persist_network_graph(data_dir, network_graph == null ? 0 : network_graph.ptr & ~1); + Reference.reachabilityFence(data_dir); + Reference.reachabilityFence(network_graph); + if (ret >= 0 && ret <= 4096) { return null; } + Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(network_graph); + return ret_hu_conv; + } + /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" * See [`PhantomKeysManager`] for more information on phantom node payments. @@ -461,6 +476,49 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" + * See [`PhantomKeysManager`] for more information on phantom node payments. + * + * `phantom_route_hints` parameter: + * Contains channel info for all nodes participating in the phantom invoice + * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each + * participating node + * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is + * updated when a channel becomes disabled or closes + * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice + * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared + * down + * + * `description_hash` is a SHA-256 hash of the description text + * + * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or + * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any + * participating node. + * + * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom + * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this + * requirement). + * + * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager + * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels + */ + public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(Option_u64Z amt_msat, Sha256 description_hash, byte[] payment_hash, byte[] payment_secret, PhantomRouteHints[] phantom_route_hints, KeysInterface keys_manager, org.ldk.enums.Currency network) { + long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr & ~1, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32), phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr & ~1).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, network); + Reference.reachabilityFence(amt_msat); + Reference.reachabilityFence(description_hash); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(payment_secret); + Reference.reachabilityFence(phantom_route_hints); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(network); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(keys_manager); + return ret_hu_conv; + } + /** * Utility to construct an invoice. Generally, unless you want to do something like a custom * cltv_expiry, this is what you should be using to create an invoice. The reason being, this @@ -482,6 +540,48 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Utility to construct an invoice. Generally, unless you want to do something like a custom + * cltv_expiry, this is what you should be using to create an invoice. The reason being, this + * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user + * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify + * that the payment secret is valid when the invoice is paid. + * Use this variant if you want to pass the `description_hash` to the invoice. + */ + public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, Sha256 description_hash) { + long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr & ~1); + Reference.reachabilityFence(channelmanager); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(network); + Reference.reachabilityFence(amt_msat); + Reference.reachabilityFence(description_hash); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(channelmanager); + ret_hu_conv.ptrs_to.add(keys_manager); + return ret_hu_conv; + } + + /** + * See [`create_invoice_from_channelmanager_with_description_hash`] + * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not + * available and the current time is supplied by the caller. + */ + public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, Sha256 description_hash, long duration_since_epoch) { + long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr & ~1, duration_since_epoch); + Reference.reachabilityFence(channelmanager); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(network); + Reference.reachabilityFence(amt_msat); + Reference.reachabilityFence(description_hash); + Reference.reachabilityFence(duration_since_epoch); + if (ret >= 0 && ret <= 4096) { return null; } + Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(channelmanager); + ret_hu_conv.ptrs_to.add(keys_manager); + return ret_hu_conv; + } + /** * See [`create_invoice_from_channelmanager`] * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index f0d71228..8888d28d 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -173,7 +173,7 @@ public class Watch extends CommonBase { MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret_conv_14_len]; for (int o = 0; o < ret_conv_14_len; o++) { long ret_conv_14 = ret[o]; - MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14); + org.ldk.structs.MonitorEvent ret_conv_14_hu_conv = org.ldk.structs.MonitorEvent.constr_from_ptr(ret_conv_14); ret_conv_14_hu_conv.ptrs_to.add(this); ret_conv_14_arr[o] = ret_conv_14_hu_conv; } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 4250dc07..97c97ec7 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -873,6 +873,84 @@ static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) { } } +static jclass LDKBech32Error_MissingSeparator_class = NULL; +static jmethodID LDKBech32Error_MissingSeparator_meth = NULL; +static jclass LDKBech32Error_InvalidChecksum_class = NULL; +static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL; +static jclass LDKBech32Error_InvalidLength_class = NULL; +static jmethodID LDKBech32Error_InvalidLength_meth = NULL; +static jclass LDKBech32Error_InvalidChar_class = NULL; +static jmethodID LDKBech32Error_InvalidChar_meth = NULL; +static jclass LDKBech32Error_InvalidData_class = NULL; +static jmethodID LDKBech32Error_InvalidData_meth = NULL; +static jclass LDKBech32Error_InvalidPadding_class = NULL; +static jmethodID LDKBech32Error_InvalidPadding_meth = NULL; +static jclass LDKBech32Error_MixedCase_class = NULL; +static jmethodID LDKBech32Error_MixedCase_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) { + LDKBech32Error_MissingSeparator_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator")); + CHECK(LDKBech32Error_MissingSeparator_class != NULL); + LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "", "()V"); + CHECK(LDKBech32Error_MissingSeparator_meth != NULL); + LDKBech32Error_InvalidChecksum_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum")); + CHECK(LDKBech32Error_InvalidChecksum_class != NULL); + LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "", "()V"); + CHECK(LDKBech32Error_InvalidChecksum_meth != NULL); + LDKBech32Error_InvalidLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength")); + CHECK(LDKBech32Error_InvalidLength_class != NULL); + LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "", "()V"); + CHECK(LDKBech32Error_InvalidLength_meth != NULL); + LDKBech32Error_InvalidChar_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar")); + CHECK(LDKBech32Error_InvalidChar_class != NULL); + LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "", "(I)V"); + CHECK(LDKBech32Error_InvalidChar_meth != NULL); + LDKBech32Error_InvalidData_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData")); + CHECK(LDKBech32Error_InvalidData_class != NULL); + LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "", "(B)V"); + CHECK(LDKBech32Error_InvalidData_meth != NULL); + LDKBech32Error_InvalidPadding_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding")); + CHECK(LDKBech32Error_InvalidPadding_class != NULL); + LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "", "()V"); + CHECK(LDKBech32Error_InvalidPadding_meth != NULL); + LDKBech32Error_MixedCase_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase")); + CHECK(LDKBech32Error_MixedCase_class != NULL); + LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "", "()V"); + CHECK(LDKBech32Error_MixedCase_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1); + switch(obj->tag) { + case LDKBech32Error_MissingSeparator: { + return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth); + } + case LDKBech32Error_InvalidChecksum: { + return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth); + } + case LDKBech32Error_InvalidLength: { + return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth); + } + case LDKBech32Error_InvalidChar: { + return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, obj->invalid_char); + } + case LDKBech32Error_InvalidData: { + return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, obj->invalid_data); + } + case LDKBech32Error_InvalidPadding: { + return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth); + } + case LDKBech32Error_MixedCase: { + return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth); + } + default: abort(); + } +} static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) { LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen }; memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen); @@ -2406,7 +2484,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_OpenChannelRequest_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest")); CHECK(LDKEvent_OpenChannelRequest_class != NULL); - LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJ)V"); + LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJJ)V"); CHECK(LDKEvent_OpenChannelRequest_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { @@ -2533,7 +2611,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data); int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form); - return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat); + LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type; + int64_t channel_type_ref = 0; + CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var); + channel_type_ref = (uintptr_t)channel_type_var.inner & ~1; + return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat, channel_type_ref); } default: abort(); } @@ -2725,6 +2809,8 @@ static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL; static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL; static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL; static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL; +static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL; +static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) { LDKMessageSendEvent_SendAcceptChannel_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel")); @@ -2821,6 +2907,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL); LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL); + LDKMessageSendEvent_SendGossipTimestampFilter_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter")); + CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL); + LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "", "([BJ)V"); + CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1); @@ -3029,6 +3120,17 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f msg_ref = (uintptr_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref); } + case LDKMessageSendEvent_SendGossipTimestampFilter: { + int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form); + LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg; + int64_t msg_ref = 0; + CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = (uintptr_t)msg_var.inner & ~1; + return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref); + } default: abort(); } } @@ -3144,76 +3246,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ return ret_ref; } -static inline struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return ProbabilisticScoringParameters_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); - LDKProbabilisticScoringParameters ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); - LDKDecodeError ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ - return ProbabilisticScoringParameters_clone(&owner->a); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); - LDKProbabilisticScoringParameters ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ - return NetworkGraph_clone(&owner->b); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); - LDKNetworkGraph ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; @@ -6718,32 +6750,259 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentEr return ret_ref; } -static inline enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){ +static jclass LDKParseError_Bech32Error_class = NULL; +static jmethodID LDKParseError_Bech32Error_meth = NULL; +static jclass LDKParseError_ParseAmountError_class = NULL; +static jmethodID LDKParseError_ParseAmountError_meth = NULL; +static jclass LDKParseError_MalformedSignature_class = NULL; +static jmethodID LDKParseError_MalformedSignature_meth = NULL; +static jclass LDKParseError_BadPrefix_class = NULL; +static jmethodID LDKParseError_BadPrefix_meth = NULL; +static jclass LDKParseError_UnknownCurrency_class = NULL; +static jmethodID LDKParseError_UnknownCurrency_meth = NULL; +static jclass LDKParseError_UnknownSiPrefix_class = NULL; +static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL; +static jclass LDKParseError_MalformedHRP_class = NULL; +static jmethodID LDKParseError_MalformedHRP_meth = NULL; +static jclass LDKParseError_TooShortDataPart_class = NULL; +static jmethodID LDKParseError_TooShortDataPart_meth = NULL; +static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL; +static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL; +static jclass LDKParseError_DescriptionDecodeError_class = NULL; +static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL; +static jclass LDKParseError_PaddingError_class = NULL; +static jmethodID LDKParseError_PaddingError_meth = NULL; +static jclass LDKParseError_IntegerOverflowError_class = NULL; +static jmethodID LDKParseError_IntegerOverflowError_meth = NULL; +static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL; +static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL; +static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL; +static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL; +static jclass LDKParseError_InvalidScriptHashLength_class = NULL; +static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL; +static jclass LDKParseError_InvalidRecoveryId_class = NULL; +static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL; +static jclass LDKParseError_InvalidSliceLength_class = NULL; +static jmethodID LDKParseError_InvalidSliceLength_meth = NULL; +static jclass LDKParseError_Skip_class = NULL; +static jmethodID LDKParseError_Skip_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) { + LDKParseError_Bech32Error_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error")); + CHECK(LDKParseError_Bech32Error_class != NULL); + LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "", "(J)V"); + CHECK(LDKParseError_Bech32Error_meth != NULL); + LDKParseError_ParseAmountError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError")); + CHECK(LDKParseError_ParseAmountError_class != NULL); + LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "", "(I)V"); + CHECK(LDKParseError_ParseAmountError_meth != NULL); + LDKParseError_MalformedSignature_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature")); + CHECK(LDKParseError_MalformedSignature_class != NULL); + LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "", "(Lorg/ldk/enums/Secp256k1Error;)V"); + CHECK(LDKParseError_MalformedSignature_meth != NULL); + LDKParseError_BadPrefix_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix")); + CHECK(LDKParseError_BadPrefix_class != NULL); + LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "", "()V"); + CHECK(LDKParseError_BadPrefix_meth != NULL); + LDKParseError_UnknownCurrency_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency")); + CHECK(LDKParseError_UnknownCurrency_class != NULL); + LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "", "()V"); + CHECK(LDKParseError_UnknownCurrency_meth != NULL); + LDKParseError_UnknownSiPrefix_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix")); + CHECK(LDKParseError_UnknownSiPrefix_class != NULL); + LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "", "()V"); + CHECK(LDKParseError_UnknownSiPrefix_meth != NULL); + LDKParseError_MalformedHRP_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP")); + CHECK(LDKParseError_MalformedHRP_class != NULL); + LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "", "()V"); + CHECK(LDKParseError_MalformedHRP_meth != NULL); + LDKParseError_TooShortDataPart_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart")); + CHECK(LDKParseError_TooShortDataPart_class != NULL); + LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "", "()V"); + CHECK(LDKParseError_TooShortDataPart_meth != NULL); + LDKParseError_UnexpectedEndOfTaggedFields_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields")); + CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL); + LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "", "()V"); + CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL); + LDKParseError_DescriptionDecodeError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError")); + CHECK(LDKParseError_DescriptionDecodeError_class != NULL); + LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "", "(I)V"); + CHECK(LDKParseError_DescriptionDecodeError_meth != NULL); + LDKParseError_PaddingError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError")); + CHECK(LDKParseError_PaddingError_class != NULL); + LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "", "()V"); + CHECK(LDKParseError_PaddingError_meth != NULL); + LDKParseError_IntegerOverflowError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError")); + CHECK(LDKParseError_IntegerOverflowError_class != NULL); + LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "", "()V"); + CHECK(LDKParseError_IntegerOverflowError_meth != NULL); + LDKParseError_InvalidSegWitProgramLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength")); + CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL); + LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "", "()V"); + CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL); + LDKParseError_InvalidPubKeyHashLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength")); + CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL); + LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "", "()V"); + CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL); + LDKParseError_InvalidScriptHashLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength")); + CHECK(LDKParseError_InvalidScriptHashLength_class != NULL); + LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "", "()V"); + CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL); + LDKParseError_InvalidRecoveryId_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId")); + CHECK(LDKParseError_InvalidRecoveryId_class != NULL); + LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "", "()V"); + CHECK(LDKParseError_InvalidRecoveryId_meth != NULL); + LDKParseError_InvalidSliceLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength")); + CHECK(LDKParseError_InvalidSliceLength_class != NULL); + LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKParseError_InvalidSliceLength_meth != NULL); + LDKParseError_Skip_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip")); + CHECK(LDKParseError_Skip_class != NULL); + LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "", "()V"); + CHECK(LDKParseError_Skip_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKParseError *obj = (LDKParseError*)(ptr & ~1); + switch(obj->tag) { + case LDKParseError_Bech32Error: { + int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1; + return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref); + } + case LDKParseError_ParseAmountError: { + /*obj->parse_amount_error*/ + return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0); + } + case LDKParseError_MalformedSignature: { + jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature); + return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv); + } + case LDKParseError_BadPrefix: { + return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth); + } + case LDKParseError_UnknownCurrency: { + return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth); + } + case LDKParseError_UnknownSiPrefix: { + return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth); + } + case LDKParseError_MalformedHRP: { + return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth); + } + case LDKParseError_TooShortDataPart: { + return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth); + } + case LDKParseError_UnexpectedEndOfTaggedFields: { + return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth); + } + case LDKParseError_DescriptionDecodeError: { + /*obj->description_decode_error*/ + return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0); + } + case LDKParseError_PaddingError: { + return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth); + } + case LDKParseError_IntegerOverflowError: { + return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth); + } + case LDKParseError_InvalidSegWitProgramLength: { + return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth); + } + case LDKParseError_InvalidPubKeyHashLength: { + return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth); + } + case LDKParseError_InvalidScriptHashLength: { + return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth); + } + case LDKParseError_InvalidRecoveryId: { + return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth); + } + case LDKParseError_InvalidSliceLength: { + LDKStr invalid_slice_length_str = obj->invalid_slice_length; + jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len); + return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv); + } + case LDKParseError_Skip: { + return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth); + } + default: abort(); + } +} +static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return SiPrefix_clone(&*owner->contents.result); } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1); - jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixNoneZ_get_ok(owner_conv)); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1); + jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv)); return ret_conv; } -static inline void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){ +static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return *owner->contents.err; + return ParseError_clone(&*owner->contents.err); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1); - CResult_SiPrefixNoneZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; } -static inline struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){ +static jclass LDKParseOrSemanticError_ParseError_class = NULL; +static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL; +static jclass LDKParseOrSemanticError_SemanticError_class = NULL; +static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) { + LDKParseOrSemanticError_ParseError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError")); + CHECK(LDKParseOrSemanticError_ParseError_class != NULL); + LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "", "(J)V"); + CHECK(LDKParseOrSemanticError_ParseError_meth != NULL); + LDKParseOrSemanticError_SemanticError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError")); + CHECK(LDKParseOrSemanticError_SemanticError_class != NULL); + LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "", "(Lorg/ldk/enums/SemanticError;)V"); + CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1); + switch(obj->tag) { + case LDKParseOrSemanticError_ParseError: { + int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1; + return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref); + } + case LDKParseOrSemanticError_SemanticError: { + jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error); + return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv); + } + default: abort(); + } +} +static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return Invoice_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1); - LDKInvoice ret_var = CResult_InvoiceNoneZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1); + LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -6755,22 +7014,25 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_ return ret_ref; } -static inline void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){ +static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return *owner->contents.err; + return ParseOrSemanticError_clone(&*owner->contents.err); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1); - CResult_InvoiceNoneZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1); + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; } -static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){ +static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return SignedRawInvoice_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1); - LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceNoneZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1); + LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -6782,13 +7044,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNo return ret_ref; } -static inline void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){ +static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return *owner->contents.err; + return ParseError_clone(&*owner->contents.err); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1); - CResult_SignedRawInvoiceNoneZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; } static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ @@ -7546,6 +7811,35 @@ static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCV } return ret; } +static jclass LDKCOption_NetAddressZ_Some_class = NULL; +static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL; +static jclass LDKCOption_NetAddressZ_None_class = NULL; +static jmethodID LDKCOption_NetAddressZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) { + LDKCOption_NetAddressZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some")); + CHECK(LDKCOption_NetAddressZ_Some_class != NULL); + LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_NetAddressZ_Some_meth != NULL); + LDKCOption_NetAddressZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None")); + CHECK(LDKCOption_NetAddressZ_None_class != NULL); + LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "", "()V"); + CHECK(LDKCOption_NetAddressZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_NetAddressZ_Some: { + int64_t some_ref = ((uintptr_t)&obj->some) | 1; + return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref); + } + case LDKCOption_NetAddressZ_None: { + return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth); + } + default: abort(); + } +} static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return CVec_u8Z_clone(&*owner->contents.result); @@ -11542,7 +11836,7 @@ typedef struct LDKRoutingMessageHandler_JCalls { jmethodID handle_channel_update_meth; jmethodID get_next_channel_announcements_meth; jmethodID get_next_node_announcements_meth; - jmethodID sync_routing_table_meth; + jmethodID peer_connected_meth; jmethodID handle_reply_channel_range_meth; jmethodID handle_reply_short_channel_ids_end_meth; jmethodID handle_query_channel_range_meth; @@ -11746,7 +12040,7 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_j } return ret_constr; } -void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -11769,10 +12063,10 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref); + (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception."); + (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception."); } if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); @@ -11944,8 +12238,8 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en CHECK(calls->get_next_channel_announcements_meth != NULL); calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J"); CHECK(calls->get_next_node_announcements_meth != NULL); - calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V"); - CHECK(calls->sync_routing_table_meth != NULL); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V"); + CHECK(calls->peer_connected_meth != NULL); calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J"); CHECK(calls->handle_reply_channel_range_meth != NULL); calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J"); @@ -11962,7 +12256,7 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall, .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall, .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall, - .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall, + .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall, .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall, .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall, .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall, @@ -12069,7 +12363,7 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_ return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; @@ -12080,7 +12374,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1r init_conv.inner = (void*)(init & (~1)); init_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); - (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { @@ -13007,14 +13301,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv return (int64_t)ret_ret; } -typedef struct LDKChannelManagerPersister_JCalls { +typedef struct LDKPersister_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; jmethodID persist_manager_meth; -} LDKChannelManagerPersister_JCalls; -static void LDKChannelManagerPersister_JCalls_free(void* this_arg) { - LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg; + jmethodID persist_graph_meth; +} LDKPersister_JCalls; +static void LDKPersister_JCalls_free(void* this_arg) { + LDKPersister_JCalls *j_calls = (LDKPersister_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); @@ -13030,8 +13325,8 @@ static void LDKChannelManagerPersister_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) { - LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg; +LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) { + LDKPersister_JCalls *j_calls = (LDKPersister_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) { @@ -13054,7 +13349,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception."); + (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception."); } void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); CHECK_ACCESS(ret_ptr); @@ -13065,36 +13360,74 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi } return ret_conv; } -static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) { - LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg; +LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) { + LDKPersister_JCalls *j_calls = (LDKPersister_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); + } + LDKNetworkGraph network_graph_var = *network_graph; + int64_t network_graph_ref = 0; + network_graph_var = NetworkGraph_clone(&network_graph_var); + CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var); + network_graph_ref = (uintptr_t)network_graph_var.inner; + if (network_graph_var.is_owned) { + network_graph_ref |= 1; + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception."); + } + void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr); + FREE((void*)ret); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) { + LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) { +static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls"); + LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J"); CHECK(calls->persist_manager_meth != NULL); + calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J"); + CHECK(calls->persist_graph_meth != NULL); - LDKChannelManagerPersister ret = { + LDKPersister ret = { .this_arg = (void*) calls, - .persist_manager = persist_manager_LDKChannelManagerPersister_jcall, - .free = LDKChannelManagerPersister_JCalls_free, + .persist_manager = persist_manager_LDKPersister_jcall, + .persist_graph = persist_graph_LDKPersister_jcall, + .free = LDKPersister_JCalls_free, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) { - LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister"); - *res_ptr = LDKChannelManagerPersister_init(env, clz, o); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) { + LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister"); + *res_ptr = LDKPersister_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } - LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr; + LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr; LDKChannelManager channel_manager_conv; channel_manager_conv.inner = (void*)(channel_manager & (~1)); channel_manager_conv.is_owned = false; @@ -13104,6 +13437,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1pe return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) { + void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr; + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); + LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); + *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv); + return (int64_t)ret_conv; +} + static jclass LDKFallback_SegWitProgram_class = NULL; static jmethodID LDKFallback_SegWitProgram_meth = NULL; static jclass LDKFallback_PubKeyHash_class = NULL; @@ -13678,6 +14024,35 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1co return ret_conv; } +static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) { + LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error"); + *ret_copy = Bech32Error_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKBech32Error* arg_conv = (LDKBech32Error*)arg; + int64_t ret_val = Bech32Error_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKBech32Error* orig_conv = (LDKBech32Error*)orig; + LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error"); + *ret_copy = Bech32Error_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) { + if ((o & 1) != 0) return; + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr); + FREE((void*)o); + Bech32Error_free(o_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) { LDKTransaction _res_ref; _res_ref.datalen = (*env)->GetArrayLength(env, _res); @@ -15983,103 +16358,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1f CResult_ScorerDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKProbabilisticScoringParameters o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = ProbabilisticScoringParameters_clone(&o_conv); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv); - return (int64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - LDKDecodeError e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = DecodeError_clone(&e_conv); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv); - return (int64_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv); -} - -static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg); - return (int64_t)ret_conv; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1); - int64_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv); - return (int64_t)ret_conv; -} - -static inline uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); - *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(arg); - return ((int64_t)ret_conv); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* arg_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg & ~1); - int64_t ret_val = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* orig_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(orig & ~1); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); - *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig_conv); - return ((int64_t)ret_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKProbabilisticScoringParameters a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = (a & 1) || (a == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - a_conv = ProbabilisticScoringParameters_clone(&a_conv); - LDKNetworkGraph b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); - *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a_conv, &b_conv); - return ((int64_t)ret_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(_res_ptr); - FREE((void*)_res); - C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKProbabilisticScorer o_conv; o_conv.inner = (void*)(o & (~1)); @@ -18475,149 +18753,161 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentEr return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) { LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o); - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_err(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uintptr_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKParseError e_conv = *(LDKParseError*)(e_ptr); + e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1)); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv); return (int64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1); - jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1); + jboolean ret_val = CResult_SiPrefixParseErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr); + LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_SiPrefixNoneZ_free(_res_conv); + CResult_SiPrefixParseErrorZ_free(_res_conv); } -static inline uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) { - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_clone(arg); +static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) { + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1); - int64_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1); + int64_t ret_val = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1); - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInvoice o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); o_conv = Invoice_clone(&o_conv); - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_ok(o_conv); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_err(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uintptr_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr); + e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1)); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv); return (int64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1); - jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1); + jboolean ret_val = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr); + LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InvoiceNoneZ_free(_res_conv); + CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv); } -static inline uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) { - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_clone(arg); +static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) { + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1); - int64_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1); + int64_t ret_val = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1); - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKSignedRawInvoice o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); o_conv = SignedRawInvoice_clone(&o_conv); - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_err(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uintptr_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKParseError e_conv = *(LDKParseError*)(e_ptr); + e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1)); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv); return (int64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1); - jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1); + jboolean ret_val = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr); + LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_SignedRawInvoiceNoneZ_free(_res_conv); + CResult_SignedRawInvoiceParseErrorZ_free(_res_conv); } -static inline uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) { - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg); +static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) { + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1); - int64_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1); + int64_t ret_val = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1); - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv); return (int64_t)ret_conv; } @@ -19909,6 +20199,53 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv CVec_PublicKeyZ_free(_res_constr); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr); + o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1)); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_some(o_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_none(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr); + FREE((void*)_res); + COption_NetAddressZ_free(_res_conv); +} + +static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) { + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg; + int64_t ret_val = COption_NetAddressZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig; + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKCVec_u8Z o_ref; o_ref.datalen = (*env)->GetArrayLength(env, o); @@ -23103,15 +23440,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1succe return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) { LDKThirtyTwoBytes temporary_channel_id_ref; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data); LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); + LDKChannelTypeFeatures channel_type_conv; + channel_type_conv.inner = (void*)(channel_type & (~1)); + channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv); + channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat); + *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv); int64_t ret_ref = (uintptr_t)ret_copy; return ret_ref; } @@ -23444,6 +23786,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1rep return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) { + LDKPublicKey node_id_ref; + CHECK((*env)->GetArrayLength(env, node_id) == 33); + (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); + LDKGossipTimestampFilter msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); + msg_conv = GossipTimestampFilter_clone(&msg_conv); + LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); + *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -23877,8 +24234,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1o ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) { - LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelHandshakeConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKChannelHandshakeConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, jboolean negotiate_scid_privacy_arg) { + LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, negotiate_scid_privacy_arg); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -27850,6 +28224,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv); + int64_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + ChannelDetails_set_channel_type(&this_ptr_conv, val_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -27873,6 +28279,29 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1ch ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + void* val_ptr = (void*)(((uintptr_t)val) & ~1); + CHECK_ACCESS(val_ptr); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); + ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -28095,7 +28524,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1publi ChannelDetails_set_is_public(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); @@ -28109,10 +28538,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv); funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv); + LDKChannelTypeFeatures channel_type_arg_conv; + channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1)); + channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv); + channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv); void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1); CHECK_ACCESS(short_channel_id_arg_ptr); LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr); short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1)); + void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1); + CHECK_ACCESS(inbound_scid_alias_arg_ptr); + LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr); + inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1)); void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1); CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr); LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr); @@ -28124,7 +28562,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv CHECK_ACCESS(force_close_spend_delay_arg_ptr); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1)); - LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -28174,6 +28612,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEn return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelDetails this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -28817,7 +29266,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t user_channel_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -28827,7 +29276,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref); + *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, user_channel_id); return (int64_t)ret_conv; } @@ -29450,13 +29899,39 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *en Init_set_features(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = Init_get_remote_network_address(&this_ptr_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + void* val_ptr = (void*)(((uintptr_t)val) & ~1); + CHECK_ACCESS(val_ptr); + LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr); + val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1)); + Init_set_remote_network_address(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t remote_network_address_arg) { LDKInitFeatures features_arg_conv; features_arg_conv.inner = (void*)(features_arg & (~1)); features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv); features_arg_conv = InitFeatures_clone(&features_arg_conv); - LDKInit ret_var = Init_new(features_arg_conv); + void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1); + CHECK_ACCESS(remote_network_address_arg_ptr); + LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr); + LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -30948,14 +31423,41 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_ FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKFundingLocked this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = FundingLocked_get_short_channel_id_alias(&this_ptr_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKFundingLocked this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + void* val_ptr = (void*)(((uintptr_t)val) & ~1); + CHECK_ACCESS(val_ptr); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); + FundingLocked_set_short_channel_id_alias(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKPublicKey next_per_commitment_point_arg_ref; CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33); (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form); - LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref); + void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1); + CHECK_ACCESS(short_channel_id_alias_arg_ptr); + LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr); + short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1)); + LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -35958,7 +36460,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor, int64_t remote_network_address) { LDKPeerManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -35973,12 +36475,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_ // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKSocketDescriptor_JCalls_cloned(&descriptor_conv); } + void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1); + CHECK_ACCESS(remote_network_address_ptr); + LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr); LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); - *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv); + *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor, int64_t remote_network_address) { LDKPeerManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -35990,8 +36495,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1 // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKSocketDescriptor_JCalls_cloned(&descriptor_conv); } + void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1); + CHECK_ACCESS(remote_network_address_ptr); + LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr); LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); - *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv); + *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv); return (int64_t)ret_conv; } @@ -42278,7 +42786,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv * return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer, int8_tArray random_seed_bytes) { LDKPublicKey our_node_pubkey_ref; CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33); (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form); @@ -42320,8 +42828,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1); if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; + unsigned char random_seed_bytes_arr[32]; + CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); + (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr); + unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv); + *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (int64_t)ret_conv; } @@ -42418,28 +42930,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(J return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKFixedPenaltyScorer obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = FixedPenaltyScorer_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_FixedPenaltyScorer_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_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); - *ret_conv = FixedPenaltyScorer_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (int64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) { LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat); int64_t ret_ref = 0; @@ -42463,6 +42953,28 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Sco return (int64_t)ret_ret; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKFixedPenaltyScorer obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = FixedPenaltyScorer_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_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = FixedPenaltyScorer_read(ser_ref, arg); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (int64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -42729,6 +43241,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_free(this_obj_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -42763,8 +43292,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg) { - LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg, int64_t amount_penalty_multiplier_msat_arg) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -42814,28 +43360,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParamet return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKProbabilisticScoringParameters obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_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_ProbabilisticScoringParameters_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_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = ProbabilisticScoringParameters_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (int64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph) { LDKProbabilisticScoringParameters params_conv; params_conv.inner = (void*)(params & (~1)); @@ -42893,16 +43417,21 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1wr return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - void* arg_ptr = (void*)(((uintptr_t)arg) & ~1); - CHECK_ACCESS(arg_ptr); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg_ptr); - arg_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone((LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(((uintptr_t)arg) & ~1)); + LDKProbabilisticScoringParameters arg_a_conv; + arg_a_conv.inner = (void*)(arg_a & (~1)); + arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv); + arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv); + LDKNetworkGraph arg_b_conv; + arg_b_conv.inner = (void*)(arg_b & (~1)); + arg_b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv); LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); - *ret_conv = ProbabilisticScorer_read(ser_ref, arg_conv); + *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (int64_t)ret_conv; } @@ -42951,6 +43480,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persis return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1network_1graph(JNIEnv *env, jclass clz, jstring data_dir, int64_t network_graph) { + LDKStr data_dir_conv = java_to_owned_str(env, data_dir); + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); + LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); + *ret_conv = FilesystemPersister_persist_network_graph(data_dir_conv, &network_graph_conv); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) { LDKFilesystemPersister this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -42986,22 +43526,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIE BackgroundProcessor_free(this_obj_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); CHECK_ACCESS(this_ptr_ptr); - LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr); + LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr); FREE((void*)this_ptr); - ChannelManagerPersister_free(this_ptr_conv); + Persister_free(this_ptr_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t net_graph_msg_handler, int64_t peer_manager, int64_t logger) { void* persister_ptr = (void*)(((uintptr_t)persister) & ~1); CHECK_ACCESS(persister_ptr); - LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr); - if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) { + LDKPersister persister_conv = *(LDKPersister*)(persister_ptr); + if (persister_conv.free == LDKPersister_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKChannelManagerPersister_JCalls_cloned(&persister_conv); + LDKPersister_JCalls_cloned(&persister_conv); } void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1); CHECK_ACCESS(event_handler_ptr); @@ -43067,6 +43607,217 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(J return (int64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr); + FREE((void*)this_ptr); + ParseError_free(this_ptr_conv); +} + +static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKParseError* arg_conv = (LDKParseError*)arg; + int64_t ret_val = ParseError_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKParseError* orig_conv = (LDKParseError*)orig; + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = (void*)(((uintptr_t)a) & ~1); + CHECK_ACCESS(a_ptr); + LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr); + a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1)); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_bech32_error(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) { + + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 }); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) { + LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_malformed_signature(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_bad_prefix(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_unknown_currency(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_unknown_si_prefix(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_malformed_hrp(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_too_short_data_part(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_unexpected_end_of_tagged_fields(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) { + + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 }); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_padding_error(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_integer_overflow_error(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_seg_wit_program_length(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_pub_key_hash_length(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_script_hash_length(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_recovery_id(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) { + LDKStr a_conv = java_to_owned_str(env, a); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_slice_length(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_skip(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr); + FREE((void*)this_ptr); + ParseOrSemanticError_free(this_ptr_conv); +} + +static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) { + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg; + int64_t ret_val = ParseOrSemanticError_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig; + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = (void*)(((uintptr_t)a) & ~1); + CHECK_ACCESS(a_ptr); + LDKParseError a_conv = *(LDKParseError*)(a_ptr); + a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1)); + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_parse_error(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) { + LDKSemanticError a_conv = LDKSemanticError_from_java(env, a); + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_semantic_error(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKInvoice this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -45265,6 +46016,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JN return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t description_hash, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) { + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKSha256 description_hash_conv; + description_hash_conv.inner = (void*)(description_hash & (~1)); + description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); + description_hash_conv = Sha256_clone(&description_hash_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + CHECK((*env)->GetArrayLength(env, payment_secret) == 32); + (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); + LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr; + phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints); + if (phantom_route_hints_constr.datalen > 0) + phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + phantom_route_hints_constr.data = NULL; + int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL); + for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) { + int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t]; + LDKPhantomRouteHints phantom_route_hints_conv_19_conv; + phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1)); + phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv); + phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv); + phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; + } + (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, description_hash_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = (void*)(channelmanager & (~1)); @@ -45288,6 +46085,60 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash) { + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = (void*)(channelmanager & (~1)); + channelmanager_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKSha256 description_hash_conv; + description_hash_conv.inner = (void*)(description_hash & (~1)); + description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); + description_hash_conv = Sha256_clone(&description_hash_conv); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch) { + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = (void*)(channelmanager & (~1)); + channelmanager_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKSha256 description_hash_conv; + description_hash_conv.inner = (void*)(description_hash & (~1)); + description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); + description_hash_conv = Sha256_clone(&description_hash_conv); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = (void*)(channelmanager & (~1)); @@ -45319,7 +46170,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *en DefaultRouter_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) { LDKNetworkGraph network_graph_conv; network_graph_conv.inner = (void*)(network_graph & (~1)); network_graph_conv.is_owned = false; @@ -45331,7 +46182,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv * // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv); + LDKThirtyTwoBytes random_seed_bytes_ref; + CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); + (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data); + LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -45365,25 +46219,41 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(J JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); *ret_conv = SiPrefix_from_str(s_conv); return (int64_t)ret_conv; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); *ret_conv = Invoice_from_str(s_conv); return (int64_t)ret_conv; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); *ret_conv = SignedRawInvoice_from_str(s_conv); return (int64_t)ret_conv; } +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) { + LDKParseError* o_conv = (LDKParseError*)o; + LDKStr ret_str = ParseError_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 jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) { + LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o; + LDKStr ret_str = ParseOrSemanticError_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 jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) { LDKInvoice o_conv; o_conv.inner = (void*)(o & (~1)); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index b70fd676..3e50ec65 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -871,6 +871,84 @@ static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) { } } +static jclass LDKBech32Error_MissingSeparator_class = NULL; +static jmethodID LDKBech32Error_MissingSeparator_meth = NULL; +static jclass LDKBech32Error_InvalidChecksum_class = NULL; +static jmethodID LDKBech32Error_InvalidChecksum_meth = NULL; +static jclass LDKBech32Error_InvalidLength_class = NULL; +static jmethodID LDKBech32Error_InvalidLength_meth = NULL; +static jclass LDKBech32Error_InvalidChar_class = NULL; +static jmethodID LDKBech32Error_InvalidChar_meth = NULL; +static jclass LDKBech32Error_InvalidData_class = NULL; +static jmethodID LDKBech32Error_InvalidData_meth = NULL; +static jclass LDKBech32Error_InvalidPadding_class = NULL; +static jmethodID LDKBech32Error_InvalidPadding_meth = NULL; +static jclass LDKBech32Error_MixedCase_class = NULL; +static jmethodID LDKBech32Error_MixedCase_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBech32Error_init (JNIEnv *env, jclass clz) { + LDKBech32Error_MissingSeparator_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MissingSeparator")); + CHECK(LDKBech32Error_MissingSeparator_class != NULL); + LDKBech32Error_MissingSeparator_meth = (*env)->GetMethodID(env, LDKBech32Error_MissingSeparator_class, "", "()V"); + CHECK(LDKBech32Error_MissingSeparator_meth != NULL); + LDKBech32Error_InvalidChecksum_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChecksum")); + CHECK(LDKBech32Error_InvalidChecksum_class != NULL); + LDKBech32Error_InvalidChecksum_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChecksum_class, "", "()V"); + CHECK(LDKBech32Error_InvalidChecksum_meth != NULL); + LDKBech32Error_InvalidLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidLength")); + CHECK(LDKBech32Error_InvalidLength_class != NULL); + LDKBech32Error_InvalidLength_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidLength_class, "", "()V"); + CHECK(LDKBech32Error_InvalidLength_meth != NULL); + LDKBech32Error_InvalidChar_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidChar")); + CHECK(LDKBech32Error_InvalidChar_class != NULL); + LDKBech32Error_InvalidChar_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidChar_class, "", "(I)V"); + CHECK(LDKBech32Error_InvalidChar_meth != NULL); + LDKBech32Error_InvalidData_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidData")); + CHECK(LDKBech32Error_InvalidData_class != NULL); + LDKBech32Error_InvalidData_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidData_class, "", "(B)V"); + CHECK(LDKBech32Error_InvalidData_meth != NULL); + LDKBech32Error_InvalidPadding_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$InvalidPadding")); + CHECK(LDKBech32Error_InvalidPadding_class != NULL); + LDKBech32Error_InvalidPadding_meth = (*env)->GetMethodID(env, LDKBech32Error_InvalidPadding_class, "", "()V"); + CHECK(LDKBech32Error_InvalidPadding_meth != NULL); + LDKBech32Error_MixedCase_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBech32Error$MixedCase")); + CHECK(LDKBech32Error_MixedCase_class != NULL); + LDKBech32Error_MixedCase_meth = (*env)->GetMethodID(env, LDKBech32Error_MixedCase_class, "", "()V"); + CHECK(LDKBech32Error_MixedCase_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKBech32Error *obj = (LDKBech32Error*)(ptr & ~1); + switch(obj->tag) { + case LDKBech32Error_MissingSeparator: { + return (*env)->NewObject(env, LDKBech32Error_MissingSeparator_class, LDKBech32Error_MissingSeparator_meth); + } + case LDKBech32Error_InvalidChecksum: { + return (*env)->NewObject(env, LDKBech32Error_InvalidChecksum_class, LDKBech32Error_InvalidChecksum_meth); + } + case LDKBech32Error_InvalidLength: { + return (*env)->NewObject(env, LDKBech32Error_InvalidLength_class, LDKBech32Error_InvalidLength_meth); + } + case LDKBech32Error_InvalidChar: { + return (*env)->NewObject(env, LDKBech32Error_InvalidChar_class, LDKBech32Error_InvalidChar_meth, obj->invalid_char); + } + case LDKBech32Error_InvalidData: { + return (*env)->NewObject(env, LDKBech32Error_InvalidData_class, LDKBech32Error_InvalidData_meth, obj->invalid_data); + } + case LDKBech32Error_InvalidPadding: { + return (*env)->NewObject(env, LDKBech32Error_InvalidPadding_class, LDKBech32Error_InvalidPadding_meth); + } + case LDKBech32Error_MixedCase: { + return (*env)->NewObject(env, LDKBech32Error_MixedCase_class, LDKBech32Error_MixedCase_meth); + } + default: abort(); + } +} static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) { LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen }; memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen); @@ -2404,7 +2482,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_OpenChannelRequest_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$OpenChannelRequest")); CHECK(LDKEvent_OpenChannelRequest_class != NULL); - LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJ)V"); + LDKEvent_OpenChannelRequest_meth = (*env)->GetMethodID(env, LDKEvent_OpenChannelRequest_class, "", "([B[BJJJ)V"); CHECK(LDKEvent_OpenChannelRequest_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { @@ -2531,7 +2609,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->open_channel_request.temporary_channel_id.data); int8_tArray counterparty_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, counterparty_node_id_arr, 0, 33, obj->open_channel_request.counterparty_node_id.compressed_form); - return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat); + LDKChannelTypeFeatures channel_type_var = obj->open_channel_request.channel_type; + int64_t channel_type_ref = 0; + CHECK((((uintptr_t)channel_type_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&channel_type_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var); + channel_type_ref = (uintptr_t)channel_type_var.inner & ~1; + return (*env)->NewObject(env, LDKEvent_OpenChannelRequest_class, LDKEvent_OpenChannelRequest_meth, temporary_channel_id_arr, counterparty_node_id_arr, obj->open_channel_request.funding_satoshis, obj->open_channel_request.push_msat, channel_type_ref); } default: abort(); } @@ -2723,6 +2807,8 @@ static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL; static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL; static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL; static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL; +static jclass LDKMessageSendEvent_SendGossipTimestampFilter_class = NULL; +static jmethodID LDKMessageSendEvent_SendGossipTimestampFilter_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) { LDKMessageSendEvent_SendAcceptChannel_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel")); @@ -2819,6 +2905,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL); LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL); + LDKMessageSendEvent_SendGossipTimestampFilter_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendGossipTimestampFilter")); + CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_class != NULL); + LDKMessageSendEvent_SendGossipTimestampFilter_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, "", "([BJ)V"); + CHECK(LDKMessageSendEvent_SendGossipTimestampFilter_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1); @@ -3027,6 +3118,17 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f msg_ref = (uintptr_t)msg_var.inner & ~1; return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref); } + case LDKMessageSendEvent_SendGossipTimestampFilter: { + int8_tArray node_id_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_gossip_timestamp_filter.node_id.compressed_form); + LDKGossipTimestampFilter msg_var = obj->send_gossip_timestamp_filter.msg; + int64_t msg_ref = 0; + CHECK((((uintptr_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = (uintptr_t)msg_var.inner & ~1; + return (*env)->NewObject(env, LDKMessageSendEvent_SendGossipTimestampFilter_class, LDKMessageSendEvent_SendGossipTimestampFilter_meth, node_id_arr, msg_ref); + } default: abort(); } } @@ -3142,76 +3244,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ return ret_ref; } -static inline struct LDKProbabilisticScoringParameters CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return ProbabilisticScoringParameters_clone(&*owner->contents.result); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); - LDKProbabilisticScoringParameters ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline struct LDKDecodeError CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* owner_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(owner & ~1); - LDKDecodeError ret_var = CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline struct LDKProbabilisticScoringParameters C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ - return ProbabilisticScoringParameters_clone(&owner->a); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1a(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); - LDKProbabilisticScoringParameters ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline struct LDKNetworkGraph C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR owner){ - return NetworkGraph_clone(&owner->b); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1b(JNIEnv *env, jclass clz, int64_t owner) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* owner_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(owner & ~1); - LDKNetworkGraph ret_var = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b(owner_conv); - int64_t ret_ref = 0; - CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uintptr_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - static inline struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return &*owner->contents.result; @@ -6716,32 +6748,259 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentEr return ret_ref; } -static inline enum LDKSiPrefix CResult_SiPrefixNoneZ_get_ok(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){ +static jclass LDKParseError_Bech32Error_class = NULL; +static jmethodID LDKParseError_Bech32Error_meth = NULL; +static jclass LDKParseError_ParseAmountError_class = NULL; +static jmethodID LDKParseError_ParseAmountError_meth = NULL; +static jclass LDKParseError_MalformedSignature_class = NULL; +static jmethodID LDKParseError_MalformedSignature_meth = NULL; +static jclass LDKParseError_BadPrefix_class = NULL; +static jmethodID LDKParseError_BadPrefix_meth = NULL; +static jclass LDKParseError_UnknownCurrency_class = NULL; +static jmethodID LDKParseError_UnknownCurrency_meth = NULL; +static jclass LDKParseError_UnknownSiPrefix_class = NULL; +static jmethodID LDKParseError_UnknownSiPrefix_meth = NULL; +static jclass LDKParseError_MalformedHRP_class = NULL; +static jmethodID LDKParseError_MalformedHRP_meth = NULL; +static jclass LDKParseError_TooShortDataPart_class = NULL; +static jmethodID LDKParseError_TooShortDataPart_meth = NULL; +static jclass LDKParseError_UnexpectedEndOfTaggedFields_class = NULL; +static jmethodID LDKParseError_UnexpectedEndOfTaggedFields_meth = NULL; +static jclass LDKParseError_DescriptionDecodeError_class = NULL; +static jmethodID LDKParseError_DescriptionDecodeError_meth = NULL; +static jclass LDKParseError_PaddingError_class = NULL; +static jmethodID LDKParseError_PaddingError_meth = NULL; +static jclass LDKParseError_IntegerOverflowError_class = NULL; +static jmethodID LDKParseError_IntegerOverflowError_meth = NULL; +static jclass LDKParseError_InvalidSegWitProgramLength_class = NULL; +static jmethodID LDKParseError_InvalidSegWitProgramLength_meth = NULL; +static jclass LDKParseError_InvalidPubKeyHashLength_class = NULL; +static jmethodID LDKParseError_InvalidPubKeyHashLength_meth = NULL; +static jclass LDKParseError_InvalidScriptHashLength_class = NULL; +static jmethodID LDKParseError_InvalidScriptHashLength_meth = NULL; +static jclass LDKParseError_InvalidRecoveryId_class = NULL; +static jmethodID LDKParseError_InvalidRecoveryId_meth = NULL; +static jclass LDKParseError_InvalidSliceLength_class = NULL; +static jmethodID LDKParseError_InvalidSliceLength_meth = NULL; +static jclass LDKParseError_Skip_class = NULL; +static jmethodID LDKParseError_Skip_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseError_init (JNIEnv *env, jclass clz) { + LDKParseError_Bech32Error_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Bech32Error")); + CHECK(LDKParseError_Bech32Error_class != NULL); + LDKParseError_Bech32Error_meth = (*env)->GetMethodID(env, LDKParseError_Bech32Error_class, "", "(J)V"); + CHECK(LDKParseError_Bech32Error_meth != NULL); + LDKParseError_ParseAmountError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$ParseAmountError")); + CHECK(LDKParseError_ParseAmountError_class != NULL); + LDKParseError_ParseAmountError_meth = (*env)->GetMethodID(env, LDKParseError_ParseAmountError_class, "", "(I)V"); + CHECK(LDKParseError_ParseAmountError_meth != NULL); + LDKParseError_MalformedSignature_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedSignature")); + CHECK(LDKParseError_MalformedSignature_class != NULL); + LDKParseError_MalformedSignature_meth = (*env)->GetMethodID(env, LDKParseError_MalformedSignature_class, "", "(Lorg/ldk/enums/Secp256k1Error;)V"); + CHECK(LDKParseError_MalformedSignature_meth != NULL); + LDKParseError_BadPrefix_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$BadPrefix")); + CHECK(LDKParseError_BadPrefix_class != NULL); + LDKParseError_BadPrefix_meth = (*env)->GetMethodID(env, LDKParseError_BadPrefix_class, "", "()V"); + CHECK(LDKParseError_BadPrefix_meth != NULL); + LDKParseError_UnknownCurrency_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownCurrency")); + CHECK(LDKParseError_UnknownCurrency_class != NULL); + LDKParseError_UnknownCurrency_meth = (*env)->GetMethodID(env, LDKParseError_UnknownCurrency_class, "", "()V"); + CHECK(LDKParseError_UnknownCurrency_meth != NULL); + LDKParseError_UnknownSiPrefix_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnknownSiPrefix")); + CHECK(LDKParseError_UnknownSiPrefix_class != NULL); + LDKParseError_UnknownSiPrefix_meth = (*env)->GetMethodID(env, LDKParseError_UnknownSiPrefix_class, "", "()V"); + CHECK(LDKParseError_UnknownSiPrefix_meth != NULL); + LDKParseError_MalformedHRP_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$MalformedHRP")); + CHECK(LDKParseError_MalformedHRP_class != NULL); + LDKParseError_MalformedHRP_meth = (*env)->GetMethodID(env, LDKParseError_MalformedHRP_class, "", "()V"); + CHECK(LDKParseError_MalformedHRP_meth != NULL); + LDKParseError_TooShortDataPart_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$TooShortDataPart")); + CHECK(LDKParseError_TooShortDataPart_class != NULL); + LDKParseError_TooShortDataPart_meth = (*env)->GetMethodID(env, LDKParseError_TooShortDataPart_class, "", "()V"); + CHECK(LDKParseError_TooShortDataPart_meth != NULL); + LDKParseError_UnexpectedEndOfTaggedFields_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$UnexpectedEndOfTaggedFields")); + CHECK(LDKParseError_UnexpectedEndOfTaggedFields_class != NULL); + LDKParseError_UnexpectedEndOfTaggedFields_meth = (*env)->GetMethodID(env, LDKParseError_UnexpectedEndOfTaggedFields_class, "", "()V"); + CHECK(LDKParseError_UnexpectedEndOfTaggedFields_meth != NULL); + LDKParseError_DescriptionDecodeError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$DescriptionDecodeError")); + CHECK(LDKParseError_DescriptionDecodeError_class != NULL); + LDKParseError_DescriptionDecodeError_meth = (*env)->GetMethodID(env, LDKParseError_DescriptionDecodeError_class, "", "(I)V"); + CHECK(LDKParseError_DescriptionDecodeError_meth != NULL); + LDKParseError_PaddingError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$PaddingError")); + CHECK(LDKParseError_PaddingError_class != NULL); + LDKParseError_PaddingError_meth = (*env)->GetMethodID(env, LDKParseError_PaddingError_class, "", "()V"); + CHECK(LDKParseError_PaddingError_meth != NULL); + LDKParseError_IntegerOverflowError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$IntegerOverflowError")); + CHECK(LDKParseError_IntegerOverflowError_class != NULL); + LDKParseError_IntegerOverflowError_meth = (*env)->GetMethodID(env, LDKParseError_IntegerOverflowError_class, "", "()V"); + CHECK(LDKParseError_IntegerOverflowError_meth != NULL); + LDKParseError_InvalidSegWitProgramLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSegWitProgramLength")); + CHECK(LDKParseError_InvalidSegWitProgramLength_class != NULL); + LDKParseError_InvalidSegWitProgramLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSegWitProgramLength_class, "", "()V"); + CHECK(LDKParseError_InvalidSegWitProgramLength_meth != NULL); + LDKParseError_InvalidPubKeyHashLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidPubKeyHashLength")); + CHECK(LDKParseError_InvalidPubKeyHashLength_class != NULL); + LDKParseError_InvalidPubKeyHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidPubKeyHashLength_class, "", "()V"); + CHECK(LDKParseError_InvalidPubKeyHashLength_meth != NULL); + LDKParseError_InvalidScriptHashLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidScriptHashLength")); + CHECK(LDKParseError_InvalidScriptHashLength_class != NULL); + LDKParseError_InvalidScriptHashLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidScriptHashLength_class, "", "()V"); + CHECK(LDKParseError_InvalidScriptHashLength_meth != NULL); + LDKParseError_InvalidRecoveryId_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidRecoveryId")); + CHECK(LDKParseError_InvalidRecoveryId_class != NULL); + LDKParseError_InvalidRecoveryId_meth = (*env)->GetMethodID(env, LDKParseError_InvalidRecoveryId_class, "", "()V"); + CHECK(LDKParseError_InvalidRecoveryId_meth != NULL); + LDKParseError_InvalidSliceLength_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$InvalidSliceLength")); + CHECK(LDKParseError_InvalidSliceLength_class != NULL); + LDKParseError_InvalidSliceLength_meth = (*env)->GetMethodID(env, LDKParseError_InvalidSliceLength_class, "", "(Ljava/lang/String;)V"); + CHECK(LDKParseError_InvalidSliceLength_meth != NULL); + LDKParseError_Skip_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseError$Skip")); + CHECK(LDKParseError_Skip_class != NULL); + LDKParseError_Skip_meth = (*env)->GetMethodID(env, LDKParseError_Skip_class, "", "()V"); + CHECK(LDKParseError_Skip_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKParseError *obj = (LDKParseError*)(ptr & ~1); + switch(obj->tag) { + case LDKParseError_Bech32Error: { + int64_t bech32_error_ref = ((uintptr_t)&obj->bech32_error) | 1; + return (*env)->NewObject(env, LDKParseError_Bech32Error_class, LDKParseError_Bech32Error_meth, bech32_error_ref); + } + case LDKParseError_ParseAmountError: { + /*obj->parse_amount_error*/ + return (*env)->NewObject(env, LDKParseError_ParseAmountError_class, LDKParseError_ParseAmountError_meth, 0); + } + case LDKParseError_MalformedSignature: { + jclass malformed_signature_conv = LDKSecp256k1Error_to_java(env, obj->malformed_signature); + return (*env)->NewObject(env, LDKParseError_MalformedSignature_class, LDKParseError_MalformedSignature_meth, malformed_signature_conv); + } + case LDKParseError_BadPrefix: { + return (*env)->NewObject(env, LDKParseError_BadPrefix_class, LDKParseError_BadPrefix_meth); + } + case LDKParseError_UnknownCurrency: { + return (*env)->NewObject(env, LDKParseError_UnknownCurrency_class, LDKParseError_UnknownCurrency_meth); + } + case LDKParseError_UnknownSiPrefix: { + return (*env)->NewObject(env, LDKParseError_UnknownSiPrefix_class, LDKParseError_UnknownSiPrefix_meth); + } + case LDKParseError_MalformedHRP: { + return (*env)->NewObject(env, LDKParseError_MalformedHRP_class, LDKParseError_MalformedHRP_meth); + } + case LDKParseError_TooShortDataPart: { + return (*env)->NewObject(env, LDKParseError_TooShortDataPart_class, LDKParseError_TooShortDataPart_meth); + } + case LDKParseError_UnexpectedEndOfTaggedFields: { + return (*env)->NewObject(env, LDKParseError_UnexpectedEndOfTaggedFields_class, LDKParseError_UnexpectedEndOfTaggedFields_meth); + } + case LDKParseError_DescriptionDecodeError: { + /*obj->description_decode_error*/ + return (*env)->NewObject(env, LDKParseError_DescriptionDecodeError_class, LDKParseError_DescriptionDecodeError_meth, 0); + } + case LDKParseError_PaddingError: { + return (*env)->NewObject(env, LDKParseError_PaddingError_class, LDKParseError_PaddingError_meth); + } + case LDKParseError_IntegerOverflowError: { + return (*env)->NewObject(env, LDKParseError_IntegerOverflowError_class, LDKParseError_IntegerOverflowError_meth); + } + case LDKParseError_InvalidSegWitProgramLength: { + return (*env)->NewObject(env, LDKParseError_InvalidSegWitProgramLength_class, LDKParseError_InvalidSegWitProgramLength_meth); + } + case LDKParseError_InvalidPubKeyHashLength: { + return (*env)->NewObject(env, LDKParseError_InvalidPubKeyHashLength_class, LDKParseError_InvalidPubKeyHashLength_meth); + } + case LDKParseError_InvalidScriptHashLength: { + return (*env)->NewObject(env, LDKParseError_InvalidScriptHashLength_class, LDKParseError_InvalidScriptHashLength_meth); + } + case LDKParseError_InvalidRecoveryId: { + return (*env)->NewObject(env, LDKParseError_InvalidRecoveryId_class, LDKParseError_InvalidRecoveryId_meth); + } + case LDKParseError_InvalidSliceLength: { + LDKStr invalid_slice_length_str = obj->invalid_slice_length; + jstring invalid_slice_length_conv = str_ref_to_java(env, invalid_slice_length_str.chars, invalid_slice_length_str.len); + return (*env)->NewObject(env, LDKParseError_InvalidSliceLength_class, LDKParseError_InvalidSliceLength_meth, invalid_slice_length_conv); + } + case LDKParseError_Skip: { + return (*env)->NewObject(env, LDKParseError_Skip_class, LDKParseError_Skip_meth); + } + default: abort(); + } +} +static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return SiPrefix_clone(&*owner->contents.result); } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1); - jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixNoneZ_get_ok(owner_conv)); +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1); + jclass ret_conv = LDKSiPrefix_to_java(env, CResult_SiPrefixParseErrorZ_get_ok(owner_conv)); return ret_conv; } -static inline void CResult_SiPrefixNoneZ_get_err(LDKCResult_SiPrefixNoneZ *NONNULL_PTR owner){ +static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return *owner->contents.err; + return ParseError_clone(&*owner->contents.err); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SiPrefixNoneZ* owner_conv = (LDKCResult_SiPrefixNoneZ*)(owner & ~1); - CResult_SiPrefixNoneZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)(owner & ~1); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; } -static inline struct LDKInvoice CResult_InvoiceNoneZ_get_ok(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){ +static jclass LDKParseOrSemanticError_ParseError_class = NULL; +static jmethodID LDKParseOrSemanticError_ParseError_meth = NULL; +static jclass LDKParseOrSemanticError_SemanticError_class = NULL; +static jmethodID LDKParseOrSemanticError_SemanticError_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKParseOrSemanticError_init (JNIEnv *env, jclass clz) { + LDKParseOrSemanticError_ParseError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$ParseError")); + CHECK(LDKParseOrSemanticError_ParseError_class != NULL); + LDKParseOrSemanticError_ParseError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_ParseError_class, "", "(J)V"); + CHECK(LDKParseOrSemanticError_ParseError_meth != NULL); + LDKParseOrSemanticError_SemanticError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKParseOrSemanticError$SemanticError")); + CHECK(LDKParseOrSemanticError_SemanticError_class != NULL); + LDKParseOrSemanticError_SemanticError_meth = (*env)->GetMethodID(env, LDKParseOrSemanticError_SemanticError_class, "", "(Lorg/ldk/enums/SemanticError;)V"); + CHECK(LDKParseOrSemanticError_SemanticError_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)(ptr & ~1); + switch(obj->tag) { + case LDKParseOrSemanticError_ParseError: { + int64_t parse_error_ref = ((uintptr_t)&obj->parse_error) | 1; + return (*env)->NewObject(env, LDKParseOrSemanticError_ParseError_class, LDKParseOrSemanticError_ParseError_meth, parse_error_ref); + } + case LDKParseOrSemanticError_SemanticError: { + jclass semantic_error_conv = LDKSemanticError_to_java(env, obj->semantic_error); + return (*env)->NewObject(env, LDKParseOrSemanticError_SemanticError_class, LDKParseOrSemanticError_SemanticError_meth, semantic_error_conv); + } + default: abort(); + } +} +static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return Invoice_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1); - LDKInvoice ret_var = CResult_InvoiceNoneZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1); + LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -6753,22 +7012,25 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_ return ret_ref; } -static inline void CResult_InvoiceNoneZ_get_err(LDKCResult_InvoiceNoneZ *NONNULL_PTR owner){ +static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return *owner->contents.err; + return ParseOrSemanticError_clone(&*owner->contents.err); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_InvoiceNoneZ* owner_conv = (LDKCResult_InvoiceNoneZ*)(owner & ~1); - CResult_InvoiceNoneZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(owner & ~1); + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; } -static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceNoneZ_get_ok(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){ +static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return SignedRawInvoice_clone(&*owner->contents.result); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1); - LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceNoneZ_get_ok(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1); + LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -6780,13 +7042,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNo return ret_ref; } -static inline void CResult_SignedRawInvoiceNoneZ_get_err(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR owner){ +static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return *owner->contents.err; + return ParseError_clone(&*owner->contents.err); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { - LDKCResult_SignedRawInvoiceNoneZ* owner_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(owner & ~1); - CResult_SignedRawInvoiceNoneZ_get_err(owner_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t owner) { + LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(owner & ~1); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; } static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ @@ -7544,6 +7809,35 @@ static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCV } return ret; } +static jclass LDKCOption_NetAddressZ_Some_class = NULL; +static jmethodID LDKCOption_NetAddressZ_Some_meth = NULL; +static jclass LDKCOption_NetAddressZ_None_class = NULL; +static jmethodID LDKCOption_NetAddressZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetAddressZ_init (JNIEnv *env, jclass clz) { + LDKCOption_NetAddressZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$Some")); + CHECK(LDKCOption_NetAddressZ_Some_class != NULL); + LDKCOption_NetAddressZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_Some_class, "", "(J)V"); + CHECK(LDKCOption_NetAddressZ_Some_meth != NULL); + LDKCOption_NetAddressZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetAddressZ$None")); + CHECK(LDKCOption_NetAddressZ_None_class != NULL); + LDKCOption_NetAddressZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetAddressZ_None_class, "", "()V"); + CHECK(LDKCOption_NetAddressZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_NetAddressZ *obj = (LDKCOption_NetAddressZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_NetAddressZ_Some: { + int64_t some_ref = ((uintptr_t)&obj->some) | 1; + return (*env)->NewObject(env, LDKCOption_NetAddressZ_Some_class, LDKCOption_NetAddressZ_Some_meth, some_ref); + } + case LDKCOption_NetAddressZ_None: { + return (*env)->NewObject(env, LDKCOption_NetAddressZ_None_class, LDKCOption_NetAddressZ_None_meth); + } + default: abort(); + } +} static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return CVec_u8Z_clone(&*owner->contents.result); @@ -11540,7 +11834,7 @@ typedef struct LDKRoutingMessageHandler_JCalls { jmethodID handle_channel_update_meth; jmethodID get_next_channel_announcements_meth; jmethodID get_next_node_announcements_meth; - jmethodID sync_routing_table_meth; + jmethodID peer_connected_meth; jmethodID handle_reply_channel_range_meth; jmethodID handle_reply_short_channel_ids_end_meth; jmethodID handle_query_channel_range_meth; @@ -11744,7 +12038,7 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_j } return ret_constr; } -void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +void peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -11767,10 +12061,10 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref); + (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, init_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception."); + (*env)->FatalError(env, "A call to peer_connected in LDKRoutingMessageHandler from rust threw an exception."); } if (get_jenv_res == JNI_EDETACHED) { DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); @@ -11942,8 +12236,8 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en CHECK(calls->get_next_channel_announcements_meth != NULL); calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J"); CHECK(calls->get_next_node_announcements_meth != NULL); - calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V"); - CHECK(calls->sync_routing_table_meth != NULL); + calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V"); + CHECK(calls->peer_connected_meth != NULL); calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J"); CHECK(calls->handle_reply_channel_range_meth != NULL); calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J"); @@ -11960,7 +12254,7 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *en .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall, .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall, .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall, - .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall, + .peer_connected = peer_connected_LDKRoutingMessageHandler_jcall, .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall, .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall, .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall, @@ -12067,7 +12361,7 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_ return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; @@ -12078,7 +12372,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1r init_conv.inner = (void*)(init & (~1)); init_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); - (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { @@ -13005,14 +13299,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv return (int64_t)ret_ret; } -typedef struct LDKChannelManagerPersister_JCalls { +typedef struct LDKPersister_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; jmethodID persist_manager_meth; -} LDKChannelManagerPersister_JCalls; -static void LDKChannelManagerPersister_JCalls_free(void* this_arg) { - LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg; + jmethodID persist_graph_meth; +} LDKPersister_JCalls; +static void LDKPersister_JCalls_free(void* this_arg) { + LDKPersister_JCalls *j_calls = (LDKPersister_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); @@ -13028,8 +13323,8 @@ static void LDKChannelManagerPersister_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) { - LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg; +LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) { + LDKPersister_JCalls *j_calls = (LDKPersister_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) { @@ -13052,7 +13347,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref); if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); - (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception."); + (*env)->FatalError(env, "A call to persist_manager in LDKPersister from rust threw an exception."); } void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); CHECK_ACCESS(ret_ptr); @@ -13063,36 +13358,74 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi } return ret_conv; } -static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) { - LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg; +LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, const LDKNetworkGraph * network_graph) { + LDKPersister_JCalls *j_calls = (LDKPersister_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); + } + LDKNetworkGraph network_graph_var = *network_graph; + int64_t network_graph_ref = 0; + network_graph_var = NetworkGraph_clone(&network_graph_var); + CHECK((((uintptr_t)network_graph_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&network_graph_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var); + network_graph_ref = (uintptr_t)network_graph_var.inner; + if (network_graph_var.is_owned) { + network_graph_ref |= 1; + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_graph_meth, network_graph_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to persist_graph in LDKPersister from rust threw an exception."); + } + void* ret_ptr = (void*)(((uintptr_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr); + FREE((void*)ret); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +static void LDKPersister_JCalls_cloned(LDKPersister* new_obj) { + LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) { +static inline LDKPersister LDKPersister_init (JNIEnv *env, jclass clz, jobject o) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls"); + LDKPersister_JCalls *calls = MALLOC(sizeof(LDKPersister_JCalls), "LDKPersister_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J"); CHECK(calls->persist_manager_meth != NULL); + calls->persist_graph_meth = (*env)->GetMethodID(env, c, "persist_graph", "(J)J"); + CHECK(calls->persist_graph_meth != NULL); - LDKChannelManagerPersister ret = { + LDKPersister ret = { .this_arg = (void*) calls, - .persist_manager = persist_manager_LDKChannelManagerPersister_jcall, - .free = LDKChannelManagerPersister_JCalls_free, + .persist_manager = persist_manager_LDKPersister_jcall, + .persist_graph = persist_graph_LDKPersister_jcall, + .free = LDKPersister_JCalls_free, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) { - LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister"); - *res_ptr = LDKChannelManagerPersister_init(env, clz, o); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new(JNIEnv *env, jclass clz, jobject o) { + LDKPersister *res_ptr = MALLOC(sizeof(LDKPersister), "LDKPersister"); + *res_ptr = LDKPersister_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) { void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } - LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)this_arg_ptr; + LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr; LDKChannelManager channel_manager_conv; channel_manager_conv.inner = (void*)(channel_manager & (~1)); channel_manager_conv.is_owned = false; @@ -13102,6 +13435,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1pe return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph(JNIEnv *env, jclass clz, int64_t this_arg, int64_t network_graph) { + void* this_arg_ptr = (void*)(((uintptr_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPersister* this_arg_conv = (LDKPersister*)this_arg_ptr; + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); + LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); + *ret_conv = (this_arg_conv->persist_graph)(this_arg_conv->this_arg, &network_graph_conv); + return (int64_t)ret_conv; +} + static jclass LDKFallback_SegWitProgram_class = NULL; static jmethodID LDKFallback_SegWitProgram_meth = NULL; static jclass LDKFallback_PubKeyHash_class = NULL; @@ -13676,6 +14022,35 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1co return ret_conv; } +static inline uintptr_t Bech32Error_clone_ptr(LDKBech32Error *NONNULL_PTR arg) { + LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error"); + *ret_copy = Bech32Error_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKBech32Error* arg_conv = (LDKBech32Error*)arg; + int64_t ret_val = Bech32Error_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKBech32Error* orig_conv = (LDKBech32Error*)orig; + LDKBech32Error *ret_copy = MALLOC(sizeof(LDKBech32Error), "LDKBech32Error"); + *ret_copy = Bech32Error_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free(JNIEnv *env, jclass clz, int64_t o) { + if ((o & 1) != 0) return; + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKBech32Error o_conv = *(LDKBech32Error*)(o_ptr); + FREE((void*)o); + Bech32Error_free(o_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) { LDKTransaction _res_ref; _res_ref.datalen = (*env)->GetArrayLength(env, _res); @@ -15981,103 +16356,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1f CResult_ScorerDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKProbabilisticScoringParameters o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = ProbabilisticScoringParameters_clone(&o_conv); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_ok(o_conv); - return (int64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - LDKDecodeError e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = DecodeError_clone(&e_conv); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_err(e_conv); - return (int64_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_ProbabilisticScoringParametersDecodeErrorZ_free(_res_conv); -} - -static inline uintptr_t CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(arg); - return (int64_t)ret_conv; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* arg_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(arg & ~1); - int64_t ret_val = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* orig_conv = (LDKCResult_ProbabilisticScoringParametersDecodeErrorZ*)(orig & ~1); - LDKCResult_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ProbabilisticScoringParametersDecodeErrorZ_clone(orig_conv); - return (int64_t)ret_conv; -} - -static inline uintptr_t C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ *NONNULL_PTR arg) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); - *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(arg); - return ((int64_t)ret_conv); -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* arg_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg & ~1); - int64_t ret_val = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* orig_conv = (LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(orig & ~1); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); - *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone(orig_conv); - return ((int64_t)ret_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKProbabilisticScoringParameters a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = (a & 1) || (a == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - a_conv = ProbabilisticScoringParameters_clone(&a_conv); - LDKNetworkGraph b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ), "LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ"); - *ret_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new(a_conv, &b_conv); - return ((int64_t)ret_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ _res_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(_res_ptr); - FREE((void*)_res); - C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free(_res_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKProbabilisticScorer o_conv; o_conv.inner = (void*)(o & (~1)); @@ -18473,149 +18751,161 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentEr return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok(JNIEnv *env, jclass clz, jclass o) { LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o); - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_err(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uintptr_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKParseError e_conv = *(LDKParseError*)(e_ptr); + e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1)); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv); return (int64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SiPrefixNoneZ* o_conv = (LDKCResult_SiPrefixNoneZ*)(o & ~1); - jboolean ret_val = CResult_SiPrefixNoneZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)(o & ~1); + jboolean ret_val = CResult_SiPrefixParseErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(_res_ptr); + LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_SiPrefixNoneZ_free(_res_conv); + CResult_SiPrefixParseErrorZ_free(_res_conv); } -static inline uintptr_t CResult_SiPrefixNoneZ_clone_ptr(LDKCResult_SiPrefixNoneZ *NONNULL_PTR arg) { - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_clone(arg); +static inline uintptr_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) { + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SiPrefixNoneZ* arg_conv = (LDKCResult_SiPrefixNoneZ*)(arg & ~1); - int64_t ret_val = CResult_SiPrefixNoneZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)(arg & ~1); + int64_t ret_val = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1); - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); - *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)(orig & ~1); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKInvoice o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); o_conv = Invoice_clone(&o_conv); - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_ok(o_conv); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_err(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uintptr_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr); + e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)(((uintptr_t)e) & ~1)); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv); return (int64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InvoiceNoneZ* o_conv = (LDKCResult_InvoiceNoneZ*)(o & ~1); - jboolean ret_val = CResult_InvoiceNoneZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(o & ~1); + jboolean ret_val = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(_res_ptr); + LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InvoiceNoneZ_free(_res_conv); + CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv); } -static inline uintptr_t CResult_InvoiceNoneZ_clone_ptr(LDKCResult_InvoiceNoneZ *NONNULL_PTR arg) { - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_clone(arg); +static inline uintptr_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) { + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceNoneZ* arg_conv = (LDKCResult_InvoiceNoneZ*)(arg & ~1); - int64_t ret_val = CResult_InvoiceNoneZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(arg & ~1); + int64_t ret_val = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1); - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); - *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)(orig & ~1); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKSignedRawInvoice o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); o_conv = SignedRawInvoice_clone(&o_conv); - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) { - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_err(); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uintptr_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKParseError e_conv = *(LDKParseError*)(e_ptr); + e_conv = ParseError_clone((LDKParseError*)(((uintptr_t)e) & ~1)); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv); return (int64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_SignedRawInvoiceNoneZ* o_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(o & ~1); - jboolean ret_val = CResult_SignedRawInvoiceNoneZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(o & ~1); + jboolean ret_val = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(_res_ptr); + LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_SignedRawInvoiceNoneZ_free(_res_conv); + CResult_SignedRawInvoiceParseErrorZ_free(_res_conv); } -static inline uintptr_t CResult_SignedRawInvoiceNoneZ_clone_ptr(LDKCResult_SignedRawInvoiceNoneZ *NONNULL_PTR arg) { - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(arg); +static inline uintptr_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) { + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_SignedRawInvoiceNoneZ* arg_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1); - int64_t ret_val = CResult_SignedRawInvoiceNoneZ_clone_ptr(arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(arg & ~1); + int64_t ret_val = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1); - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); - *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)(orig & ~1); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv); return (int64_t)ret_conv; } @@ -19907,6 +20197,53 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv CVec_PublicKeyZ_free(_res_constr); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uintptr_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr); + o_conv = NetAddress_clone((LDKNetAddress*)(((uintptr_t)o) & ~1)); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_some(o_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_none(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uintptr_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr); + FREE((void*)_res); + COption_NetAddressZ_free(_res_conv); +} + +static inline uintptr_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) { + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)arg; + int64_t ret_val = COption_NetAddressZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)orig; + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKCVec_u8Z o_ref; o_ref.datalen = (*env)->GetArrayLength(env, o); @@ -23101,15 +23438,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1succe return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t funding_satoshis, int64_t push_msat, int64_t channel_type) { LDKThirtyTwoBytes temporary_channel_id_ref; CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32); (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_ref.data); LDKPublicKey counterparty_node_id_ref; CHECK((*env)->GetArrayLength(env, counterparty_node_id) == 33); (*env)->GetByteArrayRegion(env, counterparty_node_id, 0, 33, counterparty_node_id_ref.compressed_form); + LDKChannelTypeFeatures channel_type_conv; + channel_type_conv.inner = (void*)(channel_type & (~1)); + channel_type_conv.is_owned = (channel_type & 1) || (channel_type == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv); + channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat); + *ret_copy = Event_open_channel_request(temporary_channel_id_ref, counterparty_node_id_ref, funding_satoshis, push_msat, channel_type_conv); int64_t ret_ref = (uintptr_t)ret_copy; return ret_ref; } @@ -23442,6 +23784,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1rep return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) { + LDKPublicKey node_id_ref; + CHECK((*env)->GetArrayLength(env, node_id) == 33); + (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); + LDKGossipTimestampFilter msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); + msg_conv = GossipTimestampFilter_clone(&msg_conv); + LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); + *ret_copy = MessageSendEvent_send_gossip_timestamp_filter(node_id_ref, msg_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -23875,8 +24232,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1o ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) { - LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelHandshakeConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = ChannelHandshakeConfig_get_negotiate_scid_privacy(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKChannelHandshakeConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ChannelHandshakeConfig_set_negotiate_scid_privacy(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg, jboolean negotiate_scid_privacy_arg) { + LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg, negotiate_scid_privacy_arg); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -27848,6 +28222,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = ChannelDetails_get_channel_type(&this_ptr_conv); + int64_t ret_ref = 0; + if ((uintptr_t)ret_var.inner > 4096) { + CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uintptr_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + ChannelDetails_set_channel_type(&this_ptr_conv, val_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -27871,6 +28277,29 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1ch ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = ChannelDetails_get_inbound_scid_alias(&this_ptr_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + void* val_ptr = (void*)(((uintptr_t)val) & ~1); + CHECK_ACCESS(val_ptr); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); + ChannelDetails_set_inbound_scid_alias(&this_ptr_conv, val_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -28093,7 +28522,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1publi ChannelDetails_set_is_public(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t channel_type_arg, int64_t short_channel_id_arg, int64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); @@ -28107,10 +28536,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_arg_conv); funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv); + LDKChannelTypeFeatures channel_type_arg_conv; + channel_type_arg_conv.inner = (void*)(channel_type_arg & (~1)); + channel_type_arg_conv.is_owned = (channel_type_arg & 1) || (channel_type_arg == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_arg_conv); + channel_type_arg_conv = ChannelTypeFeatures_clone(&channel_type_arg_conv); void* short_channel_id_arg_ptr = (void*)(((uintptr_t)short_channel_id_arg) & ~1); CHECK_ACCESS(short_channel_id_arg_ptr); LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_arg_ptr); short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_arg) & ~1)); + void* inbound_scid_alias_arg_ptr = (void*)(((uintptr_t)inbound_scid_alias_arg) & ~1); + CHECK_ACCESS(inbound_scid_alias_arg_ptr); + LDKCOption_u64Z inbound_scid_alias_arg_conv = *(LDKCOption_u64Z*)(inbound_scid_alias_arg_ptr); + inbound_scid_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)inbound_scid_alias_arg) & ~1)); void* unspendable_punishment_reserve_arg_ptr = (void*)(((uintptr_t)unspendable_punishment_reserve_arg) & ~1); CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr); LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr); @@ -28122,7 +28560,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv CHECK_ACCESS(force_close_spend_delay_arg_ptr); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uintptr_t)force_close_spend_delay_arg) & ~1)); - LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -28172,6 +28610,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEn return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelDetails this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = ChannelDetails_get_inbound_payment_scid(&this_arg_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); @@ -28815,7 +29264,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t user_channel_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -28825,7 +29274,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inb (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr); unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref); + *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, user_channel_id); return (int64_t)ret_conv; } @@ -29448,13 +29897,39 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *en Init_set_features(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = Init_get_remote_network_address(&this_ptr_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + void* val_ptr = (void*)(((uintptr_t)val) & ~1); + CHECK_ACCESS(val_ptr); + LDKCOption_NetAddressZ val_conv = *(LDKCOption_NetAddressZ*)(val_ptr); + val_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)(((uintptr_t)val) & ~1)); + Init_set_remote_network_address(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t remote_network_address_arg) { LDKInitFeatures features_arg_conv; features_arg_conv.inner = (void*)(features_arg & (~1)); features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv); features_arg_conv = InitFeatures_clone(&features_arg_conv); - LDKInit ret_var = Init_new(features_arg_conv); + void* remote_network_address_arg_ptr = (void*)(((uintptr_t)remote_network_address_arg) & ~1); + CHECK_ACCESS(remote_network_address_arg_ptr); + LDKCOption_NetAddressZ remote_network_address_arg_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_arg_ptr); + LDKInit ret_var = Init_new(features_arg_conv, remote_network_address_arg_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -30946,14 +31421,41 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_ FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKFundingLocked this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = FundingLocked_get_short_channel_id_alias(&this_ptr_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1short_1channel_1id_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKFundingLocked this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + void* val_ptr = (void*)(((uintptr_t)val) & ~1); + CHECK_ACCESS(val_ptr); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(val_ptr); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)val) & ~1)); + FundingLocked_set_short_channel_id_alias(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg, int64_t short_channel_id_alias_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); LDKPublicKey next_per_commitment_point_arg_ref; CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33); (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form); - LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref); + void* short_channel_id_alias_arg_ptr = (void*)(((uintptr_t)short_channel_id_alias_arg) & ~1); + CHECK_ACCESS(short_channel_id_alias_arg_ptr); + LDKCOption_u64Z short_channel_id_alias_arg_conv = *(LDKCOption_u64Z*)(short_channel_id_alias_arg_ptr); + short_channel_id_alias_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)short_channel_id_alias_arg) & ~1)); + LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref, short_channel_id_alias_arg_conv); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -35956,7 +36458,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor, int64_t remote_network_address) { LDKPeerManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -35971,12 +36473,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_ // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKSocketDescriptor_JCalls_cloned(&descriptor_conv); } + void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1); + CHECK_ACCESS(remote_network_address_ptr); + LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr); LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); - *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv); + *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv, remote_network_address_conv); return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor, int64_t remote_network_address) { LDKPeerManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -35988,8 +36493,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1 // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKSocketDescriptor_JCalls_cloned(&descriptor_conv); } + void* remote_network_address_ptr = (void*)(((uintptr_t)remote_network_address) & ~1); + CHECK_ACCESS(remote_network_address_ptr); + LDKCOption_NetAddressZ remote_network_address_conv = *(LDKCOption_NetAddressZ*)(remote_network_address_ptr); LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); - *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv); + *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv, remote_network_address_conv); return (int64_t)ret_conv; } @@ -42276,7 +42784,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read(JNIEnv * return (int64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t route_params, int64_t network, int64_tArray first_hops, int64_t logger, int64_t scorer, int8_tArray random_seed_bytes) { LDKPublicKey our_node_pubkey_ref; CHECK((*env)->GetArrayLength(env, our_node_pubkey) == 33); (*env)->GetByteArrayRegion(env, our_node_pubkey, 0, 33, our_node_pubkey_ref.compressed_form); @@ -42318,8 +42826,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc void* scorer_ptr = (void*)(((uintptr_t)scorer) & ~1); if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; + unsigned char random_seed_bytes_arr[32]; + CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); + (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_arr); + unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv); + *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (int64_t)ret_conv; } @@ -42416,28 +42928,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone(J return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKFixedPenaltyScorer obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = FixedPenaltyScorer_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_FixedPenaltyScorer_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_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); - *ret_conv = FixedPenaltyScorer_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (int64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty(JNIEnv *env, jclass clz, int64_t penalty_msat) { LDKFixedPenaltyScorer ret_var = FixedPenaltyScorer_with_penalty(penalty_msat); int64_t ret_ref = 0; @@ -42461,6 +42951,28 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Sco return (int64_t)ret_ret; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKFixedPenaltyScorer obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = FixedPenaltyScorer_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_FixedPenaltyScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_FixedPenaltyScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ), "LDKCResult_FixedPenaltyScorerDecodeErrorZ"); + *ret_conv = FixedPenaltyScorer_read(ser_ref, arg); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (int64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -42727,6 +43239,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_free(this_obj_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_base_penalty_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_base_penalty_msat(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1liquidity_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKProbabilisticScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -42761,8 +43290,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters ProbabilisticScoringParameters_set_liquidity_offset_half_life(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg) { - LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKProbabilisticScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t liquidity_penalty_multiplier_msat_arg, int64_t liquidity_offset_half_life_arg, int64_t amount_penalty_multiplier_msat_arg) { + LDKProbabilisticScoringParameters ret_var = ProbabilisticScoringParameters_new(base_penalty_msat_arg, liquidity_penalty_multiplier_msat_arg, liquidity_offset_half_life_arg, amount_penalty_multiplier_msat_arg); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -42812,28 +43358,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParamet return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKProbabilisticScoringParameters obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = ProbabilisticScoringParameters_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_ProbabilisticScoringParameters_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_ProbabilisticScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScoringParametersDecodeErrorZ), "LDKCResult_ProbabilisticScoringParametersDecodeErrorZ"); - *ret_conv = ProbabilisticScoringParameters_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (int64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1new(JNIEnv *env, jclass clz, int64_t params, int64_t network_graph) { LDKProbabilisticScoringParameters params_conv; params_conv.inner = (void*)(params & (~1)); @@ -42891,16 +43415,21 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1wr return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg_a, int64_t arg_b) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - void* arg_ptr = (void*)(((uintptr_t)arg) & ~1); - CHECK_ACCESS(arg_ptr); - LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ arg_conv = *(LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(arg_ptr); - arg_conv = C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone((LDKC2Tuple_ProbabilisticScoringParametersNetworkGraphZ*)(((uintptr_t)arg) & ~1)); + LDKProbabilisticScoringParameters arg_a_conv; + arg_a_conv.inner = (void*)(arg_a & (~1)); + arg_a_conv.is_owned = (arg_a & 1) || (arg_a == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_a_conv); + arg_a_conv = ProbabilisticScoringParameters_clone(&arg_a_conv); + LDKNetworkGraph arg_b_conv; + arg_b_conv.inner = (void*)(arg_b & (~1)); + arg_b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_b_conv); LDKCResult_ProbabilisticScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ), "LDKCResult_ProbabilisticScorerDecodeErrorZ"); - *ret_conv = ProbabilisticScorer_read(ser_ref, arg_conv); + *ret_conv = ProbabilisticScorer_read(ser_ref, arg_a_conv, &arg_b_conv); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (int64_t)ret_conv; } @@ -42949,6 +43478,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persis return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1network_1graph(JNIEnv *env, jclass clz, jstring data_dir, int64_t network_graph) { + LDKStr data_dir_conv = java_to_owned_str(env, data_dir); + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); + LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ"); + *ret_conv = FilesystemPersister_persist_network_graph(data_dir_conv, &network_graph_conv); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) { LDKFilesystemPersister this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -42984,22 +43524,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIE BackgroundProcessor_free(this_obj_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); CHECK_ACCESS(this_ptr_ptr); - LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(this_ptr_ptr); + LDKPersister this_ptr_conv = *(LDKPersister*)(this_ptr_ptr); FREE((void*)this_ptr); - ChannelManagerPersister_free(this_ptr_conv); + Persister_free(this_ptr_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t net_graph_msg_handler, int64_t peer_manager, int64_t logger) { void* persister_ptr = (void*)(((uintptr_t)persister) & ~1); CHECK_ACCESS(persister_ptr); - LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(persister_ptr); - if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) { + LDKPersister persister_conv = *(LDKPersister*)(persister_ptr); + if (persister_conv.free == LDKPersister_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKChannelManagerPersister_JCalls_cloned(&persister_conv); + LDKPersister_JCalls_cloned(&persister_conv); } void* event_handler_ptr = (void*)(((uintptr_t)event_handler) & ~1); CHECK_ACCESS(event_handler_ptr); @@ -43065,6 +43605,217 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(J return (int64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKParseError this_ptr_conv = *(LDKParseError*)(this_ptr_ptr); + FREE((void*)this_ptr); + ParseError_free(this_ptr_conv); +} + +static inline uintptr_t ParseError_clone_ptr(LDKParseError *NONNULL_PTR arg) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKParseError* arg_conv = (LDKParseError*)arg; + int64_t ret_val = ParseError_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKParseError* orig_conv = (LDKParseError*)orig; + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = (void*)(((uintptr_t)a) & ~1); + CHECK_ACCESS(a_ptr); + LDKBech32Error a_conv = *(LDKBech32Error*)(a_ptr); + a_conv = Bech32Error_clone((LDKBech32Error*)(((uintptr_t)a) & ~1)); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_bech32_error(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error(JNIEnv *env, jclass clz, int32_t a) { + + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_parse_amount_error((LDKError){ ._dummy = 0 }); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature(JNIEnv *env, jclass clz, jclass a) { + LDKSecp256k1Error a_conv = LDKSecp256k1Error_from_java(env, a); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_malformed_signature(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_bad_prefix(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_unknown_currency(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_unknown_si_prefix(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_malformed_hrp(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_too_short_data_part(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_unexpected_end_of_tagged_fields(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error(JNIEnv *env, jclass clz, int32_t a) { + + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_description_decode_error((LDKError){ ._dummy = 0 }); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_padding_error(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_integer_overflow_error(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_seg_wit_program_length(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_pub_key_hash_length(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_script_hash_length(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_recovery_id(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length(JNIEnv *env, jclass clz, jstring a) { + LDKStr a_conv = java_to_owned_str(env, a); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_invalid_slice_length(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseError_1skip(JNIEnv *env, jclass clz) { + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = ParseError_skip(); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uintptr_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKParseOrSemanticError this_ptr_conv = *(LDKParseOrSemanticError*)(this_ptr_ptr); + FREE((void*)this_ptr); + ParseOrSemanticError_free(this_ptr_conv); +} + +static inline uintptr_t ParseOrSemanticError_clone_ptr(LDKParseOrSemanticError *NONNULL_PTR arg) { + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_clone(arg); +int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKParseOrSemanticError* arg_conv = (LDKParseOrSemanticError*)arg; + int64_t ret_val = ParseOrSemanticError_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKParseOrSemanticError* orig_conv = (LDKParseOrSemanticError*)orig; + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_clone(orig_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error(JNIEnv *env, jclass clz, int64_t a) { + void* a_ptr = (void*)(((uintptr_t)a) & ~1); + CHECK_ACCESS(a_ptr); + LDKParseError a_conv = *(LDKParseError*)(a_ptr); + a_conv = ParseError_clone((LDKParseError*)(((uintptr_t)a) & ~1)); + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_parse_error(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error(JNIEnv *env, jclass clz, jclass a) { + LDKSemanticError a_conv = LDKSemanticError_from_java(env, a); + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = ParseOrSemanticError_semantic_error(a_conv); + int64_t ret_ref = (uintptr_t)ret_copy; + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKInvoice this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -45263,6 +46014,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice(JN return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t amt_msat, int64_t description_hash, int8_tArray payment_hash, int8_tArray payment_secret, int64_tArray phantom_route_hints, int64_t keys_manager, jclass network) { + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKSha256 description_hash_conv; + description_hash_conv.inner = (void*)(description_hash & (~1)); + description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); + description_hash_conv = Sha256_clone(&description_hash_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + CHECK((*env)->GetArrayLength(env, payment_secret) == 32); + (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); + LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr; + phantom_route_hints_constr.datalen = (*env)->GetArrayLength(env, phantom_route_hints); + if (phantom_route_hints_constr.datalen > 0) + phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + phantom_route_hints_constr.data = NULL; + int64_t* phantom_route_hints_vals = (*env)->GetLongArrayElements (env, phantom_route_hints, NULL); + for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) { + int64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t]; + LDKPhantomRouteHints phantom_route_hints_conv_19_conv; + phantom_route_hints_conv_19_conv.inner = (void*)(phantom_route_hints_conv_19 & (~1)); + phantom_route_hints_conv_19_conv.is_owned = (phantom_route_hints_conv_19 & 1) || (phantom_route_hints_conv_19 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv); + phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv); + phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; + } + (*env)->ReleaseLongArrayElements(env, phantom_route_hints, phantom_route_hints_vals, 0); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, description_hash_conv, payment_hash_ref, payment_secret_ref, phantom_route_hints_constr, keys_manager_conv, network_conv); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = (void*)(channelmanager & (~1)); @@ -45286,6 +46083,60 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1chan return (int64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash) { + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = (void*)(channelmanager & (~1)); + channelmanager_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKSha256 description_hash_conv; + description_hash_conv.inner = (void*)(description_hash & (~1)); + description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); + description_hash_conv = Sha256_clone(&description_hash_conv); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_invoice_from_channelmanager_with_description_hash(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv); + return (int64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, int64_t description_hash, int64_t duration_since_epoch) { + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = (void*)(channelmanager & (~1)); + channelmanager_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + void* keys_manager_ptr = (void*)(((uintptr_t)keys_manager) & ~1); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } + LDKCurrency network_conv = LDKCurrency_from_java(env, network); + void* amt_msat_ptr = (void*)(((uintptr_t)amt_msat) & ~1); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uintptr_t)amt_msat) & ~1)); + LDKSha256 description_hash_conv; + description_hash_conv.inner = (void*)(description_hash & (~1)); + description_hash_conv.is_owned = (description_hash & 1) || (description_hash == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); + description_hash_conv = Sha256_clone(&description_hash_conv); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch); + return (int64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1and_1duration_1since_1epoch(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description, int64_t duration_since_epoch) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = (void*)(channelmanager & (~1)); @@ -45317,7 +46168,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free(JNIEnv *en DefaultRouter_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t logger, int8_tArray random_seed_bytes) { LDKNetworkGraph network_graph_conv; network_graph_conv.inner = (void*)(network_graph & (~1)); network_graph_conv.is_owned = false; @@ -45329,7 +46180,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new(JNIEnv * // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv); + LDKThirtyTwoBytes random_seed_bytes_ref; + CHECK((*env)->GetArrayLength(env, random_seed_bytes) == 32); + (*env)->GetByteArrayRegion(env, random_seed_bytes, 0, 32, random_seed_bytes_ref.data); + LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref); int64_t ret_ref = 0; CHECK((((uintptr_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uintptr_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -45363,25 +46217,41 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Payer(J JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); - LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ"); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); *ret_conv = SiPrefix_from_str(s_conv); return (int64_t)ret_conv; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); - LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ"); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); *ret_conv = Invoice_from_str(s_conv); return (int64_t)ret_conv; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) { LDKStr s_conv = java_to_owned_str(env, s); - LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ"); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); *ret_conv = SignedRawInvoice_from_str(s_conv); return (int64_t)ret_conv; } +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str(JNIEnv *env, jclass clz, int64_t o) { + LDKParseError* o_conv = (LDKParseError*)o; + LDKStr ret_str = ParseError_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 jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) { + LDKParseOrSemanticError* o_conv = (LDKParseOrSemanticError*)o; + LDKStr ret_str = ParseOrSemanticError_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 jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) { LDKInvoice o_conv; o_conv.inner = (void*)(o & (~1)); diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index 23ece875..275cb5cd 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -135,6 +135,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: LDKBech32Error_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKBech32Error; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBech32Error_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: TxOut_get_script_pubkey @@ -807,38 +815,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_get_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_get_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1get_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_a - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1a - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_get_b - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1get_1b - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: CResult_ProbabilisticScorerDecodeErrorZ_get_ok @@ -1913,50 +1889,66 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErro /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_get_ok + * Method: LDKParseError_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKParseError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseError_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SiPrefixParseErrorZ_get_ok * Signature: (J)Lorg/ldk/enums/SiPrefix; */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1ok +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_get_err - * Signature: (J)V + * Method: CResult_SiPrefixParseErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKParseOrSemanticError_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKParseOrSemanticError; */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1get_1err +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKParseOrSemanticError_1ref_1from_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_get_ok + * Method: CResult_InvoiceParseOrSemanticErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_get_err - * Signature: (J)V + * Method: CResult_InvoiceParseOrSemanticErrorZ_get_err + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_get_ok + * Method: CResult_SignedRawInvoiceParseErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_get_err - * Signature: (J)V + * Method: CResult_SignedRawInvoiceParseErrorZ_get_err + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -2327,6 +2319,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementC JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_NetAddressZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_NetAddressZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetAddressZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_CVec_u8ZPeerHandleErrorZ_get_ok @@ -3521,10 +3521,10 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1g /* * Class: org_ldk_impl_bindings - * Method: RoutingMessageHandler_sync_routing_table + * Method: RoutingMessageHandler_peer_connected * Signature: (J[BJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1peer_1connected (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* @@ -3705,18 +3705,26 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock /* * Class: org_ldk_impl_bindings - * Method: LDKChannelManagerPersister_new - * Signature: (Lorg/ldk/impl/bindings/LDKChannelManagerPersister;)J + * Method: LDKPersister_new + * Signature: (Lorg/ldk/impl/bindings/LDKPersister;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPersister_1new (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings - * Method: ChannelManagerPersister_persist_manager + * Method: Persister_persist_manager + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1manager + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Persister_persist_graph * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Persister_1persist_1graph (JNIEnv *, jclass, jlong, jlong); /* @@ -3815,6 +3823,30 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1versi JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: Bech32Error_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Bech32Error_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Bech32Error_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Bech32Error_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Bech32Error_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Transaction_free @@ -5783,86 +5815,6 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeError JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_ok - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_ProbabilisticScoringParametersDecodeErrorZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ProbabilisticScoringParametersDecodeErrorZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_new - * Signature: (JJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1new - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_ProbabilisticScoringParametersNetworkGraphZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1ProbabilisticScoringParametersNetworkGraphZ_1free - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: CResult_ProbabilisticScorerDecodeErrorZ_ok @@ -7913,146 +7865,146 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentErro /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_ok + * Method: CResult_SiPrefixParseErrorZ_ok * Signature: (Lorg/ldk/enums/SiPrefix;)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1ok (JNIEnv *, jclass, jobject); /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_err - * Signature: ()J + * Method: CResult_SiPrefixParseErrorZ_err + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1err + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_is_ok + * Method: CResult_SiPrefixParseErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_free + * Method: CResult_SiPrefixParseErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_clone_ptr + * Method: CResult_SiPrefixParseErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SiPrefixNoneZ_clone + * Method: CResult_SiPrefixParseErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixParseErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_ok + * Method: CResult_InvoiceParseOrSemanticErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_err - * Signature: ()J + * Method: CResult_InvoiceParseOrSemanticErrorZ_err + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1err + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_is_ok + * Method: CResult_InvoiceParseOrSemanticErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_free + * Method: CResult_InvoiceParseOrSemanticErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_clone_ptr + * Method: CResult_InvoiceParseOrSemanticErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceNoneZ_clone + * Method: CResult_InvoiceParseOrSemanticErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceParseOrSemanticErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_ok + * Method: CResult_SignedRawInvoiceParseErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_err - * Signature: ()J + * Method: CResult_SignedRawInvoiceParseErrorZ_err + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err - (JNIEnv *, jclass); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1err + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_is_ok + * Method: CResult_SignedRawInvoiceParseErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_free + * Method: CResult_SignedRawInvoiceParseErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_clone_ptr + * Method: CResult_SignedRawInvoiceParseErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_SignedRawInvoiceNoneZ_clone + * Method: CResult_SignedRawInvoiceParseErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceParseErrorZ_1clone (JNIEnv *, jclass, jlong); /* @@ -9055,6 +9007,46 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free (JNIEnv *, jclass, jobjectArray); +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetAddressZ_some + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1some + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetAddressZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetAddressZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetAddressZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NetAddressZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetAddressZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_CVec_u8ZPeerHandleErrorZ_ok @@ -11698,10 +11690,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1success /* * Class: org_ldk_impl_bindings * Method: Event_open_channel_request - * Signature: ([B[BJJ)J + * Signature: ([B[BJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1open_1channel_1request - (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -11895,6 +11887,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1short JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1reply_1channel_1range (JNIEnv *, jclass, jbyteArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: MessageSendEvent_send_gossip_timestamp_filter + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1gossip_1timestamp_1filter + (JNIEnv *, jclass, jbyteArray, jlong); + /* * Class: org_ldk_impl_bindings * Method: MessageSendEventsProvider_free @@ -12271,13 +12271,29 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelHandshakeConfig_get_negotiate_scid_privacy + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1negotiate_1scid_1privacy + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelHandshakeConfig_set_negotiate_scid_privacy + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1negotiate_1scid_1privacy + (JNIEnv *, jclass, jlong, jboolean); + /* * Class: org_ldk_impl_bindings * Method: ChannelHandshakeConfig_new - * Signature: (ISJ)J + * Signature: (ISJZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new - (JNIEnv *, jclass, jint, jshort, jlong); + (JNIEnv *, jclass, jint, jshort, jlong, jboolean); /* * Class: org_ldk_impl_bindings @@ -14703,6 +14719,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_get_channel_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1type + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_set_channel_type + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1type + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelDetails_get_short_channel_id @@ -14719,6 +14751,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1c JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_get_inbound_scid_alias + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1scid_1alias + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_set_inbound_scid_alias + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1scid_1alias + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelDetails_get_channel_value_satoshis @@ -14914,10 +14962,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1publi /* * Class: org_ldk_impl_bindings * Method: ChannelDetails_new - * Signature: ([BJJJJJJJJJJJZZZZ)J + * Signature: ([BJJJJJJJJJJJJJZZZZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new - (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jboolean, jboolean, jboolean, jboolean); + (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jboolean, jboolean, jboolean, jboolean); /* * Class: org_ldk_impl_bindings @@ -14935,6 +14983,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone_1ptr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_get_inbound_payment_scid + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1payment_1scid + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: PaymentSendFailure_free @@ -15234,10 +15290,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our /* * Class: org_ldk_impl_bindings * Method: ChannelManager_accept_inbound_channel - * Signature: (J[B)J + * Signature: (J[BJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1accept_1inbound_1channel - (JNIEnv *, jclass, jlong, jbyteArray); + (JNIEnv *, jclass, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -15601,12 +15657,28 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features /* * Class: org_ldk_impl_bindings - * Method: Init_new + * Method: Init_get_remote_network_address * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1new +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1get_1remote_1network_1address (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Init_set_remote_network_address + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1remote_1network_1address + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Init_new + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1new + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: Init_clone_ptr @@ -16657,19 +16729,35 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_ /* * Class: org_ldk_impl_bindings - * Method: FundingLocked_new - * Signature: ([B[B)J + * Method: FundingLocked_get_short_channel_id_alias + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new - (JNIEnv *, jclass, jbyteArray, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1short_1channel_1id_1alias + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: FundingLocked_clone_ptr - * Signature: (J)J + * Method: FundingLocked_set_short_channel_id_alias + * Signature: (JJ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1short_1channel_1id_1alias + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FundingLocked_new + * Signature: ([B[BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new + (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: FundingLocked_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone_1ptr + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -19810,18 +19898,18 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer /* * Class: org_ldk_impl_bindings * Method: PeerManager_new_outbound_connection - * Signature: (J[BJ)J + * Signature: (J[BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection - (JNIEnv *, jclass, jlong, jbyteArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings * Method: PeerManager_new_inbound_connection - * Signature: (JJ)J + * Signature: (JJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -23570,10 +23658,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read /* * Class: org_ldk_impl_bindings * Method: find_route - * Signature: ([BJJ[JJJ)J + * Signature: ([BJJ[JJJ[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_find_1route - (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlongArray, jlong, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlongArray, jlong, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -23633,35 +23721,35 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1clone /* * Class: org_ldk_impl_bindings - * Method: FixedPenaltyScorer_write - * Signature: (J)[B + * Method: FixedPenaltyScorer_with_penalty + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: FixedPenaltyScorer_read - * Signature: ([B)J + * Method: FixedPenaltyScorer_as_Score + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: FixedPenaltyScorer_with_penalty - * Signature: (J)J + * Method: FixedPenaltyScorer_write + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1with_1penalty +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: FixedPenaltyScorer_as_Score - * Signature: (J)J + * Method: FixedPenaltyScorer_read + * Signature: ([BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1as_1Score - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FixedPenaltyScorer_1read + (JNIEnv *, jclass, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings @@ -23863,6 +23951,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1free JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_get_base_penalty_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1base_1penalty_1msat + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_set_base_penalty_msat + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1base_1penalty_1msat + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScoringParameters_get_liquidity_penalty_multiplier_msat @@ -23895,13 +23999,29 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameter JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1liquidity_1offset_1half_1life (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1get_1amount_1penalty_1multiplier_1msat + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1set_1amount_1penalty_1multiplier_1msat + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScoringParameters_new - * Signature: (JJ)J + * Signature: (JJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -23919,22 +24039,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameter JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1clone (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: ProbabilisticScoringParameters_write - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1write - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ProbabilisticScoringParameters_read - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScoringParameters_1read - (JNIEnv *, jclass, jbyteArray); - /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScorer_new @@ -23970,10 +24074,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1wri /* * Class: org_ldk_impl_bindings * Method: ProbabilisticScorer_read - * Signature: ([BJ)J + * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ProbabilisticScorer_1read - (JNIEnv *, jclass, jbyteArray, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -24007,6 +24111,14 @@ JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1d JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager (JNIEnv *, jclass, jstring, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: FilesystemPersister_persist_network_graph + * Signature: (Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1network_1graph + (JNIEnv *, jclass, jstring, jlong); + /* * Class: org_ldk_impl_bindings * Method: FilesystemPersister_read_channelmonitors @@ -24033,10 +24145,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free /* * Class: org_ldk_impl_bindings - * Method: ChannelManagerPersister_free + * Method: Persister_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persister_1free (JNIEnv *, jclass, jlong); /* @@ -24063,6 +24175,214 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseError_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_bech32_error + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1bech32_1error + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_parse_amount_error + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1parse_1amount_1error + (JNIEnv *, jclass, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_malformed_signature + * Signature: (Lorg/ldk/enums/Secp256k1Error;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1signature + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_bad_prefix + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1bad_1prefix + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_unknown_currency + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1currency + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_unknown_si_prefix + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1unknown_1si_1prefix + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_malformed_hrp + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1malformed_1hrp + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_too_short_data_part + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1too_1short_1data_1part + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_unexpected_end_of_tagged_fields + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1unexpected_1end_1of_1tagged_1fields + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_description_decode_error + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1description_1decode_1error + (JNIEnv *, jclass, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_padding_error + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1padding_1error + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_integer_overflow_error + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1integer_1overflow_1error + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_invalid_seg_wit_program_length + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1seg_1wit_1program_1length + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_invalid_pub_key_hash_length + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1pub_1key_1hash_1length + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_invalid_script_hash_length + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1script_1hash_1length + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_invalid_recovery_id + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1recovery_1id + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_invalid_slice_length + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1invalid_1slice_1length + (JNIEnv *, jclass, jstring); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_skip + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseError_1skip + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseOrSemanticError_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseOrSemanticError_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseOrSemanticError_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseOrSemanticError_parse_error + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1parse_1error + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseOrSemanticError_semantic_error + * Signature: (Lorg/ldk/enums/SemanticError;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1semantic_1error + (JNIEnv *, jclass, jobject); + /* * Class: org_ldk_impl_bindings * Method: Invoice_free @@ -25575,6 +25895,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1as_1EventHandle JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice (JNIEnv *, jclass, jlong, jstring, jbyteArray, jbyteArray, jlongArray, jlong, jobject); +/* + * Class: org_ldk_impl_bindings + * Method: create_phantom_invoice_with_description_hash + * Signature: (JJ[B[B[JJLorg/ldk/enums/Currency;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice_1with_1description_1hash + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray, jlongArray, jlong, jobject); + /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager @@ -25583,6 +25911,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1phantom_1invoice JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager (JNIEnv *, jclass, jlong, jlong, jobject, jlong, jstring); +/* + * Class: org_ldk_impl_bindings + * Method: create_invoice_from_channelmanager_with_description_hash + * Signature: (JJLorg/ldk/enums/Currency;JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash + (JNIEnv *, jclass, jlong, jlong, jobject, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch + * Signature: (JJLorg/ldk/enums/Currency;JJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager_1with_1description_1hash_1and_1duration_1since_1epoch + (JNIEnv *, jclass, jlong, jlong, jobject, jlong, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: create_invoice_from_channelmanager_and_duration_since_epoch @@ -25602,10 +25946,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1free /* * Class: org_ldk_impl_bindings * Method: DefaultRouter_new - * Signature: (JJ)J + * Signature: (JJ[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DefaultRouter_1new - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -25647,6 +25991,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str (JNIEnv *, jclass, jstring); +/* + * Class: org_ldk_impl_bindings + * Method: ParseError_to_str + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseError_1to_1str + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ParseOrSemanticError_to_str + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ParseOrSemanticError_1to_1str + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Invoice_to_str