From: Matt Corallo Date: Mon, 18 Oct 2021 21:08:44 +0000 (+0000) Subject: Update auto-generated bindings to 0.0.102 X-Git-Tag: v0.0.102.0^2~1 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=0e5e33e2bb46c905f6c9478fbfcda11be6b309ff;p=ldk-java Update auto-generated bindings to 0.0.102 --- diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 0f53e686..0a875796 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -496,6 +496,9 @@ public class bindings { public static native boolean LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(long arg); public static native long[] LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(long arg); public static native IOError LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(long arg); + public static native boolean LDKCResult_PaymentIdDecodeErrorZ_result_ok(long arg); + public static native long LDKCResult_PaymentIdDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_PaymentIdDecodeErrorZ_get_err(long arg); public static class LDKCOption_u16Z { private LDKCOption_u16Z() {} public final static class Some extends LDKCOption_u16Z { @@ -544,6 +547,9 @@ public class bindings { public static native long LDKCResult_NoneAPIErrorZ_get_err(long arg); public static native long LDKCVec_CResult_NoneAPIErrorZZ_new(long[] elems); public static native long LDKCVec_APIErrorZ_new(long[] elems); + public static native boolean LDKCResult__u832APIErrorZ_result_ok(long arg); + public static native byte[] LDKCResult__u832APIErrorZ_get_ok(long arg); + public static native long LDKCResult__u832APIErrorZ_get_err(long arg); public static class LDKPaymentSendFailure { private LDKPaymentSendFailure() {} public final static class ParameterError extends LDKPaymentSendFailure { @@ -566,12 +572,20 @@ public class bindings { } static { LDKPaymentSendFailure.init(); } public static native LDKPaymentSendFailure LDKPaymentSendFailure_ref_from_ptr(long ptr); + public static native boolean LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(long arg); + public static native long LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(long arg); + public static native long LDKCResult_PaymentIdPaymentSendFailureZ_get_err(long arg); public static native boolean LDKCResult_NonePaymentSendFailureZ_result_ok(long arg); public static native void LDKCResult_NonePaymentSendFailureZ_get_ok(long arg); public static native long LDKCResult_NonePaymentSendFailureZ_get_err(long arg); - public static native boolean LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(long arg); - public static native byte[] LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(long arg); - public static native long LDKCResult_PaymentHashPaymentSendFailureZ_get_err(long arg); + public static native long LDKC2Tuple_PaymentHashPaymentIdZ_new(byte[] a, long b); + // struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple); + public static native byte[] C2Tuple_PaymentHashPaymentIdZ_get_a(long tuple); + // struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple); + public static native long C2Tuple_PaymentHashPaymentIdZ_get_b(long tuple); + public static native boolean LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(long arg); + public static native long LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(long arg); + public static native long LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(long arg); public static class LDKNetAddress { private LDKNetAddress() {} public final static class IPv4 extends LDKNetAddress { @@ -833,7 +847,8 @@ public class bindings { } public final static class PaymentSent extends LDKEvent { public byte[] payment_preimage; - PaymentSent(byte[] payment_preimage) { this.payment_preimage = payment_preimage; } + public byte[] payment_hash; + PaymentSent(byte[] payment_preimage, byte[] payment_hash) { this.payment_preimage = payment_preimage; this.payment_hash = payment_hash; } } public final static class PaymentPathFailed extends LDKEvent { public byte[] payment_hash; @@ -841,7 +856,8 @@ public class bindings { public long network_update; public boolean all_paths_failed; public long[] path; - PaymentPathFailed(byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; } + public long short_channel_id; + PaymentPathFailed(byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path, long short_channel_id) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; this.short_channel_id = short_channel_id; } } public final static class PendingHTLCsForwardable extends LDKEvent { public long time_forwardable; @@ -858,8 +874,14 @@ public class bindings { } public final static class ChannelClosed extends LDKEvent { public byte[] channel_id; + public long user_channel_id; public long reason; - ChannelClosed(byte[] channel_id, long reason) { this.channel_id = channel_id; this.reason = reason; } + ChannelClosed(byte[] channel_id, long user_channel_id, long reason) { this.channel_id = channel_id; this.user_channel_id = user_channel_id; this.reason = reason; } + } + public final static class DiscardFunding extends LDKEvent { + public byte[] channel_id; + public byte[] transaction; + DiscardFunding(byte[] channel_id, byte[] transaction) { this.channel_id = channel_id; this.transaction = transaction; } } static native void init(); } @@ -937,6 +959,9 @@ public class bindings { public static native boolean LDKCResult_boolPeerHandleErrorZ_result_ok(long arg); public static native boolean LDKCResult_boolPeerHandleErrorZ_get_ok(long arg); public static native long LDKCResult_boolPeerHandleErrorZ_get_err(long arg); + public static native boolean LDKCResult_NodeIdDecodeErrorZ_result_ok(long arg); + public static native long LDKCResult_NodeIdDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_NodeIdDecodeErrorZ_get_err(long arg); public interface LDKAccess { long get_utxo(byte[] genesis_hash, long short_channel_id); } @@ -975,6 +1000,19 @@ public class bindings { public static native boolean LDKCResult_NetworkGraphDecodeErrorZ_result_ok(long arg); public static native long LDKCResult_NetworkGraphDecodeErrorZ_get_ok(long arg); public static native long LDKCResult_NetworkGraphDecodeErrorZ_get_err(long arg); + public static class LDKCOption_CVec_NetAddressZZ { + private LDKCOption_CVec_NetAddressZZ() {} + public final static class Some extends LDKCOption_CVec_NetAddressZZ { + public long[] some; + Some(long[] some) { this.some = some; } + } + public final static class None extends LDKCOption_CVec_NetAddressZZ { + None() { } + } + static native void init(); + } + static { LDKCOption_CVec_NetAddressZZ.init(); } + public static native LDKCOption_CVec_NetAddressZZ LDKCOption_CVec_NetAddressZZ_ref_from_ptr(long ptr); public static native boolean LDKCResult_NetAddressu8Z_result_ok(long arg); public static native long LDKCResult_NetAddressu8Z_get_ok(long arg); public static native byte LDKCResult_NetAddressu8Z_get_err(long arg); @@ -1122,6 +1160,10 @@ public class bindings { } static { LDKCOption_FilterZ.init(); } public static native LDKCOption_FilterZ LDKCOption_FilterZ_ref_from_ptr(long ptr); + public static native boolean LDKCResult_LockedChannelMonitorNoneZ_result_ok(long arg); + public static native long LDKCResult_LockedChannelMonitorNoneZ_get_ok(long arg); + public static native void LDKCResult_LockedChannelMonitorNoneZ_get_err(long arg); + public static native long LDKCVec_OutPointZ_new(long[] elems); public interface LDKMessageSendEventsProvider { long[] get_and_clear_pending_msg_events(); } @@ -1300,6 +1342,12 @@ public class bindings { public static native void SocketDescriptor_disconnect_socket(long this_arg); // uint64_t SocketDescriptor_hash LDKSocketDescriptor *NONNULL_PTR this_arg public static native long SocketDescriptor_hash(long this_arg); + public interface LDKScore { + long channel_penalty_msat(long short_channel_id); + } + public static native long LDKScore_new(LDKScore impl); + // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id + public static native long Score_channel_penalty_msat(long this_arg, long short_channel_id); public interface LDKChannelManagerPersister { long persist_manager(long channel_manager); } @@ -1705,6 +1753,14 @@ public class bindings { public static native void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(long _res); // struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR orig); public static native long CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(long orig); + // struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_ok(struct LDKPaymentId o); + public static native long CResult_PaymentIdDecodeErrorZ_ok(long o); + // struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_PaymentIdDecodeErrorZ_err(long e); + // void CResult_PaymentIdDecodeErrorZ_free(struct LDKCResult_PaymentIdDecodeErrorZ _res); + public static native void CResult_PaymentIdDecodeErrorZ_free(long _res); + // struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_clone(const struct LDKCResult_PaymentIdDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_PaymentIdDecodeErrorZ_clone(long orig); // struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); public static native long COption_u16Z_some(short o); // struct LDKCOption_u16Z COption_u16Z_none(void); @@ -1725,6 +1781,22 @@ public class bindings { public static native void CVec_CResult_NoneAPIErrorZZ_free(long[] _res); // void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); public static native void CVec_APIErrorZ_free(long[] _res); + // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); + public static native long CResult__u832APIErrorZ_ok(byte[] o); + // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); + public static native long CResult__u832APIErrorZ_err(long e); + // void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); + public static native void CResult__u832APIErrorZ_free(long _res); + // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); + public static native long CResult__u832APIErrorZ_clone(long orig); + // struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKPaymentId o); + public static native long CResult_PaymentIdPaymentSendFailureZ_ok(long o); + // struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); + public static native long CResult_PaymentIdPaymentSendFailureZ_err(long e); + // void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res); + public static native void CResult_PaymentIdPaymentSendFailureZ_free(long _res); + // struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig); + public static native long CResult_PaymentIdPaymentSendFailureZ_clone(long orig); // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); public static native long CResult_NonePaymentSendFailureZ_ok(); // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); @@ -1733,14 +1805,20 @@ public class bindings { public static native void CResult_NonePaymentSendFailureZ_free(long _res); // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); public static native long CResult_NonePaymentSendFailureZ_clone(long orig); - // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); - public static native long CResult_PaymentHashPaymentSendFailureZ_ok(byte[] o); - // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); - public static native long CResult_PaymentHashPaymentSendFailureZ_err(long e); - // void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); - public static native void CResult_PaymentHashPaymentSendFailureZ_free(long _res); - // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); - public static native long CResult_PaymentHashPaymentSendFailureZ_clone(long orig); + // struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); + public static native long C2Tuple_PaymentHashPaymentIdZ_clone(long orig); + // struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKPaymentId b); + public static native long C2Tuple_PaymentHashPaymentIdZ_new(byte[] a, long b); + // void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); + public static native void C2Tuple_PaymentHashPaymentIdZ_free(long _res); + // struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); + public static native long CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(long o); + // struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); + public static native long CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(long e); + // void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); + public static native void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(long _res); + // struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); + public static native long CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(long orig); // void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); public static native void CVec_NetAddressZ_free(long[] _res); // struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); @@ -2031,6 +2109,14 @@ public class bindings { public static native void CResult_boolPeerHandleErrorZ_free(long _res); // struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); public static native long CResult_boolPeerHandleErrorZ_clone(long orig); + // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); + public static native long CResult_NodeIdDecodeErrorZ_ok(long o); + // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_NodeIdDecodeErrorZ_err(long e); + // void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); + public static native void CResult_NodeIdDecodeErrorZ_free(long _res); + // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_NodeIdDecodeErrorZ_clone(long orig); // struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); public static native long COption_AccessZ_some(long o); // struct LDKCOption_AccessZ COption_AccessZ_none(void); @@ -2087,6 +2173,14 @@ public class bindings { public static native void CResult_NetworkGraphDecodeErrorZ_free(long _res); // struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_NetworkGraphDecodeErrorZ_clone(long orig); + // struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); + public static native long COption_CVec_NetAddressZZ_some(long[] o); + // struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); + public static native long COption_CVec_NetAddressZZ_none(); + // void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); + public static native void COption_CVec_NetAddressZZ_free(long _res); + // struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); + public static native long COption_CVec_NetAddressZZ_clone(long orig); // struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o); public static native long CResult_NetAddressu8Z_ok(long o); // struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e); @@ -2389,6 +2483,14 @@ public class bindings { public static native long COption_FilterZ_none(); // void COption_FilterZ_free(struct LDKCOption_FilterZ _res); public static native void COption_FilterZ_free(long _res); + // struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); + public static native long CResult_LockedChannelMonitorNoneZ_ok(long o); + // struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); + public static native long CResult_LockedChannelMonitorNoneZ_err(); + // void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); + public static native void CResult_LockedChannelMonitorNoneZ_free(long _res); + // void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); + public static native void CVec_OutPointZ_free(long[] _res); // void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); public static native void PaymentPurpose_free(long this_ptr); // struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); @@ -2425,18 +2527,20 @@ public class bindings { public static native long Event_funding_generation_ready(byte[] temporary_channel_id, long channel_value_satoshis, byte[] output_script, long user_channel_id); // struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose); public static native long Event_payment_received(byte[] payment_hash, long amt, long purpose); - // struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage); - public static native long Event_payment_sent(byte[] payment_preimage); - // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path); - public static native long Event_payment_path_failed(byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path); + // struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash); + public static native long Event_payment_sent(byte[] payment_preimage, byte[] payment_hash); + // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id); + public static native long Event_payment_path_failed(byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path, long short_channel_id); // struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); public static native long Event_pending_htlcs_forwardable(long time_forwardable); // struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); public static native long Event_spendable_outputs(long[] outputs); // struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx); public static native long Event_payment_forwarded(long fee_earned_msat, boolean claim_from_onchain_tx); - // struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKClosureReason reason); - public static native long Event_channel_closed(byte[] channel_id, long reason); + // struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason); + public static native long Event_channel_closed(byte[] channel_id, long user_channel_id, long reason); + // struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); + public static native long Event_discard_funding(byte[] channel_id, byte[] transaction); // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); public static native byte[] Event_write(long obj); // void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); @@ -2677,6 +2781,12 @@ public class bindings { public static native void Listen_free(long this_ptr); // void Confirm_free(struct LDKConfirm this_ptr); public static native void Confirm_free(long this_ptr); + // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); + public static native ChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(long orig); + // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void); + public static native ChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(); + // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void); + public static native ChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(); // void Watch_free(struct LDKWatch this_ptr); public static native void Watch_free(long this_ptr); // void Filter_free(struct LDKFilter this_ptr); @@ -2715,12 +2825,20 @@ public class bindings { public static native boolean ConfirmationTarget_eq(long a, long b); // void FeeEstimator_free(struct LDKFeeEstimator this_ptr); public static native void FeeEstimator_free(long this_ptr); + // void Persist_free(struct LDKPersist this_ptr); + public static native void Persist_free(long this_ptr); + // void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj); + public static native void LockedChannelMonitor_free(long this_obj); // void ChainMonitor_free(struct LDKChainMonitor this_obj); public static native void ChainMonitor_free(long this_obj); // MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); public static native long ChainMonitor_new(long chain_source, long broadcaster, long logger, long feeest, long persister); // MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels); public static native long[] ChainMonitor_get_claimable_balances(long this_arg, long[] ignored_channels); + // MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo); + public static native long ChainMonitor_get_monitor(long this_arg, long funding_txo); + // MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); + public static native long[] ChainMonitor_list_monitors(long this_arg); // struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); public static native long ChainMonitor_as_Listen(long this_arg); // struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg); @@ -2741,12 +2859,6 @@ public class bindings { public static native byte[] ChannelMonitorUpdate_write(long obj); // struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); public static native long ChannelMonitorUpdate_read(byte[] ser); - // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); - public static native ChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(long orig); - // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void); - public static native ChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(); - // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void); - public static native ChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(); // void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj); public static native void MonitorUpdateError_free(long this_obj); // struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig); @@ -2819,8 +2931,6 @@ public class bindings { public static native long ChannelMonitor_current_best_block(long this_arg); // MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg); public static native long[] ChannelMonitor_get_claimable_balances(long this_arg); - // void Persist_free(struct LDKPersist this_ptr); - public static native void Persist_free(long this_ptr); // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); public static native long C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, long arg); // void OutPoint_free(struct LDKOutPoint this_obj); @@ -2993,6 +3103,18 @@ public class bindings { public static native long KeysManager_spend_spendable_outputs(long this_arg, long[] descriptors, long[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight); // struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); public static native long KeysManager_as_KeysInterface(long this_arg); + // void PaymentId_free(struct LDKPaymentId this_obj); + public static native void PaymentId_free(long this_obj); + // uint64_t PaymentId_hash(const struct LDKPaymentId *NONNULL_PTR o); + public static native long PaymentId_hash(long o); + // struct LDKPaymentId PaymentId_clone(const struct LDKPaymentId *NONNULL_PTR orig); + public static native long PaymentId_clone(long orig); + // bool PaymentId_eq(const struct LDKPaymentId *NONNULL_PTR a, const struct LDKPaymentId *NONNULL_PTR b); + public static native boolean PaymentId_eq(long a, long b); + // struct LDKCVec_u8Z PaymentId_write(const struct LDKPaymentId *NONNULL_PTR obj); + public static native byte[] PaymentId_write(long obj); + // struct LDKCResult_PaymentIdDecodeErrorZ PaymentId_read(struct LDKu8slice ser); + public static native long PaymentId_read(byte[] ser); // void ChannelManager_free(struct LDKChannelManager this_obj); public static native void ChannelManager_free(long this_obj); // void ChainParameters_free(struct LDKChainParameters this_obj); @@ -3075,10 +3197,10 @@ public class bindings { public static native long ChannelDetails_get_unspendable_punishment_reserve(long this_ptr); // void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); public static native void ChannelDetails_set_unspendable_punishment_reserve(long this_ptr, long val); - // uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); - public static native long ChannelDetails_get_user_id(long this_ptr); - // void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); - public static native void ChannelDetails_set_user_id(long this_ptr, long val); + // uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + public static native long ChannelDetails_get_user_channel_id(long this_ptr); + // void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); + public static native void ChannelDetails_set_user_channel_id(long this_ptr, long val); // uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); public static native long ChannelDetails_get_outbound_capacity_msat(long this_ptr); // void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); @@ -3111,8 +3233,8 @@ 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_id_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_id_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 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 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 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); // struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); public static native long ChannelDetails_clone(long orig); // void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); @@ -3131,8 +3253,8 @@ public class bindings { public static native long ChannelManager_new(long fee_est, long chain_monitor, long tx_broadcaster, long logger, long keys_manager, long config, long params); // MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_get_current_default_configuration(long this_arg); - // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config); - public static native long ChannelManager_create_channel(long this_arg, byte[] their_network_key, long channel_value_satoshis, long push_msat, long user_id, long override_config); + // MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_channel_id, struct LDKUserConfig override_config); + public static native long ChannelManager_create_channel(long this_arg, byte[] their_network_key, long channel_value_satoshis, long push_msat, long user_channel_id, long override_config); // MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long[] ChannelManager_list_channels(long this_arg); // MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -3145,9 +3267,11 @@ public class bindings { public static native long ChannelManager_force_close_channel(long this_arg, byte[] channel_id); // void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native void ChannelManager_force_close_all_channels(long this_arg); - // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); + // MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); public static native long ChannelManager_send_payment(long this_arg, long route, byte[] payment_hash, byte[] payment_secret); - // MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); + // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKPaymentId payment_id); + public static native long ChannelManager_retry_payment(long this_arg, long route, long payment_id); + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); public static native long ChannelManager_send_spontaneous_payment(long this_arg, long route, byte[] payment_preimage); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction); public static native long ChannelManager_funding_transaction_generated(long this_arg, byte[] temporary_channel_id, byte[] funding_transaction); @@ -4547,10 +4671,6 @@ public class bindings { public static native byte[] ShutdownScript_write(long obj); // struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); public static native long ShutdownScript_read(byte[] ser); - // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]); - public static native long ShutdownScript_new_p2pkh(byte[] pubkey_hash); - // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]); - public static native long ShutdownScript_new_p2sh(byte[] script_hash); // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); public static native long ShutdownScript_new_p2wpkh(byte[] pubkey_hash); // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); @@ -4569,112 +4689,22 @@ public class bindings { public static native long Type_clone(long orig); // void Type_free(struct LDKType this_ptr); public static native void Type_free(long this_ptr); - // void RouteHop_free(struct LDKRouteHop this_obj); - public static native void RouteHop_free(long this_obj); - // struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); - public static native byte[] RouteHop_get_pubkey(long this_ptr); - // void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void RouteHop_set_pubkey(long this_ptr, byte[] val); - // struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); - public static native long RouteHop_get_node_features(long this_ptr); - // void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); - public static native void RouteHop_set_node_features(long this_ptr, long val); - // uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); - public static native long RouteHop_get_short_channel_id(long this_ptr); - // void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); - public static native void RouteHop_set_short_channel_id(long this_ptr, long val); - // struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); - public static native long RouteHop_get_channel_features(long this_ptr); - // void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); - public static native void RouteHop_set_channel_features(long this_ptr, long val); - // uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); - public static native long RouteHop_get_fee_msat(long this_ptr); - // void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); - public static native void RouteHop_set_fee_msat(long this_ptr, long val); - // uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); - public static native int RouteHop_get_cltv_expiry_delta(long this_ptr); - // void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); - public static native void RouteHop_set_cltv_expiry_delta(long this_ptr, int val); - // MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); - public static native long RouteHop_new(byte[] pubkey_arg, long node_features_arg, long short_channel_id_arg, long channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg); - // struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); - public static native long RouteHop_clone(long orig); - // uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); - public static native long RouteHop_hash(long o); - // bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); - public static native boolean RouteHop_eq(long a, long b); - // struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); - public static native byte[] RouteHop_write(long obj); - // struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); - public static native long RouteHop_read(byte[] ser); - // void Route_free(struct LDKRoute this_obj); - public static native void Route_free(long this_obj); - // struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); - public static native long[][] Route_get_paths(long this_ptr); - // void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); - public static native void Route_set_paths(long this_ptr, long[][] val); - // MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg); - public static native long Route_new(long[][] paths_arg); - // struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); - public static native long Route_clone(long orig); - // uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); - public static native long Route_hash(long o); - // bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); - public static native boolean Route_eq(long a, long b); - // MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); - public static native long Route_get_total_fees(long this_arg); - // MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); - public static native long Route_get_total_amount(long this_arg); - // struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); - public static native byte[] Route_write(long obj); - // struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); - public static native long Route_read(byte[] ser); - // void RouteHint_free(struct LDKRouteHint this_obj); - public static native void RouteHint_free(long this_obj); - // struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); - public static native long RouteHint_clone(long orig); - // uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); - public static native long RouteHint_hash(long o); - // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); - public static native boolean RouteHint_eq(long a, long b); - // void RouteHintHop_free(struct LDKRouteHintHop this_obj); - public static native void RouteHintHop_free(long this_obj); - // struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - public static native byte[] RouteHintHop_get_src_node_id(long this_ptr); - // void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void RouteHintHop_set_src_node_id(long this_ptr, byte[] val); - // uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - public static native long RouteHintHop_get_short_channel_id(long this_ptr); - // void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); - public static native void RouteHintHop_set_short_channel_id(long this_ptr, long val); - // struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - public static native long RouteHintHop_get_fees(long this_ptr); - // void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - public static native void RouteHintHop_set_fees(long this_ptr, long val); - // uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - public static native short RouteHintHop_get_cltv_expiry_delta(long this_ptr); - // void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); - public static native void RouteHintHop_set_cltv_expiry_delta(long this_ptr, short val); - // struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - public static native long RouteHintHop_get_htlc_minimum_msat(long this_ptr); - // void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - public static native void RouteHintHop_set_htlc_minimum_msat(long this_ptr, long val); - // struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - public static native long RouteHintHop_get_htlc_maximum_msat(long this_ptr); - // void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - public static native void RouteHintHop_set_htlc_maximum_msat(long this_ptr, long val); - // MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); - public static native long RouteHintHop_new(byte[] src_node_id_arg, long short_channel_id_arg, long fees_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg); - // struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); - public static native long RouteHintHop_clone(long orig); - // uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); - public static native long RouteHintHop_hash(long o); - // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); - public static native boolean RouteHintHop_eq(long a, long b); - // struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); - public static native long get_keysend_route(byte[] our_node_id, long network, byte[] payee, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger); - // struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); - public static native long get_route(byte[] our_node_id, long network, byte[] payee, long payee_features, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger); + // void Score_free(struct LDKScore this_ptr); + public static native void Score_free(long this_ptr); + // void NodeId_free(struct LDKNodeId this_obj); + public static native void NodeId_free(long this_obj); + // struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); + public static native long NodeId_clone(long orig); + // MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); + public static native long NodeId_from_pubkey(byte[] pubkey); + // MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); + public static native byte[] NodeId_as_slice(long this_arg); + // uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); + public static native long NodeId_hash(long o); + // struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); + public static native byte[] NodeId_write(long obj); + // struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); + public static native long NodeId_read(byte[] ser); // void NetworkGraph_free(struct LDKNetworkGraph this_obj); public static native void NetworkGraph_free(long this_obj); // struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); @@ -4753,18 +4783,18 @@ public class bindings { public static native long ChannelInfo_get_features(long this_ptr); // void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); public static native void ChannelInfo_set_features(long this_ptr, long val); - // struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - public static native byte[] ChannelInfo_get_node_one(long this_ptr); - // void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void ChannelInfo_set_node_one(long this_ptr, byte[] val); + // struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + public static native long ChannelInfo_get_node_one(long this_ptr); + // void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); + public static native void ChannelInfo_set_node_one(long this_ptr, long val); // struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); public static native long ChannelInfo_get_one_to_two(long this_ptr); // void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); public static native void ChannelInfo_set_one_to_two(long this_ptr, long val); - // struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - public static native byte[] ChannelInfo_get_node_two(long this_ptr); - // void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); - public static native void ChannelInfo_set_node_two(long this_ptr, byte[] val); + // struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + public static native long ChannelInfo_get_node_two(long this_ptr); + // void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); + public static native void ChannelInfo_set_node_two(long this_ptr, long val); // struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); public static native long ChannelInfo_get_two_to_one(long this_ptr); // void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); @@ -4777,8 +4807,8 @@ public class bindings { public static native long ChannelInfo_get_announcement_message(long this_ptr); // void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); public static native void ChannelInfo_set_announcement_message(long this_ptr, long val); - // MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKPublicKey node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKPublicKey node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); - public static native long ChannelInfo_new(long features_arg, byte[] node_one_arg, long one_to_two_arg, byte[] node_two_arg, long two_to_one_arg, long capacity_sats_arg, long announcement_message_arg); + // MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); + public static native long ChannelInfo_new(long features_arg, long node_one_arg, long one_to_two_arg, long node_two_arg, long two_to_one_arg, long capacity_sats_arg, long announcement_message_arg); // struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); public static native long ChannelInfo_clone(long orig); // struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); @@ -4883,6 +4913,122 @@ public class bindings { public static native long NetworkGraph_update_channel(long this_arg, long msg); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); public static native long NetworkGraph_update_channel_unsigned(long this_arg, long msg); + // MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); + public static native long ReadOnlyNetworkGraph_get_addresses(long this_arg, byte[] pubkey); + // void RouteHop_free(struct LDKRouteHop this_obj); + public static native void RouteHop_free(long this_obj); + // struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); + public static native byte[] RouteHop_get_pubkey(long this_ptr); + // void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); + public static native void RouteHop_set_pubkey(long this_ptr, byte[] val); + // struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); + public static native long RouteHop_get_node_features(long this_ptr); + // void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); + public static native void RouteHop_set_node_features(long this_ptr, long val); + // uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); + public static native long RouteHop_get_short_channel_id(long this_ptr); + // void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); + public static native void RouteHop_set_short_channel_id(long this_ptr, long val); + // struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); + public static native long RouteHop_get_channel_features(long this_ptr); + // void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); + public static native void RouteHop_set_channel_features(long this_ptr, long val); + // uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); + public static native long RouteHop_get_fee_msat(long this_ptr); + // void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); + public static native void RouteHop_set_fee_msat(long this_ptr, long val); + // uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); + public static native int RouteHop_get_cltv_expiry_delta(long this_ptr); + // void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); + public static native void RouteHop_set_cltv_expiry_delta(long this_ptr, int val); + // MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); + public static native long RouteHop_new(byte[] pubkey_arg, long node_features_arg, long short_channel_id_arg, long channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg); + // struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); + public static native long RouteHop_clone(long orig); + // uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); + public static native long RouteHop_hash(long o); + // bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); + public static native boolean RouteHop_eq(long a, long b); + // struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); + public static native byte[] RouteHop_write(long obj); + // struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); + public static native long RouteHop_read(byte[] ser); + // void Route_free(struct LDKRoute this_obj); + public static native void Route_free(long this_obj); + // struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); + public static native long[][] Route_get_paths(long this_ptr); + // void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); + public static native void Route_set_paths(long this_ptr, long[][] val); + // MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg); + public static native long Route_new(long[][] paths_arg); + // struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); + public static native long Route_clone(long orig); + // uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); + public static native long Route_hash(long o); + // bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); + public static native boolean Route_eq(long a, long b); + // MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); + public static native long Route_get_total_fees(long this_arg); + // MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); + public static native long Route_get_total_amount(long this_arg); + // struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); + public static native byte[] Route_write(long obj); + // struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); + public static native long Route_read(byte[] ser); + // void RouteHint_free(struct LDKRouteHint this_obj); + public static native void RouteHint_free(long this_obj); + // struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); + public static native long RouteHint_clone(long orig); + // uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); + public static native long RouteHint_hash(long o); + // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); + public static native boolean RouteHint_eq(long a, long b); + // void RouteHintHop_free(struct LDKRouteHintHop this_obj); + public static native void RouteHintHop_free(long this_obj); + // struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + public static native byte[] RouteHintHop_get_src_node_id(long this_ptr); + // void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); + public static native void RouteHintHop_set_src_node_id(long this_ptr, byte[] val); + // uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + public static native long RouteHintHop_get_short_channel_id(long this_ptr); + // void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); + public static native void RouteHintHop_set_short_channel_id(long this_ptr, long val); + // struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + public static native long RouteHintHop_get_fees(long this_ptr); + // void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); + public static native void RouteHintHop_set_fees(long this_ptr, long val); + // uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + public static native short RouteHintHop_get_cltv_expiry_delta(long this_ptr); + // void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); + public static native void RouteHintHop_set_cltv_expiry_delta(long this_ptr, short val); + // struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + public static native long RouteHintHop_get_htlc_minimum_msat(long this_ptr); + // void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + public static native void RouteHintHop_set_htlc_minimum_msat(long this_ptr, long val); + // struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + public static native long RouteHintHop_get_htlc_maximum_msat(long this_ptr); + // void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + public static native void RouteHintHop_set_htlc_maximum_msat(long this_ptr, long val); + // MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); + public static native long RouteHintHop_new(byte[] src_node_id_arg, long short_channel_id_arg, long fees_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg); + // struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); + public static native long RouteHintHop_clone(long orig); + // uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); + public static native long RouteHintHop_hash(long o); + // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); + public static native boolean RouteHintHop_eq(long a, long b); + // struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); + public static native long get_keysend_route(byte[] our_node_pubkey, long network, byte[] payee, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger, long scorer); + // struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); + public static native long get_route(byte[] our_node_pubkey, long network, byte[] payee, long payee_features, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger, long scorer); + // void Scorer_free(struct LDKScorer this_obj); + public static native void Scorer_free(long this_obj); + // MUST_USE_RES struct LDKScorer Scorer_new(uint64_t base_penalty_msat); + public static native long Scorer_new(long base_penalty_msat); + // MUST_USE_RES struct LDKScorer Scorer_default(void); + public static native long Scorer_default(); + // struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg); + public static native long Scorer_as_Score(long this_arg); // 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); diff --git a/src/main/java/org/ldk/structs/ChainMonitor.java b/src/main/java/org/ldk/structs/ChainMonitor.java index 8050ecdf..69d1c7ca 100644 --- a/src/main/java/org/ldk/structs/ChainMonitor.java +++ b/src/main/java/org/ldk/structs/ChainMonitor.java @@ -71,6 +71,38 @@ public class ChainMonitor extends CommonBase { return ret_conv_9_arr; } + /** + * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no + * such [`ChannelMonitor`] is currently being monitored for. + * + * Note that the result holds a mutex over our monitor set, and should not be held + * indefinitely. + */ + public Result_LockedChannelMonitorNoneZ get_monitor(OutPoint funding_txo) { + long ret = bindings.ChainMonitor_get_monitor(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Lists the funding outpoint of each [`ChannelMonitor`] being monitored. + * + * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always + * monitoring for on-chain state resolutions. + */ + public OutPoint[] list_monitors() { + long[] ret = bindings.ChainMonitor_list_monitors(this.ptr); + OutPoint[] ret_conv_10_arr = new OutPoint[ret.length]; + for (int k = 0; k < ret.length; k++) { + long ret_conv_10 = ret[k]; + OutPoint ret_conv_10_hu_conv = new OutPoint(null, ret_conv_10); + ret_conv_10_hu_conv.ptrs_to.add(this); + ret_conv_10_arr[k] = ret_conv_10_hu_conv; + } + return ret_conv_10_arr; + } + /** * Constructs a new Listen which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is diff --git a/src/main/java/org/ldk/structs/ChannelDetails.java b/src/main/java/org/ldk/structs/ChannelDetails.java index 81b4c1a7..878fe31a 100644 --- a/src/main/java/org/ldk/structs/ChannelDetails.java +++ b/src/main/java/org/ldk/structs/ChannelDetails.java @@ -159,18 +159,18 @@ public class ChannelDetails extends CommonBase { } /** - * The user_id passed in to create_channel, or 0 if the channel was inbound. + * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. */ - public long get_user_id() { - long ret = bindings.ChannelDetails_get_user_id(this.ptr); + public long get_user_channel_id() { + long ret = bindings.ChannelDetails_get_user_channel_id(this.ptr); return ret; } /** - * The user_id passed in to create_channel, or 0 if the channel was inbound. + * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. */ - public void set_user_id(long val) { - bindings.ChannelDetails_set_user_id(this.ptr, val); + public void set_user_channel_id(long val) { + bindings.ChannelDetails_set_user_channel_id(this.ptr, val); } /** @@ -382,8 +382,8 @@ 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_id_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(channel_id_arg, 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_id_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, Option_u64Z short_channel_id_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_channel_id_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(channel_id_arg, 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, 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); if (ret >= 0 && ret < 1024) { return null; } ChannelDetails ret_hu_conv = new ChannelDetails(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 c1053596..5266faed 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -41,16 +41,19 @@ public class ChannelInfo extends CommonBase { /** * Source node of the first direction of a channel */ - public byte[] get_node_one() { - byte[] ret = bindings.ChannelInfo_get_node_one(this.ptr); - return ret; + public NodeId get_node_one() { + long ret = bindings.ChannelInfo_get_node_one(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + NodeId ret_hu_conv = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } /** * Source node of the first direction of a channel */ - public void set_node_one(byte[] val) { - bindings.ChannelInfo_set_node_one(this.ptr, val); + public void set_node_one(NodeId val) { + bindings.ChannelInfo_set_node_one(this.ptr, val == null ? 0 : val.ptr & ~1); } /** @@ -79,16 +82,19 @@ public class ChannelInfo extends CommonBase { /** * Source node of the second direction of a channel */ - public byte[] get_node_two() { - byte[] ret = bindings.ChannelInfo_get_node_two(this.ptr); - return ret; + public NodeId get_node_two() { + long ret = bindings.ChannelInfo_get_node_two(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + NodeId ret_hu_conv = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } /** * Source node of the second direction of a channel */ - public void set_node_two(byte[] val) { - bindings.ChannelInfo_set_node_two(this.ptr, val); + public void set_node_two(NodeId val) { + bindings.ChannelInfo_set_node_two(this.ptr, val == null ? 0 : val.ptr & ~1); } /** @@ -164,8 +170,8 @@ public class ChannelInfo extends CommonBase { /** * Constructs a new ChannelInfo given each field */ - public static ChannelInfo of(ChannelFeatures features_arg, byte[] node_one_arg, DirectionalChannelInfo one_to_two_arg, byte[] node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) { - long ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); + public static ChannelInfo of(ChannelFeatures features_arg, NodeId node_one_arg, DirectionalChannelInfo one_to_two_arg, NodeId node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) { + long ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg == null ? 0 : node_one_arg.ptr & ~1, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg == null ? 0 : node_two_arg.ptr & ~1, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); if (ret >= 0 && ret < 1024) { return null; } ChannelInfo ret_hu_conv = new ChannelInfo(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index eb072594..9359cfb8 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -95,28 +95,37 @@ public class ChannelManager extends CommonBase { /** * Creates a new outbound channel to the given remote node and with the given value. * - * user_id will be provided back as user_channel_id in FundingGenerationReady events to allow - * tracking of which events correspond with which create_channel call. Note that the - * user_channel_id defaults to 0 for inbound channels, so you may wish to avoid using 0 for - * user_id here. user_id has no meaning inside of LDK, it is simply copied to events and - * otherwise ignored. + * `user_channel_id` will be provided back as in + * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events + * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0 + * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here. + * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise + * ignored. * - * If successful, will generate a SendOpenChannel message event, so you should probably poll - * PeerManager::process_events afterwards. - * - * Raises APIError::APIMisuseError when channel_value_satoshis > 2**24 or push_msat is - * greater than channel_value_satoshis * 1k or channel_value_satoshis is < 1000. + * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is + * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. * * Note that we do not check if you are currently connected to the given peer. If no * connection is available, the outbound `open_channel` message may fail to send, resulting in - * the channel eventually being silently forgotten. + * the channel eventually being silently forgotten (dropped on reload). + * + * Returns the new Channel's temporary `channel_id`. This ID will appear as + * [`Event::FundingGenerationReady::temporary_channel_id`] and in + * [`ChannelDetails::channel_id`] until after + * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for + * one derived from the funding transaction's TXID. If the counterparty rejects the channel + * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. + * + * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id + * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id + * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id * * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Result_NoneAPIErrorZ create_channel(byte[] their_network_key, long channel_value_satoshis, long push_msat, long user_id, @Nullable UserConfig override_config) { - long ret = bindings.ChannelManager_create_channel(this.ptr, their_network_key, channel_value_satoshis, push_msat, user_id, override_config == null ? 0 : override_config.ptr & ~1); + public Result__u832APIErrorZ create_channel(byte[] their_network_key, long channel_value_satoshis, long push_msat, long user_channel_id, @Nullable UserConfig override_config) { + long ret = bindings.ChannelManager_create_channel(this.ptr, their_network_key, channel_value_satoshis, push_msat, user_channel_id, override_config == null ? 0 : override_config.ptr & ~1); if (ret >= 0 && ret < 1024) { return null; } - Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -272,9 +281,27 @@ public class ChannelManager extends CommonBase { * * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Result_NonePaymentSendFailureZ send_payment(Route route, byte[] payment_hash, @Nullable byte[] payment_secret) { + public Result_PaymentIdPaymentSendFailureZ send_payment(Route route, byte[] payment_hash, @Nullable byte[] payment_secret) { long ret = bindings.ChannelManager_send_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_hash, payment_secret); if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + this.ptrs_to.add(route); + return ret_hu_conv; + } + + /** + * Retries a payment along the given [`Route`]. + * + * Errors returned are a superset of those returned from [`send_payment`], so see + * [`send_payment`] documentation for more details on errors. This method will also error if the + * retry amount puts the payment more than 10% over the payment's total amount, or if the payment + * for the given `payment_id` cannot be found (likely due to timeout or success). + * + * [`send_payment`]: [`ChannelManager::send_payment`] + */ + public Result_NonePaymentSendFailureZ retry_payment(Route route, PaymentId payment_id) { + long ret = bindings.ChannelManager_retry_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_id == null ? 0 : payment_id.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); return ret_hu_conv; @@ -298,10 +325,10 @@ public class ChannelManager extends CommonBase { * * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Result_PaymentHashPaymentSendFailureZ send_spontaneous_payment(Route route, @Nullable byte[] payment_preimage) { + public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_spontaneous_payment(Route route, @Nullable byte[] payment_preimage) { long ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_preimage); if (ret >= 0 && ret < 1024) { return null; } - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); 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 3a62005b..8d0a0364 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -48,6 +48,9 @@ public class Event extends CommonBase { if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) { return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val); } + if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) { + return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -66,7 +69,10 @@ public class Event extends CommonBase { */ public final byte[] output_script; /** - * The value passed in to ChannelManager::create_channel + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for + * an inbound channel. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel */ public final long user_channel_id; private FundingGenerationReady(long ptr, bindings.LDKEvent.FundingGenerationReady obj) { @@ -83,9 +89,7 @@ public class Event extends CommonBase { */ public final byte[] payment_hash; /** - * The value, in thousandths of a satoshi, that this payment is for. Note that you must - * compare this to the expected value before accepting the payment (as otherwise you are - * providing proof-of-payment for less than the value you expected!). + * The value, in thousandths of a satoshi, that this payment is for. */ public final long amt; /** @@ -110,9 +114,16 @@ public class Event extends CommonBase { * store it somehow! */ public final byte[] payment_preimage; + /** + * The hash which was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + public final byte[] payment_hash; private PaymentSent(long ptr, bindings.LDKEvent.PaymentSent obj) { super(null, ptr); this.payment_preimage = obj.payment_preimage; + this.payment_hash = obj.payment_hash; } } public final static class PaymentPathFailed extends Event { @@ -147,6 +158,13 @@ public class Event extends CommonBase { * The payment path that failed. */ public final RouteHop[] path; + /** + * The channel responsible for the failed payment path. + * + * 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; private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) { super(null, ptr); this.payment_hash = obj.payment_hash; @@ -165,6 +183,10 @@ public class Event extends CommonBase { path_conv_10_arr[k] = path_conv_10_hu_conv; } 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); + short_channel_id_hu_conv.ptrs_to.add(this); + this.short_channel_id = short_channel_id_hu_conv; } } public final static class PendingHTLCsForwardable extends Event { @@ -235,6 +257,14 @@ public class Event extends CommonBase { * resolving the channel are likely still awaiting confirmation. */ 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. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + */ + public final long user_channel_id; /** * The reason the channel was closed. */ @@ -242,12 +272,28 @@ public class Event extends CommonBase { 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); reason_hu_conv.ptrs_to.add(this); this.reason = reason_hu_conv; } } + public final static class DiscardFunding extends Event { + /** + * The channel_id of the channel which has been closed. + */ + public final byte[] channel_id; + /** + * The full transaction received from the user + */ + public final byte[] transaction; + private DiscardFunding(long ptr, bindings.LDKEvent.DiscardFunding obj) { + super(null, ptr); + this.channel_id = obj.channel_id; + this.transaction = obj.transaction; + } + } /** * Creates a copy of the Event */ @@ -284,8 +330,8 @@ public class Event extends CommonBase { /** * Utility method to constructs a new PaymentSent-variant Event */ - public static Event payment_sent(byte[] payment_preimage) { - long ret = bindings.Event_payment_sent(payment_preimage); + public static Event payment_sent(byte[] payment_preimage, byte[] payment_hash) { + long ret = bindings.Event_payment_sent(payment_preimage, payment_hash); if (ret >= 0 && ret < 1024) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -295,8 +341,8 @@ public class Event extends CommonBase { /** * Utility method to constructs a new PaymentPathFailed-variant Event */ - public static Event payment_path_failed(byte[] payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path) { - long ret = bindings.Event_payment_path_failed(payment_hash, rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null); + public static Event payment_path_failed(byte[] payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, Option_u64Z short_channel_id) { + long ret = bindings.Event_payment_path_failed(payment_hash, rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null, short_channel_id.ptr); if (ret >= 0 && ret < 1024) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -339,8 +385,19 @@ public class Event extends CommonBase { /** * Utility method to constructs a new ChannelClosed-variant Event */ - public static Event channel_closed(byte[] channel_id, ClosureReason reason) { - long ret = bindings.Event_channel_closed(channel_id, reason.ptr); + public static Event channel_closed(byte[] channel_id, long user_channel_id, ClosureReason reason) { + long ret = bindings.Event_channel_closed(channel_id, user_channel_id, reason.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Event ret_hu_conv = Event.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new DiscardFunding-variant Event + */ + public static Event discard_funding(byte[] channel_id, byte[] transaction) { + long ret = bindings.Event_discard_funding(channel_id, transaction); if (ret >= 0 && ret < 1024) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java index bd754f79..1225210d 100644 --- a/src/main/java/org/ldk/structs/Filter.java +++ b/src/main/java/org/ldk/structs/Filter.java @@ -24,7 +24,7 @@ import javax.annotation.Nullable; * processed later. Then, in order to block until the data has been processed, any [`Watch`] * invocation that has called the `Filter` must return [`TemporaryFailure`]. * - * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure + * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki */ diff --git a/src/main/java/org/ldk/structs/LockedChannelMonitor.java b/src/main/java/org/ldk/structs/LockedChannelMonitor.java new file mode 100644 index 00000000..9aa5057e --- /dev/null +++ b/src/main/java/org/ldk/structs/LockedChannelMonitor.java @@ -0,0 +1,23 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + + +/** + * A read-only reference to a current ChannelMonitor. + * + * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is + * released. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class LockedChannelMonitor extends CommonBase implements AutoCloseable { + LockedChannelMonitor(Object _dummy, long ptr) { super(ptr); } + @Override public void close() { + if (ptr != 0) { bindings.LockedChannelMonitor_free(ptr); } + } + +} diff --git a/src/main/java/org/ldk/structs/NodeId.java b/src/main/java/org/ldk/structs/NodeId.java new file mode 100644 index 00000000..a878cb5a --- /dev/null +++ b/src/main/java/org/ldk/structs/NodeId.java @@ -0,0 +1,78 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + + +/** + * Represents the compressed public key of a node + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class NodeId extends CommonBase { + NodeId(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.NodeId_free(ptr); } + } + + /** + * Creates a copy of the NodeId + */ + public NodeId clone() { + long ret = bindings.NodeId_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + NodeId ret_hu_conv = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Create a new NodeId from a public key + */ + public static NodeId from_pubkey(byte[] pubkey) { + long ret = bindings.NodeId_from_pubkey(pubkey); + if (ret >= 0 && ret < 1024) { return null; } + NodeId ret_hu_conv = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Get the public key slice from this NodeId + */ + public byte[] as_slice() { + byte[] ret = bindings.NodeId_as_slice(this.ptr); + return ret; + } + + /** + * Checks if two NodeIds contain equal inner contents. + */ + public long hash() { + long ret = bindings.NodeId_hash(this.ptr); + return ret; + } + + /** + * Serialize the NodeId object into a byte array which can be read by NodeId_read + */ + public byte[] write() { + byte[] ret = bindings.NodeId_write(this.ptr); + return ret; + } + + /** + * Read a NodeId from a byte array, created by NodeId_write + */ + public static Result_NodeIdDecodeErrorZ read(byte[] ser) { + long ret = bindings.NodeId_read(ser); + if (ret >= 0 && ret < 1024) { return null; } + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + 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 new file mode 100644 index 00000000..22a38863 --- /dev/null +++ b/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.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 javax.annotation.Nullable; + + +/** + * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Option_CVec_NetAddressZZ extends CommonBase { + private Option_CVec_NetAddressZZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.COption_CVec_NetAddressZZ_free(ptr); } + } + static Option_CVec_NetAddressZZ constr_from_ptr(long ptr) { + bindings.LDKCOption_CVec_NetAddressZZ raw_val = bindings.LDKCOption_CVec_NetAddressZZ_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKCOption_CVec_NetAddressZZ.Some.class) { + return new Some(ptr, (bindings.LDKCOption_CVec_NetAddressZZ.Some)raw_val); + } + if (raw_val.getClass() == bindings.LDKCOption_CVec_NetAddressZZ.None.class) { + return new None(ptr, (bindings.LDKCOption_CVec_NetAddressZZ.None)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface + } + + public final static class Some extends Option_CVec_NetAddressZZ { + public final NetAddress[] some; + private Some(long ptr, bindings.LDKCOption_CVec_NetAddressZZ.Some obj) { + super(null, ptr); + long[] some = obj.some; + NetAddress[] some_conv_12_arr = new NetAddress[some.length]; + for (int m = 0; m < some.length; m++) { + long some_conv_12 = some[m]; + NetAddress some_conv_12_hu_conv = 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; + } + this.some = some_conv_12_arr; + } + } + public final static class None extends Option_CVec_NetAddressZZ { + private None(long ptr, bindings.LDKCOption_CVec_NetAddressZZ.None obj) { + super(null, ptr); + } + } + /** + * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ + */ + public static Option_CVec_NetAddressZZ some(NetAddress[] o) { + long ret = bindings.COption_CVec_NetAddressZZ_some(o != null ? Arrays.stream(o).mapToLong(o_conv_12 -> o_conv_12.ptr).toArray() : null); + if (ret >= 0 && ret < 1024) { return null; } + Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Constructs a new COption_CVec_NetAddressZZ containing nothing + */ + public static Option_CVec_NetAddressZZ none() { + long ret = bindings.COption_CVec_NetAddressZZ_none(); + if (ret >= 0 && ret < 1024) { return null; } + Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Option_CVec_NetAddressZZ clone() { + long ret = bindings.COption_CVec_NetAddressZZ_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Option_CVec_NetAddressZZ ret_hu_conv = 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/PaymentId.java b/src/main/java/org/ldk/structs/PaymentId.java new file mode 100644 index 00000000..21c1c75a --- /dev/null +++ b/src/main/java/org/ldk/structs/PaymentId.java @@ -0,0 +1,70 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + + +/** + * A payment identifier used to uniquely identify a payment to LDK. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class PaymentId extends CommonBase { + PaymentId(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.PaymentId_free(ptr); } + } + + /** + * Checks if two PaymentIds contain equal inner contents. + */ + public long hash() { + long ret = bindings.PaymentId_hash(this.ptr); + return ret; + } + + /** + * Creates a copy of the PaymentId + */ + public PaymentId clone() { + long ret = bindings.PaymentId_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + PaymentId ret_hu_conv = new PaymentId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Checks if two PaymentIds contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(PaymentId b) { + boolean ret = bindings.PaymentId_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + + /** + * Serialize the PaymentId object into a byte array which can be read by PaymentId_read + */ + public byte[] write() { + byte[] ret = bindings.PaymentId_write(this.ptr); + return ret; + } + + /** + * Read a PaymentId from a byte array, created by PaymentId_write + */ + public static Result_PaymentIdDecodeErrorZ read(byte[] ser) { + long ret = bindings.PaymentId_read(ser); + if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Persist.java b/src/main/java/org/ldk/structs/Persist.java index 1ed509f4..f424851a 100644 --- a/src/main/java/org/ldk/structs/Persist.java +++ b/src/main/java/org/ldk/structs/Persist.java @@ -41,8 +41,10 @@ public class Persist extends CommonBase { * stored channel data). Note that you **must** persist every new monitor to * disk. See the `Persist` trait documentation for more details. * - * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` * and [`ChannelMonitorUpdateErr`] for requirements when returning errors. + * + * [`Writeable::write`]: crate::util::ser::Writeable::write */ Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint id, ChannelMonitor data); /** @@ -65,9 +67,11 @@ public class Persist extends CommonBase { * them in batches. The size of each monitor grows `O(number of state updates)` * whereas updates are small and `O(1)`. * - * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, - * [`ChannelMonitorUpdate::write`] for writing out an update, and + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, + * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and * [`ChannelMonitorUpdateErr`] for requirements when returning errors. + * + * [`Writeable::write`]: crate::util::ser::Writeable::write */ Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint id, ChannelMonitorUpdate update, ChannelMonitor data); } @@ -102,8 +106,10 @@ public class Persist extends CommonBase { * stored channel data). Note that you **must** persist every new monitor to * disk. See the `Persist` trait documentation for more details. * - * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor` * and [`ChannelMonitorUpdateErr`] for requirements when returning errors. + * + * [`Writeable::write`]: crate::util::ser::Writeable::write */ public Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint id, ChannelMonitor data) { long ret = bindings.Persist_persist_new_channel(this.ptr, id == null ? 0 : id.ptr & ~1, data == null ? 0 : data.ptr & ~1); @@ -133,9 +139,11 @@ public class Persist extends CommonBase { * them in batches. The size of each monitor grows `O(number of state updates)` * whereas updates are small and `O(1)`. * - * See [`ChannelMonitor::write`] for writing out a `ChannelMonitor`, - * [`ChannelMonitorUpdate::write`] for writing out an update, and + * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`, + * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and * [`ChannelMonitorUpdateErr`] for requirements when returning errors. + * + * [`Writeable::write`]: crate::util::ser::Writeable::write */ public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint id, ChannelMonitorUpdate update, ChannelMonitor data) { long ret = bindings.Persist_update_persisted_channel(this.ptr, id == null ? 0 : id.ptr & ~1, update == null ? 0 : update.ptr & ~1, data == null ? 0 : data.ptr & ~1); diff --git a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java index ac1069d5..0938058c 100644 --- a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java +++ b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java @@ -19,4 +19,17 @@ public class ReadOnlyNetworkGraph extends CommonBase { if (ptr != 0) { bindings.ReadOnlyNetworkGraph_free(ptr); } } + /** + * Get network addresses by node id. + * Returns None if the requested node is completely unknown, + * or if node announcement for the node was never received. + */ + public Option_CVec_NetAddressZZ get_addresses(byte[] pubkey) { + long ret = bindings.ReadOnlyNetworkGraph_get_addresses(this.ptr, pubkey); + if (ret >= 0 && ret < 1024) { return null; } + Option_CVec_NetAddressZZ ret_hu_conv = 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 new file mode 100644 index 00000000..3e880b17 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java @@ -0,0 +1,75 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends CommonBase { + private Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(ptr); } super.finalize(); + } + + static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(ptr)) { + return new Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_OK(null, ptr); + } else { + return new Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_Err(null, ptr); + } + } + public static final class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_OK extends Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { + public final TwoTuple_PaymentHashPaymentIdZ res; + private Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(ptr); + TwoTuple_PaymentHashPaymentIdZ res_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_Err extends Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { + public final PaymentSendFailure err; + private Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(ptr); + PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. + */ + public static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ok(TwoTuple_PaymentHashPaymentIdZ o) { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o != null ? o.ptr : 0); + if (ret >= 0 && ret < 1024) { return null; } + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. + */ + public static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ err(PaymentSendFailure e) { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ clone() { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_LockedChannelMonitorNoneZ.java b/src/main/java/org/ldk/structs/Result_LockedChannelMonitorNoneZ.java new file mode 100644 index 00000000..cae81584 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_LockedChannelMonitorNoneZ.java @@ -0,0 +1,68 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +public class Result_LockedChannelMonitorNoneZ extends CommonBase { + private Result_LockedChannelMonitorNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_LockedChannelMonitorNoneZ_free(ptr); } super.finalize(); + } + + static Result_LockedChannelMonitorNoneZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_LockedChannelMonitorNoneZ_result_ok(ptr)) { + return new Result_LockedChannelMonitorNoneZ_OK(null, ptr); + } else { + return new Result_LockedChannelMonitorNoneZ_Err(null, ptr); + } + } + public static final class Result_LockedChannelMonitorNoneZ_OK extends Result_LockedChannelMonitorNoneZ { + public final LockedChannelMonitor res; + private Result_LockedChannelMonitorNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_LockedChannelMonitorNoneZ_get_ok(ptr); + LockedChannelMonitor res_hu_conv = new LockedChannelMonitor(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_LockedChannelMonitorNoneZ_Err extends Result_LockedChannelMonitorNoneZ { + private Result_LockedChannelMonitorNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + /** + * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. + */ + public static Result_LockedChannelMonitorNoneZ ok(LockedChannelMonitor o) { + long ret = bindings.CResult_LockedChannelMonitorNoneZ_ok(o == null ? 0 : o.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(o); + // Due to rust's strict-ownership memory model, in some cases we need to "move" + // an object to pass exclusive ownership to the function being called. + // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object + // at the FFI layer, creating a new object which Rust can claim ownership of + // However, in some cases (eg here), there is no way to clone an object, and thus + // we actually have to pass full ownership to Rust. + // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object. + o.ptr = 0; + return ret_hu_conv; + } + + /** + * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. + */ + public static Result_LockedChannelMonitorNoneZ err() { + long ret = bindings.CResult_LockedChannelMonitorNoneZ_err(); + if (ret >= 0 && ret < 1024) { return null; } + Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java new file mode 100644 index 00000000..70b17fe7 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java @@ -0,0 +1,75 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +public class Result_NodeIdDecodeErrorZ extends CommonBase { + private Result_NodeIdDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NodeIdDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_NodeIdDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_NodeIdDecodeErrorZ_result_ok(ptr)) { + return new Result_NodeIdDecodeErrorZ_OK(null, ptr); + } else { + return new Result_NodeIdDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_NodeIdDecodeErrorZ_OK extends Result_NodeIdDecodeErrorZ { + public final NodeId res; + private Result_NodeIdDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_NodeIdDecodeErrorZ_get_ok(ptr); + NodeId res_hu_conv = new NodeId(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_NodeIdDecodeErrorZ_Err extends Result_NodeIdDecodeErrorZ { + public final DecodeError err; + private Result_NodeIdDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_NodeIdDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_NodeIdDecodeErrorZ in the success state. + */ + public static Result_NodeIdDecodeErrorZ ok(NodeId o) { + long ret = bindings.CResult_NodeIdDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_NodeIdDecodeErrorZ in the error state. + */ + public static Result_NodeIdDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_NodeIdDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_NodeIdDecodeErrorZ clone() { + long ret = bindings.CResult_NodeIdDecodeErrorZ_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java deleted file mode 100644 index ef6af9d4..00000000 --- a/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import javax.annotation.Nullable; - -public class Result_PaymentHashPaymentSendFailureZ extends CommonBase { - private Result_PaymentHashPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_PaymentHashPaymentSendFailureZ_free(ptr); } super.finalize(); - } - - static Result_PaymentHashPaymentSendFailureZ constr_from_ptr(long ptr) { - if (bindings.LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(ptr)) { - return new Result_PaymentHashPaymentSendFailureZ_OK(null, ptr); - } else { - return new Result_PaymentHashPaymentSendFailureZ_Err(null, ptr); - } - } - public static final class Result_PaymentHashPaymentSendFailureZ_OK extends Result_PaymentHashPaymentSendFailureZ { - public final byte[] res; - private Result_PaymentHashPaymentSendFailureZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - this.res = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(ptr); - } - } - - public static final class Result_PaymentHashPaymentSendFailureZ_Err extends Result_PaymentHashPaymentSendFailureZ { - public final PaymentSendFailure err; - private Result_PaymentHashPaymentSendFailureZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_err(ptr); - PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. - */ - public static Result_PaymentHashPaymentSendFailureZ ok(byte[] o) { - long ret = bindings.CResult_PaymentHashPaymentSendFailureZ_ok(o); - if (ret >= 0 && ret < 1024) { return null; } - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. - */ - public static Result_PaymentHashPaymentSendFailureZ err(PaymentSendFailure e) { - long ret = bindings.CResult_PaymentHashPaymentSendFailureZ_err(e.ptr); - if (ret >= 0 && ret < 1024) { return null; } - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_PaymentHashPaymentSendFailureZ clone() { - long ret = bindings.CResult_PaymentHashPaymentSendFailureZ_clone(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_PaymentIdDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentIdDecodeErrorZ.java new file mode 100644 index 00000000..1ff2739b --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PaymentIdDecodeErrorZ.java @@ -0,0 +1,75 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +public class Result_PaymentIdDecodeErrorZ extends CommonBase { + private Result_PaymentIdDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentIdDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_PaymentIdDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PaymentIdDecodeErrorZ_result_ok(ptr)) { + return new Result_PaymentIdDecodeErrorZ_OK(null, ptr); + } else { + return new Result_PaymentIdDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_PaymentIdDecodeErrorZ_OK extends Result_PaymentIdDecodeErrorZ { + public final PaymentId res; + private Result_PaymentIdDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_PaymentIdDecodeErrorZ_get_ok(ptr); + PaymentId res_hu_conv = new PaymentId(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PaymentIdDecodeErrorZ_Err extends Result_PaymentIdDecodeErrorZ { + public final DecodeError err; + private Result_PaymentIdDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_PaymentIdDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_PaymentIdDecodeErrorZ in the success state. + */ + public static Result_PaymentIdDecodeErrorZ ok(PaymentId o) { + long ret = bindings.CResult_PaymentIdDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentIdDecodeErrorZ in the error state. + */ + public static Result_PaymentIdDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_PaymentIdDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentIdDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PaymentIdDecodeErrorZ clone() { + long ret = bindings.CResult_PaymentIdDecodeErrorZ_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java new file mode 100644 index 00000000..1bc352a9 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java @@ -0,0 +1,75 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { + private Result_PaymentIdPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentIdPaymentSendFailureZ_free(ptr); } super.finalize(); + } + + static Result_PaymentIdPaymentSendFailureZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(ptr)) { + return new Result_PaymentIdPaymentSendFailureZ_OK(null, ptr); + } else { + return new Result_PaymentIdPaymentSendFailureZ_Err(null, ptr); + } + } + public static final class Result_PaymentIdPaymentSendFailureZ_OK extends Result_PaymentIdPaymentSendFailureZ { + public final PaymentId res; + private Result_PaymentIdPaymentSendFailureZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(ptr); + PaymentId res_hu_conv = new PaymentId(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PaymentIdPaymentSendFailureZ_Err extends Result_PaymentIdPaymentSendFailureZ { + public final PaymentSendFailure err; + private Result_PaymentIdPaymentSendFailureZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_PaymentIdPaymentSendFailureZ_get_err(ptr); + PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. + */ + public static Result_PaymentIdPaymentSendFailureZ ok(PaymentId o) { + long ret = bindings.CResult_PaymentIdPaymentSendFailureZ_ok(o == null ? 0 : o.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. + */ + public static Result_PaymentIdPaymentSendFailureZ err(PaymentSendFailure e) { + long ret = bindings.CResult_PaymentIdPaymentSendFailureZ_err(e.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PaymentIdPaymentSendFailureZ clone() { + long ret = bindings.CResult_PaymentIdPaymentSendFailureZ_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java new file mode 100644 index 00000000..a0a3a22f --- /dev/null +++ b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java @@ -0,0 +1,72 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +public class Result__u832APIErrorZ extends CommonBase { + private Result__u832APIErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult__u832APIErrorZ_free(ptr); } super.finalize(); + } + + static Result__u832APIErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult__u832APIErrorZ_result_ok(ptr)) { + return new Result__u832APIErrorZ_OK(null, ptr); + } else { + return new Result__u832APIErrorZ_Err(null, ptr); + } + } + public static final class Result__u832APIErrorZ_OK extends Result__u832APIErrorZ { + public final byte[] res; + private Result__u832APIErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult__u832APIErrorZ_get_ok(ptr); + } + } + + public static final class Result__u832APIErrorZ_Err extends Result__u832APIErrorZ { + public final APIError err; + private Result__u832APIErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult__u832APIErrorZ_get_err(ptr); + APIError err_hu_conv = APIError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult__u832APIErrorZ in the success state. + */ + public static Result__u832APIErrorZ ok(byte[] o) { + long ret = bindings.CResult__u832APIErrorZ_ok(o); + if (ret >= 0 && ret < 1024) { return null; } + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult__u832APIErrorZ in the error state. + */ + public static Result__u832APIErrorZ err(APIError e) { + long ret = bindings.CResult__u832APIErrorZ_err(e.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult__u832APIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result__u832APIErrorZ clone() { + long ret = bindings.CResult__u832APIErrorZ_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Score.java b/src/main/java/org/ldk/structs/Score.java new file mode 100644 index 00000000..f7a0d95e --- /dev/null +++ b/src/main/java/org/ldk/structs/Score.java @@ -0,0 +1,53 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + +/** + * An interface used to score payment channels for path finding. + * + * \tScoring is in terms of fees willing to be paid in order to avoid routing through a channel. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Score extends CommonBase { + final bindings.LDKScore bindings_instance; + Score(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private Score(bindings.LDKScore arg) { + super(bindings.LDKScore_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.Score_free(ptr); } super.finalize(); + } + + public static interface ScoreInterface { + /** + * Returns the fee in msats willing to be paid to avoid routing through the given channel. + */ + long channel_penalty_msat(long short_channel_id); + } + private static class LDKScoreHolder { Score held; } + public static Score new_impl(ScoreInterface arg) { + final LDKScoreHolder impl_holder = new LDKScoreHolder(); + impl_holder.held = new Score(new bindings.LDKScore() { + @Override public long channel_penalty_msat(long short_channel_id) { + long ret = arg.channel_penalty_msat(short_channel_id); + return ret; + } + }); + return impl_holder.held; + } + /** + * Returns the fee in msats willing to be paid to avoid routing through the given channel. + */ + public long channel_penalty_msat(long short_channel_id) { + long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/Scorer.java b/src/main/java/org/ldk/structs/Scorer.java new file mode 100644 index 00000000..f1f8ecd5 --- /dev/null +++ b/src/main/java/org/ldk/structs/Scorer.java @@ -0,0 +1,63 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + + +/** + * [`routing::Score`] implementation that provides reasonable default behavior. + * + * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with + * slightly higher fees are available. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: crate::routing::scorer + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Scorer extends CommonBase { + Scorer(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.Scorer_free(ptr); } + } + + /** + * Creates a new scorer using `base_penalty_msat` as the channel penalty. + */ + public static Scorer of(long base_penalty_msat) { + long ret = bindings.Scorer_new(base_penalty_msat); + if (ret >= 0 && ret < 1024) { return null; } + Scorer ret_hu_conv = new Scorer(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used. + */ + public static Scorer with_default() { + long ret = bindings.Scorer_default(); + if (ret >= 0 && ret < 1024) { return null; } + Scorer ret_hu_conv = new Scorer(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Constructs a new Score which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is + */ + public Score as_Score() { + long ret = bindings.Scorer_as_Score(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + Score ret_hu_conv = new Score(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ShutdownScript.java b/src/main/java/org/ldk/structs/ShutdownScript.java index f63fed8a..5d19017c 100644 --- a/src/main/java/org/ldk/structs/ShutdownScript.java +++ b/src/main/java/org/ldk/structs/ShutdownScript.java @@ -50,28 +50,6 @@ public class ShutdownScript extends CommonBase { return ret_hu_conv; } - /** - * Generates a P2PKH script pubkey from the given [`PubkeyHash`]. - */ - public static ShutdownScript new_p2pkh(byte[] pubkey_hash) { - long ret = bindings.ShutdownScript_new_p2pkh(pubkey_hash); - if (ret >= 0 && ret < 1024) { return null; } - ShutdownScript ret_hu_conv = new ShutdownScript(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - /** - * Generates a P2SH script pubkey from the given [`ScriptHash`]. - */ - public static ShutdownScript new_p2sh(byte[] script_hash) { - long ret = bindings.ShutdownScript_new_p2sh(script_hash); - if (ret >= 0 && ret < 1024) { return null; } - ShutdownScript ret_hu_conv = new ShutdownScript(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - /** * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. */ diff --git a/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentIdZ.java b/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentIdZ.java new file mode 100644 index 00000000..3d8845b2 --- /dev/null +++ b/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentIdZ.java @@ -0,0 +1,64 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import javax.annotation.Nullable; + + +/** + * A Tuple + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class TwoTuple_PaymentHashPaymentIdZ extends CommonBase { + TwoTuple_PaymentHashPaymentIdZ(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.C2Tuple_PaymentHashPaymentIdZ_free(ptr); } + } + + /** + * + */ + public byte[] get_a() { + byte[] ret = bindings.C2Tuple_PaymentHashPaymentIdZ_get_a(this.ptr); + return ret; + } + + /** + * + */ + public PaymentId get_b() { + long ret = bindings.C2Tuple_PaymentHashPaymentIdZ_get_b(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + PaymentId ret_hu_conv = new PaymentId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public TwoTuple_PaymentHashPaymentIdZ clone() { + long ret = bindings.C2Tuple_PaymentHashPaymentIdZ_clone(this.ptr); + if (ret >= 0 && ret < 1024) { return null; } + TwoTuple_PaymentHashPaymentIdZ ret_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. + */ + public static TwoTuple_PaymentHashPaymentIdZ of(byte[] a, PaymentId b) { + long ret = bindings.C2Tuple_PaymentHashPaymentIdZ_new(a, b == null ? 0 : b.ptr & ~1); + if (ret >= 0 && ret < 1024) { return null; } + TwoTuple_PaymentHashPaymentIdZ ret_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + 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 9978b40e..ec9fda76 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -212,13 +212,14 @@ 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 get_keysend_route(byte[] our_node_id, NetworkGraph network, byte[] payee, @Nullable ChannelDetails[] first_hops, RouteHint[] last_hops, long final_value_msat, int final_cltv, Logger logger) { - long ret = bindings.get_keysend_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, 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, last_hops != null ? Arrays.stream(last_hops).mapToLong(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray() : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr); + public static Result_RouteLightningErrorZ get_keysend_route(byte[] our_node_pubkey, NetworkGraph network, byte[] payee, @Nullable ChannelDetails[] first_hops, RouteHint[] last_hops, long final_value_msat, int final_cltv, Logger logger, Score scorer) { + long ret = bindings.get_keysend_route(our_node_pubkey, network == null ? 0 : network.ptr & ~1, payee, 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, last_hops != null ? Arrays.stream(last_hops).mapToLong(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray() : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); if (ret >= 0 && ret < 1024) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(network); for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; ret_hu_conv.ptrs_to.add(logger); + ret_hu_conv.ptrs_to.add(scorer); return ret_hu_conv; } @@ -246,13 +247,14 @@ public class UtilMethods { * Note that payee_features (or a relevant inner pointer) may be NULL or all-0s to represent None * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public static Result_RouteLightningErrorZ get_route(byte[] our_node_id, NetworkGraph network, byte[] payee, @Nullable InvoiceFeatures payee_features, @Nullable ChannelDetails[] first_hops, RouteHint[] last_hops, long final_value_msat, int final_cltv, Logger logger) { - long ret = bindings.get_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, payee_features == null ? 0 : payee_features.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, last_hops != null ? Arrays.stream(last_hops).mapToLong(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray() : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr); + public static Result_RouteLightningErrorZ get_route(byte[] our_node_pubkey, NetworkGraph network, byte[] payee, @Nullable InvoiceFeatures payee_features, @Nullable ChannelDetails[] first_hops, RouteHint[] last_hops, long final_value_msat, int final_cltv, Logger logger, Score scorer) { + long ret = bindings.get_route(our_node_pubkey, network == null ? 0 : network.ptr & ~1, payee, payee_features == null ? 0 : payee_features.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, last_hops != null ? Arrays.stream(last_hops).mapToLong(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray() : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); if (ret >= 0 && ret < 1024) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(network); for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; ret_hu_conv.ptrs_to.add(logger); + ret_hu_conv.ptrs_to.add(scorer); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index 9bf7a603..11482c5d 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -25,9 +25,7 @@ import javax.annotation.Nullable; * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle * multiple instances. * - * [`ChannelMonitor`]: channelmonitor::ChannelMonitor - * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr - * [`PermanentFailure`]: channelmonitor::ChannelMonitorUpdateErr::PermanentFailure + * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Watch extends CommonBase { @@ -51,6 +49,9 @@ public class Watch extends CommonBase { * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means * calling [`block_connected`] and [`block_disconnected`] on the monitor. * + * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if + * the given `funding_txo` has previously been registered via `watch_channel`. + * * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected @@ -63,7 +64,6 @@ public class Watch extends CommonBase { * [`ChannelMonitorUpdateErr`] for invariants around returning an error. * * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor - * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr */ Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update); /** @@ -109,6 +109,9 @@ public class Watch extends CommonBase { * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means * calling [`block_connected`] and [`block_disconnected`] on the monitor. * + * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if + * the given `funding_txo` has previously been registered via `watch_channel`. + * * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected @@ -127,7 +130,6 @@ public class Watch extends CommonBase { * [`ChannelMonitorUpdateErr`] for invariants around returning an error. * * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor - * [`ChannelMonitorUpdateErr`]: channelmonitor::ChannelMonitorUpdateErr */ public Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) { long ret = bindings.Watch_update_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, update == null ? 0 : update.ptr & ~1); diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 19cad0eb..83b7eee5 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -3207,6 +3207,27 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1B jclass err_conv = LDKIOError_to_java(env, (*val->contents.err)); return err_conv; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} static jclass LDKCOption_u16Z_Some_class = NULL; static jmethodID LDKCOption_u16Z_Some_meth = NULL; static jclass LDKCOption_u16Z_None_class = NULL; @@ -3379,6 +3400,22 @@ static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *or } return ret; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult__u832APIErrorZ*)arg)->result_ok; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} static jclass LDKPaymentSendFailure_ParameterError_class = NULL; static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL; static jclass LDKPaymentSendFailure_PathParameterError_class = NULL; @@ -3456,6 +3493,24 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_ default: abort(); } } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok; } @@ -3470,18 +3525,57 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSend uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { - return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { + LDKC2Tuple_PaymentHashPaymentIdZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + LDKThirtyTwoBytes a_ref; + CHECK((*env)->GetArrayLength(env, a) == 32); + (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data); + ret->a = a_ref; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + ret->b = b_conv; + return (uint64_t)ret; +} +static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return ThirtyTwoBytes_clone(&tuple->a); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data); + return ret_arr; +} + +static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return PaymentId_clone(&tuple->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(val->result_ok); - int8_tArray res_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); - return res_arr; + LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv); + return ((uint64_t)res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(!val->result_ok); uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; @@ -5326,6 +5420,8 @@ static jclass LDKEvent_PaymentForwarded_class = NULL; static jmethodID LDKEvent_PaymentForwarded_meth = NULL; static jclass LDKEvent_ChannelClosed_class = NULL; static jmethodID LDKEvent_ChannelClosed_meth = NULL; +static jclass LDKEvent_DiscardFunding_class = NULL; +static jmethodID LDKEvent_DiscardFunding_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;")); @@ -5340,12 +5436,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_PaymentSent_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;")); CHECK(LDKEvent_PaymentSent_class != NULL); - LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B)V"); + LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B[B)V"); CHECK(LDKEvent_PaymentSent_meth != NULL); LDKEvent_PaymentPathFailed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;")); CHECK(LDKEvent_PaymentPathFailed_class != NULL); - LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([BZJZ[J)V"); + LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([BZJZ[JJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;")); @@ -5365,8 +5461,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_ChannelClosed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;")); CHECK(LDKEvent_ChannelClosed_class != NULL); - LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "", "([BJ)V"); + LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "", "([BJJ)V"); CHECK(LDKEvent_ChannelClosed_meth != NULL); + LDKEvent_DiscardFunding_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$DiscardFunding;")); + CHECK(LDKEvent_DiscardFunding_class != NULL); + LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "", "([B[B)V"); + CHECK(LDKEvent_DiscardFunding_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -5388,7 +5489,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN case LDKEvent_PaymentSent: { int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data); - return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data); + return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr, payment_hash_arr); } case LDKEvent_PaymentPathFailed: { int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); @@ -5405,7 +5508,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN path_arr_ptr[k] = path_conv_10_ref; } (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); - return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr); + uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1; + return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref); } case LDKEvent_PendingHTLCsForwardable: { return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable); @@ -5429,7 +5533,15 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data); uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1; - return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, reason_ref); + return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref); + } + case LDKEvent_DiscardFunding: { + int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data); + LDKTransaction transaction_var = obj->discard_funding.transaction; + int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen); + (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data); + return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr); } default: abort(); } @@ -5940,6 +6052,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleE uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKNodeId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} typedef struct LDKAccess_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -6206,6 +6339,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDec uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL; +static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL; +static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL; +static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) { + LDKCOption_CVec_NetAddressZZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some;")); + CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL); + LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "", "([J)V"); + CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL); + LDKCOption_CVec_NetAddressZZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None;")); + CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL); + LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "", "()V"); + CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_CVec_NetAddressZZ_Some: { + LDKCVec_NetAddressZ some_var = obj->some; + int64_tArray some_arr = (*env)->NewLongArray(env, some_var.datalen); + int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL); + for (size_t m = 0; m < some_var.datalen; m++) { + uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1; + some_arr_ptr[m] = some_conv_12_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0); + return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr); + } + case LDKCOption_CVec_NetAddressZZ_None: { + return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth); + } + default: abort(); + } +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { return ((LDKCResult_NetAddressu8Z*)arg)->result_ok; } @@ -7253,6 +7422,50 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1f default: abort(); } } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKLockedChannelMonitor res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1OutPointZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ"); + ret->datalen = (*env)->GetArrayLength(env, elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data"); + int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL); + for (size_t i = 0; i < ret->datalen; i++) { + int64_t arr_elem = java_elems[i]; + LDKOutPoint arr_elem_conv; + arr_elem_conv.inner = (void*)(arr_elem & (~1)); + arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0); + arr_elem_conv = OutPoint_clone(&arr_elem_conv); + ret->data[i] = arr_elem_conv; + } + (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); + } + return (uint64_t)ret; +} +static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) { + LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = OutPoint_clone(&orig->data[i]); + } + return ret; +} typedef struct LDKMessageSendEventsProvider_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -9965,6 +10178,82 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIE return ret_val; } +typedef struct LDKScore_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID channel_penalty_msat_meth; +} LDKScore_JCalls; +static void LDKScore_JCalls_free(void* this_arg) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret; +} +static void LDKScore_JCalls_cloned(LDKScore* new_obj) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(J)J"); + CHECK(calls->channel_penalty_msat_meth != NULL); + + LDKScore ret = { + .this_arg = (void*) calls, + .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, + .free = LDKScore_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) { + LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore"); + *res_ptr = LDKScore_init(env, clz, o); + return (uint64_t)res_ptr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) { + LDKScore* this_arg_conv = (LDKScore*)(((uint64_t)this_arg) & ~1); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id); + return ret_val; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -11803,6 +12092,40 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1Blo return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) { LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z"); *ret_copy = COption_u16Z_some(o); @@ -11896,6 +12219,69 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv * CVec_APIErrorZ_free(_res_constr); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult__u832APIErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); + e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdPaymentSendFailureZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_ok(); @@ -11924,34 +12310,60 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { - LDKThirtyTwoBytes o_ref; - CHECK((*env)->GetArrayLength(env, o) == 32); - (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv); + return ((uint64_t)ret_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { + LDKThirtyTwoBytes a_ref; + CHECK((*env)->GetArrayLength(env, a) == 32); + (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data); + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv); + return ((uint64_t)ret_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + C2Tuple_PaymentHashPaymentIdZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1); + o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; - LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_PaymentHashPaymentSendFailureZ_free(_res_conv); + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv); return (uint64_t)ret_conv; } @@ -13290,19 +13702,53 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErro return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) { - LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1); - if (o_conv.free == LDKAccess_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&o_conv); - } - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_some(o_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = NodeId_clone(&o_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_NodeIdDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) { + LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1); + if (o_conv.free == LDKAccess_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKAccess_JCalls_cloned(&o_conv); + } + LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); + *ret_copy = COption_AccessZ_some(o_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) { LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); *ret_copy = COption_AccessZ_none(); uint64_t ret_ref = (uint64_t)ret_copy; @@ -13536,6 +13982,49 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecode return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) { + LDKCVec_NetAddressZ o_constr; + o_constr.datalen = (*env)->GetArrayLength(env, o); + if (o_constr.datalen > 0) + o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + o_constr.data = NULL; + int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL); + for (size_t m = 0; m < o_constr.datalen; m++) { + int64_t o_conv_12 = o_vals[m]; + LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(((uint64_t)o_conv_12) & ~1); + o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1)); + o_constr.data[m] = o_conv_12_conv; + } + (*env)->ReleaseLongArrayElements(env, o, o_vals, 0); + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_some(o_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_none(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + COption_CVec_NetAddressZZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig; + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1); o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1)); @@ -14850,6 +15339,48 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv COption_FilterZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKLockedChannelMonitor o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_err(); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_LockedChannelMonitorNoneZ_free(_res_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_OutPointZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t k = 0; k < _res_constr.datalen; k++) { + int64_t _res_conv_10 = _res_vals[k]; + LDKOutPoint _res_conv_10_conv; + _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1)); + _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0); + _res_constr.data[k] = _res_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_OutPointZ_free(_res_constr); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1); @@ -15004,17 +15535,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_hash) { LDKThirtyTwoBytes payment_preimage_ref; CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_sent(payment_preimage_ref); + *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id) { LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); @@ -15036,8 +15570,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile path_constr.data[k] = path_conv_10_conv; } (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1); + short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr); + *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -15079,14 +15615,29 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(J return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t reason) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t user_channel_id, int64_t reason) { LDKThirtyTwoBytes channel_id_ref; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data); LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1); reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_channel_closed(channel_id_ref, reason_conv); + *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) { + LDKThirtyTwoBytes channel_id_ref; + CHECK((*env)->GetArrayLength(env, channel_id) == 32); + (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data); + LDKTransaction transaction_ref; + transaction_ref.datalen = (*env)->GetArrayLength(env, transaction); + transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes"); + (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data); + transaction_ref.data_is_owned = true; + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -16220,6 +16771,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jcl Confirm_free(this_ptr_conv); } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); + jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure()); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1); @@ -16392,6 +16959,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env FeeEstimator_free(this_ptr_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Persist_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKLockedChannelMonitor this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + LockedChannelMonitor_free(this_obj_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChainMonitor this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -16473,6 +17054,41 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1cla return ret_arr; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKOutPoint funding_txo_conv; + funding_txo_conv.inner = (void*)(funding_txo & (~1)); + funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); + funding_txo_conv = OutPoint_clone(&funding_txo_conv); + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv); + int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); + for (size_t k = 0; k < ret_var.datalen; k++) { + LDKOutPoint ret_conv_10_var = ret_var.data[k]; + CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner; + if (ret_conv_10_var.is_owned) { + ret_conv_10_ref |= 1; + } + ret_arr_ptr[k] = ret_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -16566,22 +17182,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read( return (uint64_t)ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); - jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv)); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure()); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure()); - return ret_conv; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKMonitorUpdateError this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -17112,13 +17712,6 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1c return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - Persist_free(this_ptr_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); @@ -18060,6 +18653,67 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterf return (uint64_t)ret_ret; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPaymentId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + PaymentId_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = PaymentId_hash(&o_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPaymentId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKPaymentId ret_var = PaymentId_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPaymentId a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = PaymentId_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentId_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPaymentId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = PaymentId_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_PaymentId_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_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = PaymentId_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -18478,19 +19132,19 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendab ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(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; - int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv); + int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(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; - ChannelDetails_set_user_id(&this_ptr_conv, val); + ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -18621,7 +19275,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_id_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 short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_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); @@ -18640,7 +19294,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1)); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_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_id_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, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_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); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -18809,7 +19463,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1curren return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, int64_t override_config) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, int64_t override_config) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -18820,8 +19474,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1cha override_config_conv.inner = (void*)(override_config & (~1)); override_config_conv.is_owned = (override_config & 1) || (override_config == 0); override_config_conv = UserConfig_clone(&override_config_conv); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv); return (uint64_t)ret_conv; } @@ -18928,11 +19582,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payme LDKThirtyTwoBytes payment_secret_ref; CHECK((*env)->GetArrayLength(env, payment_secret) == 32); (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int64_t payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + LDKPaymentId payment_id_conv; + payment_id_conv.inner = (void*)(payment_id & (~1)); + payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0); + payment_id_conv = PaymentId_clone(&payment_id_conv); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -18943,7 +19613,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spont LDKThirtyTwoBytes payment_preimage_ref; CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref); return (uint64_t)ret_conv; } @@ -26422,36 +27092,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) { - unsigned char pubkey_hash_arr[20]; - CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20); - (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr); - unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) { - unsigned char script_hash_arr[20]; - CHECK((*env)->GetArrayLength(env, script_hash) == 20); - (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr); - unsigned char (*script_hash_ref)[20] = &script_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) { unsigned char pubkey_hash_arr[20]; CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20); @@ -26545,37 +27185,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass Type_free(this_ptr_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRouteHop this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHop_free(this_obj_conv); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKScore this_ptr_conv = *(LDKScore*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form); - return ret_arr; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKNodeId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NodeId_free(this_obj_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - RouteHop_set_pubkey(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKNodeId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNodeId ret_var = NodeId_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26585,37 +27213,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1featur return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeFeatures_clone(&val_conv); - RouteHop_set_node_features(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_short_channel_id(&this_ptr_conv, val); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) { + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26625,60 +27227,57 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1fea return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - RouteHop_set_channel_features(&this_ptr_conv, val_conv); +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeId this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = NodeId_hash(&o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_fee_msat(&this_ptr_conv, val); +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKNodeId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NodeId_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 int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_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_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = NodeId_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NetworkGraph_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { - LDKPublicKey pubkey_arg_ref; - CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33); - (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form); - LDKNodeFeatures node_features_arg_conv; - node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); - node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); - node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); - LDKChannelFeatures channel_features_arg_conv; - channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); - channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); - channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); - LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKNetworkGraph orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26688,171 +27287,126 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRouteHop orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHop ret_var = RouteHop_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKReadOnlyNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + ReadOnlyNetworkGraph_free(this_obj_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + NetworkUpdate_free(this_ptr_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRouteHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHop_hash(&o_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) { + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + msg_conv = ChannelUpdate_clone(&msg_conv); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_update_message(msg_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRouteHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) { + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKRouteHop obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) { + LDKPublicKey node_id_ref; + CHECK((*env)->GetArrayLength(env, node_id) == 33); + (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; + LDKCVec_u8Z ret_var = NetworkUpdate_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_RouteHop_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_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = RouteHop_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); + *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRoute this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKNetGraphMsgHandler this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - Route_free(this_obj_conv); + NetGraphMsgHandler_free(this_obj_conv); } -JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRoute this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKNetGraphMsgHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL); - ; - for (size_t m = 0; m < ret_var.datalen; m++) { - LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; - int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen); - int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL); - for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { - LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; - CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; - if (ret_conv_12_conv_10_var.is_owned) { - ret_conv_12_conv_10_ref |= 1; - } - ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0); - FREE(ret_conv_12_var.data); - (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr); + LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; } - FREE(ret_var.data); - return ret_arr; + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) { - LDKRoute this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKNetGraphMsgHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ val_constr; - val_constr.datalen = (*env)->GetArrayLength(env, val); - if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - val_constr.data = NULL; - for (size_t m = 0; m < val_constr.datalen; m++) { - int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m); - LDKCVec_RouteHopZ val_conv_12_constr; - val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12); - if (val_conv_12_constr.datalen > 0) - val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - val_conv_12_constr.data = NULL; - int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL); - for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { - int64_t val_conv_12_conv_10 = val_conv_12_vals[k]; - LDKRouteHop val_conv_12_conv_10_conv; - val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); - val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); - val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); - val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; - } - (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0); - val_constr.data[m] = val_conv_12_constr; - } - Route_set_paths(&this_ptr_conv, val_constr); + LDKNetworkGraph val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NetworkGraph_clone(&val_conv); + NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) { - LDKCVec_CVec_RouteHopZZ paths_arg_constr; - paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg); - if (paths_arg_constr.datalen > 0) - paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - paths_arg_constr.data = NULL; - for (size_t m = 0; m < paths_arg_constr.datalen; m++) { - int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m); - LDKCVec_RouteHopZ paths_arg_conv_12_constr; - paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12); - if (paths_arg_conv_12_constr.datalen > 0) - paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - paths_arg_conv_12_constr.data = NULL; - int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL); - for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { - int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; - LDKRouteHop paths_arg_conv_12_conv_10_conv; - paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); - paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); - paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); - paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) { + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); + network_graph_conv = NetworkGraph_clone(&network_graph_conv); + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKAccess_JCalls_cloned(&chain_access_conv.some); } - (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); - paths_arg_constr.data[m] = paths_arg_conv_12_constr; } - LDKRoute ret_var = Route_new(paths_arg_constr); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); } - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRoute orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRoute ret_var = Route_clone(&orig_conv); + LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26862,234 +27416,188 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, j return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRoute o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = Route_hash(&o_conv); - return ret_val; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRoute a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRoute b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = Route_eq(&a_conv, &b_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKRoute this_arg_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_fees(&this_arg_conv); - return ret_val; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKAccess_JCalls_cloned(&chain_access_conv.some); + } + } + NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKRoute this_arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_amount(&this_arg_conv); - return ret_val; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKRoute obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = Route_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; + LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); + *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_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_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = Route_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); + return (uint64_t)ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRouteHint this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKDirectionalChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHint_free(this_obj_conv); + DirectionalChannelInfo_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRouteHint orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHint ret_var = RouteHint_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); + return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRouteHint o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHint_hash(&o_conv); - return ret_val; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRouteHint a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHint b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRouteHintHop this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHintHop_free(this_obj_conv); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form); - return ret_arr; + int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); + DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_short_channel_id(&this_ptr_conv, val); + DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = RoutingFees_clone(&val_conv); - RouteHintHop_set_fees(&this_ptr_conv, val_conv); -} - -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; + LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); + LDKRoutingFees val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = RoutingFees_clone(&val_conv); + DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; + LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + LDKChannelUpdate val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelUpdate_clone(&val_conv); + DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) { - LDKPublicKey src_node_id_arg_ref; - CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33); - (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); LDKRoutingFees fees_arg_conv; fees_arg_conv.inner = (void*)(fees_arg & (~1)); fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); - htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); + LDKChannelUpdate last_update_message_arg_conv; + last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); + last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); + last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27099,11 +27607,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *e return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRouteHintHop orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKDirectionalChannelInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27113,153 +27621,39 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRouteHintHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHintHop_hash(&o_conv); - return ret_val; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRouteHintHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHintHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) { - LDKPublicKey our_node_id_ref; - CHECK((*env)->GetArrayLength(env, our_node_id) == 33); - (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK((*env)->GetArrayLength(env, payee) == 33); - (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - int64_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return (uint64_t)ret_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKDirectionalChannelInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = DirectionalChannelInfo_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_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) { - LDKPublicKey our_node_id_ref; - CHECK((*env)->GetArrayLength(env, our_node_id) == 33); - (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK((*env)->GetArrayLength(env, payee) == 33); - (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); - LDKInvoiceFeatures payee_features_conv; - payee_features_conv.inner = (void*)(payee_features & (~1)); - payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); - payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - int64_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_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_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); + *ret_conv = DirectionalChannelInfo_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKNetworkGraph this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetworkGraph_free(this_obj_conv); + ChannelInfo_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKNetworkGraph orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27269,86 +27663,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKReadOnlyNetworkGraph this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ReadOnlyNetworkGraph_free(this_obj_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - NetworkUpdate_free(this_ptr_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_clone(orig_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) { - LDKChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = (msg & 1) || (msg == 0); - msg_conv = ChannelUpdate_clone(&msg_conv); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_update_message(msg_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) { - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) { - LDKPublicKey node_id_ref; - CHECK((*env)->GetArrayLength(env, node_id) == 33); - (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; - LDKCVec_u8Z ret_var = NetworkUpdate_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_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); - return (uint64_t)ret_ret; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKNetGraphMsgHandler this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetGraphMsgHandler_free(this_obj_conv); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelFeatures_clone(&val_conv); + ChannelInfo_set_features(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKNetGraphMsgHandler this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); + LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27358,37 +27688,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1ne return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKNetGraphMsgHandler this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph val_conv; + LDKNodeId val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NetworkGraph_clone(&val_conv); - NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_one(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) { - LDKNetworkGraph network_graph_conv; - network_graph_conv.inner = (void*)(network_graph & (~1)); - network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); - network_graph_conv = NetworkGraph_clone(&network_graph_conv); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); - } - } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27398,131 +27713,91 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNI return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); - } - } - NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); - *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); - return (uint64_t)ret_ret; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); - *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); - return (uint64_t)ret_ret; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKDirectionalChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - DirectionalChannelInfo_free(this_obj_conv); -} - -JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); } -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; + LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); + LDKNodeId val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_two(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); - return ret_val; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); + *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27532,277 +27807,34 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; + LDKChannelAnnouncement val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = RoutingFees_clone(&val_conv); - DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); + val_conv = ChannelAnnouncement_clone(&val_conv); + ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelUpdate val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelUpdate_clone(&val_conv); - DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRoutingFees fees_arg_conv; - fees_arg_conv.inner = (void*)(fees_arg & (~1)); - fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); - fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKChannelUpdate last_update_message_arg_conv; - last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); - last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); - last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKDirectionalChannelInfo orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKDirectionalChannelInfo obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = DirectionalChannelInfo_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_DirectionalChannelInfo_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_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = DirectionalChannelInfo_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ChannelInfo_free(this_obj_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - ChannelInfo_set_features(&this_ptr_conv, val_conv); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form); - return ret_arr; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - ChannelInfo_set_node_one(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form); - return ret_arr; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - ChannelInfo_set_node_two(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelAnnouncement val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelAnnouncement_clone(&val_conv); - ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray node_one_arg, int64_t one_to_two_arg, int8_tArray node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t node_one_arg, int64_t one_to_two_arg, int64_t node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) { LDKChannelFeatures features_arg_conv; features_arg_conv.inner = (void*)(features_arg & (~1)); features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKPublicKey node_one_arg_ref; - CHECK((*env)->GetArrayLength(env, node_one_arg) == 33); - (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form); + LDKNodeId node_one_arg_conv; + node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); + node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); + node_one_arg_conv = NodeId_clone(&node_one_arg_conv); LDKDirectionalChannelInfo one_to_two_arg_conv; one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKPublicKey node_two_arg_ref; - CHECK((*env)->GetArrayLength(env, node_two_arg) == 33); - (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form); + LDKNodeId node_two_arg_conv; + node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); + node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); + node_two_arg_conv = NodeId_clone(&node_two_arg_conv); LDKDirectionalChannelInfo two_to_one_arg_conv; two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); @@ -27813,7 +27845,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *en announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); + LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -28462,6 +28494,762 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRouteHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHop_free(this_obj_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + RouteHop_set_pubkey(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeFeatures_clone(&val_conv); + RouteHop_set_node_features(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHop_set_short_channel_id(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelFeatures_clone(&val_conv); + RouteHop_set_channel_features(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHop_set_fee_msat(&this_ptr_conv, val); +} + +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { + LDKPublicKey pubkey_arg_ref; + CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33); + (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form); + LDKNodeFeatures node_features_arg_conv; + node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); + node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); + node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); + LDKChannelFeatures channel_features_arg_conv; + channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); + channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); + channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); + LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRouteHop orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHop ret_var = RouteHop_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHop o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHop_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRouteHop obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = RouteHop_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_RouteHop_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_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = RouteHop_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRoute this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + Route_free(this_obj_conv); +} + +JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRoute this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); + jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL); + ; + for (size_t m = 0; m < ret_var.datalen; m++) { + LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; + int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen); + int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL); + for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { + LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; + CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; + if (ret_conv_12_conv_10_var.is_owned) { + ret_conv_12_conv_10_ref |= 1; + } + ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0); + FREE(ret_conv_12_var.data); + (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr); + } + FREE(ret_var.data); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) { + LDKRoute this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_CVec_RouteHopZZ val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); + else + val_constr.data = NULL; + for (size_t m = 0; m < val_constr.datalen; m++) { + int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m); + LDKCVec_RouteHopZ val_conv_12_constr; + val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12); + if (val_conv_12_constr.datalen > 0) + val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + val_conv_12_constr.data = NULL; + int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL); + for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { + int64_t val_conv_12_conv_10 = val_conv_12_vals[k]; + LDKRouteHop val_conv_12_conv_10_conv; + val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); + val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); + val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); + val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0); + val_constr.data[m] = val_conv_12_constr; + } + Route_set_paths(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) { + LDKCVec_CVec_RouteHopZZ paths_arg_constr; + paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg); + if (paths_arg_constr.datalen > 0) + paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); + else + paths_arg_constr.data = NULL; + for (size_t m = 0; m < paths_arg_constr.datalen; m++) { + int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m); + LDKCVec_RouteHopZ paths_arg_conv_12_constr; + paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12); + if (paths_arg_conv_12_constr.datalen > 0) + paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + paths_arg_conv_12_constr.data = NULL; + int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL); + for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { + int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; + LDKRouteHop paths_arg_conv_12_conv_10_conv; + paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); + paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); + paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); + paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); + paths_arg_constr.data[m] = paths_arg_conv_12_constr; + } + LDKRoute ret_var = Route_new(paths_arg_constr); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRoute orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRoute ret_var = Route_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRoute o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = Route_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRoute a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRoute b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = Route_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_fees(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_amount(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRoute obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = Route_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_Route_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_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = Route_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRouteHint this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHint_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRouteHint orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHint ret_var = RouteHint_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHint o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHint_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteHint a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHint b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRouteHintHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHintHop_free(this_obj_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_short_channel_id(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = RoutingFees_clone(&val_conv); + RouteHintHop_set_fees(&this_ptr_conv, val_conv); +} + +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) { + LDKPublicKey src_node_id_arg_ref; + CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33); + (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form); + LDKRoutingFees fees_arg_conv; + fees_arg_conv.inner = (void*)(fees_arg & (~1)); + fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); + fees_arg_conv = RoutingFees_clone(&fees_arg_conv); + LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); + htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); + LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRouteHintHop orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHintHop o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHintHop_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteHintHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHintHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) { + 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); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK((*env)->GetArrayLength(env, payee) == 33); + (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + int64_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) { + 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); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK((*env)->GetArrayLength(env, payee) == 33); + (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); + LDKInvoiceFeatures payee_features_conv; + payee_features_conv.inner = (void*)(payee_features & (~1)); + payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); + payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + int64_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return (uint64_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)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + Scorer_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat) { + LDKScorer ret_var = Scorer_new(base_penalty_msat); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) { + LDKScorer ret_var = Scorer_default(); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = Scorer_as_Score(&this_arg_conv); + return (uint64_t)ret_ret; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKFilesystemPersister this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index 531fa8e0..c67f2147 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -3205,6 +3205,27 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1B jclass err_conv = LDKIOError_to_java(env, (*val->contents.err)); return err_conv; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} static jclass LDKCOption_u16Z_Some_class = NULL; static jmethodID LDKCOption_u16Z_Some_meth = NULL; static jclass LDKCOption_u16Z_None_class = NULL; @@ -3377,6 +3398,22 @@ static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *or } return ret; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult__u832APIErrorZ*)arg)->result_ok; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} static jclass LDKPaymentSendFailure_ParameterError_class = NULL; static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL; static jclass LDKPaymentSendFailure_PathParameterError_class = NULL; @@ -3454,6 +3491,24 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_ default: abort(); } } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok; } @@ -3468,18 +3523,57 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSend uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { - return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { + LDKC2Tuple_PaymentHashPaymentIdZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + LDKThirtyTwoBytes a_ref; + CHECK((*env)->GetArrayLength(env, a) == 32); + (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data); + ret->a = a_ref; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + ret->b = b_conv; + return (uint64_t)ret; +} +static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return ThirtyTwoBytes_clone(&tuple->a); +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a(JNIEnv *env, jclass clz, int64_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data); + return ret_arr; +} + +static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return PaymentId_clone(&tuple->b); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b(JNIEnv *env, jclass clz, int64_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(val->result_ok); - int8_tArray res_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); - return res_arr; + LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv); + return ((uint64_t)res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(!val->result_ok); uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; @@ -5324,6 +5418,8 @@ static jclass LDKEvent_PaymentForwarded_class = NULL; static jmethodID LDKEvent_PaymentForwarded_meth = NULL; static jclass LDKEvent_ChannelClosed_class = NULL; static jmethodID LDKEvent_ChannelClosed_meth = NULL; +static jclass LDKEvent_DiscardFunding_class = NULL; +static jmethodID LDKEvent_DiscardFunding_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;")); @@ -5338,12 +5434,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_PaymentSent_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;")); CHECK(LDKEvent_PaymentSent_class != NULL); - LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B)V"); + LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B[B)V"); CHECK(LDKEvent_PaymentSent_meth != NULL); LDKEvent_PaymentPathFailed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;")); CHECK(LDKEvent_PaymentPathFailed_class != NULL); - LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([BZJZ[J)V"); + LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([BZJZ[JJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;")); @@ -5363,8 +5459,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en LDKEvent_ChannelClosed_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;")); CHECK(LDKEvent_ChannelClosed_class != NULL); - LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "", "([BJ)V"); + LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "", "([BJJ)V"); CHECK(LDKEvent_ChannelClosed_meth != NULL); + LDKEvent_DiscardFunding_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$DiscardFunding;")); + CHECK(LDKEvent_DiscardFunding_class != NULL); + LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "", "([B[B)V"); + CHECK(LDKEvent_DiscardFunding_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -5386,7 +5487,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN case LDKEvent_PaymentSent: { int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data); - return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_sent.payment_hash.data); + return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr, payment_hash_arr); } case LDKEvent_PaymentPathFailed: { int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); @@ -5403,7 +5506,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN path_arr_ptr[k] = path_conv_10_ref; } (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); - return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr); + uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1; + return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref); } case LDKEvent_PendingHTLCsForwardable: { return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable); @@ -5427,7 +5531,15 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data); uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1; - return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, reason_ref); + return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, obj->channel_closed.user_channel_id, reason_ref); + } + case LDKEvent_DiscardFunding: { + int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->discard_funding.channel_id.data); + LDKTransaction transaction_var = obj->discard_funding.transaction; + int8_tArray transaction_arr = (*env)->NewByteArray(env, transaction_var.datalen); + (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data); + return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr); } default: abort(); } @@ -5938,6 +6050,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleE uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKNodeId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} typedef struct LDKAccess_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -6204,6 +6337,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDec uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +static jclass LDKCOption_CVec_NetAddressZZ_Some_class = NULL; +static jmethodID LDKCOption_CVec_NetAddressZZ_Some_meth = NULL; +static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL; +static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) { + LDKCOption_CVec_NetAddressZZ_Some_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some;")); + CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL); + LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "", "([J)V"); + CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL); + LDKCOption_CVec_NetAddressZZ_None_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None;")); + CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL); + LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "", "()V"); + CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_CVec_NetAddressZZ_Some: { + LDKCVec_NetAddressZ some_var = obj->some; + int64_tArray some_arr = (*env)->NewLongArray(env, some_var.datalen); + int64_t *some_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, some_arr, NULL); + for (size_t m = 0; m < some_var.datalen; m++) { + uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1; + some_arr_ptr[m] = some_conv_12_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, some_arr, some_arr_ptr, 0); + return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_Some_class, LDKCOption_CVec_NetAddressZZ_Some_meth, some_arr); + } + case LDKCOption_CVec_NetAddressZZ_None: { + return (*env)->NewObject(env, LDKCOption_CVec_NetAddressZZ_None_class, LDKCOption_CVec_NetAddressZZ_None_meth); + } + default: abort(); + } +} JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { return ((LDKCResult_NetAddressu8Z*)arg)->result_ok; } @@ -7251,6 +7420,50 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1f default: abort(); } } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKLockedChannelMonitor res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1OutPointZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ"); + ret->datalen = (*env)->GetArrayLength(env, elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data"); + int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL); + for (size_t i = 0; i < ret->datalen; i++) { + int64_t arr_elem = java_elems[i]; + LDKOutPoint arr_elem_conv; + arr_elem_conv.inner = (void*)(arr_elem & (~1)); + arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0); + arr_elem_conv = OutPoint_clone(&arr_elem_conv); + ret->data[i] = arr_elem_conv; + } + (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); + } + return (uint64_t)ret; +} +static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) { + LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = OutPoint_clone(&orig->data[i]); + } + return ret; +} typedef struct LDKMessageSendEventsProvider_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -9963,6 +10176,82 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIE return ret_val; } +typedef struct LDKScore_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID channel_penalty_msat_meth; +} LDKScore_JCalls; +static void LDKScore_JCalls_free(void* this_arg) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret; +} +static void LDKScore_JCalls_cloned(LDKScore* new_obj) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(J)J"); + CHECK(calls->channel_penalty_msat_meth != NULL); + + LDKScore ret = { + .this_arg = (void*) calls, + .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, + .free = LDKScore_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, jclass clz, jobject o) { + LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore"); + *res_ptr = LDKScore_init(env, clz, o); + return (uint64_t)res_ptr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id) { + LDKScore* this_arg_conv = (LDKScore*)(((uint64_t)this_arg) & ~1); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id); + return ret_val; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -11801,6 +12090,40 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1Blo return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) { LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z"); *ret_copy = COption_u16Z_some(o); @@ -11894,6 +12217,69 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv * CVec_APIErrorZ_free(_res_constr); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult__u832APIErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); + e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdPaymentSendFailureZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) { LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_ok(); @@ -11922,34 +12308,60 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { - LDKThirtyTwoBytes o_ref; - CHECK((*env)->GetArrayLength(env, o) == 32); - (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv); + return ((uint64_t)ret_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) { + LDKThirtyTwoBytes a_ref; + CHECK((*env)->GetArrayLength(env, a) == 32); + (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data); + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv); + return ((uint64_t)ret_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + C2Tuple_PaymentHashPaymentIdZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1); + o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; - LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_PaymentHashPaymentSendFailureZ_free(_res_conv); + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv); return (uint64_t)ret_conv; } @@ -13288,19 +13700,53 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErro return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) { - LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1); - if (o_conv.free == LDKAccess_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&o_conv); - } - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_some(o_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = NodeId_clone(&o_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_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); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_NodeIdDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) { + LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1); + if (o_conv.free == LDKAccess_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKAccess_JCalls_cloned(&o_conv); + } + LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); + *ret_copy = COption_AccessZ_some(o_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) { LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); *ret_copy = COption_AccessZ_none(); uint64_t ret_ref = (uint64_t)ret_copy; @@ -13534,6 +13980,49 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecode return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some(JNIEnv *env, jclass clz, int64_tArray o) { + LDKCVec_NetAddressZ o_constr; + o_constr.datalen = (*env)->GetArrayLength(env, o); + if (o_constr.datalen > 0) + o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + o_constr.data = NULL; + int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL); + for (size_t m = 0; m < o_constr.datalen; m++) { + int64_t o_conv_12 = o_vals[m]; + LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(((uint64_t)o_conv_12) & ~1); + o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1)); + o_constr.data[m] = o_conv_12_conv; + } + (*env)->ReleaseLongArrayElements(env, o, o_vals, 0); + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_some(o_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none(JNIEnv *env, jclass clz) { + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_none(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + COption_CVec_NetAddressZZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig; + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1); o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1)); @@ -14848,6 +15337,48 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv COption_FilterZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKLockedChannelMonitor o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_err(); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_LockedChannelMonitorNoneZ_free(_res_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_OutPointZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t k = 0; k < _res_constr.datalen; k++) { + int64_t _res_conv_10 = _res_vals[k]; + LDKOutPoint _res_conv_10_conv; + _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1)); + _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0); + _res_constr.data[k] = _res_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_OutPointZ_free(_res_constr); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1); @@ -15002,17 +15533,20 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_hash) { LDKThirtyTwoBytes payment_preimage_ref; CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_sent(payment_preimage_ref); + *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path, int64_t short_channel_id) { LDKThirtyTwoBytes payment_hash_ref; CHECK((*env)->GetArrayLength(env, payment_hash) == 32); (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); @@ -15034,8 +15568,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile path_constr.data[k] = path_conv_10_conv; } (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1); + short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr); + *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -15077,14 +15613,29 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(J return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t reason) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t user_channel_id, int64_t reason) { LDKThirtyTwoBytes channel_id_ref; CHECK((*env)->GetArrayLength(env, channel_id) == 32); (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data); LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1); reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_channel_closed(channel_id_ref, reason_conv); + *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNIEnv *env, jclass clz, int8_tArray channel_id, int8_tArray transaction) { + LDKThirtyTwoBytes channel_id_ref; + CHECK((*env)->GetArrayLength(env, channel_id) == 32); + (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data); + LDKTransaction transaction_ref; + transaction_ref.datalen = (*env)->GetArrayLength(env, transaction); + transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes"); + (*env)->GetByteArrayRegion(env, transaction, 0, transaction_ref.datalen, transaction_ref.data); + transaction_ref.data_is_owned = true; + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -16218,6 +16769,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jcl Confirm_free(this_ptr_conv); } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); + jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv)); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure()); + return ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1); @@ -16390,6 +16957,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env FeeEstimator_free(this_ptr_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Persist_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKLockedChannelMonitor this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + LockedChannelMonitor_free(this_obj_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChainMonitor this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -16471,6 +17052,41 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1cla return ret_arr; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKOutPoint funding_txo_conv; + funding_txo_conv.inner = (void*)(funding_txo & (~1)); + funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); + funding_txo_conv = OutPoint_clone(&funding_txo_conv); + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv); + int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); + int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); + for (size_t k = 0; k < ret_var.datalen; k++) { + LDKOutPoint ret_conv_10_var = ret_var.data[k]; + CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner; + if (ret_conv_10_var.is_owned) { + ret_conv_10_ref |= 1; + } + ret_arr_ptr[k] = ret_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); + FREE(ret_var.data); + return ret_arr; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -16564,22 +17180,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read( return (uint64_t)ret_conv; } -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); - jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv)); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_temporary_failure()); - return ret_conv; -} - -JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure(JNIEnv *env, jclass clz) { - jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_permanent_failure()); - return ret_conv; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKMonitorUpdateError this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -17110,13 +17710,6 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1c return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - Persist_free(this_ptr_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); @@ -18058,6 +18651,67 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterf return (uint64_t)ret_ret; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKPaymentId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + PaymentId_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = PaymentId_hash(&o_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentId_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKPaymentId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKPaymentId ret_var = PaymentId_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentId_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKPaymentId a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = PaymentId_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_PaymentId_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKPaymentId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = PaymentId_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_PaymentId_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_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = PaymentId_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -18476,19 +19130,19 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendab ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id(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; - int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv); + int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id(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; - ChannelDetails_set_user_id(&this_ptr_conv, val); + ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -18619,7 +19273,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_id_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 short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_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); @@ -18638,7 +19292,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1)); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_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_id_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, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_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); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -18807,7 +19461,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1curren return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, int64_t override_config) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, int64_t override_config) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -18818,8 +19472,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1cha override_config_conv.inner = (void*)(override_config & (~1)); override_config_conv.is_owned = (override_config & 1) || (override_config == 0); override_config_conv = UserConfig_clone(&override_config_conv); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv); return (uint64_t)ret_conv; } @@ -18926,11 +19580,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payme LDKThirtyTwoBytes payment_secret_ref; CHECK((*env)->GetArrayLength(env, payment_secret) == 32); (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int64_t payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + LDKPaymentId payment_id_conv; + payment_id_conv.inner = (void*)(payment_id & (~1)); + payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0); + payment_id_conv = PaymentId_clone(&payment_id_conv); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -18941,7 +19611,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spont LDKThirtyTwoBytes payment_preimage_ref; CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref); return (uint64_t)ret_conv; } @@ -26420,36 +27090,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read(JNIEnv return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) { - unsigned char pubkey_hash_arr[20]; - CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20); - (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr); - unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) { - unsigned char script_hash_arr[20]; - CHECK((*env)->GetArrayLength(env, script_hash) == 20); - (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr); - unsigned char (*script_hash_ref)[20] = &script_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) { unsigned char pubkey_hash_arr[20]; CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20); @@ -26543,37 +27183,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass Type_free(this_ptr_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRouteHop this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHop_free(this_obj_conv); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKScore this_ptr_conv = *(LDKScore*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form); - return ret_arr; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKNodeId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NodeId_free(this_obj_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - RouteHop_set_pubkey(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKNodeId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNodeId ret_var = NodeId_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26583,37 +27211,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1featur return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeFeatures_clone(&val_conv); - RouteHop_set_node_features(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_short_channel_id(&this_ptr_conv, val); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey(JNIEnv *env, jclass clz, int8_tArray pubkey) { + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26623,60 +27225,57 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1fea return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - RouteHop_set_channel_features(&this_ptr_conv, val_conv); +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNodeId this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = NodeId_hash(&o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_fee_msat(&this_ptr_conv, val); +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKNodeId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NodeId_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 int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeId_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_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = NodeId_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NetworkGraph_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { - LDKPublicKey pubkey_arg_ref; - CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33); - (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form); - LDKNodeFeatures node_features_arg_conv; - node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); - node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); - node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); - LDKChannelFeatures channel_features_arg_conv; - channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); - channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); - channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); - LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKNetworkGraph orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26686,171 +27285,126 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRouteHop orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHop ret_var = RouteHop_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKReadOnlyNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + ReadOnlyNetworkGraph_free(this_obj_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + NetworkUpdate_free(this_ptr_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRouteHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHop_hash(&o_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) { + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + msg_conv = ChannelUpdate_clone(&msg_conv); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_update_message(msg_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRouteHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) { + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKRouteHop obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) { + LDKPublicKey node_id_ref; + CHECK((*env)->GetArrayLength(env, node_id) == 33); + (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; + LDKCVec_u8Z ret_var = NetworkUpdate_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_RouteHop_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_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = RouteHop_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); + *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRoute this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKNetGraphMsgHandler this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - Route_free(this_obj_conv); + NetGraphMsgHandler_free(this_obj_conv); } -JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRoute this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKNetGraphMsgHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); - jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL); - ; - for (size_t m = 0; m < ret_var.datalen; m++) { - LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; - int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen); - int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL); - for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { - LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; - CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; - if (ret_conv_12_conv_10_var.is_owned) { - ret_conv_12_conv_10_ref |= 1; - } - ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; - } - (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0); - FREE(ret_conv_12_var.data); - (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr); + LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; } - FREE(ret_var.data); - return ret_arr; + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) { - LDKRoute this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKNetGraphMsgHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ val_constr; - val_constr.datalen = (*env)->GetArrayLength(env, val); - if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - val_constr.data = NULL; - for (size_t m = 0; m < val_constr.datalen; m++) { - int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m); - LDKCVec_RouteHopZ val_conv_12_constr; - val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12); - if (val_conv_12_constr.datalen > 0) - val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - val_conv_12_constr.data = NULL; - int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL); - for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { - int64_t val_conv_12_conv_10 = val_conv_12_vals[k]; - LDKRouteHop val_conv_12_conv_10_conv; - val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); - val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); - val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); - val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; - } - (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0); - val_constr.data[m] = val_conv_12_constr; - } - Route_set_paths(&this_ptr_conv, val_constr); + LDKNetworkGraph val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NetworkGraph_clone(&val_conv); + NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) { - LDKCVec_CVec_RouteHopZZ paths_arg_constr; - paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg); - if (paths_arg_constr.datalen > 0) - paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - paths_arg_constr.data = NULL; - for (size_t m = 0; m < paths_arg_constr.datalen; m++) { - int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m); - LDKCVec_RouteHopZ paths_arg_conv_12_constr; - paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12); - if (paths_arg_conv_12_constr.datalen > 0) - paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - paths_arg_conv_12_constr.data = NULL; - int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL); - for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { - int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; - LDKRouteHop paths_arg_conv_12_conv_10_conv; - paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); - paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); - paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); - paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) { + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); + network_graph_conv = NetworkGraph_clone(&network_graph_conv); + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKAccess_JCalls_cloned(&chain_access_conv.some); } - (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); - paths_arg_constr.data[m] = paths_arg_conv_12_constr; } - LDKRoute ret_var = Route_new(paths_arg_constr); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); } - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRoute orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRoute ret_var = Route_clone(&orig_conv); + LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -26860,234 +27414,188 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, j return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRoute o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = Route_hash(&o_conv); - return ret_val; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRoute a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRoute b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = Route_eq(&a_conv, &b_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKRoute this_arg_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_fees(&this_arg_conv); - return ret_val; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKAccess_JCalls_cloned(&chain_access_conv.some); + } + } + NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKRoute this_arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_amount(&this_arg_conv); - return ret_val; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKRoute obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = Route_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; + LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); + *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_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_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = Route_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); + return (uint64_t)ret_ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRouteHint this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKDirectionalChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHint_free(this_obj_conv); + DirectionalChannelInfo_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRouteHint orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHint ret_var = RouteHint_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); + return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRouteHint o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHint_hash(&o_conv); - return ret_val; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRouteHint a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHint b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKRouteHintHop this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHintHop_free(this_obj_conv); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form); - return ret_arr; + int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); + DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_short_channel_id(&this_ptr_conv, val); + DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = RoutingFees_clone(&val_conv); - RouteHintHop_set_fees(&this_ptr_conv, val_conv); -} - -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; + LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); + LDKRoutingFees val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = RoutingFees_clone(&val_conv); + DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; + LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + LDKChannelUpdate val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelUpdate_clone(&val_conv); + DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) { - LDKPublicKey src_node_id_arg_ref; - CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33); - (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); LDKRoutingFees fees_arg_conv; fees_arg_conv.inner = (void*)(fees_arg & (~1)); fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); - htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); + LDKChannelUpdate last_update_message_arg_conv; + last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); + last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); + last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27097,11 +27605,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *e return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKRouteHintHop orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKDirectionalChannelInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27111,153 +27619,39 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) { - LDKRouteHintHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHintHop_hash(&o_conv); - return ret_val; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKRouteHintHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHintHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) { - LDKPublicKey our_node_id_ref; - CHECK((*env)->GetArrayLength(env, our_node_id) == 33); - (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK((*env)->GetArrayLength(env, payee) == 33); - (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - int64_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return (uint64_t)ret_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKDirectionalChannelInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = DirectionalChannelInfo_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_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) { - LDKPublicKey our_node_id_ref; - CHECK((*env)->GetArrayLength(env, our_node_id) == 33); - (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK((*env)->GetArrayLength(env, payee) == 33); - (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); - LDKInvoiceFeatures payee_features_conv; - payee_features_conv.inner = (void*)(payee_features & (~1)); - payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); - payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != NULL) { - first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - int64_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - int64_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_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_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); + *ret_conv = DirectionalChannelInfo_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKNetworkGraph this_obj_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetworkGraph_free(this_obj_conv); + ChannelInfo_free(this_obj_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKNetworkGraph orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27267,86 +27661,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKReadOnlyNetworkGraph this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ReadOnlyNetworkGraph_free(this_obj_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - NetworkUpdate_free(this_ptr_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_clone(orig_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) { - LDKChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = (msg & 1) || (msg == 0); - msg_conv = ChannelUpdate_clone(&msg_conv); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_update_message(msg_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) { - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) { - LDKPublicKey node_id_ref; - CHECK((*env)->GetArrayLength(env, node_id) == 33); - (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; - LDKCVec_u8Z ret_var = NetworkUpdate_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_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); - return (uint64_t)ret_ret; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKNetGraphMsgHandler this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetGraphMsgHandler_free(this_obj_conv); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelFeatures_clone(&val_conv); + ChannelInfo_set_features(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKNetGraphMsgHandler this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); + LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27356,37 +27686,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1ne return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKNetGraphMsgHandler this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph val_conv; + LDKNodeId val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NetworkGraph_clone(&val_conv); - NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_one(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) { - LDKNetworkGraph network_graph_conv; - network_graph_conv.inner = (void*)(network_graph & (~1)); - network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); - network_graph_conv = NetworkGraph_clone(&network_graph_conv); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); - } - } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - if (logger_conv.free == LDKLogger_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLogger_JCalls_cloned(&logger_conv); - } - LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27396,131 +27711,91 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNI return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); - } - } - NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); - *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); - return (uint64_t)ret_ret; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); - *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); - return (uint64_t)ret_ret; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKDirectionalChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - DirectionalChannelInfo_free(this_obj_conv); -} - -JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); } -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; + LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); + LDKNodeId val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_two(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); - return ret_val; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); + *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -27530,277 +27805,34 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get return ret_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; + LDKChannelAnnouncement val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = RoutingFees_clone(&val_conv); - DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); + val_conv = ChannelAnnouncement_clone(&val_conv); + ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelUpdate val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelUpdate_clone(&val_conv); - DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) { - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRoutingFees fees_arg_conv; - fees_arg_conv.inner = (void*)(fees_arg & (~1)); - fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); - fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKChannelUpdate last_update_message_arg_conv; - last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); - last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); - last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKDirectionalChannelInfo orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKDirectionalChannelInfo obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = DirectionalChannelInfo_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_DirectionalChannelInfo_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_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = DirectionalChannelInfo_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ChannelInfo_free(this_obj_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - ChannelInfo_set_features(&this_ptr_conv, val_conv); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form); - return ret_arr; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - ChannelInfo_set_node_one(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form); - return ret_arr; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK((*env)->GetArrayLength(env, val) == 33); - (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); - ChannelInfo_set_node_two(&this_ptr_conv, val_ref); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelAnnouncement val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelAnnouncement_clone(&val_conv); - ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray node_one_arg, int64_t one_to_two_arg, int8_tArray node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t node_one_arg, int64_t one_to_two_arg, int64_t node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) { LDKChannelFeatures features_arg_conv; features_arg_conv.inner = (void*)(features_arg & (~1)); features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKPublicKey node_one_arg_ref; - CHECK((*env)->GetArrayLength(env, node_one_arg) == 33); - (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form); + LDKNodeId node_one_arg_conv; + node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); + node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); + node_one_arg_conv = NodeId_clone(&node_one_arg_conv); LDKDirectionalChannelInfo one_to_two_arg_conv; one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKPublicKey node_two_arg_ref; - CHECK((*env)->GetArrayLength(env, node_two_arg) == 33); - (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form); + LDKNodeId node_two_arg_conv; + node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); + node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); + node_two_arg_conv = NodeId_clone(&node_two_arg_conv); LDKDirectionalChannelInfo two_to_one_arg_conv; two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); @@ -27811,7 +27843,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *en announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); + LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -28460,6 +28492,762 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1chann return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRouteHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHop_free(this_obj_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + RouteHop_set_pubkey(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeFeatures_clone(&val_conv); + RouteHop_set_node_features(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHop_set_short_channel_id(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelFeatures_clone(&val_conv); + RouteHop_set_channel_features(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHop_set_fee_msat(&this_ptr_conv, val); +} + +JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) { + LDKRouteHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { + LDKPublicKey pubkey_arg_ref; + CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33); + (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form); + LDKNodeFeatures node_features_arg_conv; + node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); + node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); + node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); + LDKChannelFeatures channel_features_arg_conv; + channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); + channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); + channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); + LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRouteHop orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHop ret_var = RouteHop_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHop o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHop_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRouteHop obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = RouteHop_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_RouteHop_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_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = RouteHop_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRoute this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + Route_free(this_obj_conv); +} + +JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRoute this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); + jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL); + ; + for (size_t m = 0; m < ret_var.datalen; m++) { + LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; + int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen); + int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL); + for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { + LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; + CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; + if (ret_conv_12_conv_10_var.is_owned) { + ret_conv_12_conv_10_ref |= 1; + } + ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0); + FREE(ret_conv_12_var.data); + (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr); + } + FREE(ret_var.data); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) { + LDKRoute this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCVec_CVec_RouteHopZZ val_constr; + val_constr.datalen = (*env)->GetArrayLength(env, val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); + else + val_constr.data = NULL; + for (size_t m = 0; m < val_constr.datalen; m++) { + int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m); + LDKCVec_RouteHopZ val_conv_12_constr; + val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12); + if (val_conv_12_constr.datalen > 0) + val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + val_conv_12_constr.data = NULL; + int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL); + for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { + int64_t val_conv_12_conv_10 = val_conv_12_vals[k]; + LDKRouteHop val_conv_12_conv_10_conv; + val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); + val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); + val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); + val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0); + val_constr.data[m] = val_conv_12_constr; + } + Route_set_paths(&this_ptr_conv, val_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) { + LDKCVec_CVec_RouteHopZZ paths_arg_constr; + paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg); + if (paths_arg_constr.datalen > 0) + paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); + else + paths_arg_constr.data = NULL; + for (size_t m = 0; m < paths_arg_constr.datalen; m++) { + int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m); + LDKCVec_RouteHopZ paths_arg_conv_12_constr; + paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12); + if (paths_arg_conv_12_constr.datalen > 0) + paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + paths_arg_conv_12_constr.data = NULL; + int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL); + for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { + int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; + LDKRouteHop paths_arg_conv_12_conv_10_conv; + paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); + paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); + paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); + paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0); + paths_arg_constr.data[m] = paths_arg_conv_12_constr; + } + LDKRoute ret_var = Route_new(paths_arg_constr); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRoute orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRoute ret_var = Route_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRoute o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = Route_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRoute a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRoute b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = Route_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_fees(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_amount(&this_arg_conv); + return ret_val; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKRoute obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = Route_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_Route_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_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = Route_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRouteHint this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHint_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRouteHint orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHint ret_var = RouteHint_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHint o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHint_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteHint a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHint b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKRouteHintHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHintHop_free(this_obj_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKPublicKey val_ref; + CHECK((*env)->GetArrayLength(env, val) == 33); + (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form); + RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_short_channel_id(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = RoutingFees_clone(&val_conv); + RouteHintHop_set_fees(&this_ptr_conv, val_conv); +} + +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg) { + LDKPublicKey src_node_id_arg_ref; + CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33); + (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form); + LDKRoutingFees fees_arg_conv; + fees_arg_conv.inner = (void*)(fees_arg & (~1)); + fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); + fees_arg_conv = RoutingFees_clone(&fees_arg_conv); + LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); + htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); + LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKRouteHintHop orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) { + LDKRouteHintHop o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHintHop_hash(&o_conv); + return ret_val; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKRouteHintHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHintHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) { + 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); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK((*env)->GetArrayLength(env, payee) == 33); + (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + int64_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_pubkey, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger, int64_t scorer) { + 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); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK((*env)->GetArrayLength(env, payee) == 33); + (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form); + LDKInvoiceFeatures payee_features_conv; + payee_features_conv.inner = (void*)(payee_features & (~1)); + payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); + payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != NULL) { + first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + int64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0); + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + int64_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0); + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return (uint64_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)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + Scorer_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat) { + LDKScorer ret_var = Scorer_new(base_penalty_msat); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1default(JNIEnv *env, jclass clz) { + LDKScorer ret_var = Scorer_default(); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKScorer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = Scorer_as_Score(&this_arg_conv); + return (uint64_t)ret_ret; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKFilesystemPersister this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index a2f4c071..82234dec 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -1431,6 +1431,30 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tupl JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentIdDecodeErrorZ_result_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1result_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentIdDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentIdDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCOption_u16Z_ref_from_ptr @@ -1487,6 +1511,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErro JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new (JNIEnv *, jclass, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult__u832APIErrorZ_result_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1result_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult__u832APIErrorZ_get_ok + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult__u832APIErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1_1u832APIErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKPaymentSendFailure_ref_from_ptr @@ -1495,6 +1543,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentIdPaymentSendFailureZ_result_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1result_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentIdPaymentSendFailureZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentIdPaymentSendFailureZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentIdPaymentSendFailureZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_NonePaymentSendFailureZ_result_ok @@ -1521,26 +1593,50 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFa /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_PaymentHashPaymentSendFailureZ_result_ok + * Method: LDKC2Tuple_PaymentHashPaymentIdZ_new + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentIdZ_1new + (JNIEnv *, jclass, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_get_a + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1a + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_get_b + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1get_1b + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1result_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_PaymentHashPaymentSendFailureZ_get_ok - * Signature: (J)[B + * Method: LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_PaymentHashPaymentSendFailureZ_get_err + * Method: LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -2711,6 +2807,30 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandle JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_NodeIdDecodeErrorZ_result_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1result_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_NodeIdDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_NodeIdDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeIdDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKAccess_new @@ -2887,6 +3007,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecod JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCOption_CVec_NetAddressZZ_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_CVec_NetAddressZZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1CVec_1NetAddressZZ_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_NetAddressu8Z_result_ok @@ -3823,6 +3951,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_LockedChannelMonitorNoneZ_result_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1result_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_LockedChannelMonitorNoneZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_LockedChannelMonitorNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1LockedChannelMonitorNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVec_OutPointZ_new + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1OutPointZ_1new + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: LDKMessageSendEventsProvider_new @@ -4311,6 +4471,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKScore_new + * Signature: (Lorg/ldk/impl/bindings/LDKScore;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKScore_1new + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: Score_channel_penalty_msat + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKChannelManagerPersister_new @@ -5855,6 +6031,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockH JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: COption_u16Z_some @@ -5935,6 +6143,70 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free (JNIEnv *, jclass, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: CResult__u832APIErrorZ_ok + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1ok + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult__u832APIErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult__u832APIErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult__u832APIErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1_1u832APIErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdPaymentSendFailureZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdPaymentSendFailureZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdPaymentSendFailureZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentIdPaymentSendFailureZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentIdPaymentSendFailureZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_NonePaymentSendFailureZ_ok @@ -5969,34 +6241,58 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailu /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_ok - * Signature: ([B)J + * Method: C2Tuple_PaymentHashPaymentIdZ_clone + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_new + * Signature: ([BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new + (JNIEnv *, jclass, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_err + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_free + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentHashPaymentSendFailureZ_clone + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone (JNIEnv *, jclass, jlong); /* @@ -7159,6 +7455,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NodeIdDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NodeIdDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NodeIdDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NodeIdDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeIdDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: COption_AccessZ_some @@ -7385,11 +7713,43 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeEr /* * Class: org_ldk_impl_bindings - * Method: CResult_NetAddressu8Z_ok - * Signature: (J)J + * Method: COption_CVec_NetAddressZZ_some + * Signature: ([J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1some + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_CVec_NetAddressZZ_none + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_CVec_NetAddressZZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_CVec_NetAddressZZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1CVec_1NetAddressZZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NetAddressu8Z_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -8591,6 +8951,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_LockedChannelMonitorNoneZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_LockedChannelMonitorNoneZ_err + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1err + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_LockedChannelMonitorNoneZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1LockedChannelMonitorNoneZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CVec_OutPointZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1OutPointZ_1free + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: PaymentPurpose_free @@ -8738,18 +9130,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received /* * Class: org_ldk_impl_bindings * Method: Event_payment_sent - * Signature: ([B)J + * Signature: ([B[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent - (JNIEnv *, jclass, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings * Method: Event_payment_path_failed - * Signature: ([BZJZ[J)J + * Signature: ([BZJZ[JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed - (JNIEnv *, jclass, jbyteArray, jboolean, jlong, jboolean, jlongArray); + (JNIEnv *, jclass, jbyteArray, jboolean, jlong, jboolean, jlongArray, jlong); /* * Class: org_ldk_impl_bindings @@ -8778,10 +9170,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded /* * Class: org_ldk_impl_bindings * Method: Event_channel_closed - * Signature: ([BJ)J + * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed - (JNIEnv *, jclass, jbyteArray, jlong); + (JNIEnv *, jclass, jbyteArray, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Event_discard_funding + * Signature: ([B[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding + (JNIEnv *, jclass, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -9743,6 +10143,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelMonitorUpdateErr_clone + * Signature: (J)Lorg/ldk/enums/ChannelMonitorUpdateErr; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelMonitorUpdateErr_temporary_failure + * Signature: ()Lorg/ldk/enums/ChannelMonitorUpdateErr; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelMonitorUpdateErr_permanent_failure + * Signature: ()Lorg/ldk/enums/ChannelMonitorUpdateErr; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: Watch_free @@ -9895,6 +10319,22 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Persist_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LockedChannelMonitor_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedChannelMonitor_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChainMonitor_free @@ -9919,6 +10359,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances (JNIEnv *, jclass, jlong, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChainMonitor_get_monitor + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1monitor + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChainMonitor_list_monitors + * Signature: (J)[J + */ +JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1list_1monitors + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChainMonitor_as_Listen @@ -9999,30 +10455,6 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1wr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read (JNIEnv *, jclass, jbyteArray); -/* - * Class: org_ldk_impl_bindings - * Method: ChannelMonitorUpdateErr_clone - * Signature: (J)Lorg/ldk/enums/ChannelMonitorUpdateErr; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelMonitorUpdateErr_temporary_failure - * Signature: ()Lorg/ldk/enums/ChannelMonitorUpdateErr; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1temporary_1failure - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: ChannelMonitorUpdateErr_permanent_failure - * Signature: ()Lorg/ldk/enums/ChannelMonitorUpdateErr; - */ -JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1permanent_1failure - (JNIEnv *, jclass); - /* * Class: org_ldk_impl_bindings * Method: MonitorUpdateError_free @@ -10311,14 +10743,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: Persist_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: C2Tuple_BlockHashChannelMonitorZ_read @@ -11007,6 +11431,54 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: PaymentId_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentId_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentId_hash + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentId_1hash + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentId_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentId_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentId_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PaymentId_1eq + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentId_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PaymentId_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: PaymentId_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentId_1read + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_free @@ -11337,18 +11809,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendab /* * Class: org_ldk_impl_bindings - * Method: ChannelDetails_get_user_id + * Method: ChannelDetails_get_user_channel_id * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1channel_1id (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelDetails_set_user_id + * Method: ChannelDetails_set_user_channel_id * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id (JNIEnv *, jclass, jlong, jlong); /* @@ -11623,6 +12095,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_retry_payment + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment + (JNIEnv *, jclass, jlong, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_send_spontaneous_payment @@ -17223,22 +17703,6 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read (JNIEnv *, jclass, jbyteArray); -/* - * Class: org_ldk_impl_bindings - * Method: ShutdownScript_new_p2pkh - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh - (JNIEnv *, jclass, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: ShutdownScript_new_p2sh - * Signature: ([B)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh - (JNIEnv *, jclass, jbyteArray); - /* * Class: org_ldk_impl_bindings * Method: ShutdownScript_new_p2wpkh @@ -17313,1259 +17777,1363 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free /* * Class: org_ldk_impl_bindings - * Method: RouteHop_free + * Method: Score_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_get_pubkey - * Signature: (J)[B + * Method: NodeId_free + * Signature: (J)V */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_set_pubkey - * Signature: (J[B)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey - (JNIEnv *, jclass, jlong, jbyteArray); - -/* - * Class: org_ldk_impl_bindings - * Method: RouteHop_get_node_features + * Method: NodeId_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeId_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_set_node_features - * Signature: (JJ)V + * Method: NodeId_from_pubkey + * Signature: ([B)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeId_1from_1pubkey + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_get_short_channel_id - * Signature: (J)J + * Method: NodeId_as_slice + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeId_1as_1slice (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_set_short_channel_id - * Signature: (JJ)V + * Method: NodeId_hash + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeId_1hash + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_get_channel_features - * Signature: (J)J + * Method: NodeId_write + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeId_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_set_channel_features - * Signature: (JJ)V + * Method: NodeId_read + * Signature: ([B)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeId_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_get_fee_msat - * Signature: (J)J + * Method: NetworkGraph_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_set_fee_msat - * Signature: (JJ)V + * Method: NetworkGraph_clone + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_get_cltv_expiry_delta - * Signature: (J)I + * Method: ReadOnlyNetworkGraph_free + * Signature: (J)V */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_set_cltv_expiry_delta - * Signature: (JI)V + * Method: NetworkUpdate_free + * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta - (JNIEnv *, jclass, jlong, jint); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_new - * Signature: ([BJJJJI)J + * Method: NetworkUpdate_clone + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1new - (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong, jlong, jint); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_clone + * Method: NetworkUpdate_channel_update_message * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_hash - * Signature: (J)J + * Method: NetworkUpdate_channel_closed + * Signature: (JZ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed + (JNIEnv *, jclass, jlong, jboolean); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_eq - * Signature: (JJ)Z + * Method: NetworkUpdate_node_failure + * Signature: ([BZ)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure + (JNIEnv *, jclass, jbyteArray, jboolean); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_write + * Method: NetworkUpdate_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHop_read - * Signature: ([B)J + * Method: NetGraphMsgHandler_as_EventHandler + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_free + * Method: NetGraphMsgHandler_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_get_paths - * Signature: (J)[[J + * Method: NetGraphMsgHandler_get_network_graph + * Signature: (J)J */ -JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_set_paths - * Signature: (J[[J)V + * Method: NetGraphMsgHandler_set_network_graph + * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths - (JNIEnv *, jclass, jlong, jobjectArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_new - * Signature: ([[J)J + * Method: NetGraphMsgHandler_new + * Signature: (JJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new - (JNIEnv *, jclass, jobjectArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new + (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_clone + * Method: NetGraphMsgHandler_add_chain_access + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NetGraphMsgHandler_as_RoutingMessageHandler * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_hash + * Method: NetGraphMsgHandler_as_MessageSendEventsProvider * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1hash +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_eq - * Signature: (JJ)Z + * Method: DirectionalChannelInfo_free + * Signature: (J)V */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_get_total_fees - * Signature: (J)J + * Method: DirectionalChannelInfo_get_last_update + * Signature: (J)I */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_get_total_amount - * Signature: (J)J + * Method: DirectionalChannelInfo_set_last_update + * Signature: (JI)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update + (JNIEnv *, jclass, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: Route_write - * Signature: (J)[B + * Method: DirectionalChannelInfo_get_enabled + * Signature: (J)Z */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: Route_read - * Signature: ([B)J + * Method: DirectionalChannelInfo_set_enabled + * Signature: (JZ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled + (JNIEnv *, jclass, jlong, jboolean); /* * Class: org_ldk_impl_bindings - * Method: RouteHint_free - * Signature: (J)V + * Method: DirectionalChannelInfo_get_cltv_expiry_delta + * Signature: (J)S */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHint_clone - * Signature: (J)J + * Method: DirectionalChannelInfo_set_cltv_expiry_delta + * Signature: (JS)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong, jshort); /* * Class: org_ldk_impl_bindings - * Method: RouteHint_hash + * Method: DirectionalChannelInfo_get_htlc_minimum_msat * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHint_eq - * Signature: (JJ)Z + * Method: DirectionalChannelInfo_set_htlc_minimum_msat + * Signature: (JJ)V */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_free - * Signature: (J)V + * Method: DirectionalChannelInfo_get_htlc_maximum_msat + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_get_src_node_id - * Signature: (J)[B + * Method: DirectionalChannelInfo_set_htlc_maximum_msat + * Signature: (JJ)V */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DirectionalChannelInfo_get_fees + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_set_src_node_id - * Signature: (J[B)V + * Method: DirectionalChannelInfo_set_fees + * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id - (JNIEnv *, jclass, jlong, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_get_short_channel_id + * Method: DirectionalChannelInfo_get_last_update_message * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_set_short_channel_id + * Method: DirectionalChannelInfo_set_last_update_message * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_get_fees + * Method: DirectionalChannelInfo_new + * Signature: (IZSJJJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new + (JNIEnv *, jclass, jint, jboolean, jshort, jlong, jlong, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DirectionalChannelInfo_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_set_fees - * Signature: (JJ)V + * Method: DirectionalChannelInfo_write + * Signature: (J)[B */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_get_cltv_expiry_delta - * Signature: (J)S + * Method: DirectionalChannelInfo_read + * Signature: ([B)J */ -JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_set_cltv_expiry_delta - * Signature: (JS)V + * Method: ChannelInfo_free + * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta - (JNIEnv *, jclass, jlong, jshort); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_get_htlc_minimum_msat + * Method: ChannelInfo_get_features * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_set_htlc_minimum_msat + * Method: ChannelInfo_set_features * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_get_htlc_maximum_msat + * Method: ChannelInfo_get_node_one * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_set_htlc_maximum_msat + * Method: ChannelInfo_set_node_one * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_new - * Signature: ([BJJSJJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new - (JNIEnv *, jclass, jbyteArray, jlong, jlong, jshort, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: RouteHintHop_clone + * Method: ChannelInfo_get_one_to_two * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_hash + * Method: ChannelInfo_set_one_to_two + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_get_node_two * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RouteHintHop_eq - * Signature: (JJ)Z + * Method: ChannelInfo_set_node_two + * Signature: (JJ)V */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: get_keysend_route - * Signature: ([BJ[B[J[JJIJ)J + * Method: ChannelInfo_get_two_to_one + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route - (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray, jlongArray, jlongArray, jlong, jint, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: get_route - * Signature: ([BJ[BJ[J[JJIJ)J + * Method: ChannelInfo_set_two_to_one + * Signature: (JJ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route - (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray, jlong, jlongArray, jlongArray, jlong, jint, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_free - * Signature: (J)V + * Method: ChannelInfo_get_capacity_sats + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_clone - * Signature: (J)J + * Method: ChannelInfo_set_capacity_sats + * Signature: (JJ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ReadOnlyNetworkGraph_free - * Signature: (J)V + * Method: ChannelInfo_get_announcement_message + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkUpdate_free - * Signature: (J)V + * Method: ChannelInfo_set_announcement_message + * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkUpdate_clone - * Signature: (J)J + * Method: ChannelInfo_new + * Signature: (JJJJJJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkUpdate_channel_update_message + * Method: ChannelInfo_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkUpdate_channel_closed - * Signature: (JZ)J + * Method: ChannelInfo_write + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed - (JNIEnv *, jclass, jlong, jboolean); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkUpdate_node_failure - * Signature: ([BZ)J + * Method: ChannelInfo_read + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure - (JNIEnv *, jclass, jbyteArray, jboolean); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: NetworkUpdate_write - * Signature: (J)[B + * Method: RoutingFees_free + * Signature: (J)V */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_as_EventHandler - * Signature: (J)J + * Method: RoutingFees_get_base_msat + * Signature: (J)I */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_free - * Signature: (J)V + * Method: RoutingFees_set_base_msat + * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat + (JNIEnv *, jclass, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_get_network_graph - * Signature: (J)J + * Method: RoutingFees_get_proportional_millionths + * Signature: (J)I */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_set_network_graph - * Signature: (JJ)V + * Method: RoutingFees_set_proportional_millionths + * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths + (JNIEnv *, jclass, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_new - * Signature: (JJJ)J + * Method: RoutingFees_new + * Signature: (II)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new - (JNIEnv *, jclass, jlong, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new + (JNIEnv *, jclass, jint, jint); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_add_chain_access - * Signature: (JJ)V + * Method: RoutingFees_eq + * Signature: (JJ)Z */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_as_RoutingMessageHandler + * Method: RoutingFees_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetGraphMsgHandler_as_MessageSendEventsProvider + * Method: RoutingFees_hash * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_free + * Method: RoutingFees_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: RoutingFees_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeAnnouncementInfo_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_last_update + * Method: NodeAnnouncementInfo_get_features + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeAnnouncementInfo_set_features + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeAnnouncementInfo_get_last_update * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_last_update + * Method: NodeAnnouncementInfo_set_last_update * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update (JNIEnv *, jclass, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_enabled - * Signature: (J)Z + * Method: NodeAnnouncementInfo_get_rgb + * Signature: (J)[B */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_enabled - * Signature: (JZ)V + * Method: NodeAnnouncementInfo_set_rgb + * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled - (JNIEnv *, jclass, jlong, jboolean); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_cltv_expiry_delta - * Signature: (J)S + * Method: NodeAnnouncementInfo_get_alias + * Signature: (J)[B */ -JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_cltv_expiry_delta - * Signature: (JS)V + * Method: NodeAnnouncementInfo_set_alias + * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta - (JNIEnv *, jclass, jlong, jshort); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_htlc_minimum_msat + * Method: NodeAnnouncementInfo_set_addresses + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses + (JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeAnnouncementInfo_get_announcement_message * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_htlc_minimum_msat + * Method: NodeAnnouncementInfo_set_announcement_message * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_htlc_maximum_msat - * Signature: (J)J + * Method: NodeAnnouncementInfo_new + * Signature: (JI[B[B[JJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new + (JNIEnv *, jclass, jlong, jint, jbyteArray, jbyteArray, jlongArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeAnnouncementInfo_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeAnnouncementInfo_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeAnnouncementInfo_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: NodeInfo_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_htlc_maximum_msat - * Signature: (JJ)V + * Method: NodeInfo_set_channels + * Signature: (J[J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels + (JNIEnv *, jclass, jlong, jlongArray); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_fees + * Method: NodeInfo_get_lowest_inbound_channel_fees * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_fees + * Method: NodeInfo_set_lowest_inbound_channel_fees * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_get_last_update_message + * Method: NodeInfo_get_announcement_info * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_set_last_update_message + * Method: NodeInfo_set_announcement_info * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_new - * Signature: (IZSJJJJ)J + * Method: NodeInfo_new + * Signature: ([JJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new - (JNIEnv *, jclass, jint, jboolean, jshort, jlong, jlong, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new + (JNIEnv *, jclass, jlongArray, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_clone + * Method: NodeInfo_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_write + * Method: NodeInfo_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: DirectionalChannelInfo_read + * Method: NodeInfo_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_free - * Signature: (J)V + * Method: NetworkGraph_write + * Signature: (J)[B */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_features - * Signature: (J)J + * Method: NetworkGraph_read + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_features - * Signature: (JJ)V + * Method: NetworkGraph_new + * Signature: ([B)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_node_one - * Signature: (J)[B + * Method: NetworkGraph_read_only + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_node_one - * Signature: (J[B)V + * Method: NetworkGraph_update_node_from_announcement + * Signature: (JJ)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one - (JNIEnv *, jclass, jlong, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_one_to_two - * Signature: (J)J + * Method: NetworkGraph_update_node_from_unsigned_announcement + * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_one_to_two - * Signature: (JJ)V + * Method: NetworkGraph_update_channel_from_announcement + * Signature: (JJJ)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement + (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_node_two - * Signature: (J)[B + * Method: NetworkGraph_update_channel_from_unsigned_announcement + * Signature: (JJJ)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement + (JNIEnv *, jclass, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_node_two - * Signature: (J[B)V + * Method: NetworkGraph_close_channel_from_update + * Signature: (JJZ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two - (JNIEnv *, jclass, jlong, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update + (JNIEnv *, jclass, jlong, jlong, jboolean); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_two_to_one - * Signature: (J)J + * Method: NetworkGraph_fail_node + * Signature: (J[BZ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node + (JNIEnv *, jclass, jlong, jbyteArray, jboolean); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_two_to_one - * Signature: (JJ)V + * Method: NetworkGraph_update_channel + * Signature: (JJ)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_capacity_sats - * Signature: (J)J + * Method: NetworkGraph_update_channel_unsigned + * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_capacity_sats - * Signature: (JJ)V + * Method: ReadOnlyNetworkGraph_get_addresses + * Signature: (J[B)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1get_1addresses + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_get_announcement_message - * Signature: (J)J + * Method: RouteHop_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_set_announcement_message - * Signature: (JJ)V + * Method: RouteHop_get_pubkey + * Signature: (J)[B */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_new - * Signature: (J[BJ[BJJJ)J + * Method: RouteHop_set_pubkey + * Signature: (J[B)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jbyteArray, jlong, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_clone + * Method: RouteHop_get_node_features * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_write - * Signature: (J)[B + * Method: RouteHop_set_node_features + * Signature: (JJ)V */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: RouteHop_get_short_channel_id + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelInfo_read - * Signature: ([B)J + * Method: RouteHop_set_short_channel_id + * Signature: (JJ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_free - * Signature: (J)V + * Method: RouteHop_get_channel_features + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_get_base_msat - * Signature: (J)I + * Method: RouteHop_set_channel_features + * Signature: (JJ)V */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: RouteHop_get_fee_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_set_base_msat - * Signature: (JI)V + * Method: RouteHop_set_fee_msat + * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat - (JNIEnv *, jclass, jlong, jint); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_get_proportional_millionths + * Method: RouteHop_get_cltv_expiry_delta * Signature: (J)I */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths +JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_set_proportional_millionths + * Method: RouteHop_set_cltv_expiry_delta * Signature: (JI)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta (JNIEnv *, jclass, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_new - * Signature: (II)J + * Method: RouteHop_new + * Signature: ([BJJJJI)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new - (JNIEnv *, jclass, jint, jint); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1new + (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_eq - * Signature: (JJ)Z + * Method: RouteHop_clone + * Signature: (J)J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_clone + * Method: RouteHop_hash * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_hash - * Signature: (J)J + * Method: RouteHop_eq + * Signature: (JJ)Z */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash - (JNIEnv *, jclass, jlong); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_write + * Method: RouteHop_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: RoutingFees_read + * Method: RouteHop_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1read (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_free + * Method: Route_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_get_features - * Signature: (J)J + * Method: Route_get_paths + * Signature: (J)[[J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features +JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_set_features - * Signature: (JJ)V + * Method: Route_set_paths + * Signature: (J[[J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths + (JNIEnv *, jclass, jlong, jobjectArray); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_get_last_update - * Signature: (J)I + * Method: Route_new + * Signature: ([[J)J */ -JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new + (JNIEnv *, jclass, jobjectArray); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_set_last_update - * Signature: (JI)V + * Method: Route_clone + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update - (JNIEnv *, jclass, jlong, jint); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_get_rgb - * Signature: (J)[B + * Method: Route_hash + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1hash (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_set_rgb - * Signature: (J[B)V + * Method: Route_eq + * Signature: (JJ)Z */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb - (JNIEnv *, jclass, jlong, jbyteArray); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_get_alias - * Signature: (J)[B + * Method: Route_get_total_fees + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_set_alias - * Signature: (J[B)V + * Method: Route_get_total_amount + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias - (JNIEnv *, jclass, jlong, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_set_addresses - * Signature: (J[J)V + * Method: Route_write + * Signature: (J)[B */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses - (JNIEnv *, jclass, jlong, jlongArray); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_get_announcement_message - * Signature: (J)J + * Method: Route_read + * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_set_announcement_message - * Signature: (JJ)V + * Method: RouteHint_free + * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_new - * Signature: (JI[B[B[JJ)J + * Method: RouteHint_clone + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new - (JNIEnv *, jclass, jlong, jint, jbyteArray, jbyteArray, jlongArray, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_clone + * Method: RouteHint_hash * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_write - * Signature: (J)[B + * Method: RouteHint_eq + * Signature: (JJ)Z */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write - (JNIEnv *, jclass, jlong); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeAnnouncementInfo_read - * Signature: ([B)J + * Method: RouteHintHop_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_free - * Signature: (J)V + * Method: RouteHintHop_get_src_node_id + * Signature: (J)[B */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_set_channels - * Signature: (J[J)V + * Method: RouteHintHop_set_src_node_id + * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels - (JNIEnv *, jclass, jlong, jlongArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id + (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_get_lowest_inbound_channel_fees + * Method: RouteHintHop_get_short_channel_id * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_set_lowest_inbound_channel_fees + * Method: RouteHintHop_set_short_channel_id * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_get_announcement_info + * Method: RouteHintHop_get_fees * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_set_announcement_info + * Method: RouteHintHop_set_fees * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_new - * Signature: ([JJJ)J + * Method: RouteHintHop_get_cltv_expiry_delta + * Signature: (J)S */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new - (JNIEnv *, jclass, jlongArray, jlong, jlong); +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_clone - * Signature: (J)J + * Method: RouteHintHop_set_cltv_expiry_delta + * Signature: (JS)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone - (JNIEnv *, jclass, jlong); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta + (JNIEnv *, jclass, jlong, jshort); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_write - * Signature: (J)[B + * Method: RouteHintHop_get_htlc_minimum_msat + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NodeInfo_read - * Signature: ([B)J + * Method: RouteHintHop_set_htlc_minimum_msat + * Signature: (JJ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_write - * Signature: (J)[B + * Method: RouteHintHop_get_htlc_maximum_msat + * Signature: (J)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_read - * Signature: ([B)J + * Method: RouteHintHop_set_htlc_maximum_msat + * Signature: (JJ)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat + (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_new - * Signature: ([B)J + * Method: RouteHintHop_new + * Signature: ([BJJSJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1new + (JNIEnv *, jclass, jbyteArray, jlong, jlong, jshort, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_read_only + * Method: RouteHintHop_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_update_node_from_announcement - * Signature: (JJ)J + * Method: RouteHintHop_hash + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_update_node_from_unsigned_announcement - * Signature: (JJ)J + * Method: RouteHintHop_eq + * Signature: (JJ)Z */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_update_channel_from_announcement - * Signature: (JJJ)J + * Method: get_keysend_route + * Signature: ([BJ[B[J[JJIJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement - (JNIEnv *, jclass, jlong, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route + (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray, jlongArray, jlongArray, jlong, jint, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_update_channel_from_unsigned_announcement - * Signature: (JJJ)J + * Method: get_route + * Signature: ([BJ[BJ[J[JJIJJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement - (JNIEnv *, jclass, jlong, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route + (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray, jlong, jlongArray, jlongArray, jlong, jint, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_close_channel_from_update - * Signature: (JJZ)V + * Method: Scorer_free + * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update - (JNIEnv *, jclass, jlong, jlong, jboolean); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_fail_node - * Signature: (J[BZ)V + * Method: Scorer_new + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node - (JNIEnv *, jclass, jlong, jbyteArray, jboolean); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Scorer_1new + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_update_channel - * Signature: (JJ)J + * Method: Scorer_default + * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Scorer_1default + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: NetworkGraph_update_channel_unsigned - * Signature: (JJ)J + * Method: Scorer_as_Score + * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned - (JNIEnv *, jclass, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Scorer_1as_1Score + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_CVec_NetAddressZZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_CVec_NetAddressZZ.h new file mode 100644 index 00000000..41a6eded --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_CVec_NetAddressZZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_CVec_NetAddressZZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_CVec_NetAddressZZ +#define _Included_org_ldk_impl_bindings_LDKCOption_CVec_NetAddressZZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_CVec_NetAddressZZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ts/bindings.c b/ts/bindings.c index b387b4e6..4ac3369b 100644 --- a/ts/bindings.c +++ b/ts/bindings.c @@ -2223,6 +2223,27 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_Bloc uint32_t err_conv = LDKIOError_to_js((*val->contents.err)); return err_conv; } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) { LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1); switch(obj->tag) { @@ -2333,6 +2354,22 @@ static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *or } return ret; } +jboolean __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult__u832APIErrorZ*)arg)->result_ok; +} +int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); + return res_arr; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) { LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1); switch(obj->tag) { @@ -2377,6 +2414,24 @@ uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_fro default: abort(); } } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(uint32_t arg) { + return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) { return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok; } @@ -2391,18 +2446,57 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFa uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } -jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) { - return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok; +uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) { + LDKC2Tuple_PaymentHashPaymentIdZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + LDKThirtyTwoBytes a_ref; + CHECK(*((uint32_t*)a) == 32); + memcpy(a_ref.data, (uint8_t*)(a + 4), 32); + ret->a = a_ref; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + ret->b = b_conv; + return (uint64_t)ret; +} +static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return ThirtyTwoBytes_clone(&tuple->a); +} +int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32); + return ret_arr; +} + +static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return PaymentId_clone(&tuple->b); +} +uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(uint32_t arg) { + return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok; } -int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(val->result_ok); - int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); - return res_arr; + LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv); + return ((uint64_t)res_conv); } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(!val->result_ok); uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; @@ -3758,7 +3852,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ case LDKEvent_PaymentSent: { int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32); - return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr; + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32); + return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr; (void) payment_hash_arr; } case LDKEvent_PaymentPathFailed: { int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -3774,7 +3870,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; path_arr_ptr[k] = path_conv_10_ref; } - return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; + uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1; + return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref; } case LDKEvent_PendingHTLCsForwardable: { return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable; @@ -3797,7 +3894,15 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32); uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1; - return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) reason_ref; + return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref; + } + case LDKEvent_DiscardFunding: { + int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32); + LDKTransaction transaction_var = obj->discard_funding.transaction; + int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen); + return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr; } default: abort(); } @@ -4269,6 +4374,27 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErr uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKNodeId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} typedef struct LDKAccess_JCalls { atomic_size_t refcnt; uint32_t get_utxo_meth; @@ -4481,6 +4607,25 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecod uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) { + LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_CVec_NetAddressZZ_Some: { + LDKCVec_NetAddressZ some_var = obj->some; + uint32_tArray some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4); + for (size_t m = 0; m < some_var.datalen; m++) { + uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1; + some_arr_ptr[m] = some_conv_12_ref; + } + return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr; + } + case LDKCOption_CVec_NetAddressZZ_None: { + return 0 /* LDKCOption_CVec_NetAddressZZ - None */; + } + default: abort(); + } +} jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) { return ((LDKCResult_NetAddressu8Z*)arg)->result_ok; } @@ -5437,6 +5582,49 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_p default: abort(); } } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_result_ok(uint32_t arg) { + return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKLockedChannelMonitor res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCVec_OutPointZ_new(uint32_tArray elems) { + LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ"); + ret->datalen = *((uint32_t*)elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data"); + uint32_t *java_elems = (uint32_t*)(elems + 4); + for (size_t i = 0; i < ret->datalen; i++) { + uint32_t arr_elem = java_elems[i]; + LDKOutPoint arr_elem_conv; + arr_elem_conv.inner = (void*)(arr_elem & (~1)); + arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0); + arr_elem_conv = OutPoint_clone(&arr_elem_conv); + ret->data[i] = arr_elem_conv; + } + } + return (uint64_t)ret; +} +static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) { + LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = OutPoint_clone(&orig->data[i]); + } + return ret; +} typedef struct LDKMessageSendEventsProvider_JCalls { atomic_size_t refcnt; uint32_t get_and_clear_pending_msg_events_meth; @@ -7116,6 +7304,48 @@ int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_ return ret_val; } +typedef struct LDKScore_JCalls { + atomic_size_t refcnt; + uint32_t channel_penalty_msat_meth; +} LDKScore_JCalls; +static void LDKScore_JCalls_free(void* this_arg) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + js_free(j_calls->channel_penalty_msat_meth); + FREE(j_calls); + } +} +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + return js_invoke_function_1(j_calls->channel_penalty_msat_meth, short_channel_id); +} +static void LDKScore_JCalls_cloned(LDKScore* new_obj) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) { + LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls"); + atomic_init(&calls->refcnt, 1); + //TODO: Assign calls->o from o + + LDKScore ret = { + .this_arg = (void*) calls, + .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, + .free = LDKScore_JCalls_free, + }; + return ret; +} +long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) { + LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore"); + *res_ptr = LDKScore_init(o); + return (long)res_ptr; +} +int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id) { + LDKScore* this_arg_conv = (LDKScore*)(((uint64_t)this_arg) & ~1); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id); + return ret_val; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; uint32_t persist_manager_meth; @@ -8890,6 +9120,40 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHa return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_ok(uint32_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_err(uint32_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdDecodeErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) { LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z"); *ret_copy = COption_u16Z_some(o); @@ -8981,6 +9245,69 @@ void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArra CVec_APIErrorZ_free(_res_constr); } +uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(*((uint32_t*)o) == 32); + memcpy(o_ref.data, (uint8_t*)(o + 4), 32); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) { + LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult__u832APIErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) { + LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(uint32_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) { + LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); + e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdPaymentSendFailureZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) { + LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() { LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_ok(); @@ -9009,34 +9336,60 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailu return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) { - LDKThirtyTwoBytes o_ref; - CHECK(*((uint32_t*)o) == 32); - memcpy(o_ref.data, (uint8_t*)(o + 4), 32); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref); +uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) { + LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv); + return ((uint64_t)ret_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) { + LDKThirtyTwoBytes a_ref; + CHECK(*((uint32_t*)a) == 32); + memcpy(a_ref.data, (uint8_t*)(a + 4), 32); + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv); + return ((uint64_t)ret_conv); +} + +void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + C2Tuple_PaymentHashPaymentIdZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) { + LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1); + o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) { LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) { if ((_res & 1) != 0) return; - LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_PaymentHashPaymentSendFailureZ_free(_res_conv); + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) { - LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv); +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv); return (uint64_t)ret_conv; } @@ -10355,6 +10708,40 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = NodeId_clone(&o_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_NodeIdDecodeErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) { LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1); LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); @@ -10596,6 +10983,48 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeEr return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) { + LDKCVec_NetAddressZ o_constr; + o_constr.datalen = *((uint32_t*)o); + if (o_constr.datalen > 0) + o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + o_constr.data = NULL; + uint32_t* o_vals = (uint32_t*)(o + 4); + for (size_t m = 0; m < o_constr.datalen; m++) { + uint32_t o_conv_12 = o_vals[m]; + LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(((uint64_t)o_conv_12) & ~1); + o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1)); + o_constr.data[m] = o_conv_12_conv; + } + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_some(o_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() { + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_none(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + COption_CVec_NetAddressZZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) { + LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig; + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) { LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1); o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1)); @@ -11902,11 +12331,52 @@ void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _r COption_FilterZ_free(_res_conv); } -void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - PaymentPurpose_free(this_ptr_conv); +uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) { + LDKLockedChannelMonitor o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() { + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_err(); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_LockedChannelMonitorNoneZ_free(_res_conv); +} + +void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) { + LDKCVec_OutPointZ _res_constr; + _res_constr.datalen = *((uint32_t*)_res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements"); + else + _res_constr.data = NULL; + uint32_t* _res_vals = (uint32_t*)(_res + 4); + for (size_t k = 0; k < _res_constr.datalen; k++) { + uint32_t _res_conv_10 = _res_vals[k]; + LDKOutPoint _res_conv_10_conv; + _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1)); + _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0); + _res_constr.data[k] = _res_conv_10_conv; + } + CVec_OutPointZ_free(_res_constr); +} + +void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + PaymentPurpose_free(this_ptr_conv); } uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) { @@ -12056,17 +12526,20 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_ return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) { +uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage, int8_tArray payment_hash) { LDKThirtyTwoBytes payment_preimage_ref; CHECK(*((uint32_t*)payment_preimage) == 32); memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_sent(payment_preimage_ref); + *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path) { +uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path, uint32_t short_channel_id) { LDKThirtyTwoBytes payment_hash_ref; CHECK(*((uint32_t*)payment_hash) == 32); memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); @@ -12087,8 +12560,10 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(in path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); path_constr.data[k] = path_conv_10_conv; } + LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1); + short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr); + *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -12129,14 +12604,29 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, uint32_t reason) { +uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) { LDKThirtyTwoBytes channel_id_ref; CHECK(*((uint32_t*)channel_id) == 32); memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32); LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1); reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_channel_closed(channel_id_ref, reason_conv); + *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) { + LDKThirtyTwoBytes channel_id_ref; + CHECK(*((uint32_t*)channel_id) == 32); + memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32); + LDKTransaction transaction_ref; + transaction_ref.datalen = *((uint32_t*)transaction); + transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes"); + memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen); + transaction_ref.data_is_owned = true; + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -13266,6 +13756,22 @@ void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) Confirm_free(this_ptr_conv); } +uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) { + LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); + uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv)); + return ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() { + uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure()); + return ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() { + uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure()); + return ret_conv; +} + void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1); @@ -13438,6 +13944,20 @@ void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ FeeEstimator_free(this_ptr_conv); } +void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Persist_free(this_ptr_conv); +} + +void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) { + LDKLockedChannelMonitor this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + LockedChannelMonitor_free(this_obj_conv); +} + void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) { LDKChainMonitor this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -13497,6 +14017,40 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claima return ret_arr; } +uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKOutPoint funding_txo_conv; + funding_txo_conv.inner = (void*)(funding_txo & (~1)); + funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); + funding_txo_conv = OutPoint_clone(&funding_txo_conv); + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv); + return (uint64_t)ret_conv; +} + +uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv); + uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4); + for (size_t k = 0; k < ret_var.datalen; k++) { + LDKOutPoint ret_conv_10_var = ret_var.data[k]; + CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner; + if (ret_conv_10_var.is_owned) { + ret_conv_10_ref |= 1; + } + ret_arr_ptr[k] = ret_conv_10_ref; + } + FREE(ret_var.data); + return ret_arr; +} + uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) { LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -13589,22 +14143,6 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(in return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) { - LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); - uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv)); - return ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() { - uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure()); - return ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() { - uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure()); - return ret_conv; -} - void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) { LDKMonitorUpdateError this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -14065,13 +14603,6 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_clai return ret_arr; } -void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - Persist_free(this_ptr_conv); -} - uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); @@ -15005,6 +15536,66 @@ uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface return (uint64_t)ret_ret; } +void __attribute__((visibility("default"))) TS_PaymentId_free(uint32_t this_obj) { + LDKPaymentId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + PaymentId_free(this_obj_conv); +} + +int64_t __attribute__((visibility("default"))) TS_PaymentId_hash(uint32_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = PaymentId_hash(&o_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_PaymentId_clone(uint32_t orig) { + LDKPaymentId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKPaymentId ret_var = PaymentId_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +jboolean __attribute__((visibility("default"))) TS_PaymentId_eq(uint32_t a, uint32_t b) { + LDKPaymentId a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = PaymentId_eq(&a_conv, &b_conv); + return ret_val; +} + +int8_tArray __attribute__((visibility("default"))) TS_PaymentId_write(uint32_t obj) { + LDKPaymentId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = PaymentId_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_PaymentId_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = PaymentId_read(ser_ref); + return (uint64_t)ret_conv; +} + void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -15423,19 +16014,19 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_p ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv); } -int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) { +int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv); + int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) { +void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - ChannelDetails_set_user_id(&this_ptr_conv, val); + ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) { @@ -15566,7 +16157,7 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uin ChannelDetails_set_is_public(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_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(*((uint32_t*)channel_id_arg) == 32); memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32); @@ -15585,7 +16176,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArr confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1)); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_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_id_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, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_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); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -15731,7 +16322,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_d return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, uint32_t override_config) { +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -15742,8 +16333,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channe override_config_conv.inner = (void*)(override_config & (~1)); override_config_conv.is_owned = (override_config & 1) || (override_config == 0); override_config_conv = UserConfig_clone(&override_config_conv); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv); return (uint64_t)ret_conv; } @@ -15848,11 +16439,27 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment( LDKThirtyTwoBytes payment_secret_ref; CHECK(*((uint32_t*)payment_secret) == 32); memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, uint32_t payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + LDKPaymentId payment_id_conv; + payment_id_conv.inner = (void*)(payment_id & (~1)); + payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0); + payment_id_conv = PaymentId_clone(&payment_id_conv); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -15863,7 +16470,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontane LDKThirtyTwoBytes payment_preimage_ref; CHECK(*((uint32_t*)payment_preimage) == 32); memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref); return (uint64_t)ret_conv; } @@ -23202,36 +23809,6 @@ uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tAr return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) { - unsigned char pubkey_hash_arr[20]; - CHECK(*((uint32_t*)pubkey_hash) == 20); - memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20); - unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) { - unsigned char script_hash_arr[20]; - CHECK(*((uint32_t*)script_hash) == 20); - memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20); - unsigned char (*script_hash_ref)[20] = &script_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) { unsigned char pubkey_hash_arr[20]; CHECK(*((uint32_t*)pubkey_hash) == 20); @@ -23324,37 +23901,25 @@ void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) { Type_free(this_ptr_conv); } -void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) { - LDKRouteHop this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHop_free(this_obj_conv); -} - -int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33); - return ret_arr; +void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKScore this_ptr_conv = *(LDKScore*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); } -void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK(*((uint32_t*)val) == 33); - memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - RouteHop_set_pubkey(&this_ptr_conv, val_ref); +void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) { + LDKNodeId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NodeId_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); +uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) { + LDKNodeId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNodeId ret_var = NodeId_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23364,37 +23929,11 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(u return ret_ref; } -void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeFeatures_clone(&val_conv); - RouteHop_set_node_features(&this_ptr_conv, val_conv); -} - -int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); - return ret_val; -} - -void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_short_channel_id(&this_ptr_conv, val); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); +uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) { + LDKPublicKey pubkey_ref; + CHECK(*((uint32_t*)pubkey) == 33); + memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33); + LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23404,60 +23943,56 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_feature return ret_ref; } -void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - RouteHop_set_channel_features(&this_ptr_conv, val_conv); +int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) { + LDKNodeId this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + return ret_arr; } -int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); +int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = NodeId_hash(&o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_fee_msat(&this_ptr_conv, val); +int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) { + LDKNodeId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NodeId_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; } -int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = NodeId_read(ser_ref); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); +void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) { + LDKNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NetworkGraph_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { - LDKPublicKey pubkey_arg_ref; - CHECK(*((uint32_t*)pubkey_arg) == 33); - memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33); - LDKNodeFeatures node_features_arg_conv; - node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); - node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); - node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); - LDKChannelFeatures channel_features_arg_conv; - channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); - channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); - channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); - LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) { + LDKNetworkGraph orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23467,155 +24002,86 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(int8_tArray pub return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) { - LDKRouteHop orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHop ret_var = RouteHop_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } +void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) { + LDKReadOnlyNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + ReadOnlyNetworkGraph_free(this_obj_conv); +} + +void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + NetworkUpdate_free(this_ptr_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) { + LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) { - LDKRouteHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHop_hash(&o_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) { + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + msg_conv = ChannelUpdate_clone(&msg_conv); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_update_message(msg_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) { - LDKRouteHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) { + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) { - LDKRouteHop obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv); +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) { + LDKPublicKey node_id_ref; + CHECK(*((uint32_t*)node_id) == 33); + memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) { + LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; + LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = RouteHop_read(ser_ref); - return (uint64_t)ret_conv; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); + *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) { - LDKRoute this_obj_conv; +void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) { + LDKNetGraphMsgHandler this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - Route_free(this_obj_conv); -} - -ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) { - LDKRoute this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); - ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); - uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4); - for (size_t m = 0; m < ret_var.datalen; m++) { - LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; - uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); - uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4); - for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { - LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; - CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; - if (ret_conv_12_conv_10_var.is_owned) { - ret_conv_12_conv_10_ref |= 1; - } - ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; - } - FREE(ret_conv_12_var.data); - ret_arr_ptr[m] = ret_conv_12_arr; - } - FREE(ret_var.data); - return ret_arr; + NetGraphMsgHandler_free(this_obj_conv); } -void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) { - LDKRoute this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) { + LDKNetGraphMsgHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ val_constr; - val_constr.datalen = *((uint32_t*)val); - if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - val_constr.data = NULL; - uint32_tArray* val_vals = (uint32_tArray*)(val + 4); - for (size_t m = 0; m < val_constr.datalen; m++) { - uint32_tArray val_conv_12 = val_vals[m]; - LDKCVec_RouteHopZ val_conv_12_constr; - val_conv_12_constr.datalen = *((uint32_t*)val_conv_12); - if (val_conv_12_constr.datalen > 0) - val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - val_conv_12_constr.data = NULL; - uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4); - for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { - uint32_t val_conv_12_conv_10 = val_conv_12_vals[k]; - LDKRouteHop val_conv_12_conv_10_conv; - val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); - val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); - val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); - val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; - } - val_constr.data[m] = val_conv_12_constr; - } - Route_set_paths(&this_ptr_conv, val_constr); -} - -uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) { - LDKCVec_CVec_RouteHopZZ paths_arg_constr; - paths_arg_constr.datalen = *((uint32_t*)paths_arg); - if (paths_arg_constr.datalen > 0) - paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - paths_arg_constr.data = NULL; - uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4); - for (size_t m = 0; m < paths_arg_constr.datalen; m++) { - uint32_tArray paths_arg_conv_12 = paths_arg_vals[m]; - LDKCVec_RouteHopZ paths_arg_conv_12_constr; - paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12); - if (paths_arg_conv_12_constr.datalen > 0) - paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - paths_arg_conv_12_constr.data = NULL; - uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4); - for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { - uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; - LDKRouteHop paths_arg_conv_12_conv_10_conv; - paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); - paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); - paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); - paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; - } - paths_arg_constr.data[m] = paths_arg_conv_12_constr; - } - LDKRoute ret_var = Route_new(paths_arg_constr); + LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23625,11 +24091,29 @@ uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) { - LDKRoute orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRoute ret_var = Route_clone(&orig_conv); +void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) { + LDKNetGraphMsgHandler this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNetworkGraph val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NetworkGraph_clone(&val_conv); + NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) { + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); + network_graph_conv = NetworkGraph_clone(&network_graph_conv); + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23639,233 +24123,127 @@ uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) { return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) { - LDKRoute o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = Route_hash(&o_conv); - return ret_val; -} - -jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) { - LDKRoute a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRoute b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = Route_eq(&a_conv, &b_conv); - return ret_val; -} - -int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) { - LDKRoute this_arg_conv; +void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_fees(&this_arg_conv); - return ret_val; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); } -int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) { - LDKRoute this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_amount(&this_arg_conv); - return ret_val; -} - -int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) { - LDKRoute obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = Route_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = Route_read(ser_ref); - return (uint64_t)ret_conv; -} - -void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) { - LDKRouteHint this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHint_free(this_obj_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) { - LDKRouteHint orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHint ret_var = RouteHint_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) { - LDKRouteHint o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHint_hash(&o_conv); - return ret_val; + LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); + *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) { - LDKRouteHint a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHint b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); + return (uint64_t)ret_ret; } -void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) { - LDKRouteHintHop this_obj_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) { + LDKDirectionalChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHintHop_free(this_obj_conv); + DirectionalChannelInfo_free(this_obj_conv); } -int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33); - return ret_arr; + int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); + return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK(*((uint32_t*)val) == 33); - memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); + DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); } -int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_short_channel_id(&this_ptr_conv, val); + DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; + int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = RoutingFees_clone(&val_conv); - RouteHintHop_set_fees(&this_ptr_conv, val_conv); + DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); } -int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); + int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); + DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); + *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; + DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { - LDKRouteHintHop this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) { - LDKPublicKey src_node_id_arg_ref; - CHECK(*((uint32_t*)src_node_id_arg) == 33); - memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33); - LDKRoutingFees fees_arg_conv; - fees_arg_conv.inner = (void*)(fees_arg & (~1)); - fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); - fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); - htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); + LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23875,155 +24253,315 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_new(int8_tArray return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) { - LDKRouteHintHop orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = RoutingFees_clone(&val_conv); + DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; } return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) { - LDKRouteHintHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHintHop_hash(&o_conv); - return ret_val; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelUpdate val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelUpdate_clone(&val_conv); + DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); } -jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) { - LDKRouteHintHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHintHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) { + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); + LDKRoutingFees fees_arg_conv; + fees_arg_conv.inner = (void*)(fees_arg & (~1)); + fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); + fees_arg_conv = RoutingFees_clone(&fees_arg_conv); + LDKChannelUpdate last_update_message_arg_conv; + last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); + last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); + last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) { - LDKPublicKey our_node_id_ref; - CHECK(*((uint32_t*)our_node_id) == 33); - memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK(*((uint32_t*)payee) == 33); - memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != 0) { - first_hops_constr.datalen = *((uint32_t*)first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - uint32_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = *((uint32_t*)last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - uint32_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) { + LDKDirectionalChannelInfo orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return (uint64_t)ret_conv; + return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) { - LDKPublicKey our_node_id_ref; - CHECK(*((uint32_t*)our_node_id) == 33); - memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK(*((uint32_t*)payee) == 33); - memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); - LDKInvoiceFeatures payee_features_conv; - payee_features_conv.inner = (void*)(payee_features & (~1)); - payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); - payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != 0) { - first_hops_constr.datalen = *((uint32_t*)first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - uint32_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = *((uint32_t*)last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - uint32_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } +int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) { + LDKDirectionalChannelInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); + *ret_conv = DirectionalChannelInfo_read(ser_ref); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) { - LDKNetworkGraph this_obj_conv; +void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) { + LDKChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetworkGraph_free(this_obj_conv); + ChannelInfo_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) { - LDKNetworkGraph orig_conv; +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelFeatures_clone(&val_conv); + ChannelInfo_set_features(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_one(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_two(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelAnnouncement val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelAnnouncement_clone(&val_conv); + ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) { + LDKChannelFeatures features_arg_conv; + features_arg_conv.inner = (void*)(features_arg & (~1)); + features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); + features_arg_conv = ChannelFeatures_clone(&features_arg_conv); + LDKNodeId node_one_arg_conv; + node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); + node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); + node_one_arg_conv = NodeId_clone(&node_one_arg_conv); + LDKDirectionalChannelInfo one_to_two_arg_conv; + one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); + one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); + one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); + LDKNodeId node_two_arg_conv; + node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); + node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); + node_two_arg_conv = NodeId_clone(&node_two_arg_conv); + LDKDirectionalChannelInfo two_to_one_arg_conv; + two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); + two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); + two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); + LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1); + capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); + LDKChannelAnnouncement announcement_message_arg_conv; + announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); + announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); + announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); + LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) { + LDKChannelInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); + LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24033,86 +24571,139 @@ uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t return ret_ref; } -void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) { - LDKReadOnlyNetworkGraph this_obj_conv; +int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) { + LDKChannelInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); + *ret_conv = ChannelInfo_read(ser_ref); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) { + LDKRoutingFees this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ReadOnlyNetworkGraph_free(this_obj_conv); + RoutingFees_free(this_obj_conv); } -void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - NetworkUpdate_free(this_ptr_conv); +int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv); + return ret_val; } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) { - LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_clone(orig_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RoutingFees_set_base_msat(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) { - LDKChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = (msg & 1) || (msg == 0); - msg_conv = ChannelUpdate_clone(&msg_conv); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_update_message(msg_conv); - uint64_t ret_ref = (uint64_t)ret_copy; +int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RoutingFees_set_proportional_millionths(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) { + LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) { - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; +jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) { + LDKRoutingFees a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRoutingFees b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) { + LDKRoutingFees orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) { - LDKPublicKey node_id_ref; - CHECK(*((uint32_t*)node_id) == 33); - memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) { + LDKRoutingFees o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RoutingFees_hash(&o_conv); + return ret_val; } -int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) { - LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; - LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv); +int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) { + LDKRoutingFees obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); - return (uint64_t)ret_ret; +uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ"); + *ret_conv = RoutingFees_read(ser_ref); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) { - LDKNetGraphMsgHandler this_obj_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) { + LDKNodeAnnouncementInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetGraphMsgHandler_free(this_obj_conv); + NodeAnnouncementInfo_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) { - LDKNetGraphMsgHandler this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); + LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24122,159 +24713,216 @@ uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_netwo return ret_ref; } -void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) { - LDKNetGraphMsgHandler this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph val_conv; + LDKNodeFeatures val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NetworkGraph_clone(&val_conv); - NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) { - LDKNetworkGraph network_graph_conv; - network_graph_conv.inner = (void*)(network_graph & (~1)); - network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); - network_graph_conv = NetworkGraph_clone(&network_graph_conv); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); + val_conv = NodeFeatures_clone(&val_conv); + NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); - *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); - return (uint64_t)ret_ret; +int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv); + return ret_val; } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); - *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); - return (uint64_t)ret_ret; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) { + LDKNodeAnnouncementInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val); } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) { - LDKDirectionalChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - DirectionalChannelInfo_free(this_obj_conv); +int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3); + return ret_arr; } -int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); - return ret_val; + LDKThreeBytes val_ref; + CHECK(*((uint32_t*)val) == 3); + memcpy(val_ref.data, (uint8_t*)(val + 4), 3); + NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref); } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32); + return ret_arr; } -jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); - return ret_val; + LDKThirtyTwoBytes val_ref; + CHECK(*((uint32_t*)val) == 32); + memcpy(val_ref.data, (uint8_t*)(val + 4), 32); + NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref); } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); + LDKCVec_NetAddressZ val_constr; + val_constr.datalen = *((uint32_t*)val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + val_constr.data = NULL; + uint32_t* val_vals = (uint32_t*)(val + 4); + for (size_t m = 0; m < val_constr.datalen; m++) { + uint32_t val_conv_12 = val_vals[m]; + LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); + val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1)); + val_constr.data[m] = val_conv_12_conv; + } + NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr); } -int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; + LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); + LDKNodeAnnouncement val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeAnnouncement_clone(&val_conv); + NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) { + LDKNodeFeatures features_arg_conv; + features_arg_conv.inner = (void*)(features_arg & (~1)); + features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); + features_arg_conv = NodeFeatures_clone(&features_arg_conv); + LDKThreeBytes rgb_arg_ref; + CHECK(*((uint32_t*)rgb_arg) == 3); + memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3); + LDKThirtyTwoBytes alias_arg_ref; + CHECK(*((uint32_t*)alias_arg) == 32); + memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32); + LDKCVec_NetAddressZ addresses_arg_constr; + addresses_arg_constr.datalen = *((uint32_t*)addresses_arg); + if (addresses_arg_constr.datalen > 0) + addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + addresses_arg_constr.data = NULL; + uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4); + for (size_t m = 0; m < addresses_arg_constr.datalen; m++) { + uint32_t addresses_arg_conv_12 = addresses_arg_vals[m]; + LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1); + addresses_arg_constr.data[m] = addresses_arg_conv_12_conv; + } + LDKNodeAnnouncement announcement_message_arg_conv; + announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); + announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); + announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv); + LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) { + LDKNodeAnnouncementInfo orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); +int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) { + LDKNodeAnnouncementInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ"); + *ret_conv = NodeAnnouncementInfo_read(ser_ref); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) { + LDKNodeInfo this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NodeInfo_free(this_obj_conv); +} + +void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + LDKCVec_u64Z val_constr; + val_constr.datalen = *((uint32_t*)val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (int64_t*)(val + 4); + for (size_t i = 0; i < val_constr.datalen; i++) { + int64_t val_conv_8 = val_vals[i]; + val_constr.data[i] = val_conv_8; + } + NodeInfo_set_channels(&this_ptr_conv, val_constr); } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24284,22 +24932,22 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_f return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRoutingFees val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); val_conv = RoutingFees_clone(&val_conv); - DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); + NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24309,29 +24957,38 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_l return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelUpdate val_conv; + LDKNodeAnnouncementInfo val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelUpdate_clone(&val_conv); - DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); + val_conv = NodeAnnouncementInfo_clone(&val_conv); + NodeInfo_set_announcement_info(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) { - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRoutingFees fees_arg_conv; - fees_arg_conv.inner = (void*)(fees_arg & (~1)); - fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); - fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKChannelUpdate last_update_message_arg_conv; - last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); - last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); - last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) { + LDKCVec_u64Z channels_arg_constr; + channels_arg_constr.datalen = *((uint32_t*)channels_arg); + if (channels_arg_constr.datalen > 0) + channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + channels_arg_constr.data = NULL; + int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4); + for (size_t i = 0; i < channels_arg_constr.datalen; i++) { + int64_t channels_arg_conv_8 = channels_arg_vals[i]; + channels_arg_constr.data[i] = channels_arg_conv_8; + } + LDKRoutingFees lowest_inbound_channel_fees_arg_conv; + lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1)); + lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0); + lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv); + LDKNodeAnnouncementInfo announcement_info_arg_conv; + announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1)); + announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0); + announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); + LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24341,11 +24998,11 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(i return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) { - LDKDirectionalChannelInfo orig_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) { + LDKNodeInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); + LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24355,126 +25012,217 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) { - LDKDirectionalChannelInfo obj_conv; +int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) { + LDKNodeInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv); + LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) { +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = DirectionalChannelInfo_read(ser_ref); + LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ"); + *ret_conv = NodeInfo_read(ser_ref); + return (uint64_t)ret_conv; +} + +int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) { + LDKNetworkGraph obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); + *ret_conv = NetworkGraph_read(ser_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) { + LDKThirtyTwoBytes genesis_hash_ref; + CHECK(*((uint32_t*)genesis_hash) == 32); + memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32); + LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKNodeAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKUnsignedNodeAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKChannelAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKUnsignedChannelAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) { - LDKChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ChannelInfo_free(this_obj_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; +void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent); } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - ChannelInfo_set_features(&this_ptr_conv, val_conv); +void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKPublicKey _node_id_ref; + CHECK(*((uint32_t*)_node_id) == 33); + memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33); + NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } -int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33); - return ret_arr; +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK(*((uint32_t*)val) == 33); - memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - ChannelInfo_set_node_one(&this_ptr_conv, val_ref); +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKUnsignedChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } +uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKPublicKey pubkey_ref; + CHECK(*((uint32_t*)pubkey) == 33); + memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33); + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); +void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) { + LDKRouteHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHop_free(this_obj_conv); } -int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33); + memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33); return ret_arr; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKPublicKey val_ref; CHECK(*((uint32_t*)val) == 33); memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - ChannelInfo_set_node_two(&this_ptr_conv, val_ref); + RouteHop_set_pubkey(&this_ptr_conv, val_ref); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24484,41 +25232,37 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(u return ret_ref; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; + LDKNodeFeatures val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); + val_conv = NodeFeatures_clone(&val_conv); + RouteHop_set_node_features(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; + int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); + return ret_val; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); + RouteHop_set_short_channel_id(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); + LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24528,125 +25272,60 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement return ret_ref; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelAnnouncement val_conv; + LDKChannelFeatures val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelAnnouncement_clone(&val_conv); - ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, int8_tArray node_one_arg, uint32_t one_to_two_arg, int8_tArray node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) { - LDKChannelFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKPublicKey node_one_arg_ref; - CHECK(*((uint32_t*)node_one_arg) == 33); - memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33); - LDKDirectionalChannelInfo one_to_two_arg_conv; - one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); - one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); - one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKPublicKey node_two_arg_ref; - CHECK(*((uint32_t*)node_two_arg) == 33); - memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33); - LDKDirectionalChannelInfo two_to_one_arg_conv; - two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); - two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); - two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); - LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1); - capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); - LDKChannelAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) { - LDKChannelInfo orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) { - LDKChannelInfo obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); - *ret_conv = ChannelInfo_read(ser_ref); - return (uint64_t)ret_conv; -} - -void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) { - LDKRoutingFees this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RoutingFees_free(this_obj_conv); + val_conv = ChannelFeatures_clone(&val_conv); + RouteHop_set_channel_features(&this_ptr_conv, val_conv); } -int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) { - LDKRoutingFees this_ptr_conv; +int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv); + int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) { - LDKRoutingFees this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RoutingFees_set_base_msat(&this_ptr_conv, val); + RouteHop_set_fee_msat(&this_ptr_conv, val); } -int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) { - LDKRoutingFees this_ptr_conv; +int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv); + int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) { - LDKRoutingFees this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RoutingFees_set_proportional_millionths(&this_ptr_conv, val); + RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) { - LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg); +uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { + LDKPublicKey pubkey_arg_ref; + CHECK(*((uint32_t*)pubkey_arg) == 33); + memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33); + LDKNodeFeatures node_features_arg_conv; + node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); + node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); + node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); + LDKChannelFeatures channel_features_arg_conv; + channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); + channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); + channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); + LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24656,22 +25335,11 @@ uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) { - LDKRoutingFees a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRoutingFees b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv); - return ret_val; -} - -uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) { - LDKRoutingFees orig_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) { + LDKRouteHop orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv); + LDKRouteHop ret_var = RouteHop_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24681,192 +25349,141 @@ uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t o return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) { - LDKRoutingFees o_conv; +int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) { + LDKRouteHop o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = false; - int64_t ret_val = RoutingFees_hash(&o_conv); + int64_t ret_val = RouteHop_hash(&o_conv); return ret_val; } -int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) { - LDKRoutingFees obj_conv; +jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) { + LDKRouteHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); + return ret_val; +} + +int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) { + LDKRouteHop obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv); + LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) { +uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ"); - *ret_conv = RoutingFees_read(ser_ref); + LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = RouteHop_read(ser_ref); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) { - LDKNodeAnnouncementInfo this_obj_conv; +void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) { + LDKRoute this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NodeAnnouncementInfo_free(this_obj_conv); + Route_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; +ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) { + LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); + ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); + uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4); + for (size_t m = 0; m < ret_var.datalen; m++) { + LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; + uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4); + for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { + LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; + CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; + if (ret_conv_12_conv_10_var.is_owned) { + ret_conv_12_conv_10_ref |= 1; + } + ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; + } + FREE(ret_conv_12_var.data); + ret_arr_ptr[m] = ret_conv_12_arr; } - return ret_ref; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeFeatures_clone(&val_conv); - NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv); -} - -int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv); - return ret_val; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val); -} - -int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3); - return ret_arr; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKThreeBytes val_ref; - CHECK(*((uint32_t*)val) == 3); - memcpy(val_ref.data, (uint8_t*)(val + 4), 3); - NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref); -} - -int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32); + FREE(ret_var.data); return ret_arr; } -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKThirtyTwoBytes val_ref; - CHECK(*((uint32_t*)val) == 32); - memcpy(val_ref.data, (uint8_t*)(val + 4), 32); - NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref); -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) { - LDKNodeAnnouncementInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) { + LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_NetAddressZ val_constr; + LDKCVec_CVec_RouteHopZZ val_constr; val_constr.datalen = *((uint32_t*)val); if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); else val_constr.data = NULL; - uint32_t* val_vals = (uint32_t*)(val + 4); + uint32_tArray* val_vals = (uint32_tArray*)(val + 4); for (size_t m = 0; m < val_constr.datalen; m++) { - uint32_t val_conv_12 = val_vals[m]; - LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); - val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1)); - val_constr.data[m] = val_conv_12_conv; - } - NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr); -} - -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint32_tArray val_conv_12 = val_vals[m]; + LDKCVec_RouteHopZ val_conv_12_constr; + val_conv_12_constr.datalen = *((uint32_t*)val_conv_12); + if (val_conv_12_constr.datalen > 0) + val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + val_conv_12_constr.data = NULL; + uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4); + for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { + uint32_t val_conv_12_conv_10 = val_conv_12_vals[k]; + LDKRouteHop val_conv_12_conv_10_conv; + val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); + val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); + val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); + val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; + } + val_constr.data[m] = val_conv_12_constr; } - return ret_ref; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeAnnouncement val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeAnnouncement_clone(&val_conv); - NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv); + Route_set_paths(&this_ptr_conv, val_constr); } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) { - LDKNodeFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - features_arg_conv = NodeFeatures_clone(&features_arg_conv); - LDKThreeBytes rgb_arg_ref; - CHECK(*((uint32_t*)rgb_arg) == 3); - memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3); - LDKThirtyTwoBytes alias_arg_ref; - CHECK(*((uint32_t*)alias_arg) == 32); - memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32); - LDKCVec_NetAddressZ addresses_arg_constr; - addresses_arg_constr.datalen = *((uint32_t*)addresses_arg); - if (addresses_arg_constr.datalen > 0) - addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); +uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) { + LDKCVec_CVec_RouteHopZZ paths_arg_constr; + paths_arg_constr.datalen = *((uint32_t*)paths_arg); + if (paths_arg_constr.datalen > 0) + paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); else - addresses_arg_constr.data = NULL; - uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4); - for (size_t m = 0; m < addresses_arg_constr.datalen; m++) { - uint32_t addresses_arg_conv_12 = addresses_arg_vals[m]; - LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1); - addresses_arg_constr.data[m] = addresses_arg_conv_12_conv; + paths_arg_constr.data = NULL; + uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4); + for (size_t m = 0; m < paths_arg_constr.datalen; m++) { + uint32_tArray paths_arg_conv_12 = paths_arg_vals[m]; + LDKCVec_RouteHopZ paths_arg_conv_12_constr; + paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12); + if (paths_arg_conv_12_constr.datalen > 0) + paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + paths_arg_conv_12_constr.data = NULL; + uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4); + for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { + uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; + LDKRouteHop paths_arg_conv_12_conv_10_conv; + paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); + paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); + paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); + paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; + } + paths_arg_constr.data[m] = paths_arg_conv_12_constr; } - LDKNodeAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv); - LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv); + LDKRoute ret_var = Route_new(paths_arg_constr); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24876,11 +25493,11 @@ uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(uin return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) { - LDKNodeAnnouncementInfo orig_conv; +uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) { + LDKRoute orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv); + LDKRoute ret_var = Route_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24890,56 +25507,147 @@ uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(u return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) { - LDKNodeAnnouncementInfo obj_conv; +int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) { + LDKRoute o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = Route_hash(&o_conv); + return ret_val; +} + +jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) { + LDKRoute a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRoute b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = Route_eq(&a_conv, &b_conv); + return ret_val; +} + +int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_fees(&this_arg_conv); + return ret_val; +} + +int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_amount(&this_arg_conv); + return ret_val; +} + +int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) { + LDKRoute obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv); + LDKCVec_u8Z ret_var = Route_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) { +uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ"); - *ret_conv = NodeAnnouncementInfo_read(ser_ref); + LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = Route_read(ser_ref); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) { - LDKNodeInfo this_obj_conv; +void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) { + LDKRouteHint this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NodeInfo_free(this_obj_conv); + RouteHint_free(this_obj_conv); } -void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) { - LDKNodeInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) { + LDKRouteHint orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHint ret_var = RouteHint_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) { + LDKRouteHint o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHint_hash(&o_conv); + return ret_val; +} + +jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) { + LDKRouteHint a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHint b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) { + LDKRouteHintHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHintHop_free(this_obj_conv); +} + +int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_u64Z val_constr; - val_constr.datalen = *((uint32_t*)val); - if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); - else - val_constr.data = NULL; - int64_t* val_vals = (int64_t*)(val + 4); - for (size_t i = 0; i < val_constr.datalen; i++) { - int64_t val_conv_8 = val_vals[i]; - val_constr.data[i] = val_conv_8; - } - NodeInfo_set_channels(&this_ptr_conv, val_constr); + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33); + return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) { - LDKNodeInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv); + LDKPublicKey val_ref; + CHECK(*((uint32_t*)val) == 33); + memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); + RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); +} + +int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_short_channel_id(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24949,63 +25657,83 @@ uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_ return ret_ref; } -void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) { - LDKNodeInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRoutingFees val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); val_conv = RoutingFees_clone(&val_conv); - NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv); + RouteHintHop_set_fees(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) { - LDKNodeInfo this_ptr_conv; +int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) { - LDKNodeInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNodeAnnouncementInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeAnnouncementInfo_clone(&val_conv); - NodeInfo_set_announcement_info(&this_ptr_conv, val_conv); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) { - LDKCVec_u64Z channels_arg_constr; - channels_arg_constr.datalen = *((uint32_t*)channels_arg); - if (channels_arg_constr.datalen > 0) - channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); - else - channels_arg_constr.data = NULL; - int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4); - for (size_t i = 0; i < channels_arg_constr.datalen; i++) { - int64_t channels_arg_conv_8 = channels_arg_vals[i]; - channels_arg_constr.data[i] = channels_arg_conv_8; - } - LDKRoutingFees lowest_inbound_channel_fees_arg_conv; - lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1)); - lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0); - lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv); - LDKNodeAnnouncementInfo announcement_info_arg_conv; - announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1)); - announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0); - announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); - LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) { + LDKPublicKey src_node_id_arg_ref; + CHECK(*((uint32_t*)src_node_id_arg) == 33); + memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33); + LDKRoutingFees fees_arg_conv; + fees_arg_conv.inner = (void*)(fees_arg & (~1)); + fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); + fees_arg_conv = RoutingFees_clone(&fees_arg_conv); + LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); + htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); + LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25015,11 +25743,11 @@ uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray ch return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) { - LDKNodeInfo orig_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) { + LDKRouteHintHop orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv); + LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25029,51 +25757,140 @@ uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) { - LDKNodeInfo obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; +int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) { + LDKRouteHintHop o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHintHop_hash(&o_conv); + return ret_val; } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ"); - *ret_conv = NodeInfo_read(ser_ref); - return (uint64_t)ret_conv; +jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) { + LDKRouteHintHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHintHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); + return ret_val; } -int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) { - LDKNetworkGraph obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; +uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_pubkey, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger, uint32_t scorer) { + LDKPublicKey our_node_pubkey_ref; + CHECK(*((uint32_t*)our_node_pubkey) == 33); + memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK(*((uint32_t*)payee) == 33); + memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != 0) { + first_hops_constr.datalen = *((uint32_t*)first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + uint32_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = *((uint32_t*)last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + uint32_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); - *ret_conv = NetworkGraph_read(ser_ref); +uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_pubkey, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger, uint32_t scorer) { + LDKPublicKey our_node_pubkey_ref; + CHECK(*((uint32_t*)our_node_pubkey) == 33); + memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK(*((uint32_t*)payee) == 33); + memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); + LDKInvoiceFeatures payee_features_conv; + payee_features_conv.inner = (void*)(payee_features & (~1)); + payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); + payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != 0) { + first_hops_constr.datalen = *((uint32_t*)first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + uint32_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = *((uint32_t*)last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + uint32_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) { - LDKThirtyTwoBytes genesis_hash_ref; - CHECK(*((uint32_t*)genesis_hash) == 32); - memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32); - LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref); +void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) { + LDKScorer this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + Scorer_free(this_obj_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_Scorer_new(int64_t base_penalty_msat) { + LDKScorer ret_var = Scorer_new(base_penalty_msat); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25083,11 +25900,8 @@ uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv); +uint32_t __attribute__((visibility("default"))) TS_Scorer_default() { + LDKScorer ret_var = Scorer_default(); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25097,103 +25911,13 @@ uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint3 return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKNodeAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKUnsignedNodeAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKChannelAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKUnsignedChannelAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv); - return (uint64_t)ret_conv; -} - -void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent); -} - -void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKPublicKey _node_id_ref; - CHECK(*((uint32_t*)_node_id) == 33); - memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33); - NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) { + LDKScorer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKUnsignedChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; + LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = Scorer_as_Score(&this_arg_conv); + return (uint64_t)ret_ret; } void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) { diff --git a/ts/bindings.c.body b/ts/bindings.c.body index ee5550d1..c2e953af 100644 --- a/ts/bindings.c.body +++ b/ts/bindings.c.body @@ -2221,6 +2221,27 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_CVec_C2Tuple_Bloc uint32_t err_conv = LDKIOError_to_js((*val->contents.err)); return err_conv; } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult_PaymentIdDecodeErrorZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_PaymentIdDecodeErrorZ *val = (LDKCResult_PaymentIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} uint32_t __attribute__((visibility("default"))) TS_LDKCOption_u16Z_ref_from_ptr(uint32_t ptr) { LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1); switch(obj->tag) { @@ -2331,6 +2352,22 @@ static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *or } return ret; } +jboolean __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult__u832APIErrorZ*)arg)->result_ok; +} +int8_tArray __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_ok(uint32_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); + return res_arr; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult__u832APIErrorZ_get_err(uint32_t arg) { + LDKCResult__u832APIErrorZ *val = (LDKCResult__u832APIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) { LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1); switch(obj->tag) { @@ -2375,6 +2412,24 @@ uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_fro default: abort(); } } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(uint32_t arg) { + return ((LDKCResult_PaymentIdPaymentSendFailureZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(uint32_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(val->result_ok); + LDKPaymentId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentIdPaymentSendFailureZ_get_err(uint32_t arg) { + LDKCResult_PaymentIdPaymentSendFailureZ *val = (LDKCResult_PaymentIdPaymentSendFailureZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) { return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok; } @@ -2389,18 +2444,57 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFa uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } -jboolean __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) { - return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok; +uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) { + LDKC2Tuple_PaymentHashPaymentIdZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + LDKThirtyTwoBytes a_ref; + CHECK(*((uint32_t*)a) == 32); + memcpy(a_ref.data, (uint8_t*)(a + 4), 32); + ret->a = a_ref; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + ret->b = b_conv; + return (uint64_t)ret; +} +static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return ThirtyTwoBytes_clone(&tuple->a); +} +int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_a(uint32_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), C2Tuple_PaymentHashPaymentIdZ_get_a(tuple_conv).data, 32); + return ret_arr; +} + +static inline struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple){ + return PaymentId_clone(&tuple->b); +} +uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_get_b(uint32_t tuple) { + LDKC2Tuple_PaymentHashPaymentIdZ* tuple_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(tuple & ~1); + LDKPaymentId ret_var = C2Tuple_PaymentHashPaymentIdZ_get_b(tuple_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(uint32_t arg) { + return ((LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)arg)->result_ok; } -int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(val->result_ok); - int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); - return res_arr; + LDKC2Tuple_PaymentHashPaymentIdZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentIdZ_clone(res_conv); + return ((uint64_t)res_conv); } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) { - LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(arg & ~1); CHECK(!val->result_ok); uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; @@ -3756,7 +3850,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ case LDKEvent_PaymentSent: { int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32); - return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr; + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_sent.payment_hash.data, 32); + return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr; (void) payment_hash_arr; } case LDKEvent_PaymentPathFailed: { int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -3772,7 +3868,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; path_arr_ptr[k] = path_conv_10_ref; } - return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; + uint64_t short_channel_id_ref = ((uint64_t)&obj->payment_path_failed.short_channel_id) | 1; + return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref; } case LDKEvent_PendingHTLCsForwardable: { return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable; @@ -3795,7 +3892,15 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32); uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1; - return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) reason_ref; + return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) obj->channel_closed.user_channel_id; (void) reason_ref; + } + case LDKEvent_DiscardFunding: { + int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(channel_id_arr + 4), obj->discard_funding.channel_id.data, 32); + LDKTransaction transaction_var = obj->discard_funding.transaction; + int8_tArray transaction_arr = init_arr(transaction_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen); + return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr; } default: abort(); } @@ -4267,6 +4372,27 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_boolPeerHandleErr uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult_NodeIdDecodeErrorZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKNodeId res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeIdDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_NodeIdDecodeErrorZ *val = (LDKCResult_NodeIdDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} typedef struct LDKAccess_JCalls { atomic_size_t refcnt; uint32_t get_utxo_meth; @@ -4479,6 +4605,25 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NetworkGraphDecod uint64_t err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } +uint32_t __attribute__((visibility("default"))) TS_LDKCOption_CVec_NetAddressZZ_ref_from_ptr(uint32_t ptr) { + LDKCOption_CVec_NetAddressZZ *obj = (LDKCOption_CVec_NetAddressZZ*)(ptr & ~1); + switch(obj->tag) { + case LDKCOption_CVec_NetAddressZZ_Some: { + LDKCVec_NetAddressZ some_var = obj->some; + uint32_tArray some_arr = init_arr(some_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *some_arr_ptr = (uint32_t*)(some_arr + 4); + for (size_t m = 0; m < some_var.datalen; m++) { + uint64_t some_conv_12_ref = ((uint64_t)&some_var.data[m]) | 1; + some_arr_ptr[m] = some_conv_12_ref; + } + return 0 /* LDKCOption_CVec_NetAddressZZ - Some */; (void) some_arr; + } + case LDKCOption_CVec_NetAddressZZ_None: { + return 0 /* LDKCOption_CVec_NetAddressZZ - None */; + } + default: abort(); + } +} jboolean __attribute__((visibility("default"))) TS_LDKCResult_NetAddressu8Z_result_ok(uint32_t arg) { return ((LDKCResult_NetAddressu8Z*)arg)->result_ok; } @@ -5435,6 +5580,49 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_p default: abort(); } } +jboolean __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_result_ok(uint32_t arg) { + return ((LDKCResult_LockedChannelMonitorNoneZ*)arg)->result_ok; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_ok(uint32_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKLockedChannelMonitor res_var = (*val->contents.result); + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +void __attribute__((visibility("default"))) TS_LDKCResult_LockedChannelMonitorNoneZ_get_err(uint32_t arg) { + LDKCResult_LockedChannelMonitorNoneZ *val = (LDKCResult_LockedChannelMonitorNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCVec_OutPointZ_new(uint32_tArray elems) { + LDKCVec_OutPointZ *ret = MALLOC(sizeof(LDKCVec_OutPointZ), "LDKCVec_OutPointZ"); + ret->datalen = *((uint32_t*)elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKOutPoint) * ret->datalen, "LDKCVec_OutPointZ Data"); + uint32_t *java_elems = (uint32_t*)(elems + 4); + for (size_t i = 0; i < ret->datalen; i++) { + uint32_t arr_elem = java_elems[i]; + LDKOutPoint arr_elem_conv; + arr_elem_conv.inner = (void*)(arr_elem & (~1)); + arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0); + arr_elem_conv = OutPoint_clone(&arr_elem_conv); + ret->data[i] = arr_elem_conv; + } + } + return (uint64_t)ret; +} +static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *orig) { + LDKCVec_OutPointZ ret = { .data = MALLOC(sizeof(LDKOutPoint) * orig->datalen, "LDKCVec_OutPointZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = OutPoint_clone(&orig->data[i]); + } + return ret; +} typedef struct LDKMessageSendEventsProvider_JCalls { atomic_size_t refcnt; uint32_t get_and_clear_pending_msg_events_meth; @@ -7114,6 +7302,48 @@ int64_t __attribute__((visibility("default"))) TS_SocketDescriptor_hash(uint32_ return ret_val; } +typedef struct LDKScore_JCalls { + atomic_size_t refcnt; + uint32_t channel_penalty_msat_meth; +} LDKScore_JCalls; +static void LDKScore_JCalls_free(void* this_arg) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + js_free(j_calls->channel_penalty_msat_meth); + FREE(j_calls); + } +} +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + return js_invoke_function_1(j_calls->channel_penalty_msat_meth, short_channel_id); +} +static void LDKScore_JCalls_cloned(LDKScore* new_obj) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) { + LDKScore_JCalls *calls = MALLOC(sizeof(LDKScore_JCalls), "LDKScore_JCalls"); + atomic_init(&calls->refcnt, 1); + //TODO: Assign calls->o from o + + LDKScore ret = { + .this_arg = (void*) calls, + .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, + .free = LDKScore_JCalls_free, + }; + return ret; +} +long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object Reference */void* o) { + LDKScore *res_ptr = MALLOC(sizeof(LDKScore), "LDKScore"); + *res_ptr = LDKScore_init(o); + return (long)res_ptr; +} +int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id) { + LDKScore* this_arg_conv = (LDKScore*)(((uint64_t)this_arg) & ~1); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id); + return ret_val; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; uint32_t persist_manager_meth; @@ -8888,6 +9118,40 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_C2Tuple_BlockHa return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_ok(uint32_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_err(uint32_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdDecodeErrorZ _res_conv = *(LDKCResult_PaymentIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdDecodeErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_PaymentIdDecodeErrorZ* orig_conv = (LDKCResult_PaymentIdDecodeErrorZ*)(orig & ~1); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = CResult_PaymentIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_COption_u16Z_some(int16_t o) { LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z"); *ret_copy = COption_u16Z_some(o); @@ -8979,6 +9243,69 @@ void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArra CVec_APIErrorZ_free(_res_constr); } +uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(*((uint32_t*)o) == 32); + memcpy(o_ref.data, (uint8_t*)(o + 4), 32); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_err(uint32_t e) { + LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult__u832APIErrorZ _res_conv = *(LDKCResult__u832APIErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult__u832APIErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult__u832APIErrorZ_clone(uint32_t orig) { + LDKCResult__u832APIErrorZ* orig_conv = (LDKCResult__u832APIErrorZ*)(orig & ~1); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = CResult__u832APIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(uint32_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = PaymentId_clone(&o_conv); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint32_t e) { + LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); + e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_PaymentIdPaymentSendFailureZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint32_t orig) { + LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)(orig & ~1); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_ok() { LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_ok(); @@ -9007,34 +9334,60 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailu return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) { - LDKThirtyTwoBytes o_ref; - CHECK(*((uint32_t*)o) == 32); - memcpy(o_ref.data, (uint8_t*)(o + 4), 32); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref); +uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_clone(uint32_t orig) { + LDKC2Tuple_PaymentHashPaymentIdZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentIdZ*)(orig & ~1); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(orig_conv); + return ((uint64_t)ret_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_new(int8_tArray a, uint32_t b) { + LDKThirtyTwoBytes a_ref; + CHECK(*((uint32_t*)a) == 32); + memcpy(a_ref.data, (uint8_t*)(a + 4), 32); + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = (b & 1) || (b == 0); + b_conv = PaymentId_clone(&b_conv); + LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); + *ret_conv = C2Tuple_PaymentHashPaymentIdZ_new(a_ref, b_conv); + return ((uint64_t)ret_conv); +} + +void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentIdZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKC2Tuple_PaymentHashPaymentIdZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + C2Tuple_PaymentHashPaymentIdZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(uint32_t o) { + LDKC2Tuple_PaymentHashPaymentIdZ o_conv = *(LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1); + o_conv = C2Tuple_PaymentHashPaymentIdZ_clone((LDKC2Tuple_PaymentHashPaymentIdZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(uint32_t e) { LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1)); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e_conv); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(uint32_t _res) { if ((_res & 1) != 0) return; - LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_PaymentHashPaymentSendFailureZ_free(_res_conv); + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) { - LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); - *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv); +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(uint32_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig_conv); return (uint64_t)ret_conv; } @@ -10353,6 +10706,40 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_boolPeerHandleErrorZ return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint32_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = NodeId_clone(&o_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_err(uint32_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_NodeIdDecodeErrorZ _res_conv = *(LDKCResult_NodeIdDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_NodeIdDecodeErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeIdDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_NodeIdDecodeErrorZ* orig_conv = (LDKCResult_NodeIdDecodeErrorZ*)(orig & ~1); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = CResult_NodeIdDecodeErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) { LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1); LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); @@ -10594,6 +10981,48 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeEr return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_some(uint32_tArray o) { + LDKCVec_NetAddressZ o_constr; + o_constr.datalen = *((uint32_t*)o); + if (o_constr.datalen > 0) + o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + o_constr.data = NULL; + uint32_t* o_vals = (uint32_t*)(o + 4); + for (size_t m = 0; m < o_constr.datalen; m++) { + uint32_t o_conv_12 = o_vals[m]; + LDKNetAddress o_conv_12_conv = *(LDKNetAddress*)(((uint64_t)o_conv_12) & ~1); + o_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o_conv_12) & ~1)); + o_constr.data[m] = o_conv_12_conv; + } + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_some(o_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_none() { + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_none(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCOption_CVec_NetAddressZZ _res_conv = *(LDKCOption_CVec_NetAddressZZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + COption_CVec_NetAddressZZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_COption_CVec_NetAddressZZ_clone(uint32_t orig) { + LDKCOption_CVec_NetAddressZZ* orig_conv = (LDKCOption_CVec_NetAddressZZ*)orig; + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = COption_CVec_NetAddressZZ_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) { LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1); o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1)); @@ -11900,11 +12329,52 @@ void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _r COption_FilterZ_free(_res_conv); } -void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - PaymentPurpose_free(this_ptr_conv); +uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_ok(uint32_t o) { + LDKLockedChannelMonitor o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + // Warning: we need a move here but no clone is available for LDKLockedChannelMonitor + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_err() { + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = CResult_LockedChannelMonitorNoneZ_err(); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_LockedChannelMonitorNoneZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_LockedChannelMonitorNoneZ _res_conv = *(LDKCResult_LockedChannelMonitorNoneZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_LockedChannelMonitorNoneZ_free(_res_conv); +} + +void __attribute__((visibility("default"))) TS_CVec_OutPointZ_free(uint32_tArray _res) { + LDKCVec_OutPointZ _res_constr; + _res_constr.datalen = *((uint32_t*)_res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKOutPoint), "LDKCVec_OutPointZ Elements"); + else + _res_constr.data = NULL; + uint32_t* _res_vals = (uint32_t*)(_res + 4); + for (size_t k = 0; k < _res_constr.datalen; k++) { + uint32_t _res_conv_10 = _res_vals[k]; + LDKOutPoint _res_conv_10_conv; + _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1)); + _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0); + _res_constr.data[k] = _res_conv_10_conv; + } + CVec_OutPointZ_free(_res_constr); +} + +void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + PaymentPurpose_free(this_ptr_conv); } uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) { @@ -12054,17 +12524,20 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_received(int8_ return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage) { +uint32_t __attribute__((visibility("default"))) TS_Event_payment_sent(int8_tArray payment_preimage, int8_tArray payment_hash) { LDKThirtyTwoBytes payment_preimage_ref; CHECK(*((uint32_t*)payment_preimage) == 32); memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_sent(payment_preimage_ref); + *ret_copy = Event_payment_sent(payment_preimage_ref, payment_hash_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path) { +uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path, uint32_t short_channel_id) { LDKThirtyTwoBytes payment_hash_ref; CHECK(*((uint32_t*)payment_hash) == 32); memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); @@ -12085,8 +12558,10 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(in path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); path_constr.data[k] = path_conv_10_conv; } + LDKCOption_u64Z short_channel_id_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1); + short_channel_id_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr); + *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -12127,14 +12602,29 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, uint32_t reason) { +uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint32_t reason) { LDKThirtyTwoBytes channel_id_ref; CHECK(*((uint32_t*)channel_id) == 32); memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32); LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1); reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_channel_closed(channel_id_ref, reason_conv); + *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_tArray channel_id, int8_tArray transaction) { + LDKThirtyTwoBytes channel_id_ref; + CHECK(*((uint32_t*)channel_id) == 32); + memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32); + LDKTransaction transaction_ref; + transaction_ref.datalen = *((uint32_t*)transaction); + transaction_ref.data = MALLOC(transaction_ref.datalen, "LDKTransaction Bytes"); + memcpy(transaction_ref.data, (uint8_t*)(transaction + 4), transaction_ref.datalen); + transaction_ref.data_is_owned = true; + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_discard_funding(channel_id_ref, transaction_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -13264,6 +13754,22 @@ void __attribute__((visibility("default"))) TS_Confirm_free(uint32_t this_ptr) Confirm_free(this_ptr_conv); } +uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) { + LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); + uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv)); + return ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() { + uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure()); + return ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() { + uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure()); + return ret_conv; +} + void __attribute__((visibility("default"))) TS_Watch_free(uint32_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1); @@ -13436,6 +13942,20 @@ void __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ FeeEstimator_free(this_ptr_conv); } +void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Persist_free(this_ptr_conv); +} + +void __attribute__((visibility("default"))) TS_LockedChannelMonitor_free(uint32_t this_obj) { + LDKLockedChannelMonitor this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + LockedChannelMonitor_free(this_obj_conv); +} + void __attribute__((visibility("default"))) TS_ChainMonitor_free(uint32_t this_obj) { LDKChainMonitor this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -13495,6 +14015,40 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claima return ret_arr; } +uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_get_monitor(uint32_t this_arg, uint32_t funding_txo) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKOutPoint funding_txo_conv; + funding_txo_conv.inner = (void*)(funding_txo & (~1)); + funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0); + funding_txo_conv = OutPoint_clone(&funding_txo_conv); + LDKCResult_LockedChannelMonitorNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_LockedChannelMonitorNoneZ), "LDKCResult_LockedChannelMonitorNoneZ"); + *ret_conv = ChainMonitor_get_monitor(&this_arg_conv, funding_txo_conv); + return (uint64_t)ret_conv; +} + +uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_list_monitors(uint32_t this_arg) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKCVec_OutPointZ ret_var = ChainMonitor_list_monitors(&this_arg_conv); + uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4); + for (size_t k = 0; k < ret_var.datalen; k++) { + LDKOutPoint ret_conv_10_var = ret_var.data[k]; + CHECK((((uint64_t)ret_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_10_ref = (uint64_t)ret_conv_10_var.inner; + if (ret_conv_10_var.is_owned) { + ret_conv_10_ref |= 1; + } + ret_arr_ptr[k] = ret_conv_10_ref; + } + FREE(ret_var.data); + return ret_arr; +} + uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) { LDKChainMonitor this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -13587,22 +14141,6 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(in return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_clone(uint32_t orig) { - LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1); - uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_clone(orig_conv)); - return ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_temporary_failure() { - uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_temporary_failure()); - return ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdateErr_permanent_failure() { - uint32_t ret_conv = LDKChannelMonitorUpdateErr_to_js(ChannelMonitorUpdateErr_permanent_failure()); - return ret_conv; -} - void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) { LDKMonitorUpdateError this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -14063,13 +14601,6 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_clai return ret_arr; } -void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - Persist_free(this_ptr_conv); -} - uint32_t __attribute__((visibility("default"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint32_t arg) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); @@ -15003,6 +15534,66 @@ uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface return (uint64_t)ret_ret; } +void __attribute__((visibility("default"))) TS_PaymentId_free(uint32_t this_obj) { + LDKPaymentId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + PaymentId_free(this_obj_conv); +} + +int64_t __attribute__((visibility("default"))) TS_PaymentId_hash(uint32_t o) { + LDKPaymentId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = PaymentId_hash(&o_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_PaymentId_clone(uint32_t orig) { + LDKPaymentId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKPaymentId ret_var = PaymentId_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +jboolean __attribute__((visibility("default"))) TS_PaymentId_eq(uint32_t a, uint32_t b) { + LDKPaymentId a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKPaymentId b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = PaymentId_eq(&a_conv, &b_conv); + return ret_val; +} + +int8_tArray __attribute__((visibility("default"))) TS_PaymentId_write(uint32_t obj) { + LDKPaymentId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = PaymentId_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_PaymentId_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_PaymentIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdDecodeErrorZ), "LDKCResult_PaymentIdDecodeErrorZ"); + *ret_conv = PaymentId_read(ser_ref); + return (uint64_t)ret_conv; +} + void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -15421,19 +16012,19 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_unspendable_p ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv); } -int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_id(uint32_t this_ptr) { +int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_user_channel_id(uint32_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv); + int64_t ret_val = ChannelDetails_get_user_channel_id(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_id(uint32_t this_ptr, int64_t val) { +void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_id(uint32_t this_ptr, int64_t val) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - ChannelDetails_set_user_id(&this_ptr_conv, val); + ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) { @@ -15564,7 +16155,7 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uin ChannelDetails_set_is_public(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_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(*((uint32_t*)channel_id_arg) == 32); memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32); @@ -15583,7 +16174,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArr confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1)); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_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_id_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, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_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); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -15729,7 +16320,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_current_d return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, uint32_t override_config) { +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channel(uint32_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint32_t override_config) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -15740,8 +16331,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_channe override_config_conv.inner = (void*)(override_config & (~1)); override_config_conv.is_owned = (override_config & 1) || (override_config == 0); override_config_conv = UserConfig_clone(&override_config_conv); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv); + LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); + *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv); return (uint64_t)ret_conv; } @@ -15846,11 +16437,27 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_payment( LDKThirtyTwoBytes payment_secret_ref; CHECK(*((uint32_t*)payment_secret) == 32); memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment(uint32_t this_arg, uint32_t route, uint32_t payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + LDKPaymentId payment_id_conv; + payment_id_conv.inner = (void*)(payment_id & (~1)); + payment_id_conv.is_owned = (payment_id & 1) || (payment_id == 0); + payment_id_conv = PaymentId_clone(&payment_id_conv); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -15861,7 +16468,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontane LDKThirtyTwoBytes payment_preimage_ref; CHECK(*((uint32_t*)payment_preimage) == 32); memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); - LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref); return (uint64_t)ret_conv; } @@ -23200,36 +23807,6 @@ uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_read(int8_tAr return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) { - unsigned char pubkey_hash_arr[20]; - CHECK(*((uint32_t*)pubkey_hash) == 20); - memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20); - unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) { - unsigned char script_hash_arr[20]; - CHECK(*((uint32_t*)script_hash) == 20); - memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20); - unsigned char (*script_hash_ref)[20] = &script_hash_arr; - LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - uint32_t __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) { unsigned char pubkey_hash_arr[20]; CHECK(*((uint32_t*)pubkey_hash) == 20); @@ -23322,37 +23899,25 @@ void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) { Type_free(this_ptr_conv); } -void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) { - LDKRouteHop this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHop_free(this_obj_conv); -} - -int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33); - return ret_arr; +void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKScore this_ptr_conv = *(LDKScore*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); } -void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK(*((uint32_t*)val) == 33); - memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - RouteHop_set_pubkey(&this_ptr_conv, val_ref); +void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) { + LDKNodeId this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NodeId_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); +uint32_t __attribute__((visibility("default"))) TS_NodeId_clone(uint32_t orig) { + LDKNodeId orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNodeId ret_var = NodeId_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23362,37 +23927,11 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(u return ret_ref; } -void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeFeatures_clone(&val_conv); - RouteHop_set_node_features(&this_ptr_conv, val_conv); -} - -int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); - return ret_val; -} - -void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_short_channel_id(&this_ptr_conv, val); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); +uint32_t __attribute__((visibility("default"))) TS_NodeId_from_pubkey(int8_tArray pubkey) { + LDKPublicKey pubkey_ref; + CHECK(*((uint32_t*)pubkey) == 33); + memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33); + LDKNodeId ret_var = NodeId_from_pubkey(pubkey_ref); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23402,60 +23941,56 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_feature return ret_ref; } -void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - RouteHop_set_channel_features(&this_ptr_conv, val_conv); +int8_tArray __attribute__((visibility("default"))) TS_NodeId_as_slice(uint32_t this_arg) { + LDKNodeId this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKu8slice ret_var = NodeId_as_slice(&this_arg_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + return ret_arr; } -int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); +int64_t __attribute__((visibility("default"))) TS_NodeId_hash(uint32_t o) { + LDKNodeId o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = NodeId_hash(&o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_fee_msat(&this_ptr_conv, val); +int8_tArray __attribute__((visibility("default"))) TS_NodeId_write(uint32_t obj) { + LDKNodeId obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NodeId_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; } -int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NodeId_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_NodeIdDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeIdDecodeErrorZ), "LDKCResult_NodeIdDecodeErrorZ"); + *ret_conv = NodeId_read(ser_ref); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) { - LDKRouteHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); +void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) { + LDKNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NetworkGraph_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { - LDKPublicKey pubkey_arg_ref; - CHECK(*((uint32_t*)pubkey_arg) == 33); - memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33); - LDKNodeFeatures node_features_arg_conv; - node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); - node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); - node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); - LDKChannelFeatures channel_features_arg_conv; - channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); - channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); - channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); - LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) { + LDKNetworkGraph orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23465,155 +24000,86 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(int8_tArray pub return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) { - LDKRouteHop orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHop ret_var = RouteHop_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } +void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) { + LDKReadOnlyNetworkGraph this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + ReadOnlyNetworkGraph_free(this_obj_conv); +} + +void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + NetworkUpdate_free(this_ptr_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) { + LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_clone(orig_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) { - LDKRouteHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHop_hash(&o_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) { + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = (msg & 1) || (msg == 0); + msg_conv = ChannelUpdate_clone(&msg_conv); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_update_message(msg_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) { - LDKRouteHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) { + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) { - LDKRouteHop obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv); +uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) { + LDKPublicKey node_id_ref; + CHECK(*((uint32_t*)node_id) == 33); + memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33); + LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); + *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) { + LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; + LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = RouteHop_read(ser_ref); - return (uint64_t)ret_conv; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); + *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) { - LDKRoute this_obj_conv; +void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) { + LDKNetGraphMsgHandler this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - Route_free(this_obj_conv); -} - -ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) { - LDKRoute this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); - ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); - uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4); - for (size_t m = 0; m < ret_var.datalen; m++) { - LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; - uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); - uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4); - for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { - LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; - CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; - if (ret_conv_12_conv_10_var.is_owned) { - ret_conv_12_conv_10_ref |= 1; - } - ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; - } - FREE(ret_conv_12_var.data); - ret_arr_ptr[m] = ret_conv_12_arr; - } - FREE(ret_var.data); - return ret_arr; + NetGraphMsgHandler_free(this_obj_conv); } -void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) { - LDKRoute this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) { + LDKNetGraphMsgHandler this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_CVec_RouteHopZZ val_constr; - val_constr.datalen = *((uint32_t*)val); - if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - val_constr.data = NULL; - uint32_tArray* val_vals = (uint32_tArray*)(val + 4); - for (size_t m = 0; m < val_constr.datalen; m++) { - uint32_tArray val_conv_12 = val_vals[m]; - LDKCVec_RouteHopZ val_conv_12_constr; - val_conv_12_constr.datalen = *((uint32_t*)val_conv_12); - if (val_conv_12_constr.datalen > 0) - val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - val_conv_12_constr.data = NULL; - uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4); - for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { - uint32_t val_conv_12_conv_10 = val_conv_12_vals[k]; - LDKRouteHop val_conv_12_conv_10_conv; - val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); - val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); - val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); - val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; - } - val_constr.data[m] = val_conv_12_constr; - } - Route_set_paths(&this_ptr_conv, val_constr); -} - -uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) { - LDKCVec_CVec_RouteHopZZ paths_arg_constr; - paths_arg_constr.datalen = *((uint32_t*)paths_arg); - if (paths_arg_constr.datalen > 0) - paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - paths_arg_constr.data = NULL; - uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4); - for (size_t m = 0; m < paths_arg_constr.datalen; m++) { - uint32_tArray paths_arg_conv_12 = paths_arg_vals[m]; - LDKCVec_RouteHopZ paths_arg_conv_12_constr; - paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12); - if (paths_arg_conv_12_constr.datalen > 0) - paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - paths_arg_conv_12_constr.data = NULL; - uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4); - for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { - uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; - LDKRouteHop paths_arg_conv_12_conv_10_conv; - paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); - paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); - paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); - paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; - } - paths_arg_constr.data[m] = paths_arg_conv_12_constr; - } - LDKRoute ret_var = Route_new(paths_arg_constr); + LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23623,11 +24089,29 @@ uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) { - LDKRoute orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRoute ret_var = Route_clone(&orig_conv); +void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) { + LDKNetGraphMsgHandler this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNetworkGraph val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NetworkGraph_clone(&val_conv); + NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) { + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = (void*)(network_graph & (~1)); + network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); + network_graph_conv = NetworkGraph_clone(&network_graph_conv); + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23637,233 +24121,127 @@ uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) { return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) { - LDKRoute o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = Route_hash(&o_conv); - return ret_val; -} - -jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) { - LDKRoute a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRoute b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = Route_eq(&a_conv, &b_conv); - return ret_val; -} - -int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) { - LDKRoute this_arg_conv; +void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_fees(&this_arg_conv); - return ret_val; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); } -int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) { - LDKRoute this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int64_t ret_val = Route_get_total_amount(&this_arg_conv); - return ret_val; -} - -int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) { - LDKRoute obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = Route_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = Route_read(ser_ref); - return (uint64_t)ret_conv; -} - -void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) { - LDKRouteHint this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHint_free(this_obj_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) { - LDKRouteHint orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHint ret_var = RouteHint_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) { - LDKRouteHint o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHint_hash(&o_conv); - return ret_val; + LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); + *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); + return (uint64_t)ret_ret; } -jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) { - LDKRouteHint a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHint b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) { + LDKNetGraphMsgHandler this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); + *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); + return (uint64_t)ret_ret; } -void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) { - LDKRouteHintHop this_obj_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) { + LDKDirectionalChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RouteHintHop_free(this_obj_conv); + DirectionalChannelInfo_free(this_obj_conv); } -int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33); - return ret_arr; + int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); + return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK(*((uint32_t*)val) == 33); - memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); + DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); } -int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_short_channel_id(&this_ptr_conv, val); + DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; + int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = RoutingFees_clone(&val_conv); - RouteHintHop_set_fees(&this_ptr_conv, val_conv); + DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); } -int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); + int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); + DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); + *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) { - LDKRouteHintHop this_ptr_conv; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) { - LDKRouteHintHop this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; + DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); } -void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { - LDKRouteHintHop this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) { - LDKPublicKey src_node_id_arg_ref; - CHECK(*((uint32_t*)src_node_id_arg) == 33); - memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33); - LDKRoutingFees fees_arg_conv; - fees_arg_conv.inner = (void*)(fees_arg & (~1)); - fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); - fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); - htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); + LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -23873,155 +24251,315 @@ uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_new(int8_tArray return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) { - LDKRouteHintHop orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = RoutingFees_clone(&val_conv); + DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; } return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) { - LDKRouteHintHop o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = false; - int64_t ret_val = RouteHintHop_hash(&o_conv); - return ret_val; +void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) { + LDKDirectionalChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelUpdate val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelUpdate_clone(&val_conv); + DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); } -jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) { - LDKRouteHintHop a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRouteHintHop b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) { + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); + LDKRoutingFees fees_arg_conv; + fees_arg_conv.inner = (void*)(fees_arg & (~1)); + fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); + fees_arg_conv = RoutingFees_clone(&fees_arg_conv); + LDKChannelUpdate last_update_message_arg_conv; + last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); + last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); + last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) { - LDKPublicKey our_node_id_ref; - CHECK(*((uint32_t*)our_node_id) == 33); - memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK(*((uint32_t*)payee) == 33); - memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != 0) { - first_hops_constr.datalen = *((uint32_t*)first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - uint32_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = *((uint32_t*)last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - uint32_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) { + LDKDirectionalChannelInfo orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } - return (uint64_t)ret_conv; + return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) { - LDKPublicKey our_node_id_ref; - CHECK(*((uint32_t*)our_node_id) == 33); - memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33); - LDKNetworkGraph network_conv; - network_conv.inner = (void*)(network & (~1)); - network_conv.is_owned = false; - LDKPublicKey payee_ref; - CHECK(*((uint32_t*)payee) == 33); - memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); - LDKInvoiceFeatures payee_features_conv; - payee_features_conv.inner = (void*)(payee_features & (~1)); - payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); - payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); - LDKCVec_ChannelDetailsZ first_hops_constr; - LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; - if (first_hops != 0) { - first_hops_constr.datalen = *((uint32_t*)first_hops); - if (first_hops_constr.datalen > 0) - first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - first_hops_constr.data = NULL; - uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); - for (size_t q = 0; q < first_hops_constr.datalen; q++) { - uint32_t first_hops_conv_16 = first_hops_vals[q]; - LDKChannelDetails first_hops_conv_16_conv; - first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); - first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); - first_hops_constr.data[q] = first_hops_conv_16_conv; - } - first_hops_ptr = &first_hops_constr; - } - LDKCVec_RouteHintZ last_hops_constr; - last_hops_constr.datalen = *((uint32_t*)last_hops); - if (last_hops_constr.datalen > 0) - last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); - else - last_hops_constr.data = NULL; - uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); - for (size_t l = 0; l < last_hops_constr.datalen; l++) { - uint32_t last_hops_conv_11 = last_hops_vals[l]; - LDKRouteHint last_hops_conv_11_conv; - last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); - last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); - last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); - last_hops_constr.data[l] = last_hops_conv_11_conv; - } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv); - if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } +int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) { + LDKDirectionalChannelInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); + *ret_conv = DirectionalChannelInfo_read(ser_ref); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_obj) { - LDKNetworkGraph this_obj_conv; +void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) { + LDKChannelInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetworkGraph_free(this_obj_conv); + ChannelInfo_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) { - LDKNetworkGraph orig_conv; +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelFeatures_clone(&val_conv); + ChannelInfo_set_features(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId ret_var = ChannelInfo_get_node_one(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_one(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId ret_var = ChannelInfo_get_node_two(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKNodeId val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeId_clone(&val_conv); + ChannelInfo_set_node_two(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKDirectionalChannelInfo val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = DirectionalChannelInfo_clone(&val_conv); + ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { + LDKChannelInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKChannelAnnouncement val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = ChannelAnnouncement_clone(&val_conv); + ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) { + LDKChannelFeatures features_arg_conv; + features_arg_conv.inner = (void*)(features_arg & (~1)); + features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); + features_arg_conv = ChannelFeatures_clone(&features_arg_conv); + LDKNodeId node_one_arg_conv; + node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); + node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); + node_one_arg_conv = NodeId_clone(&node_one_arg_conv); + LDKDirectionalChannelInfo one_to_two_arg_conv; + one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); + one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); + one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); + LDKNodeId node_two_arg_conv; + node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); + node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); + node_two_arg_conv = NodeId_clone(&node_two_arg_conv); + LDKDirectionalChannelInfo two_to_one_arg_conv; + two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); + two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); + two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); + LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1); + capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); + LDKChannelAnnouncement announcement_message_arg_conv; + announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); + announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); + announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); + LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) { + LDKChannelInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv); + LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24031,86 +24569,139 @@ uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t return ret_ref; } -void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) { - LDKReadOnlyNetworkGraph this_obj_conv; +int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) { + LDKChannelInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); + *ret_conv = ChannelInfo_read(ser_ref); + return (uint64_t)ret_conv; +} + +void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) { + LDKRoutingFees this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ReadOnlyNetworkGraph_free(this_obj_conv); + RoutingFees_free(this_obj_conv); } -void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1); - FREE((void*)this_ptr); - NetworkUpdate_free(this_ptr_conv); +int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv); + return ret_val; } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) { - LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig; - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_clone(orig_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RoutingFees_set_base_msat(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) { - LDKChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = (msg & 1) || (msg == 0); - msg_conv = ChannelUpdate_clone(&msg_conv); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_update_message(msg_conv); - uint64_t ret_ref = (uint64_t)ret_copy; +int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) { + LDKRoutingFees this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RoutingFees_set_proportional_millionths(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) { + LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) { - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; +jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) { + LDKRoutingFees a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRoutingFees b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) { + LDKRoutingFees orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) { - LDKPublicKey node_id_ref; - CHECK(*((uint32_t*)node_id) == 33); - memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33); - LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate"); - *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) { + LDKRoutingFees o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RoutingFees_hash(&o_conv); + return ret_val; } -int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) { - LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj; - LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv); +int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) { + LDKRoutingFees obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv); - return (uint64_t)ret_ret; +uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ"); + *ret_conv = RoutingFees_read(ser_ref); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) { - LDKNetGraphMsgHandler this_obj_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) { + LDKNodeAnnouncementInfo this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NetGraphMsgHandler_free(this_obj_conv); + NodeAnnouncementInfo_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) { - LDKNetGraphMsgHandler this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv); + LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24120,159 +24711,216 @@ uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_netwo return ret_ref; } -void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) { - LDKNetGraphMsgHandler this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNetworkGraph val_conv; + LDKNodeFeatures val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NetworkGraph_clone(&val_conv); - NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) { - LDKNetworkGraph network_graph_conv; - network_graph_conv.inner = (void*)(network_graph & (~1)); - network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); - network_graph_conv = NetworkGraph_clone(&network_graph_conv); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); - LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_add_chain_access(uint32_t this_arg, uint32_t chain_access) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv); + val_conv = NodeFeatures_clone(&val_conv); + NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler"); - *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv); - return (uint64_t)ret_ret; +int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv); + return ret_val; } -uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) { - LDKNetGraphMsgHandler this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider"); - *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv); - return (uint64_t)ret_ret; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) { + LDKNodeAnnouncementInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val); } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) { - LDKDirectionalChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - DirectionalChannelInfo_free(this_obj_conv); +int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3); + return ret_arr; } -int32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv); - return ret_val; + LDKThreeBytes val_ref; + CHECK(*((uint32_t*)val) == 3); + memcpy(val_ref.data, (uint8_t*)(val + 4), 3); + NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref); } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update(uint32_t this_ptr, int32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_last_update(&this_ptr_conv, val); + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32); + return ret_arr; } -jboolean __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_enabled(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv); - return ret_val; + LDKThirtyTwoBytes val_ref; + CHECK(*((uint32_t*)val) == 32); + memcpy(val_ref.data, (uint8_t*)(val + 4), 32); + NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref); } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_enabled(uint32_t this_ptr, jboolean val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_enabled(&this_ptr_conv, val); + LDKCVec_NetAddressZ val_constr; + val_constr.datalen = *((uint32_t*)val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + val_constr.data = NULL; + uint32_t* val_vals = (uint32_t*)(val + 4); + for (size_t m = 0; m < val_constr.datalen; m++) { + uint32_t val_conv_12 = val_vals[m]; + LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); + val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1)); + val_constr.data[m] = val_conv_12_conv; + } + NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr); } -int16_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_cltv_expiry_delta(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv); - return ret_val; + LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { + LDKNodeAnnouncementInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val); + LDKNodeAnnouncement val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = NodeAnnouncement_clone(&val_conv); + NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) { + LDKNodeFeatures features_arg_conv; + features_arg_conv.inner = (void*)(features_arg & (~1)); + features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); + features_arg_conv = NodeFeatures_clone(&features_arg_conv); + LDKThreeBytes rgb_arg_ref; + CHECK(*((uint32_t*)rgb_arg) == 3); + memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3); + LDKThirtyTwoBytes alias_arg_ref; + CHECK(*((uint32_t*)alias_arg) == 32); + memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32); + LDKCVec_NetAddressZ addresses_arg_constr; + addresses_arg_constr.datalen = *((uint32_t*)addresses_arg); + if (addresses_arg_constr.datalen > 0) + addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + else + addresses_arg_constr.data = NULL; + uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4); + for (size_t m = 0; m < addresses_arg_constr.datalen; m++) { + uint32_t addresses_arg_conv_12 = addresses_arg_vals[m]; + LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1); + addresses_arg_constr.data[m] = addresses_arg_conv_12_conv; + } + LDKNodeAnnouncement announcement_message_arg_conv; + announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); + announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); + announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv); + LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_minimum_msat(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) { + LDKNodeAnnouncementInfo orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_minimum_msat(uint32_t this_ptr, int64_t val) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val); +int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) { + LDKNodeAnnouncementInfo obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_htlc_maximum_msat(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; +uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ"); + *ret_conv = NodeAnnouncementInfo_read(ser_ref); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) { + LDKNodeInfo this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + NodeInfo_free(this_obj_conv); +} + +void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv); + LDKCVec_u64Z val_constr; + val_constr.datalen = *((uint32_t*)val); + if (val_constr.datalen > 0) + val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + val_constr.data = NULL; + int64_t* val_vals = (int64_t*)(val + 4); + for (size_t i = 0; i < val_constr.datalen; i++) { + int64_t val_conv_8 = val_vals[i]; + val_constr.data[i] = val_conv_8; + } + NodeInfo_set_channels(&this_ptr_conv, val_constr); } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_fees(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv); + LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24282,22 +24930,22 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_f return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_fees(uint32_t this_ptr, uint32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRoutingFees val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); val_conv = RoutingFees_clone(&val_conv); - DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv); + NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_last_update_message(uint32_t this_ptr) { - LDKDirectionalChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv); + LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24307,29 +24955,38 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_get_l return ret_ref; } -void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_set_last_update_message(uint32_t this_ptr, uint32_t val) { - LDKDirectionalChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) { + LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelUpdate val_conv; + LDKNodeAnnouncementInfo val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelUpdate_clone(&val_conv); - DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv); + val_conv = NodeAnnouncementInfo_clone(&val_conv); + NodeInfo_set_announcement_info(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) { - LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); - htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); - LDKRoutingFees fees_arg_conv; - fees_arg_conv.inner = (void*)(fees_arg & (~1)); - fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); - fees_arg_conv = RoutingFees_clone(&fees_arg_conv); - LDKChannelUpdate last_update_message_arg_conv; - last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1)); - last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0); - last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv); - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv); +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) { + LDKCVec_u64Z channels_arg_constr; + channels_arg_constr.datalen = *((uint32_t*)channels_arg); + if (channels_arg_constr.datalen > 0) + channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); + else + channels_arg_constr.data = NULL; + int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4); + for (size_t i = 0; i < channels_arg_constr.datalen; i++) { + int64_t channels_arg_conv_8 = channels_arg_vals[i]; + channels_arg_constr.data[i] = channels_arg_conv_8; + } + LDKRoutingFees lowest_inbound_channel_fees_arg_conv; + lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1)); + lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0); + lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv); + LDKNodeAnnouncementInfo announcement_info_arg_conv; + announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1)); + announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0); + announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); + LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24339,11 +24996,11 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(i return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone(uint32_t orig) { - LDKDirectionalChannelInfo orig_conv; +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) { + LDKNodeInfo orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv); + LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24353,126 +25010,217 @@ uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_clone return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_write(uint32_t obj) { - LDKDirectionalChannelInfo obj_conv; +int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) { + LDKNodeInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv); + LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_read(int8_tArray ser) { +uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ"); - *ret_conv = DirectionalChannelInfo_read(ser_ref); + LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ"); + *ret_conv = NodeInfo_read(ser_ref); + return (uint64_t)ret_conv; +} + +int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) { + LDKNetworkGraph obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); + *ret_conv = NetworkGraph_read(ser_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) { + LDKThirtyTwoBytes genesis_hash_ref; + CHECK(*((uint32_t*)genesis_hash) == 32); + memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32); + LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKNodeAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKUnsignedNodeAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKChannelAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKUnsignedChannelAnnouncement msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); + // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ + if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + // Manually implement clone for Java trait instances + } + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_ChannelInfo_free(uint32_t this_obj) { - LDKChannelInfo this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - ChannelInfo_free(this_obj_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_features(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; +void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent); } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_features(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKChannelFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelFeatures_clone(&val_conv); - ChannelInfo_set_features(&this_ptr_conv, val_conv); +void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKPublicKey _node_id_ref; + CHECK(*((uint32_t*)_node_id) == 33); + memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33); + NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } -int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33); - return ret_arr; +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKPublicKey val_ref; - CHECK(*((uint32_t*)val) == 33); - memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - ChannelInfo_set_node_one(&this_ptr_conv, val_ref); +uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKUnsignedChannelUpdate msg_conv; + msg_conv.inner = (void*)(msg & (~1)); + msg_conv.is_owned = false; + LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); + *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv); + return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_one_to_two(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } +uint32_t __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_get_addresses(uint32_t this_arg, int8_tArray pubkey) { + LDKReadOnlyNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKPublicKey pubkey_ref; + CHECK(*((uint32_t*)pubkey) == 33); + memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33); + LDKCOption_CVec_NetAddressZZ *ret_copy = MALLOC(sizeof(LDKCOption_CVec_NetAddressZZ), "LDKCOption_CVec_NetAddressZZ"); + *ret_copy = ReadOnlyNetworkGraph_get_addresses(&this_arg_conv, pubkey_ref); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_one_to_two(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv); +void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) { + LDKRouteHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHop_free(this_obj_conv); } -int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33); + memcpy((uint8_t*)(ret_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33); return ret_arr; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKPublicKey val_ref; CHECK(*((uint32_t*)val) == 33); memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); - ChannelInfo_set_node_two(&this_ptr_conv, val_ref); + RouteHop_set_pubkey(&this_ptr_conv, val_ref); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_node_features(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv); + LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24482,41 +25230,37 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_two_to_one(u return ret_ref; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_two_to_one(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_node_features(uint32_t this_ptr, uint32_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKDirectionalChannelInfo val_conv; + LDKNodeFeatures val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = DirectionalChannelInfo_clone(&val_conv); - ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv); + val_conv = NodeFeatures_clone(&val_conv); + RouteHop_set_node_features(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_capacity_sats(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +int64_t __attribute__((visibility("default"))) TS_RouteHop_get_short_channel_id(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv); - uint64_t ret_ref = (uint64_t)ret_copy; - return ret_ref; + int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv); + return ret_val; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_capacity_sats(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); - val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); - ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv); + RouteHop_set_short_channel_id(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement_message(uint32_t this_ptr) { - LDKChannelInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHop_get_channel_features(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv); + LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24526,125 +25270,60 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_get_announcement return ret_ref; } -void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { - LDKChannelInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_channel_features(uint32_t this_ptr, uint32_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKChannelAnnouncement val_conv; + LDKChannelFeatures val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); - val_conv = ChannelAnnouncement_clone(&val_conv); - ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, int8_tArray node_one_arg, uint32_t one_to_two_arg, int8_tArray node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) { - LDKChannelFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKPublicKey node_one_arg_ref; - CHECK(*((uint32_t*)node_one_arg) == 33); - memcpy(node_one_arg_ref.compressed_form, (uint8_t*)(node_one_arg + 4), 33); - LDKDirectionalChannelInfo one_to_two_arg_conv; - one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); - one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); - one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKPublicKey node_two_arg_ref; - CHECK(*((uint32_t*)node_two_arg) == 33); - memcpy(node_two_arg_ref.compressed_form, (uint8_t*)(node_two_arg + 4), 33); - LDKDirectionalChannelInfo two_to_one_arg_conv; - two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); - two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); - two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); - LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1); - capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); - LDKChannelAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_clone(uint32_t orig) { - LDKChannelInfo orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_write(uint32_t obj) { - LDKChannelInfo obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); - *ret_conv = ChannelInfo_read(ser_ref); - return (uint64_t)ret_conv; -} - -void __attribute__((visibility("default"))) TS_RoutingFees_free(uint32_t this_obj) { - LDKRoutingFees this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - RoutingFees_free(this_obj_conv); + val_conv = ChannelFeatures_clone(&val_conv); + RouteHop_set_channel_features(&this_ptr_conv, val_conv); } -int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_base_msat(uint32_t this_ptr) { - LDKRoutingFees this_ptr_conv; +int64_t __attribute__((visibility("default"))) TS_RouteHop_get_fee_msat(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv); + int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RoutingFees_set_base_msat(uint32_t this_ptr, int32_t val) { - LDKRoutingFees this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_fee_msat(uint32_t this_ptr, int64_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RoutingFees_set_base_msat(&this_ptr_conv, val); + RouteHop_set_fee_msat(&this_ptr_conv, val); } -int32_t __attribute__((visibility("default"))) TS_RoutingFees_get_proportional_millionths(uint32_t this_ptr) { - LDKRoutingFees this_ptr_conv; +int32_t __attribute__((visibility("default"))) TS_RouteHop_get_cltv_expiry_delta(uint32_t this_ptr) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv); + int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_RoutingFees_set_proportional_millionths(uint32_t this_ptr, int32_t val) { - LDKRoutingFees this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHop_set_cltv_expiry_delta(uint32_t this_ptr, int32_t val) { + LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - RoutingFees_set_proportional_millionths(&this_ptr_conv, val); + RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base_msat_arg, int32_t proportional_millionths_arg) { - LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg); +uint32_t __attribute__((visibility("default"))) TS_RouteHop_new(int8_tArray pubkey_arg, uint32_t node_features_arg, int64_t short_channel_id_arg, uint32_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) { + LDKPublicKey pubkey_arg_ref; + CHECK(*((uint32_t*)pubkey_arg) == 33); + memcpy(pubkey_arg_ref.compressed_form, (uint8_t*)(pubkey_arg + 4), 33); + LDKNodeFeatures node_features_arg_conv; + node_features_arg_conv.inner = (void*)(node_features_arg & (~1)); + node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0); + node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv); + LDKChannelFeatures channel_features_arg_conv; + channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1)); + channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0); + channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv); + LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24654,22 +25333,11 @@ uint32_t __attribute__((visibility("default"))) TS_RoutingFees_new(int32_t base return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_RoutingFees_eq(uint32_t a, uint32_t b) { - LDKRoutingFees a_conv; - a_conv.inner = (void*)(a & (~1)); - a_conv.is_owned = false; - LDKRoutingFees b_conv; - b_conv.inner = (void*)(b & (~1)); - b_conv.is_owned = false; - jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv); - return ret_val; -} - -uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t orig) { - LDKRoutingFees orig_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHop_clone(uint32_t orig) { + LDKRouteHop orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv); + LDKRouteHop ret_var = RouteHop_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24679,192 +25347,141 @@ uint32_t __attribute__((visibility("default"))) TS_RoutingFees_clone(uint32_t o return ret_ref; } -int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) { - LDKRoutingFees o_conv; +int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) { + LDKRouteHop o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = false; - int64_t ret_val = RoutingFees_hash(&o_conv); + int64_t ret_val = RouteHop_hash(&o_conv); return ret_val; } -int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) { - LDKRoutingFees obj_conv; +jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) { + LDKRouteHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHop_eq(&a_conv, &b_conv); + return ret_val; +} + +int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) { + LDKRouteHop obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv); + LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_RoutingFees_read(int8_tArray ser) { +uint32_t __attribute__((visibility("default"))) TS_RouteHop_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ"); - *ret_conv = RoutingFees_read(ser_ref); + LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = RouteHop_read(ser_ref); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_obj) { - LDKNodeAnnouncementInfo this_obj_conv; +void __attribute__((visibility("default"))) TS_Route_free(uint32_t this_obj) { + LDKRoute this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NodeAnnouncementInfo_free(this_obj_conv); + Route_free(this_obj_conv); } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_features(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; +ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) { + LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv); + ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); + uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4); + for (size_t m = 0; m < ret_var.datalen; m++) { + LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m]; + uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4); + for (size_t k = 0; k < ret_conv_12_var.datalen; k++) { + LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k]; + CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner; + if (ret_conv_12_conv_10_var.is_owned) { + ret_conv_12_conv_10_ref |= 1; + } + ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref; + } + FREE(ret_conv_12_var.data); + ret_arr_ptr[m] = ret_conv_12_arr; } - return ret_ref; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_features(uint32_t this_ptr, uint32_t val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeFeatures val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeFeatures_clone(&val_conv); - NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv); -} - -int32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_last_update(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv); - return ret_val; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_last_update(uint32_t this_ptr, int32_t val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val); -} - -int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_rgb(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(3, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_rgb(&this_ptr_conv), 3); - return ret_arr; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_rgb(uint32_t this_ptr, int8_tArray val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKThreeBytes val_ref; - CHECK(*((uint32_t*)val) == 3); - memcpy(val_ref.data, (uint8_t*)(val + 4), 3); - NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref); -} - -int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_alias(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), *NodeAnnouncementInfo_get_alias(&this_ptr_conv), 32); + FREE(ret_var.data); return ret_arr; } -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_alias(uint32_t this_ptr, int8_tArray val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKThirtyTwoBytes val_ref; - CHECK(*((uint32_t*)val) == 32); - memcpy(val_ref.data, (uint8_t*)(val + 4), 32); - NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref); -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_addresses(uint32_t this_ptr, uint32_tArray val) { - LDKNodeAnnouncementInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) { + LDKRoute this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_NetAddressZ val_constr; + LDKCVec_CVec_RouteHopZZ val_constr; val_constr.datalen = *((uint32_t*)val); if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); + val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); else val_constr.data = NULL; - uint32_t* val_vals = (uint32_t*)(val + 4); + uint32_tArray* val_vals = (uint32_tArray*)(val + 4); for (size_t m = 0; m < val_constr.datalen; m++) { - uint32_t val_conv_12 = val_vals[m]; - LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); - val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1)); - val_constr.data[m] = val_conv_12_conv; - } - NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr); -} - -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_get_announcement_message(uint32_t this_ptr) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; + uint32_tArray val_conv_12 = val_vals[m]; + LDKCVec_RouteHopZ val_conv_12_constr; + val_conv_12_constr.datalen = *((uint32_t*)val_conv_12); + if (val_conv_12_constr.datalen > 0) + val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + val_conv_12_constr.data = NULL; + uint32_t* val_conv_12_vals = (uint32_t*)(val_conv_12 + 4); + for (size_t k = 0; k < val_conv_12_constr.datalen; k++) { + uint32_t val_conv_12_conv_10 = val_conv_12_vals[k]; + LDKRouteHop val_conv_12_conv_10_conv; + val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1)); + val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0); + val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv); + val_conv_12_constr.data[k] = val_conv_12_conv_10_conv; + } + val_constr.data[m] = val_conv_12_constr; } - return ret_ref; -} - -void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_announcement_message(uint32_t this_ptr, uint32_t val) { - LDKNodeAnnouncementInfo this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - LDKNodeAnnouncement val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeAnnouncement_clone(&val_conv); - NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv); + Route_set_paths(&this_ptr_conv, val_constr); } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(uint32_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, uint32_tArray addresses_arg, uint32_t announcement_message_arg) { - LDKNodeFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - features_arg_conv = NodeFeatures_clone(&features_arg_conv); - LDKThreeBytes rgb_arg_ref; - CHECK(*((uint32_t*)rgb_arg) == 3); - memcpy(rgb_arg_ref.data, (uint8_t*)(rgb_arg + 4), 3); - LDKThirtyTwoBytes alias_arg_ref; - CHECK(*((uint32_t*)alias_arg) == 32); - memcpy(alias_arg_ref.data, (uint8_t*)(alias_arg + 4), 32); - LDKCVec_NetAddressZ addresses_arg_constr; - addresses_arg_constr.datalen = *((uint32_t*)addresses_arg); - if (addresses_arg_constr.datalen > 0) - addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements"); +uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg) { + LDKCVec_CVec_RouteHopZZ paths_arg_constr; + paths_arg_constr.datalen = *((uint32_t*)paths_arg); + if (paths_arg_constr.datalen > 0) + paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); else - addresses_arg_constr.data = NULL; - uint32_t* addresses_arg_vals = (uint32_t*)(addresses_arg + 4); - for (size_t m = 0; m < addresses_arg_constr.datalen; m++) { - uint32_t addresses_arg_conv_12 = addresses_arg_vals[m]; - LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1); - addresses_arg_constr.data[m] = addresses_arg_conv_12_conv; + paths_arg_constr.data = NULL; + uint32_tArray* paths_arg_vals = (uint32_tArray*)(paths_arg + 4); + for (size_t m = 0; m < paths_arg_constr.datalen; m++) { + uint32_tArray paths_arg_conv_12 = paths_arg_vals[m]; + LDKCVec_RouteHopZ paths_arg_conv_12_constr; + paths_arg_conv_12_constr.datalen = *((uint32_t*)paths_arg_conv_12); + if (paths_arg_conv_12_constr.datalen > 0) + paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + paths_arg_conv_12_constr.data = NULL; + uint32_t* paths_arg_conv_12_vals = (uint32_t*)(paths_arg_conv_12 + 4); + for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) { + uint32_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k]; + LDKRouteHop paths_arg_conv_12_conv_10_conv; + paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1)); + paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0); + paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv); + paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv; + } + paths_arg_constr.data[m] = paths_arg_conv_12_constr; } - LDKNodeAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv); - LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv); + LDKRoute ret_var = Route_new(paths_arg_constr); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24874,11 +25491,11 @@ uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(uin return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(uint32_t orig) { - LDKNodeAnnouncementInfo orig_conv; +uint32_t __attribute__((visibility("default"))) TS_Route_clone(uint32_t orig) { + LDKRoute orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv); + LDKRoute ret_var = Route_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24888,56 +25505,147 @@ uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_clone(u return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_write(uint32_t obj) { - LDKNodeAnnouncementInfo obj_conv; +int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) { + LDKRoute o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = Route_hash(&o_conv); + return ret_val; +} + +jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) { + LDKRoute a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRoute b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = Route_eq(&a_conv, &b_conv); + return ret_val; +} + +int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_fees(&this_arg_conv); + return ret_val; +} + +int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) { + LDKRoute this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int64_t ret_val = Route_get_total_amount(&this_arg_conv); + return ret_val; +} + +int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) { + LDKRoute obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv); + LDKCVec_u8Z ret_var = Route_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_read(int8_tArray ser) { +uint32_t __attribute__((visibility("default"))) TS_Route_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ"); - *ret_conv = NodeAnnouncementInfo_read(ser_ref); + LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = Route_read(ser_ref); return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_NodeInfo_free(uint32_t this_obj) { - LDKNodeInfo this_obj_conv; +void __attribute__((visibility("default"))) TS_RouteHint_free(uint32_t this_obj) { + LDKRouteHint this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - NodeInfo_free(this_obj_conv); + RouteHint_free(this_obj_conv); } -void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t this_ptr, int64_tArray val) { - LDKNodeInfo this_ptr_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) { + LDKRouteHint orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKRouteHint ret_var = RouteHint_clone(&orig_conv); + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + uint64_t ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) { + LDKRouteHint o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHint_hash(&o_conv); + return ret_val; +} + +jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) { + LDKRouteHint a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHint b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHint_eq(&a_conv, &b_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) { + LDKRouteHintHop this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + RouteHintHop_free(this_obj_conv); +} + +int8_tArray __attribute__((visibility("default"))) TS_RouteHintHop_get_src_node_id(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKCVec_u64Z val_constr; - val_constr.datalen = *((uint32_t*)val); - if (val_constr.datalen > 0) - val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); - else - val_constr.data = NULL; - int64_t* val_vals = (int64_t*)(val + 4); - for (size_t i = 0; i < val_constr.datalen; i++) { - int64_t val_conv_8 = val_vals[i]; - val_constr.data[i] = val_conv_8; - } - NodeInfo_set_channels(&this_ptr_conv, val_constr); + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form, 33); + return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint32_t this_ptr) { - LDKNodeInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHintHop_set_src_node_id(uint32_t this_ptr, int8_tArray val) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv); + LDKPublicKey val_ref; + CHECK(*((uint32_t*)val) == 33); + memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33); + RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref); +} + +int64_t __attribute__((visibility("default"))) TS_RouteHintHop_get_short_channel_id(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_set_short_channel_id(uint32_t this_ptr, int64_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_short_channel_id(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_fees(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -24947,63 +25655,83 @@ uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_lowest_inbound_ return ret_ref; } -void __attribute__((visibility("default"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint32_t this_ptr, uint32_t val) { - LDKNodeInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHintHop_set_fees(uint32_t this_ptr, uint32_t val) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKRoutingFees val_conv; val_conv.inner = (void*)(val & (~1)); val_conv.is_owned = (val & 1) || (val == 0); val_conv = RoutingFees_clone(&val_conv); - NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv); + RouteHintHop_set_fees(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_get_announcement_info(uint32_t this_ptr) { - LDKNodeInfo this_ptr_conv; +int16_t __attribute__((visibility("default"))) TS_RouteHintHop_get_cltv_expiry_delta(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv); - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - uint64_t ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_minimum_msat(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } -void __attribute__((visibility("default"))) TS_NodeInfo_set_announcement_info(uint32_t this_ptr, uint32_t val) { - LDKNodeInfo this_ptr_conv; +void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_minimum_msat(uint32_t this_ptr, uint32_t val) { + LDKRouteHintHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKNodeAnnouncementInfo val_conv; - val_conv.inner = (void*)(val & (~1)); - val_conv.is_owned = (val & 1) || (val == 0); - val_conv = NodeAnnouncementInfo_clone(&val_conv); - NodeInfo_set_announcement_info(&this_ptr_conv, val_conv); + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray channels_arg, uint32_t lowest_inbound_channel_fees_arg, uint32_t announcement_info_arg) { - LDKCVec_u64Z channels_arg_constr; - channels_arg_constr.datalen = *((uint32_t*)channels_arg); - if (channels_arg_constr.datalen > 0) - channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements"); - else - channels_arg_constr.data = NULL; - int64_t* channels_arg_vals = (int64_t*)(channels_arg + 4); - for (size_t i = 0; i < channels_arg_constr.datalen; i++) { - int64_t channels_arg_conv_8 = channels_arg_vals[i]; - channels_arg_constr.data[i] = channels_arg_conv_8; - } - LDKRoutingFees lowest_inbound_channel_fees_arg_conv; - lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1)); - lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0); - lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv); - LDKNodeAnnouncementInfo announcement_info_arg_conv; - announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1)); - announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0); - announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); - LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_get_htlc_maximum_msat(uint32_t this_ptr) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_RouteHintHop_set_htlc_maximum_msat(uint32_t this_ptr, uint32_t val) { + LDKRouteHintHop this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1); + val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1)); + RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_new(int8_tArray src_node_id_arg, int64_t short_channel_id_arg, uint32_t fees_arg, int16_t cltv_expiry_delta_arg, uint32_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg) { + LDKPublicKey src_node_id_arg_ref; + CHECK(*((uint32_t*)src_node_id_arg) == 33); + memcpy(src_node_id_arg_ref.compressed_form, (uint8_t*)(src_node_id_arg + 4), 33); + LDKRoutingFees fees_arg_conv; + fees_arg_conv.inner = (void*)(fees_arg & (~1)); + fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0); + fees_arg_conv = RoutingFees_clone(&fees_arg_conv); + LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1); + htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1)); + LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1); + htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1)); + LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25013,11 +25741,11 @@ uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray ch return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig) { - LDKNodeInfo orig_conv; +uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) { + LDKRouteHintHop orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv); + LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25027,51 +25755,140 @@ uint32_t __attribute__((visibility("default"))) TS_NodeInfo_clone(uint32_t orig return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t obj) { - LDKNodeInfo obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; +int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) { + LDKRouteHintHop o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = false; + int64_t ret_val = RouteHintHop_hash(&o_conv); + return ret_val; } -uint32_t __attribute__((visibility("default"))) TS_NodeInfo_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ"); - *ret_conv = NodeInfo_read(ser_ref); - return (uint64_t)ret_conv; +jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) { + LDKRouteHintHop a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + LDKRouteHintHop b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv); + return ret_val; } -int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32_t obj) { - LDKNetworkGraph obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; +uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_pubkey, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger, uint32_t scorer) { + LDKPublicKey our_node_pubkey_ref; + CHECK(*((uint32_t*)our_node_pubkey) == 33); + memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK(*((uint32_t*)payee) == 33); + memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != 0) { + first_hops_constr.datalen = *((uint32_t*)first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + uint32_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = *((uint32_t*)last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + uint32_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_keysend_route(our_node_pubkey_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); - *ret_conv = NetworkGraph_read(ser_ref); +uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_pubkey, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger, uint32_t scorer) { + LDKPublicKey our_node_pubkey_ref; + CHECK(*((uint32_t*)our_node_pubkey) == 33); + memcpy(our_node_pubkey_ref.compressed_form, (uint8_t*)(our_node_pubkey + 4), 33); + LDKNetworkGraph network_conv; + network_conv.inner = (void*)(network & (~1)); + network_conv.is_owned = false; + LDKPublicKey payee_ref; + CHECK(*((uint32_t*)payee) == 33); + memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33); + LDKInvoiceFeatures payee_features_conv; + payee_features_conv.inner = (void*)(payee_features & (~1)); + payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0); + payee_features_conv = InvoiceFeatures_clone(&payee_features_conv); + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != 0) { + first_hops_constr.datalen = *((uint32_t*)first_hops); + if (first_hops_constr.datalen > 0) + first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + first_hops_constr.data = NULL; + uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4); + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + uint32_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1)); + first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0); + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + first_hops_ptr = &first_hops_constr; + } + LDKCVec_RouteHintZ last_hops_constr; + last_hops_constr.datalen = *((uint32_t*)last_hops); + if (last_hops_constr.datalen > 0) + last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + last_hops_constr.data = NULL; + uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4); + for (size_t l = 0; l < last_hops_constr.datalen; l++) { + uint32_t last_hops_conv_11 = last_hops_vals[l]; + LDKRouteHint last_hops_conv_11_conv; + last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1)); + last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0); + last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv); + last_hops_constr.data[l] = last_hops_conv_11_conv; + } + LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1); + LDKScore* scorer_conv = (LDKScore*)(((uint64_t)scorer) & ~1); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = get_route(our_node_pubkey_ref, &network_conv, payee_ref, payee_features_conv, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv, scorer_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray genesis_hash) { - LDKThirtyTwoBytes genesis_hash_ref; - CHECK(*((uint32_t*)genesis_hash) == 32); - memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32); - LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref); +void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) { + LDKScorer this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + Scorer_free(this_obj_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_Scorer_new(int64_t base_penalty_msat) { + LDKScorer ret_var = Scorer_new(base_penalty_msat); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25081,11 +25898,8 @@ uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_new(int8_tArray return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv); +uint32_t __attribute__((visibility("default"))) TS_Scorer_default() { + LDKScorer ret_var = Scorer_default(); CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. uint64_t ret_ref = (uint64_t)ret_var.inner; @@ -25095,103 +25909,13 @@ uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint3 return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKNodeAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_unsigned_announcement(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKUnsignedNodeAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKChannelAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint32_t this_arg, uint32_t msg, uint32_t chain_access) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKUnsignedChannelAnnouncement msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1); - // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { - // Manually implement clone for Java trait instances - } - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv); - return (uint64_t)ret_conv; -} - -void __attribute__((visibility("default"))) TS_NetworkGraph_close_channel_from_update(uint32_t this_arg, int64_t short_channel_id, jboolean is_permanent) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent); -} - -void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKPublicKey _node_id_ref; - CHECK(*((uint32_t*)_node_id) == 33); - memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33); - NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - LDKChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel_unsigned(uint32_t this_arg, uint32_t msg) { - LDKNetworkGraph this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_Scorer_as_Score(uint32_t this_arg) { + LDKScorer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKUnsignedChannelUpdate msg_conv; - msg_conv.inner = (void*)(msg & (~1)); - msg_conv.is_owned = false; - LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv); - return (uint64_t)ret_conv; + LDKScore* ret_ret =MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = Scorer_as_Score(&this_arg_conv); + return (uint64_t)ret_ret; } void __attribute__((visibility("default"))) TS_FilesystemPersister_free(uint32_t this_obj) { diff --git a/ts/bindings.ts b/ts/bindings.ts index e10bcd84..0310e0a3 100644 --- a/ts/bindings.ts +++ b/ts/bindings.ts @@ -731,6 +731,9 @@ public static native long new_empty_slice_vec(); public static native boolean LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(long arg); public static native number[] LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(long arg); public static native IOError LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(long arg); + public static native boolean LDKCResult_PaymentIdDecodeErrorZ_result_ok(long arg); + public static native number LDKCResult_PaymentIdDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_PaymentIdDecodeErrorZ_get_err(long arg); public static class LDKCOption_u16Z { private LDKCOption_u16Z() {} export class Some extends LDKCOption_u16Z { @@ -779,6 +782,9 @@ public static native long new_empty_slice_vec(); public static native number LDKCResult_NoneAPIErrorZ_get_err(long arg); public static native long LDKCVec_CResult_NoneAPIErrorZZ_new(number[] elems); public static native long LDKCVec_APIErrorZ_new(number[] elems); + public static native boolean LDKCResult__u832APIErrorZ_result_ok(long arg); + public static native Uint8Array LDKCResult__u832APIErrorZ_get_ok(long arg); + public static native number LDKCResult__u832APIErrorZ_get_err(long arg); public static class LDKPaymentSendFailure { private LDKPaymentSendFailure() {} export class ParameterError extends LDKPaymentSendFailure { @@ -801,12 +807,32 @@ public static native long new_empty_slice_vec(); } static { LDKPaymentSendFailure.init(); } public static native LDKPaymentSendFailure LDKPaymentSendFailure_ref_from_ptr(long ptr); + public static native boolean LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(long arg); + public static native number LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(long arg); + public static native number LDKCResult_PaymentIdPaymentSendFailureZ_get_err(long arg); public static native boolean LDKCResult_NonePaymentSendFailureZ_result_ok(long arg); public static native void LDKCResult_NonePaymentSendFailureZ_get_ok(long arg); public static native number LDKCResult_NonePaymentSendFailureZ_get_err(long arg); - public static native boolean LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(long arg); - public static native Uint8Array LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(long arg); - public static native number LDKCResult_PaymentHashPaymentSendFailureZ_get_err(long arg); + public static native long LDKC2Tuple_PaymentHashPaymentIdZ_new(Uint8Array a, number b); + // struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple); + export function C2Tuple_PaymentHashPaymentIdZ_get_a(tuple: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.C2Tuple_PaymentHashPaymentIdZ_get_a(tuple); + return decodeArray(nativeResponseValue); + } + // struct LDKPaymentId C2Tuple_PaymentHashPaymentIdZ_get_b(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR tuple); + export function C2Tuple_PaymentHashPaymentIdZ_get_b(tuple: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.C2Tuple_PaymentHashPaymentIdZ_get_b(tuple); + return nativeResponseValue; + } + public static native boolean LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(long arg); + public static native number LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(long arg); + public static native number LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(long arg); public static class LDKNetAddress { private LDKNetAddress() {} export class IPv4 extends LDKNetAddress { @@ -1308,7 +1334,8 @@ public static native long new_empty_slice_vec(); } export class PaymentSent extends LDKEvent { public Uint8Array payment_preimage; - PaymentSent(Uint8Array payment_preimage) { this.payment_preimage = payment_preimage; } + public Uint8Array payment_hash; + PaymentSent(Uint8Array payment_preimage, Uint8Array payment_hash) { this.payment_preimage = payment_preimage; this.payment_hash = payment_hash; } } export class PaymentPathFailed extends LDKEvent { public Uint8Array payment_hash; @@ -1316,7 +1343,8 @@ public static native long new_empty_slice_vec(); public number network_update; public boolean all_paths_failed; public number[] path; - PaymentPathFailed(Uint8Array payment_hash, boolean rejected_by_dest, number network_update, boolean all_paths_failed, number[] path) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; } + public number short_channel_id; + PaymentPathFailed(Uint8Array payment_hash, boolean rejected_by_dest, number network_update, boolean all_paths_failed, number[] path, number short_channel_id) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; this.short_channel_id = short_channel_id; } } export class PendingHTLCsForwardable extends LDKEvent { public number time_forwardable; @@ -1333,8 +1361,14 @@ public static native long new_empty_slice_vec(); } export class ChannelClosed extends LDKEvent { public Uint8Array channel_id; + public number user_channel_id; public number reason; - ChannelClosed(Uint8Array channel_id, number reason) { this.channel_id = channel_id; this.reason = reason; } + ChannelClosed(Uint8Array channel_id, number user_channel_id, number reason) { this.channel_id = channel_id; this.user_channel_id = user_channel_id; this.reason = reason; } + } + export class DiscardFunding extends LDKEvent { + public Uint8Array channel_id; + public Uint8Array transaction; + DiscardFunding(Uint8Array channel_id, Uint8Array transaction) { this.channel_id = channel_id; this.transaction = transaction; } } static native void init(); } @@ -1466,6 +1500,9 @@ public static native long new_empty_slice_vec(); public static native boolean LDKCResult_boolPeerHandleErrorZ_result_ok(long arg); public static native boolean LDKCResult_boolPeerHandleErrorZ_get_ok(long arg); public static native number LDKCResult_boolPeerHandleErrorZ_get_err(long arg); + public static native boolean LDKCResult_NodeIdDecodeErrorZ_result_ok(long arg); + public static native number LDKCResult_NodeIdDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_NodeIdDecodeErrorZ_get_err(long arg); @@ -1522,6 +1559,19 @@ public static native long new_empty_slice_vec(); public static native boolean LDKCResult_NetworkGraphDecodeErrorZ_result_ok(long arg); public static native number LDKCResult_NetworkGraphDecodeErrorZ_get_ok(long arg); public static native number LDKCResult_NetworkGraphDecodeErrorZ_get_err(long arg); + public static class LDKCOption_CVec_NetAddressZZ { + private LDKCOption_CVec_NetAddressZZ() {} + export class Some extends LDKCOption_CVec_NetAddressZZ { + public number[] some; + Some(number[] some) { this.some = some; } + } + export class None extends LDKCOption_CVec_NetAddressZZ { + None() { } + } + static native void init(); + } + static { LDKCOption_CVec_NetAddressZZ.init(); } + public static native LDKCOption_CVec_NetAddressZZ LDKCOption_CVec_NetAddressZZ_ref_from_ptr(long ptr); public static native boolean LDKCResult_NetAddressu8Z_result_ok(long arg); public static native number LDKCResult_NetAddressu8Z_get_ok(long arg); public static native number LDKCResult_NetAddressu8Z_get_err(long arg); @@ -1693,6 +1743,10 @@ public static native long new_empty_slice_vec(); } static { LDKCOption_FilterZ.init(); } public static native LDKCOption_FilterZ LDKCOption_FilterZ_ref_from_ptr(long ptr); + public static native boolean LDKCResult_LockedChannelMonitorNoneZ_result_ok(long arg); + public static native number LDKCResult_LockedChannelMonitorNoneZ_get_ok(long arg); + public static native void LDKCResult_LockedChannelMonitorNoneZ_get_err(long arg); + public static native long LDKCVec_OutPointZ_new(number[] elems); @@ -2285,6 +2339,30 @@ public static native long new_empty_slice_vec(); +// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START + + export interface LDKScore { + channel_penalty_msat (short_channel_id: number): number; + } + + export function LDKScore_new(impl: LDKScore): number { + throw new Error('unimplemented'); // TODO: bind to WASM + } + +// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END + + + // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id + export function Score_channel_penalty_msat(this_arg: number, short_channel_id: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Score_channel_penalty_msat(this_arg, short_channel_id); + return nativeResponseValue; + } + + + // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START export interface LDKChannelManagerPersister { @@ -3845,6 +3923,38 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(orig); return nativeResponseValue; } + // struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_ok(struct LDKPaymentId o); + export function CResult_PaymentIdDecodeErrorZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdDecodeErrorZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_PaymentIdDecodeErrorZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdDecodeErrorZ_err(e); + return nativeResponseValue; + } + // void CResult_PaymentIdDecodeErrorZ_free(struct LDKCResult_PaymentIdDecodeErrorZ _res); + export function CResult_PaymentIdDecodeErrorZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdDecodeErrorZ_free(_res); + // debug statements here + } + // struct LDKCResult_PaymentIdDecodeErrorZ CResult_PaymentIdDecodeErrorZ_clone(const struct LDKCResult_PaymentIdDecodeErrorZ *NONNULL_PTR orig); + export function CResult_PaymentIdDecodeErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdDecodeErrorZ_clone(orig); + return nativeResponseValue; + } // struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); export function COption_u16Z_some(o: number): number { if(!isWasmInitialized) { @@ -3925,6 +4035,70 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CVec_APIErrorZ_free(_res); // debug statements here } + // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); + export function CResult__u832APIErrorZ_ok(o: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult__u832APIErrorZ_ok(encodeArray(o)); + return nativeResponseValue; + } + // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); + export function CResult__u832APIErrorZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult__u832APIErrorZ_err(e); + return nativeResponseValue; + } + // void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); + export function CResult__u832APIErrorZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult__u832APIErrorZ_free(_res); + // debug statements here + } + // struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); + export function CResult__u832APIErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult__u832APIErrorZ_clone(orig); + return nativeResponseValue; + } + // struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKPaymentId o); + export function CResult_PaymentIdPaymentSendFailureZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdPaymentSendFailureZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); + export function CResult_PaymentIdPaymentSendFailureZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdPaymentSendFailureZ_err(e); + return nativeResponseValue; + } + // void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res); + export function CResult_PaymentIdPaymentSendFailureZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdPaymentSendFailureZ_free(_res); + // debug statements here + } + // struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig); + export function CResult_PaymentIdPaymentSendFailureZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentIdPaymentSendFailureZ_clone(orig); + return nativeResponseValue; + } // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); export function CResult_NonePaymentSendFailureZ_ok(): number { if(!isWasmInitialized) { @@ -3957,36 +4131,60 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_NonePaymentSendFailureZ_clone(orig); return nativeResponseValue; } - // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); - export function CResult_PaymentHashPaymentSendFailureZ_ok(o: Uint8Array): number { + // struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); + export function C2Tuple_PaymentHashPaymentIdZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.C2Tuple_PaymentHashPaymentIdZ_clone(orig); + return nativeResponseValue; + } + // struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKPaymentId b); + export function C2Tuple_PaymentHashPaymentIdZ_new(a: Uint8Array, b: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.C2Tuple_PaymentHashPaymentIdZ_new(encodeArray(a), b); + return nativeResponseValue; + } + // void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); + export function C2Tuple_PaymentHashPaymentIdZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.C2Tuple_PaymentHashPaymentIdZ_free(_res); + // debug statements here + } + // struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); + export function CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_ok(encodeArray(o)); + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); - export function CResult_PaymentHashPaymentSendFailureZ_err(e: number): number { + // struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); + export function CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_err(e); + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e); return nativeResponseValue; } - // void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); - export function CResult_PaymentHashPaymentSendFailureZ_free(_res: number): void { + // void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); + export function CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_free(_res); + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(_res); // debug statements here } - // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); - export function CResult_PaymentHashPaymentSendFailureZ_clone(orig: number): number { + // struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); + export function CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_clone(orig); + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(orig); return nativeResponseValue; } // void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); @@ -5149,6 +5347,38 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_boolPeerHandleErrorZ_clone(orig); return nativeResponseValue; } + // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); + export function CResult_NodeIdDecodeErrorZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_NodeIdDecodeErrorZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_NodeIdDecodeErrorZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_NodeIdDecodeErrorZ_err(e); + return nativeResponseValue; + } + // void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); + export function CResult_NodeIdDecodeErrorZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_NodeIdDecodeErrorZ_free(_res); + // debug statements here + } + // struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); + export function CResult_NodeIdDecodeErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_NodeIdDecodeErrorZ_clone(orig); + return nativeResponseValue; + } // struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); export function COption_AccessZ_some(o: number): number { if(!isWasmInitialized) { @@ -5373,6 +5603,38 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_NetworkGraphDecodeErrorZ_clone(orig); return nativeResponseValue; } + // struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); + export function COption_CVec_NetAddressZZ_some(o: number[]): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.COption_CVec_NetAddressZZ_some(o); + return nativeResponseValue; + } + // struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); + export function COption_CVec_NetAddressZZ_none(): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.COption_CVec_NetAddressZZ_none(); + return nativeResponseValue; + } + // void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); + export function COption_CVec_NetAddressZZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.COption_CVec_NetAddressZZ_free(_res); + // debug statements here + } + // struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); + export function COption_CVec_NetAddressZZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.COption_CVec_NetAddressZZ_clone(orig); + return nativeResponseValue; + } // struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o); export function CResult_NetAddressu8Z_ok(o: number): number { if(!isWasmInitialized) { @@ -6581,6 +6843,38 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.COption_FilterZ_free(_res); // debug statements here } + // struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); + export function CResult_LockedChannelMonitorNoneZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_LockedChannelMonitorNoneZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); + export function CResult_LockedChannelMonitorNoneZ_err(): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_LockedChannelMonitorNoneZ_err(); + return nativeResponseValue; + } + // void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); + export function CResult_LockedChannelMonitorNoneZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_LockedChannelMonitorNoneZ_free(_res); + // debug statements here + } + // void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); + export function CVec_OutPointZ_free(_res: number[]): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CVec_OutPointZ_free(_res); + // debug statements here + } // void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); export function PaymentPurpose_free(this_ptr: number): void { if(!isWasmInitialized) { @@ -6725,20 +7019,20 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Event_payment_received(encodeArray(payment_hash), amt, purpose); return nativeResponseValue; } - // struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage); - export function Event_payment_sent(payment_preimage: Uint8Array): number { + // struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash); + export function Event_payment_sent(payment_preimage: Uint8Array, payment_hash: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Event_payment_sent(encodeArray(payment_preimage)); + const nativeResponseValue = wasm.Event_payment_sent(encodeArray(payment_preimage), encodeArray(payment_hash)); return nativeResponseValue; } - // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path); - export function Event_payment_path_failed(payment_hash: Uint8Array, rejected_by_dest: boolean, network_update: number, all_paths_failed: boolean, path: number[]): number { + // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id); + export function Event_payment_path_failed(payment_hash: Uint8Array, rejected_by_dest: boolean, network_update: number, all_paths_failed: boolean, path: number[], short_channel_id: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Event_payment_path_failed(encodeArray(payment_hash), rejected_by_dest, network_update, all_paths_failed, path); + const nativeResponseValue = wasm.Event_payment_path_failed(encodeArray(payment_hash), rejected_by_dest, network_update, all_paths_failed, path, short_channel_id); return nativeResponseValue; } // struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); @@ -6765,12 +7059,20 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Event_payment_forwarded(fee_earned_msat, claim_from_onchain_tx); return nativeResponseValue; } - // struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKClosureReason reason); - export function Event_channel_closed(channel_id: Uint8Array, reason: number): number { + // struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason); + export function Event_channel_closed(channel_id: Uint8Array, user_channel_id: number, reason: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Event_channel_closed(encodeArray(channel_id), user_channel_id, reason); + return nativeResponseValue; + } + // struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); + export function Event_discard_funding(channel_id: Uint8Array, transaction: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Event_channel_closed(encodeArray(channel_id), reason); + const nativeResponseValue = wasm.Event_discard_funding(encodeArray(channel_id), encodeArray(transaction)); return nativeResponseValue; } // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); @@ -7733,6 +8035,30 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Confirm_free(this_ptr); // debug statements here } + // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); + export function ChannelMonitorUpdateErr_clone(orig: number): ChannelMonitorUpdateErr { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelMonitorUpdateErr_clone(orig); + return nativeResponseValue; + } + // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void); + export function ChannelMonitorUpdateErr_temporary_failure(): ChannelMonitorUpdateErr { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelMonitorUpdateErr_temporary_failure(); + return nativeResponseValue; + } + // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void); + export function ChannelMonitorUpdateErr_permanent_failure(): ChannelMonitorUpdateErr { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelMonitorUpdateErr_permanent_failure(); + return nativeResponseValue; + } // void Watch_free(struct LDKWatch this_ptr); export function Watch_free(this_ptr: number): void { if(!isWasmInitialized) { @@ -7885,6 +8211,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.FeeEstimator_free(this_ptr); // debug statements here } + // void Persist_free(struct LDKPersist this_ptr); + export function Persist_free(this_ptr: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Persist_free(this_ptr); + // debug statements here + } + // void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj); + export function LockedChannelMonitor_free(this_obj: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.LockedChannelMonitor_free(this_obj); + // debug statements here + } // void ChainMonitor_free(struct LDKChainMonitor this_obj); export function ChainMonitor_free(this_obj: number): void { if(!isWasmInitialized) { @@ -7909,6 +8251,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChainMonitor_get_claimable_balances(this_arg, ignored_channels); return nativeResponseValue; } + // MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo); + export function ChainMonitor_get_monitor(this_arg: number, funding_txo: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChainMonitor_get_monitor(this_arg, funding_txo); + return nativeResponseValue; + } + // MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); + export function ChainMonitor_list_monitors(this_arg: number): number[] { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChainMonitor_list_monitors(this_arg); + return nativeResponseValue; + } // struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg); export function ChainMonitor_as_Listen(this_arg: number): number { if(!isWasmInitialized) { @@ -7989,30 +8347,6 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelMonitorUpdate_read(encodeArray(ser)); return nativeResponseValue; } - // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig); - export function ChannelMonitorUpdateErr_clone(orig: number): ChannelMonitorUpdateErr { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdateErr_clone(orig); - return nativeResponseValue; - } - // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void); - export function ChannelMonitorUpdateErr_temporary_failure(): ChannelMonitorUpdateErr { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdateErr_temporary_failure(); - return nativeResponseValue; - } - // enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void); - export function ChannelMonitorUpdateErr_permanent_failure(): ChannelMonitorUpdateErr { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdateErr_permanent_failure(); - return nativeResponseValue; - } // void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj); export function MonitorUpdateError_free(this_obj: number): void { if(!isWasmInitialized) { @@ -8301,16 +8635,8 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelMonitor_get_claimable_balances(this_arg); return nativeResponseValue; } - // void Persist_free(struct LDKPersist this_ptr); - export function Persist_free(this_ptr: number): void { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.Persist_free(this_ptr); - // debug statements here - } - // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); - export function C2Tuple_BlockHashChannelMonitorZ_read(ser: Uint8Array, arg: number): number { + // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg); + export function C2Tuple_BlockHashChannelMonitorZ_read(ser: Uint8Array, arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } @@ -8997,6 +9323,54 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.KeysManager_as_KeysInterface(this_arg); return nativeResponseValue; } + // void PaymentId_free(struct LDKPaymentId this_obj); + export function PaymentId_free(this_obj: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.PaymentId_free(this_obj); + // debug statements here + } + // uint64_t PaymentId_hash(const struct LDKPaymentId *NONNULL_PTR o); + export function PaymentId_hash(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.PaymentId_hash(o); + return nativeResponseValue; + } + // struct LDKPaymentId PaymentId_clone(const struct LDKPaymentId *NONNULL_PTR orig); + export function PaymentId_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.PaymentId_clone(orig); + return nativeResponseValue; + } + // bool PaymentId_eq(const struct LDKPaymentId *NONNULL_PTR a, const struct LDKPaymentId *NONNULL_PTR b); + export function PaymentId_eq(a: number, b: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.PaymentId_eq(a, b); + return nativeResponseValue; + } + // struct LDKCVec_u8Z PaymentId_write(const struct LDKPaymentId *NONNULL_PTR obj); + export function PaymentId_write(obj: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.PaymentId_write(obj); + return decodeArray(nativeResponseValue); + } + // struct LDKCResult_PaymentIdDecodeErrorZ PaymentId_read(struct LDKu8slice ser); + export function PaymentId_read(ser: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.PaymentId_read(encodeArray(ser)); + return nativeResponseValue; + } // void ChannelManager_free(struct LDKChannelManager this_obj); export function ChannelManager_free(this_obj: number): void { if(!isWasmInitialized) { @@ -9325,20 +9699,20 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelDetails_set_unspendable_punishment_reserve(this_ptr, val); // debug statements here } - // uint64_t ChannelDetails_get_user_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); - export function ChannelDetails_get_user_id(this_ptr: number): number { + // uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + export function ChannelDetails_get_user_channel_id(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelDetails_get_user_id(this_ptr); + const nativeResponseValue = wasm.ChannelDetails_get_user_channel_id(this_ptr); return nativeResponseValue; } - // void ChannelDetails_set_user_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); - export function ChannelDetails_set_user_id(this_ptr: number, val: number): void { + // void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); + export function ChannelDetails_set_user_channel_id(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelDetails_set_user_id(this_ptr, val); + const nativeResponseValue = wasm.ChannelDetails_set_user_channel_id(this_ptr, val); // debug statements here } // uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); @@ -9469,12 +9843,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelDetails_set_is_public(this_ptr, val); // debug statements here } - // 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_id_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); - export function ChannelDetails_new(channel_id_arg: Uint8Array, counterparty_arg: number, funding_txo_arg: number, short_channel_id_arg: number, channel_value_satoshis_arg: number, unspendable_punishment_reserve_arg: number, user_id_arg: number, outbound_capacity_msat_arg: number, inbound_capacity_msat_arg: number, confirmations_required_arg: number, force_close_spend_delay_arg: number, is_outbound_arg: boolean, is_funding_locked_arg: boolean, is_usable_arg: boolean, is_public_arg: boolean): number { + // 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 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); + export function ChannelDetails_new(channel_id_arg: Uint8Array, counterparty_arg: number, funding_txo_arg: number, short_channel_id_arg: number, channel_value_satoshis_arg: number, unspendable_punishment_reserve_arg: number, user_channel_id_arg: number, outbound_capacity_msat_arg: number, inbound_capacity_msat_arg: number, confirmations_required_arg: number, force_close_spend_delay_arg: number, is_outbound_arg: boolean, is_funding_locked_arg: boolean, is_usable_arg: boolean, is_public_arg: boolean): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelDetails_new(encodeArray(channel_id_arg), counterparty_arg, funding_txo_arg, short_channel_id_arg, channel_value_satoshis_arg, unspendable_punishment_reserve_arg, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg, force_close_spend_delay_arg, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + const nativeResponseValue = wasm.ChannelDetails_new(encodeArray(channel_id_arg), counterparty_arg, funding_txo_arg, short_channel_id_arg, channel_value_satoshis_arg, unspendable_punishment_reserve_arg, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg, force_close_spend_delay_arg, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); return nativeResponseValue; } // struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); @@ -9549,12 +9923,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelManager_get_current_default_configuration(this_arg); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_id, struct LDKUserConfig override_config); - export function ChannelManager_create_channel(this_arg: number, their_network_key: Uint8Array, channel_value_satoshis: number, push_msat: number, user_id: number, override_config: number): number { + // MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_channel_id, struct LDKUserConfig override_config); + export function ChannelManager_create_channel(this_arg: number, their_network_key: Uint8Array, channel_value_satoshis: number, push_msat: number, user_channel_id: number, override_config: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelManager_create_channel(this_arg, encodeArray(their_network_key), channel_value_satoshis, push_msat, user_id, override_config); + const nativeResponseValue = wasm.ChannelManager_create_channel(this_arg, encodeArray(their_network_key), channel_value_satoshis, push_msat, user_channel_id, override_config); return nativeResponseValue; } // MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -9605,7 +9979,7 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelManager_force_close_all_channels(this_arg); // debug statements here } - // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); + // MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); export function ChannelManager_send_payment(this_arg: number, route: number, payment_hash: Uint8Array, payment_secret: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); @@ -9613,7 +9987,15 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelManager_send_payment(this_arg, route, encodeArray(payment_hash), encodeArray(payment_secret)); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); + // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKPaymentId payment_id); + export function ChannelManager_retry_payment(this_arg: number, route: number, payment_id: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelManager_retry_payment(this_arg, route, payment_id); + return nativeResponseValue; + } + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); export function ChannelManager_send_spontaneous_payment(this_arg: number, route: number, payment_preimage: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); @@ -15213,22 +15595,6 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ShutdownScript_read(encodeArray(ser)); return nativeResponseValue; } - // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]); - export function ShutdownScript_new_p2pkh(pubkey_hash: Uint8Array): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ShutdownScript_new_p2pkh(encodeArray(pubkey_hash)); - return nativeResponseValue; - } - // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]); - export function ShutdownScript_new_p2sh(script_hash: Uint8Array): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ShutdownScript_new_p2sh(encodeArray(script_hash)); - return nativeResponseValue; - } // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); export function ShutdownScript_new_p2wpkh(pubkey_hash: Uint8Array): number { if(!isWasmInitialized) { @@ -15301,1260 +15667,1364 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Type_free(this_ptr); // debug statements here } - // void RouteHop_free(struct LDKRouteHop this_obj); - export function RouteHop_free(this_obj: number): void { + // void Score_free(struct LDKScore this_ptr); + export function Score_free(this_ptr: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_free(this_obj); + const nativeResponseValue = wasm.Score_free(this_ptr); // debug statements here } - // struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); - export function RouteHop_get_pubkey(this_ptr: number): Uint8Array { + // void NodeId_free(struct LDKNodeId this_obj); + export function NodeId_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_get_pubkey(this_ptr); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.NodeId_free(this_obj); + // debug statements here } - // void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); - export function RouteHop_set_pubkey(this_ptr: number, val: Uint8Array): void { + // struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); + export function NodeId_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_set_pubkey(this_ptr, encodeArray(val)); - // debug statements here + const nativeResponseValue = wasm.NodeId_clone(orig); + return nativeResponseValue; } - // struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); - export function RouteHop_get_node_features(this_ptr: number): number { + // MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); + export function NodeId_from_pubkey(pubkey: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_get_node_features(this_ptr); + const nativeResponseValue = wasm.NodeId_from_pubkey(encodeArray(pubkey)); return nativeResponseValue; } - // void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); - export function RouteHop_set_node_features(this_ptr: number, val: number): void { + // MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); + export function NodeId_as_slice(this_arg: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_set_node_features(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.NodeId_as_slice(this_arg); + return decodeArray(nativeResponseValue); } - // uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); - export function RouteHop_get_short_channel_id(this_ptr: number): number { + // uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); + export function NodeId_hash(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_get_short_channel_id(this_ptr); + const nativeResponseValue = wasm.NodeId_hash(o); return nativeResponseValue; } - // void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); - export function RouteHop_set_short_channel_id(this_ptr: number, val: number): void { + // struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); + export function NodeId_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_set_short_channel_id(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.NodeId_write(obj); + return decodeArray(nativeResponseValue); } - // struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); - export function RouteHop_get_channel_features(this_ptr: number): number { + // struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); + export function NodeId_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_get_channel_features(this_ptr); + const nativeResponseValue = wasm.NodeId_read(encodeArray(ser)); return nativeResponseValue; } - // void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); - export function RouteHop_set_channel_features(this_ptr: number, val: number): void { + // void NetworkGraph_free(struct LDKNetworkGraph this_obj); + export function NetworkGraph_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_set_channel_features(this_ptr, val); + const nativeResponseValue = wasm.NetworkGraph_free(this_obj); // debug statements here } - // uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); - export function RouteHop_get_fee_msat(this_ptr: number): number { + // struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); + export function NetworkGraph_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_get_fee_msat(this_ptr); + const nativeResponseValue = wasm.NetworkGraph_clone(orig); return nativeResponseValue; } - // void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); - export function RouteHop_set_fee_msat(this_ptr: number, val: number): void { + // void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); + export function ReadOnlyNetworkGraph_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_set_fee_msat(this_ptr, val); + const nativeResponseValue = wasm.ReadOnlyNetworkGraph_free(this_obj); // debug statements here } - // uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); - export function RouteHop_get_cltv_expiry_delta(this_ptr: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.RouteHop_get_cltv_expiry_delta(this_ptr); - return nativeResponseValue; - } - // void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); - export function RouteHop_set_cltv_expiry_delta(this_ptr: number, val: number): void { + // void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); + export function NetworkUpdate_free(this_ptr: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_set_cltv_expiry_delta(this_ptr, val); + const nativeResponseValue = wasm.NetworkUpdate_free(this_ptr); // debug statements here } - // MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); - export function RouteHop_new(pubkey_arg: Uint8Array, node_features_arg: number, short_channel_id_arg: number, channel_features_arg: number, fee_msat_arg: number, cltv_expiry_delta_arg: number): number { + // struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); + export function NetworkUpdate_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_new(encodeArray(pubkey_arg), node_features_arg, short_channel_id_arg, channel_features_arg, fee_msat_arg, cltv_expiry_delta_arg); + const nativeResponseValue = wasm.NetworkUpdate_clone(orig); return nativeResponseValue; } - // struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); - export function RouteHop_clone(orig: number): number { + // struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg); + export function NetworkUpdate_channel_update_message(msg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_clone(orig); + const nativeResponseValue = wasm.NetworkUpdate_channel_update_message(msg); return nativeResponseValue; } - // uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); - export function RouteHop_hash(o: number): number { + // struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent); + export function NetworkUpdate_channel_closed(short_channel_id: number, is_permanent: boolean): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_hash(o); + const nativeResponseValue = wasm.NetworkUpdate_channel_closed(short_channel_id, is_permanent); return nativeResponseValue; } - // bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); - export function RouteHop_eq(a: number, b: number): boolean { + // struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); + export function NetworkUpdate_node_failure(node_id: Uint8Array, is_permanent: boolean): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_eq(a, b); + const nativeResponseValue = wasm.NetworkUpdate_node_failure(encodeArray(node_id), is_permanent); return nativeResponseValue; } - // struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); - export function RouteHop_write(obj: number): Uint8Array { + // struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); + export function NetworkUpdate_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_write(obj); + const nativeResponseValue = wasm.NetworkUpdate_write(obj); return decodeArray(nativeResponseValue); } - // struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); - export function RouteHop_read(ser: Uint8Array): number { + // struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); + export function NetGraphMsgHandler_as_EventHandler(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHop_read(encodeArray(ser)); + const nativeResponseValue = wasm.NetGraphMsgHandler_as_EventHandler(this_arg); return nativeResponseValue; } - // void Route_free(struct LDKRoute this_obj); - export function Route_free(this_obj: number): void { + // void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj); + export function NetGraphMsgHandler_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_free(this_obj); + const nativeResponseValue = wasm.NetGraphMsgHandler_free(this_obj); // debug statements here } - // struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); - export function Route_get_paths(this_ptr: number): number[][] { + // struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr); + export function NetGraphMsgHandler_get_network_graph(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_get_paths(this_ptr); + const nativeResponseValue = wasm.NetGraphMsgHandler_get_network_graph(this_ptr); return nativeResponseValue; } - // void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); - export function Route_set_paths(this_ptr: number, val: number[][]): void { + // void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val); + export function NetGraphMsgHandler_set_network_graph(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_set_paths(this_ptr, val); + const nativeResponseValue = wasm.NetGraphMsgHandler_set_network_graph(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg); - export function Route_new(paths_arg: number[][]): number { + // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); + export function NetGraphMsgHandler_new(network_graph: number, chain_access: number, logger: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_new(paths_arg); + const nativeResponseValue = wasm.NetGraphMsgHandler_new(network_graph, chain_access, logger); return nativeResponseValue; } - // struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); - export function Route_clone(orig: number): number { + // void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); + export function NetGraphMsgHandler_add_chain_access(this_arg: number, chain_access: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_clone(orig); - return nativeResponseValue; + const nativeResponseValue = wasm.NetGraphMsgHandler_add_chain_access(this_arg, chain_access); + // debug statements here } - // uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); - export function Route_hash(o: number): number { + // struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); + export function NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_hash(o); + const nativeResponseValue = wasm.NetGraphMsgHandler_as_RoutingMessageHandler(this_arg); return nativeResponseValue; } - // bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); - export function Route_eq(a: number, b: number): boolean { + // struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); + export function NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_eq(a, b); + const nativeResponseValue = wasm.NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg); return nativeResponseValue; } - // MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); - export function Route_get_total_fees(this_arg: number): number { + // void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj); + export function DirectionalChannelInfo_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_get_total_fees(this_arg); - return nativeResponseValue; + const nativeResponseValue = wasm.DirectionalChannelInfo_free(this_obj); + // debug statements here } - // MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); - export function Route_get_total_amount(this_arg: number): number { + // uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + export function DirectionalChannelInfo_get_last_update(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_get_total_amount(this_arg); + const nativeResponseValue = wasm.DirectionalChannelInfo_get_last_update(this_ptr); return nativeResponseValue; } - // struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); - export function Route_write(obj: number): Uint8Array { + // void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val); + export function DirectionalChannelInfo_set_last_update(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_write(obj); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.DirectionalChannelInfo_set_last_update(this_ptr, val); + // debug statements here } - // struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); - export function Route_read(ser: Uint8Array): number { + // bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + export function DirectionalChannelInfo_get_enabled(this_ptr: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Route_read(encodeArray(ser)); + const nativeResponseValue = wasm.DirectionalChannelInfo_get_enabled(this_ptr); return nativeResponseValue; } - // void RouteHint_free(struct LDKRouteHint this_obj); - export function RouteHint_free(this_obj: number): void { + // void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val); + export function DirectionalChannelInfo_set_enabled(this_ptr: number, val: boolean): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHint_free(this_obj); + const nativeResponseValue = wasm.DirectionalChannelInfo_set_enabled(this_ptr, val); // debug statements here } - // struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); - export function RouteHint_clone(orig: number): number { + // uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + export function DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHint_clone(orig); + const nativeResponseValue = wasm.DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr); return nativeResponseValue; } - // uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); - export function RouteHint_hash(o: number): number { + // void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val); + export function DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHint_hash(o); - return nativeResponseValue; + const nativeResponseValue = wasm.DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr, val); + // debug statements here } - // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); - export function RouteHint_eq(a: number, b: number): boolean { + // uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + export function DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHint_eq(a, b); + const nativeResponseValue = wasm.DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr); return nativeResponseValue; } - // void RouteHintHop_free(struct LDKRouteHintHop this_obj); - export function RouteHintHop_free(this_obj: number): void { + // void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val); + export function DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_free(this_obj); + const nativeResponseValue = wasm.DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr, val); // debug statements here } - // struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - export function RouteHintHop_get_src_node_id(this_ptr: number): Uint8Array { + // struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + export function DirectionalChannelInfo_get_htlc_maximum_msat(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_get_src_node_id(this_ptr); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.DirectionalChannelInfo_get_htlc_maximum_msat(this_ptr); + return nativeResponseValue; } - // void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); - export function RouteHintHop_set_src_node_id(this_ptr: number, val: Uint8Array): void { + // void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + export function DirectionalChannelInfo_set_htlc_maximum_msat(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_set_src_node_id(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.DirectionalChannelInfo_set_htlc_maximum_msat(this_ptr, val); // debug statements here } - // uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - export function RouteHintHop_get_short_channel_id(this_ptr: number): number { + // struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + export function DirectionalChannelInfo_get_fees(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_get_short_channel_id(this_ptr); + const nativeResponseValue = wasm.DirectionalChannelInfo_get_fees(this_ptr); return nativeResponseValue; } - // void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); - export function RouteHintHop_set_short_channel_id(this_ptr: number, val: number): void { + // void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); + export function DirectionalChannelInfo_set_fees(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_set_short_channel_id(this_ptr, val); + const nativeResponseValue = wasm.DirectionalChannelInfo_set_fees(this_ptr, val); // debug statements here } - // struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - export function RouteHintHop_get_fees(this_ptr: number): number { + // struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); + export function DirectionalChannelInfo_get_last_update_message(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_get_fees(this_ptr); + const nativeResponseValue = wasm.DirectionalChannelInfo_get_last_update_message(this_ptr); return nativeResponseValue; } - // void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - export function RouteHintHop_set_fees(this_ptr: number, val: number): void { + // void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); + export function DirectionalChannelInfo_set_last_update_message(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_set_fees(this_ptr, val); + const nativeResponseValue = wasm.DirectionalChannelInfo_set_last_update_message(this_ptr, val); // debug statements here } - // uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - export function RouteHintHop_get_cltv_expiry_delta(this_ptr: number): number { + // MUST_USE_RES struct LDKDirectionalChannelInfo DirectionalChannelInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); + export function DirectionalChannelInfo_new(last_update_arg: number, enabled_arg: boolean, cltv_expiry_delta_arg: number, htlc_minimum_msat_arg: number, htlc_maximum_msat_arg: number, fees_arg: number, last_update_message_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_get_cltv_expiry_delta(this_ptr); + const nativeResponseValue = wasm.DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg, last_update_message_arg); return nativeResponseValue; } - // void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); - export function RouteHintHop_set_cltv_expiry_delta(this_ptr: number, val: number): void { + // struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig); + export function DirectionalChannelInfo_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_set_cltv_expiry_delta(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.DirectionalChannelInfo_clone(orig); + return nativeResponseValue; } - // struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - export function RouteHintHop_get_htlc_minimum_msat(this_ptr: number): number { + // struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); + export function DirectionalChannelInfo_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_get_htlc_minimum_msat(this_ptr); + const nativeResponseValue = wasm.DirectionalChannelInfo_write(obj); + return decodeArray(nativeResponseValue); + } + // struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser); + export function DirectionalChannelInfo_read(ser: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DirectionalChannelInfo_read(encodeArray(ser)); return nativeResponseValue; } - // void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - export function RouteHintHop_set_htlc_minimum_msat(this_ptr: number, val: number): void { + // void ChannelInfo_free(struct LDKChannelInfo this_obj); + export function ChannelInfo_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_set_htlc_minimum_msat(this_ptr, val); + const nativeResponseValue = wasm.ChannelInfo_free(this_obj); // debug statements here } - // struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); - export function RouteHintHop_get_htlc_maximum_msat(this_ptr: number): number { + // struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + export function ChannelInfo_get_features(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_get_htlc_maximum_msat(this_ptr); + const nativeResponseValue = wasm.ChannelInfo_get_features(this_ptr); return nativeResponseValue; } - // void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - export function RouteHintHop_set_htlc_maximum_msat(this_ptr: number, val: number): void { + // void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); + export function ChannelInfo_set_features(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_set_htlc_maximum_msat(this_ptr, val); + const nativeResponseValue = wasm.ChannelInfo_set_features(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); - export function RouteHintHop_new(src_node_id_arg: Uint8Array, short_channel_id_arg: number, fees_arg: number, cltv_expiry_delta_arg: number, htlc_minimum_msat_arg: number, htlc_maximum_msat_arg: number): number { + // struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + export function ChannelInfo_get_node_one(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_new(encodeArray(src_node_id_arg), short_channel_id_arg, fees_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg); + const nativeResponseValue = wasm.ChannelInfo_get_node_one(this_ptr); return nativeResponseValue; } - // struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); - export function RouteHintHop_clone(orig: number): number { + // void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); + export function ChannelInfo_set_node_one(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_clone(orig); - return nativeResponseValue; + const nativeResponseValue = wasm.ChannelInfo_set_node_one(this_ptr, val); + // debug statements here } - // uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); - export function RouteHintHop_hash(o: number): number { + // struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + export function ChannelInfo_get_one_to_two(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_hash(o); + const nativeResponseValue = wasm.ChannelInfo_get_one_to_two(this_ptr); return nativeResponseValue; } - // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); - export function RouteHintHop_eq(a: number, b: number): boolean { + // void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); + export function ChannelInfo_set_one_to_two(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RouteHintHop_eq(a, b); - return nativeResponseValue; + const nativeResponseValue = wasm.ChannelInfo_set_one_to_two(this_ptr, val); + // debug statements here } - // struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); - export function get_keysend_route(our_node_id: Uint8Array, network: number, payee: Uint8Array, first_hops: number[], last_hops: number[], final_value_msat: number, final_cltv: number, logger: number): number { + // struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + export function ChannelInfo_get_node_two(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.get_keysend_route(encodeArray(our_node_id), network, encodeArray(payee), first_hops, last_hops, final_value_msat, final_cltv, logger); + const nativeResponseValue = wasm.ChannelInfo_get_node_two(this_ptr); return nativeResponseValue; } - // struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger); - export function get_route(our_node_id: Uint8Array, network: number, payee: Uint8Array, payee_features: number, first_hops: number[], last_hops: number[], final_value_msat: number, final_cltv: number, logger: number): number { + // void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); + export function ChannelInfo_set_node_two(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.get_route(encodeArray(our_node_id), network, encodeArray(payee), payee_features, first_hops, last_hops, final_value_msat, final_cltv, logger); - return nativeResponseValue; + const nativeResponseValue = wasm.ChannelInfo_set_node_two(this_ptr, val); + // debug statements here } - // void NetworkGraph_free(struct LDKNetworkGraph this_obj); - export function NetworkGraph_free(this_obj: number): void { + // struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + export function ChannelInfo_get_two_to_one(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_free(this_obj); - // debug statements here + const nativeResponseValue = wasm.ChannelInfo_get_two_to_one(this_ptr); + return nativeResponseValue; } - // struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); - export function NetworkGraph_clone(orig: number): number { + // void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); + export function ChannelInfo_set_two_to_one(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_clone(orig); - return nativeResponseValue; + const nativeResponseValue = wasm.ChannelInfo_set_two_to_one(this_ptr, val); + // debug statements here } - // void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); - export function ReadOnlyNetworkGraph_free(this_obj: number): void { + // struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + export function ChannelInfo_get_capacity_sats(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ReadOnlyNetworkGraph_free(this_obj); - // debug statements here + const nativeResponseValue = wasm.ChannelInfo_get_capacity_sats(this_ptr); + return nativeResponseValue; } - // void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); - export function NetworkUpdate_free(this_ptr: number): void { + // void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + export function ChannelInfo_set_capacity_sats(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkUpdate_free(this_ptr); + const nativeResponseValue = wasm.ChannelInfo_set_capacity_sats(this_ptr, val); // debug statements here } - // struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); - export function NetworkUpdate_clone(orig: number): number { + // struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); + export function ChannelInfo_get_announcement_message(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkUpdate_clone(orig); + const nativeResponseValue = wasm.ChannelInfo_get_announcement_message(this_ptr); return nativeResponseValue; } - // struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg); - export function NetworkUpdate_channel_update_message(msg: number): number { + // void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); + export function ChannelInfo_set_announcement_message(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkUpdate_channel_update_message(msg); - return nativeResponseValue; + const nativeResponseValue = wasm.ChannelInfo_set_announcement_message(this_ptr, val); + // debug statements here } - // struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent); - export function NetworkUpdate_channel_closed(short_channel_id: number, is_permanent: boolean): number { + // MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); + export function ChannelInfo_new(features_arg: number, node_one_arg: number, one_to_two_arg: number, node_two_arg: number, two_to_one_arg: number, capacity_sats_arg: number, announcement_message_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkUpdate_channel_closed(short_channel_id, is_permanent); + const nativeResponseValue = wasm.ChannelInfo_new(features_arg, node_one_arg, one_to_two_arg, node_two_arg, two_to_one_arg, capacity_sats_arg, announcement_message_arg); return nativeResponseValue; } - // struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); - export function NetworkUpdate_node_failure(node_id: Uint8Array, is_permanent: boolean): number { + // struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); + export function ChannelInfo_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkUpdate_node_failure(encodeArray(node_id), is_permanent); + const nativeResponseValue = wasm.ChannelInfo_clone(orig); return nativeResponseValue; } - // struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); - export function NetworkUpdate_write(obj: number): Uint8Array { + // struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); + export function ChannelInfo_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkUpdate_write(obj); + const nativeResponseValue = wasm.ChannelInfo_write(obj); return decodeArray(nativeResponseValue); } - // struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); - export function NetGraphMsgHandler_as_EventHandler(this_arg: number): number { + // struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); + export function ChannelInfo_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_as_EventHandler(this_arg); + const nativeResponseValue = wasm.ChannelInfo_read(encodeArray(ser)); return nativeResponseValue; } - // void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj); - export function NetGraphMsgHandler_free(this_obj: number): void { + // void RoutingFees_free(struct LDKRoutingFees this_obj); + export function RoutingFees_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_free(this_obj); + const nativeResponseValue = wasm.RoutingFees_free(this_obj); // debug statements here } - // struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr); - export function NetGraphMsgHandler_get_network_graph(this_ptr: number): number { + // uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); + export function RoutingFees_get_base_msat(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_get_network_graph(this_ptr); + const nativeResponseValue = wasm.RoutingFees_get_base_msat(this_ptr); return nativeResponseValue; } - // void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val); - export function NetGraphMsgHandler_set_network_graph(this_ptr: number, val: number): void { + // void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); + export function RoutingFees_set_base_msat(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_set_network_graph(this_ptr, val); + const nativeResponseValue = wasm.RoutingFees_set_base_msat(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); - export function NetGraphMsgHandler_new(network_graph: number, chain_access: number, logger: number): number { + // uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); + export function RoutingFees_get_proportional_millionths(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_new(network_graph, chain_access, logger); + const nativeResponseValue = wasm.RoutingFees_get_proportional_millionths(this_ptr); return nativeResponseValue; } - // void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); - export function NetGraphMsgHandler_add_chain_access(this_arg: number, chain_access: number): void { + // void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); + export function RoutingFees_set_proportional_millionths(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_add_chain_access(this_arg, chain_access); + const nativeResponseValue = wasm.RoutingFees_set_proportional_millionths(this_ptr, val); // debug statements here } - // struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); - export function NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: number): number { + // MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); + export function RoutingFees_new(base_msat_arg: number, proportional_millionths_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_as_RoutingMessageHandler(this_arg); + const nativeResponseValue = wasm.RoutingFees_new(base_msat_arg, proportional_millionths_arg); return nativeResponseValue; } - // struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); - export function NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg: number): number { + // bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); + export function RoutingFees_eq(a: number, b: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetGraphMsgHandler_as_MessageSendEventsProvider(this_arg); + const nativeResponseValue = wasm.RoutingFees_eq(a, b); return nativeResponseValue; } - // void DirectionalChannelInfo_free(struct LDKDirectionalChannelInfo this_obj); - export function DirectionalChannelInfo_free(this_obj: number): void { + // struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); + export function RoutingFees_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_free(this_obj); - // debug statements here + const nativeResponseValue = wasm.RoutingFees_clone(orig); + return nativeResponseValue; } - // uint32_t DirectionalChannelInfo_get_last_update(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - export function DirectionalChannelInfo_get_last_update(this_ptr: number): number { + // uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); + export function RoutingFees_hash(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_get_last_update(this_ptr); + const nativeResponseValue = wasm.RoutingFees_hash(o); return nativeResponseValue; } - // void DirectionalChannelInfo_set_last_update(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint32_t val); - export function DirectionalChannelInfo_set_last_update(this_ptr: number, val: number): void { + // struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); + export function RoutingFees_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_set_last_update(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.RoutingFees_write(obj); + return decodeArray(nativeResponseValue); } - // bool DirectionalChannelInfo_get_enabled(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - export function DirectionalChannelInfo_get_enabled(this_ptr: number): boolean { + // struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); + export function RoutingFees_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_get_enabled(this_ptr); + const nativeResponseValue = wasm.RoutingFees_read(encodeArray(ser)); return nativeResponseValue; } - // void DirectionalChannelInfo_set_enabled(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, bool val); - export function DirectionalChannelInfo_set_enabled(this_ptr: number, val: boolean): void { + // void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj); + export function NodeAnnouncementInfo_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_set_enabled(this_ptr, val); + const nativeResponseValue = wasm.NodeAnnouncementInfo_free(this_obj); // debug statements here } - // uint16_t DirectionalChannelInfo_get_cltv_expiry_delta(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - export function DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr: number): number { + // struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); + export function NodeAnnouncementInfo_get_features(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr); + const nativeResponseValue = wasm.NodeAnnouncementInfo_get_features(this_ptr); return nativeResponseValue; } - // void DirectionalChannelInfo_set_cltv_expiry_delta(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint16_t val); - export function DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr: number, val: number): void { + // void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); + export function NodeAnnouncementInfo_set_features(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr, val); + const nativeResponseValue = wasm.NodeAnnouncementInfo_set_features(this_ptr, val); // debug statements here } - // uint64_t DirectionalChannelInfo_get_htlc_minimum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - export function DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr: number): number { + // uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); + export function NodeAnnouncementInfo_get_last_update(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr); + const nativeResponseValue = wasm.NodeAnnouncementInfo_get_last_update(this_ptr); return nativeResponseValue; } - // void DirectionalChannelInfo_set_htlc_minimum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, uint64_t val); - export function DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr: number, val: number): void { + // void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); + export function NodeAnnouncementInfo_set_last_update(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr, val); + const nativeResponseValue = wasm.NodeAnnouncementInfo_set_last_update(this_ptr, val); // debug statements here } - // struct LDKCOption_u64Z DirectionalChannelInfo_get_htlc_maximum_msat(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - export function DirectionalChannelInfo_get_htlc_maximum_msat(this_ptr: number): number { + // const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; + export function NodeAnnouncementInfo_get_rgb(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_get_htlc_maximum_msat(this_ptr); - return nativeResponseValue; + const nativeResponseValue = wasm.NodeAnnouncementInfo_get_rgb(this_ptr); + return decodeArray(nativeResponseValue); } - // void DirectionalChannelInfo_set_htlc_maximum_msat(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - export function DirectionalChannelInfo_set_htlc_maximum_msat(this_ptr: number, val: number): void { + // void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); + export function NodeAnnouncementInfo_set_rgb(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_set_htlc_maximum_msat(this_ptr, val); + const nativeResponseValue = wasm.NodeAnnouncementInfo_set_rgb(this_ptr, encodeArray(val)); // debug statements here } - // struct LDKRoutingFees DirectionalChannelInfo_get_fees(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - export function DirectionalChannelInfo_get_fees(this_ptr: number): number { + // const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; + export function NodeAnnouncementInfo_get_alias(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_get_fees(this_ptr); - return nativeResponseValue; + const nativeResponseValue = wasm.NodeAnnouncementInfo_get_alias(this_ptr); + return decodeArray(nativeResponseValue); } - // void DirectionalChannelInfo_set_fees(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - export function DirectionalChannelInfo_set_fees(this_ptr: number, val: number): void { + // void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + export function NodeAnnouncementInfo_set_alias(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_set_fees(this_ptr, val); + const nativeResponseValue = wasm.NodeAnnouncementInfo_set_alias(this_ptr, encodeArray(val)); // debug statements here } - // struct LDKChannelUpdate DirectionalChannelInfo_get_last_update_message(const struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr); - export function DirectionalChannelInfo_get_last_update_message(this_ptr: number): number { + // void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); + export function NodeAnnouncementInfo_set_addresses(this_ptr: number, val: number[]): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_get_last_update_message(this_ptr); + const nativeResponseValue = wasm.NodeAnnouncementInfo_set_addresses(this_ptr, val); + // debug statements here + } + // struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); + export function NodeAnnouncementInfo_get_announcement_message(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.NodeAnnouncementInfo_get_announcement_message(this_ptr); return nativeResponseValue; } - // void DirectionalChannelInfo_set_last_update_message(struct LDKDirectionalChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); - export function DirectionalChannelInfo_set_last_update_message(this_ptr: number, val: number): void { + // void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); + export function NodeAnnouncementInfo_set_announcement_message(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_set_last_update_message(this_ptr, val); + const nativeResponseValue = wasm.NodeAnnouncementInfo_set_announcement_message(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKDirectionalChannelInfo DirectionalChannelInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); - export function DirectionalChannelInfo_new(last_update_arg: number, enabled_arg: boolean, cltv_expiry_delta_arg: number, htlc_minimum_msat_arg: number, htlc_maximum_msat_arg: number, fees_arg: number, last_update_message_arg: number): number { + // MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); + export function NodeAnnouncementInfo_new(features_arg: number, last_update_arg: number, rgb_arg: Uint8Array, alias_arg: Uint8Array, addresses_arg: number[], announcement_message_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg, last_update_message_arg); + const nativeResponseValue = wasm.NodeAnnouncementInfo_new(features_arg, last_update_arg, encodeArray(rgb_arg), encodeArray(alias_arg), addresses_arg, announcement_message_arg); return nativeResponseValue; } - // struct LDKDirectionalChannelInfo DirectionalChannelInfo_clone(const struct LDKDirectionalChannelInfo *NONNULL_PTR orig); - export function DirectionalChannelInfo_clone(orig: number): number { + // struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); + export function NodeAnnouncementInfo_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_clone(orig); + const nativeResponseValue = wasm.NodeAnnouncementInfo_clone(orig); return nativeResponseValue; } - // struct LDKCVec_u8Z DirectionalChannelInfo_write(const struct LDKDirectionalChannelInfo *NONNULL_PTR obj); - export function DirectionalChannelInfo_write(obj: number): Uint8Array { + // struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); + export function NodeAnnouncementInfo_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_write(obj); + const nativeResponseValue = wasm.NodeAnnouncementInfo_write(obj); return decodeArray(nativeResponseValue); } - // struct LDKCResult_DirectionalChannelInfoDecodeErrorZ DirectionalChannelInfo_read(struct LDKu8slice ser); - export function DirectionalChannelInfo_read(ser: Uint8Array): number { + // struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); + export function NodeAnnouncementInfo_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.DirectionalChannelInfo_read(encodeArray(ser)); + const nativeResponseValue = wasm.NodeAnnouncementInfo_read(encodeArray(ser)); return nativeResponseValue; } - // void ChannelInfo_free(struct LDKChannelInfo this_obj); - export function ChannelInfo_free(this_obj: number): void { + // void NodeInfo_free(struct LDKNodeInfo this_obj); + export function NodeInfo_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_free(this_obj); + const nativeResponseValue = wasm.NodeInfo_free(this_obj); // debug statements here } - // struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - export function ChannelInfo_get_features(this_ptr: number): number { + // void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); + export function NodeInfo_set_channels(this_ptr: number, val: number[]): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_get_features(this_ptr); + const nativeResponseValue = wasm.NodeInfo_set_channels(this_ptr, val); + // debug statements here + } + // struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); + export function NodeInfo_get_lowest_inbound_channel_fees(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.NodeInfo_get_lowest_inbound_channel_fees(this_ptr); return nativeResponseValue; } - // void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); - export function ChannelInfo_set_features(this_ptr: number, val: number): void { + // void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); + export function NodeInfo_set_lowest_inbound_channel_fees(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_set_features(this_ptr, val); + const nativeResponseValue = wasm.NodeInfo_set_lowest_inbound_channel_fees(this_ptr, val); // debug statements here } - // struct LDKPublicKey ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - export function ChannelInfo_get_node_one(this_ptr: number): Uint8Array { + // struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); + export function NodeInfo_get_announcement_info(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_get_node_one(this_ptr); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.NodeInfo_get_announcement_info(this_ptr); + return nativeResponseValue; } - // void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); - export function ChannelInfo_set_node_one(this_ptr: number, val: Uint8Array): void { + // void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); + export function NodeInfo_set_announcement_info(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_set_node_one(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.NodeInfo_set_announcement_info(this_ptr, val); // debug statements here } - // struct LDKDirectionalChannelInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - export function ChannelInfo_get_one_to_two(this_ptr: number): number { + // MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); + export function NodeInfo_new(channels_arg: number[], lowest_inbound_channel_fees_arg: number, announcement_info_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_get_one_to_two(this_ptr); + const nativeResponseValue = wasm.NodeInfo_new(channels_arg, lowest_inbound_channel_fees_arg, announcement_info_arg); return nativeResponseValue; } - // void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); - export function ChannelInfo_set_one_to_two(this_ptr: number, val: number): void { + // struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); + export function NodeInfo_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_set_one_to_two(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.NodeInfo_clone(orig); + return nativeResponseValue; } - // struct LDKPublicKey ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - export function ChannelInfo_get_node_two(this_ptr: number): Uint8Array { + // struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); + export function NodeInfo_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_get_node_two(this_ptr); + const nativeResponseValue = wasm.NodeInfo_write(obj); return decodeArray(nativeResponseValue); } - // void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKPublicKey val); - export function ChannelInfo_set_node_two(this_ptr: number, val: Uint8Array): void { + // struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); + export function NodeInfo_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_set_node_two(this_ptr, encodeArray(val)); - // debug statements here + const nativeResponseValue = wasm.NodeInfo_read(encodeArray(ser)); + return nativeResponseValue; } - // struct LDKDirectionalChannelInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - export function ChannelInfo_get_two_to_one(this_ptr: number): number { + // struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); + export function NetworkGraph_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_get_two_to_one(this_ptr); + const nativeResponseValue = wasm.NetworkGraph_write(obj); + return decodeArray(nativeResponseValue); + } + // struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); + export function NetworkGraph_read(ser: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.NetworkGraph_read(encodeArray(ser)); return nativeResponseValue; } - // void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKDirectionalChannelInfo val); - export function ChannelInfo_set_two_to_one(this_ptr: number, val: number): void { + // MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash); + export function NetworkGraph_new(genesis_hash: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_set_two_to_one(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.NetworkGraph_new(encodeArray(genesis_hash)); + return nativeResponseValue; } - // struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - export function ChannelInfo_get_capacity_sats(this_ptr: number): number { + // MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); + export function NetworkGraph_read_only(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_get_capacity_sats(this_ptr); + const nativeResponseValue = wasm.NetworkGraph_read_only(this_arg); return nativeResponseValue; } - // void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); - export function ChannelInfo_set_capacity_sats(this_ptr: number, val: number): void { + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); + export function NetworkGraph_update_node_from_announcement(this_arg: number, msg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_set_capacity_sats(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.NetworkGraph_update_node_from_announcement(this_arg, msg); + return nativeResponseValue; } - // struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); - export function ChannelInfo_get_announcement_message(this_ptr: number): number { + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); + export function NetworkGraph_update_node_from_unsigned_announcement(this_arg: number, msg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_get_announcement_message(this_ptr); + const nativeResponseValue = wasm.NetworkGraph_update_node_from_unsigned_announcement(this_arg, msg); return nativeResponseValue; } - // void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); - export function ChannelInfo_set_announcement_message(this_ptr: number, val: number): void { + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); + export function NetworkGraph_update_channel_from_announcement(this_arg: number, msg: number, chain_access: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_set_announcement_message(this_ptr, val); + const nativeResponseValue = wasm.NetworkGraph_update_channel_from_announcement(this_arg, msg, chain_access); + return nativeResponseValue; + } + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); + export function NetworkGraph_update_channel_from_unsigned_announcement(this_arg: number, msg: number, chain_access: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.NetworkGraph_update_channel_from_unsigned_announcement(this_arg, msg, chain_access); + return nativeResponseValue; + } + // void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); + export function NetworkGraph_close_channel_from_update(this_arg: number, short_channel_id: number, is_permanent: boolean): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.NetworkGraph_close_channel_from_update(this_arg, short_channel_id, is_permanent); + // debug statements here + } + // void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); + export function NetworkGraph_fail_node(this_arg: number, _node_id: Uint8Array, is_permanent: boolean): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.NetworkGraph_fail_node(this_arg, encodeArray(_node_id), is_permanent); // debug statements here } - // MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKPublicKey node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKPublicKey node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); - export function ChannelInfo_new(features_arg: number, node_one_arg: Uint8Array, one_to_two_arg: number, node_two_arg: Uint8Array, two_to_one_arg: number, capacity_sats_arg: number, announcement_message_arg: number): number { + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); + export function NetworkGraph_update_channel(this_arg: number, msg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_new(features_arg, encodeArray(node_one_arg), one_to_two_arg, encodeArray(node_two_arg), two_to_one_arg, capacity_sats_arg, announcement_message_arg); + const nativeResponseValue = wasm.NetworkGraph_update_channel(this_arg, msg); return nativeResponseValue; } - // struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); - export function ChannelInfo_clone(orig: number): number { + // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); + export function NetworkGraph_update_channel_unsigned(this_arg: number, msg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_clone(orig); + const nativeResponseValue = wasm.NetworkGraph_update_channel_unsigned(this_arg, msg); return nativeResponseValue; } - // struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); - export function ChannelInfo_write(obj: number): Uint8Array { + // MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); + export function ReadOnlyNetworkGraph_get_addresses(this_arg: number, pubkey: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_write(obj); + const nativeResponseValue = wasm.ReadOnlyNetworkGraph_get_addresses(this_arg, encodeArray(pubkey)); + return nativeResponseValue; + } + // void RouteHop_free(struct LDKRouteHop this_obj); + export function RouteHop_free(this_obj: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.RouteHop_free(this_obj); + // debug statements here + } + // struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); + export function RouteHop_get_pubkey(this_ptr: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.RouteHop_get_pubkey(this_ptr); return decodeArray(nativeResponseValue); } - // struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); - export function ChannelInfo_read(ser: Uint8Array): number { + // void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); + export function RouteHop_set_pubkey(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelInfo_read(encodeArray(ser)); + const nativeResponseValue = wasm.RouteHop_set_pubkey(this_ptr, encodeArray(val)); + // debug statements here + } + // struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); + export function RouteHop_get_node_features(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.RouteHop_get_node_features(this_ptr); return nativeResponseValue; } - // void RoutingFees_free(struct LDKRoutingFees this_obj); - export function RoutingFees_free(this_obj: number): void { + // void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); + export function RouteHop_set_node_features(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_free(this_obj); + const nativeResponseValue = wasm.RouteHop_set_node_features(this_ptr, val); // debug statements here } - // uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); - export function RoutingFees_get_base_msat(this_ptr: number): number { + // uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); + export function RouteHop_get_short_channel_id(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_get_base_msat(this_ptr); + const nativeResponseValue = wasm.RouteHop_get_short_channel_id(this_ptr); return nativeResponseValue; } - // void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); - export function RoutingFees_set_base_msat(this_ptr: number, val: number): void { + // void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); + export function RouteHop_set_short_channel_id(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_set_base_msat(this_ptr, val); + const nativeResponseValue = wasm.RouteHop_set_short_channel_id(this_ptr, val); // debug statements here } - // uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); - export function RoutingFees_get_proportional_millionths(this_ptr: number): number { + // struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); + export function RouteHop_get_channel_features(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_get_proportional_millionths(this_ptr); + const nativeResponseValue = wasm.RouteHop_get_channel_features(this_ptr); return nativeResponseValue; } - // void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); - export function RoutingFees_set_proportional_millionths(this_ptr: number, val: number): void { + // void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); + export function RouteHop_set_channel_features(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_set_proportional_millionths(this_ptr, val); + const nativeResponseValue = wasm.RouteHop_set_channel_features(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); - export function RoutingFees_new(base_msat_arg: number, proportional_millionths_arg: number): number { + // uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); + export function RouteHop_get_fee_msat(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_new(base_msat_arg, proportional_millionths_arg); + const nativeResponseValue = wasm.RouteHop_get_fee_msat(this_ptr); return nativeResponseValue; } - // bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); - export function RoutingFees_eq(a: number, b: number): boolean { + // void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); + export function RouteHop_set_fee_msat(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_eq(a, b); + const nativeResponseValue = wasm.RouteHop_set_fee_msat(this_ptr, val); + // debug statements here + } + // uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); + export function RouteHop_get_cltv_expiry_delta(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.RouteHop_get_cltv_expiry_delta(this_ptr); return nativeResponseValue; } - // struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); - export function RoutingFees_clone(orig: number): number { + // void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); + export function RouteHop_set_cltv_expiry_delta(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_clone(orig); + const nativeResponseValue = wasm.RouteHop_set_cltv_expiry_delta(this_ptr, val); + // debug statements here + } + // MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); + export function RouteHop_new(pubkey_arg: Uint8Array, node_features_arg: number, short_channel_id_arg: number, channel_features_arg: number, fee_msat_arg: number, cltv_expiry_delta_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.RouteHop_new(encodeArray(pubkey_arg), node_features_arg, short_channel_id_arg, channel_features_arg, fee_msat_arg, cltv_expiry_delta_arg); return nativeResponseValue; } - // uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); - export function RoutingFees_hash(o: number): number { + // struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); + export function RouteHop_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.RouteHop_clone(orig); + return nativeResponseValue; + } + // uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); + export function RouteHop_hash(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.RouteHop_hash(o); + return nativeResponseValue; + } + // bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); + export function RouteHop_eq(a: number, b: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_hash(o); + const nativeResponseValue = wasm.RouteHop_eq(a, b); return nativeResponseValue; } - // struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); - export function RoutingFees_write(obj: number): Uint8Array { + // struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); + export function RouteHop_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_write(obj); + const nativeResponseValue = wasm.RouteHop_write(obj); return decodeArray(nativeResponseValue); } - // struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); - export function RoutingFees_read(ser: Uint8Array): number { + // struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); + export function RouteHop_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.RoutingFees_read(encodeArray(ser)); + const nativeResponseValue = wasm.RouteHop_read(encodeArray(ser)); return nativeResponseValue; } - // void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_obj); - export function NodeAnnouncementInfo_free(this_obj: number): void { + // void Route_free(struct LDKRoute this_obj); + export function Route_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_free(this_obj); + const nativeResponseValue = wasm.Route_free(this_obj); // debug statements here } - // struct LDKNodeFeatures NodeAnnouncementInfo_get_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); - export function NodeAnnouncementInfo_get_features(this_ptr: number): number { + // struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); + export function Route_get_paths(this_ptr: number): number[][] { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_get_features(this_ptr); + const nativeResponseValue = wasm.Route_get_paths(this_ptr); return nativeResponseValue; } - // void NodeAnnouncementInfo_set_features(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); - export function NodeAnnouncementInfo_set_features(this_ptr: number, val: number): void { + // void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); + export function Route_set_paths(this_ptr: number, val: number[][]): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_set_features(this_ptr, val); + const nativeResponseValue = wasm.Route_set_paths(this_ptr, val); // debug statements here } - // uint32_t NodeAnnouncementInfo_get_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); - export function NodeAnnouncementInfo_get_last_update(this_ptr: number): number { + // MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg); + export function Route_new(paths_arg: number[][]): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_get_last_update(this_ptr); + const nativeResponseValue = wasm.Route_new(paths_arg); return nativeResponseValue; } - // void NodeAnnouncementInfo_set_last_update(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, uint32_t val); - export function NodeAnnouncementInfo_set_last_update(this_ptr: number, val: number): void { + // struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); + export function Route_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_set_last_update(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.Route_clone(orig); + return nativeResponseValue; } - // const uint8_t (*NodeAnnouncementInfo_get_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[3]; - export function NodeAnnouncementInfo_get_rgb(this_ptr: number): Uint8Array { + // uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); + export function Route_hash(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_get_rgb(this_ptr); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.Route_hash(o); + return nativeResponseValue; } - // void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThreeBytes val); - export function NodeAnnouncementInfo_set_rgb(this_ptr: number, val: Uint8Array): void { + // bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); + export function Route_eq(a: number, b: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_set_rgb(this_ptr, encodeArray(val)); - // debug statements here + const nativeResponseValue = wasm.Route_eq(a, b); + return nativeResponseValue; } - // const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; - export function NodeAnnouncementInfo_get_alias(this_ptr: number): Uint8Array { + // MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); + export function Route_get_total_fees(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_get_alias(this_ptr); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.Route_get_total_fees(this_arg); + return nativeResponseValue; } - // void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - export function NodeAnnouncementInfo_set_alias(this_ptr: number, val: Uint8Array): void { + // MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); + export function Route_get_total_amount(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_set_alias(this_ptr, encodeArray(val)); - // debug statements here + const nativeResponseValue = wasm.Route_get_total_amount(this_arg); + return nativeResponseValue; } - // void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val); - export function NodeAnnouncementInfo_set_addresses(this_ptr: number, val: number[]): void { + // struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); + export function Route_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_set_addresses(this_ptr, val); - // debug statements here + const nativeResponseValue = wasm.Route_write(obj); + return decodeArray(nativeResponseValue); } - // struct LDKNodeAnnouncement NodeAnnouncementInfo_get_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); - export function NodeAnnouncementInfo_get_announcement_message(this_ptr: number): number { + // struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); + export function Route_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_get_announcement_message(this_ptr); + const nativeResponseValue = wasm.Route_read(encodeArray(ser)); return nativeResponseValue; } - // void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncement val); - export function NodeAnnouncementInfo_set_announcement_message(this_ptr: number, val: number): void { + // void RouteHint_free(struct LDKRouteHint this_obj); + export function RouteHint_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_set_announcement_message(this_ptr, val); + const nativeResponseValue = wasm.RouteHint_free(this_obj); // debug statements here } - // MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKThirtyTwoBytes alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); - export function NodeAnnouncementInfo_new(features_arg: number, last_update_arg: number, rgb_arg: Uint8Array, alias_arg: Uint8Array, addresses_arg: number[], announcement_message_arg: number): number { + // struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); + export function RouteHint_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_new(features_arg, last_update_arg, encodeArray(rgb_arg), encodeArray(alias_arg), addresses_arg, announcement_message_arg); + const nativeResponseValue = wasm.RouteHint_clone(orig); return nativeResponseValue; } - // struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); - export function NodeAnnouncementInfo_clone(orig: number): number { + // uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); + export function RouteHint_hash(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_clone(orig); + const nativeResponseValue = wasm.RouteHint_hash(o); return nativeResponseValue; } - // struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); - export function NodeAnnouncementInfo_write(obj: number): Uint8Array { + // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); + export function RouteHint_eq(a: number, b: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_write(obj); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.RouteHint_eq(a, b); + return nativeResponseValue; } - // struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); - export function NodeAnnouncementInfo_read(ser: Uint8Array): number { + // void RouteHintHop_free(struct LDKRouteHintHop this_obj); + export function RouteHintHop_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeAnnouncementInfo_read(encodeArray(ser)); - return nativeResponseValue; + const nativeResponseValue = wasm.RouteHintHop_free(this_obj); + // debug statements here } - // void NodeInfo_free(struct LDKNodeInfo this_obj); - export function NodeInfo_free(this_obj: number): void { + // struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + export function RouteHintHop_get_src_node_id(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_free(this_obj); - // debug statements here + const nativeResponseValue = wasm.RouteHintHop_get_src_node_id(this_ptr); + return decodeArray(nativeResponseValue); } - // void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); - export function NodeInfo_set_channels(this_ptr: number, val: number[]): void { + // void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); + export function RouteHintHop_set_src_node_id(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_set_channels(this_ptr, val); + const nativeResponseValue = wasm.RouteHintHop_set_src_node_id(this_ptr, encodeArray(val)); // debug statements here } - // struct LDKRoutingFees NodeInfo_get_lowest_inbound_channel_fees(const struct LDKNodeInfo *NONNULL_PTR this_ptr); - export function NodeInfo_get_lowest_inbound_channel_fees(this_ptr: number): number { + // uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + export function RouteHintHop_get_short_channel_id(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_get_lowest_inbound_channel_fees(this_ptr); + const nativeResponseValue = wasm.RouteHintHop_get_short_channel_id(this_ptr); return nativeResponseValue; } - // void NodeInfo_set_lowest_inbound_channel_fees(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); - export function NodeInfo_set_lowest_inbound_channel_fees(this_ptr: number, val: number): void { + // void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); + export function RouteHintHop_set_short_channel_id(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_set_lowest_inbound_channel_fees(this_ptr, val); + const nativeResponseValue = wasm.RouteHintHop_set_short_channel_id(this_ptr, val); // debug statements here } - // struct LDKNodeAnnouncementInfo NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); - export function NodeInfo_get_announcement_info(this_ptr: number): number { + // struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + export function RouteHintHop_get_fees(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_get_announcement_info(this_ptr); + const nativeResponseValue = wasm.RouteHintHop_get_fees(this_ptr); return nativeResponseValue; } - // void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKNodeAnnouncementInfo val); - export function NodeInfo_set_announcement_info(this_ptr: number, val: number): void { + // void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); + export function RouteHintHop_set_fees(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_set_announcement_info(this_ptr, val); + const nativeResponseValue = wasm.RouteHintHop_set_fees(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKNodeInfo NodeInfo_new(struct LDKCVec_u64Z channels_arg, struct LDKRoutingFees lowest_inbound_channel_fees_arg, struct LDKNodeAnnouncementInfo announcement_info_arg); - export function NodeInfo_new(channels_arg: number[], lowest_inbound_channel_fees_arg: number, announcement_info_arg: number): number { + // uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + export function RouteHintHop_get_cltv_expiry_delta(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_new(channels_arg, lowest_inbound_channel_fees_arg, announcement_info_arg); + const nativeResponseValue = wasm.RouteHintHop_get_cltv_expiry_delta(this_ptr); return nativeResponseValue; } - // struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); - export function NodeInfo_clone(orig: number): number { + // void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); + export function RouteHintHop_set_cltv_expiry_delta(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_clone(orig); - return nativeResponseValue; + const nativeResponseValue = wasm.RouteHintHop_set_cltv_expiry_delta(this_ptr, val); + // debug statements here } - // struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); - export function NodeInfo_write(obj: number): Uint8Array { + // struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + export function RouteHintHop_get_htlc_minimum_msat(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_write(obj); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.RouteHintHop_get_htlc_minimum_msat(this_ptr); + return nativeResponseValue; } - // struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); - export function NodeInfo_read(ser: Uint8Array): number { + // void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + export function RouteHintHop_set_htlc_minimum_msat(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeInfo_read(encodeArray(ser)); - return nativeResponseValue; + const nativeResponseValue = wasm.RouteHintHop_set_htlc_minimum_msat(this_ptr, val); + // debug statements here } - // struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); - export function NetworkGraph_write(obj: number): Uint8Array { + // struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); + export function RouteHintHop_get_htlc_maximum_msat(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_write(obj); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.RouteHintHop_get_htlc_maximum_msat(this_ptr); + return nativeResponseValue; } - // struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); - export function NetworkGraph_read(ser: Uint8Array): number { + // void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + export function RouteHintHop_set_htlc_maximum_msat(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_read(encodeArray(ser)); - return nativeResponseValue; + const nativeResponseValue = wasm.RouteHintHop_set_htlc_maximum_msat(this_ptr, val); + // debug statements here } - // MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash); - export function NetworkGraph_new(genesis_hash: Uint8Array): number { + // MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); + export function RouteHintHop_new(src_node_id_arg: Uint8Array, short_channel_id_arg: number, fees_arg: number, cltv_expiry_delta_arg: number, htlc_minimum_msat_arg: number, htlc_maximum_msat_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_new(encodeArray(genesis_hash)); + const nativeResponseValue = wasm.RouteHintHop_new(encodeArray(src_node_id_arg), short_channel_id_arg, fees_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg); return nativeResponseValue; } - // MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); - export function NetworkGraph_read_only(this_arg: number): number { + // struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); + export function RouteHintHop_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_read_only(this_arg); + const nativeResponseValue = wasm.RouteHintHop_clone(orig); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); - export function NetworkGraph_update_node_from_announcement(this_arg: number, msg: number): number { + // uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); + export function RouteHintHop_hash(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_update_node_from_announcement(this_arg, msg); + const nativeResponseValue = wasm.RouteHintHop_hash(o); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); - export function NetworkGraph_update_node_from_unsigned_announcement(this_arg: number, msg: number): number { + // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); + export function RouteHintHop_eq(a: number, b: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_update_node_from_unsigned_announcement(this_arg, msg); + const nativeResponseValue = wasm.RouteHintHop_eq(a, b); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); - export function NetworkGraph_update_channel_from_announcement(this_arg: number, msg: number, chain_access: number): number { + // struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); + export function get_keysend_route(our_node_pubkey: Uint8Array, network: number, payee: Uint8Array, first_hops: number[], last_hops: number[], final_value_msat: number, final_cltv: number, logger: number, scorer: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_update_channel_from_announcement(this_arg, msg, chain_access); + const nativeResponseValue = wasm.get_keysend_route(encodeArray(our_node_pubkey), network, encodeArray(payee), first_hops, last_hops, final_value_msat, final_cltv, logger, scorer); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); - export function NetworkGraph_update_channel_from_unsigned_announcement(this_arg: number, msg: number, chain_access: number): number { + // struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_pubkey, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); + export function get_route(our_node_pubkey: Uint8Array, network: number, payee: Uint8Array, payee_features: number, first_hops: number[], last_hops: number[], final_value_msat: number, final_cltv: number, logger: number, scorer: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_update_channel_from_unsigned_announcement(this_arg, msg, chain_access); + const nativeResponseValue = wasm.get_route(encodeArray(our_node_pubkey), network, encodeArray(payee), payee_features, first_hops, last_hops, final_value_msat, final_cltv, logger, scorer); return nativeResponseValue; } - // void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); - export function NetworkGraph_close_channel_from_update(this_arg: number, short_channel_id: number, is_permanent: boolean): void { + // void Scorer_free(struct LDKScorer this_obj); + export function Scorer_free(this_obj: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_close_channel_from_update(this_arg, short_channel_id, is_permanent); + const nativeResponseValue = wasm.Scorer_free(this_obj); // debug statements here } - // void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); - export function NetworkGraph_fail_node(this_arg: number, _node_id: Uint8Array, is_permanent: boolean): void { + // MUST_USE_RES struct LDKScorer Scorer_new(uint64_t base_penalty_msat); + export function Scorer_new(base_penalty_msat: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_fail_node(this_arg, encodeArray(_node_id), is_permanent); - // debug statements here + const nativeResponseValue = wasm.Scorer_new(base_penalty_msat); + return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); - export function NetworkGraph_update_channel(this_arg: number, msg: number): number { + // MUST_USE_RES struct LDKScorer Scorer_default(void); + export function Scorer_default(): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_update_channel(this_arg, msg); + const nativeResponseValue = wasm.Scorer_default(); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); - export function NetworkGraph_update_channel_unsigned(this_arg: number, msg: number): number { + // struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg); + export function Scorer_as_Score(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetworkGraph_update_channel_unsigned(this_arg, msg); + const nativeResponseValue = wasm.Scorer_as_Score(this_arg); return nativeResponseValue; } // void FilesystemPersister_free(struct LDKFilesystemPersister this_obj); diff --git a/ts/structs/ChainMonitor.ts b/ts/structs/ChainMonitor.ts index 8e2ff344..902ef268 100644 --- a/ts/structs/ChainMonitor.ts +++ b/ts/structs/ChainMonitor.ts @@ -41,6 +41,24 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_conv_9_arr; } + public Result_LockedChannelMonitorNoneZ get_monitor(OutPoint funding_txo) { + number ret = bindings.ChainMonitor_get_monitor(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1); + Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public OutPoint[] list_monitors() { + number[] ret = bindings.ChainMonitor_list_monitors(this.ptr); + OutPoint[] ret_conv_10_arr = new OutPoint[ret.length]; + for (int k = 0; k < ret.length; k++) { + number ret_conv_10 = ret[k]; + const ret_conv_10_hu_conv: OutPoint = new OutPoint(null, ret_conv_10); + ret_conv_10_hu_conv.ptrs_to.add(this); + ret_conv_10_arr[k] = ret_conv_10_hu_conv; + } + return ret_conv_10_arr; + } + public Listen as_Listen() { number ret = bindings.ChainMonitor_as_Listen(this.ptr); Listen ret_hu_conv = new Listen(null, ret); diff --git a/ts/structs/ChannelDetails.ts b/ts/structs/ChannelDetails.ts index 1e4e72e4..07ddf85d 100644 --- a/ts/structs/ChannelDetails.ts +++ b/ts/structs/ChannelDetails.ts @@ -80,13 +80,13 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr); } - public number get_user_id() { - number ret = bindings.ChannelDetails_get_user_id(this.ptr); + public number get_user_channel_id() { + number ret = bindings.ChannelDetails_get_user_channel_id(this.ptr); return ret; } - public void set_user_id(number val) { - bindings.ChannelDetails_set_user_id(this.ptr, val); + public void set_user_channel_id(number val) { + bindings.ChannelDetails_set_user_channel_id(this.ptr, val); } public number get_outbound_capacity_msat() { @@ -165,8 +165,8 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelDetails_set_is_public(this.ptr, val); } - public static ChannelDetails constructor_new(Uint8Array channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, number channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, number user_id_arg, number outbound_capacity_msat_arg, number 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) { - number ret = bindings.ChannelDetails_new(channel_id_arg, 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_id_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 constructor_new(Uint8Array channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, number channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, number user_channel_id_arg, number outbound_capacity_msat_arg, number 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) { + number ret = bindings.ChannelDetails_new(channel_id_arg, 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, 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); const ret_hu_conv: ChannelDetails = new ChannelDetails(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/ChannelInfo.ts b/ts/structs/ChannelInfo.ts index 75971baf..2ae6c0e9 100644 --- a/ts/structs/ChannelInfo.ts +++ b/ts/structs/ChannelInfo.ts @@ -29,13 +29,15 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); } - public Uint8Array get_node_one() { - Uint8Array ret = bindings.ChannelInfo_get_node_one(this.ptr); - return ret; + public NodeId get_node_one() { + number ret = bindings.ChannelInfo_get_node_one(this.ptr); + const ret_hu_conv: NodeId = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } - public void set_node_one(Uint8Array val) { - bindings.ChannelInfo_set_node_one(this.ptr, val); + public void set_node_one(NodeId val) { + bindings.ChannelInfo_set_node_one(this.ptr, val == null ? 0 : val.ptr & ~1); } public DirectionalChannelInfo get_one_to_two() { @@ -49,13 +51,15 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1); } - public Uint8Array get_node_two() { - Uint8Array ret = bindings.ChannelInfo_get_node_two(this.ptr); - return ret; + public NodeId get_node_two() { + number ret = bindings.ChannelInfo_get_node_two(this.ptr); + const ret_hu_conv: NodeId = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } - public void set_node_two(Uint8Array val) { - bindings.ChannelInfo_set_node_two(this.ptr, val); + public void set_node_two(NodeId val) { + bindings.ChannelInfo_set_node_two(this.ptr, val == null ? 0 : val.ptr & ~1); } public DirectionalChannelInfo get_two_to_one() { @@ -91,8 +95,8 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1); } - public static ChannelInfo constructor_new(ChannelFeatures features_arg, Uint8Array node_one_arg, DirectionalChannelInfo one_to_two_arg, Uint8Array node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) { - number ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); + public static ChannelInfo constructor_new(ChannelFeatures features_arg, NodeId node_one_arg, DirectionalChannelInfo one_to_two_arg, NodeId node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) { + number ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg == null ? 0 : node_one_arg.ptr & ~1, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg == null ? 0 : node_two_arg.ptr & ~1, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); const ret_hu_conv: ChannelInfo = new ChannelInfo(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/ChannelManager.ts b/ts/structs/ChannelManager.ts index d2ecf92b..17136a1e 100644 --- a/ts/structs/ChannelManager.ts +++ b/ts/structs/ChannelManager.ts @@ -37,9 +37,9 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } - public Result_NoneAPIErrorZ create_channel(Uint8Array their_network_key, number channel_value_satoshis, number push_msat, number user_id, UserConfig override_config) { - number ret = bindings.ChannelManager_create_channel(this.ptr, their_network_key, channel_value_satoshis, push_msat, user_id, override_config == null ? 0 : override_config.ptr & ~1); - Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); + public Result__u832APIErrorZ create_channel(Uint8Array their_network_key, number channel_value_satoshis, number push_msat, number user_channel_id, UserConfig override_config) { + number ret = bindings.ChannelManager_create_channel(this.ptr, their_network_key, channel_value_satoshis, push_msat, user_channel_id, override_config == null ? 0 : override_config.ptr & ~1); + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -89,16 +89,23 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelManager_force_close_all_channels(this.ptr); } - public Result_NonePaymentSendFailureZ send_payment(Route route, Uint8Array payment_hash, Uint8Array payment_secret) { + public Result_PaymentIdPaymentSendFailureZ send_payment(Route route, Uint8Array payment_hash, Uint8Array payment_secret) { number ret = bindings.ChannelManager_send_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_hash, payment_secret); + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + this.ptrs_to.add(route); + return ret_hu_conv; + } + + public Result_NonePaymentSendFailureZ retry_payment(Route route, PaymentId payment_id) { + number ret = bindings.ChannelManager_retry_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_id == null ? 0 : payment_id.ptr & ~1); Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); return ret_hu_conv; } - public Result_PaymentHashPaymentSendFailureZ send_spontaneous_payment(Route route, Uint8Array payment_preimage) { + public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_spontaneous_payment(Route route, Uint8Array payment_preimage) { number ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_preimage); - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); return ret_hu_conv; } diff --git a/ts/structs/Event.ts b/ts/structs/Event.ts index c8374a2b..bd9ddd4d 100644 --- a/ts/structs/Event.ts +++ b/ts/structs/Event.ts @@ -34,6 +34,9 @@ export default class Event extends CommonBase { if (raw_val instanceof bindings.LDKEvent.ChannelClosed) { return new ChannelClosed(this.ptr, raw_val); } + if (raw_val instanceof bindings.LDKEvent.DiscardFunding) { + return new DiscardFunding(this.ptr, raw_val); + } throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } @@ -67,9 +70,11 @@ export class PaymentReceived extends Event { } export class PaymentSent extends Event { public payment_preimage: Uint8Array; + public payment_hash: Uint8Array; private constructor(ptr: number, obj: bindings.LDKEvent.PaymentSent) { super(null, ptr); this.payment_preimage = obj.payment_preimage; + this.payment_hash = obj.payment_hash; } } export class PaymentPathFailed extends Event { @@ -78,6 +83,7 @@ export class PaymentPathFailed extends Event { public network_update: Option_NetworkUpdateZ; public all_paths_failed: boolean; public path: RouteHop[]; + public short_channel_id: Option_u64Z; private constructor(ptr: number, obj: bindings.LDKEvent.PaymentPathFailed) { super(null, ptr); this.payment_hash = obj.payment_hash; @@ -96,6 +102,10 @@ export class PaymentPathFailed extends Event { path_conv_10_arr[k] = path_conv_10_hu_conv; } this.path = path_conv_10_arr; + const short_channel_id: number = obj.short_channel_id; + Option_u64Z short_channel_id_hu_conv = 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; } } export class PendingHTLCsForwardable extends Event { @@ -134,15 +144,26 @@ export class PaymentForwarded extends Event { } export class ChannelClosed extends Event { public channel_id: Uint8Array; + public user_channel_id: number; public reason: ClosureReason; private constructor(ptr: number, obj: bindings.LDKEvent.ChannelClosed) { super(null, ptr); this.channel_id = obj.channel_id; + this.user_channel_id = obj.user_channel_id; const reason: number = obj.reason; ClosureReason reason_hu_conv = ClosureReason.constr_from_ptr(reason); reason_hu_conv.ptrs_to.add(this); this.reason = reason_hu_conv; } +} +export class DiscardFunding extends Event { + public channel_id: Uint8Array; + public transaction: Uint8Array; + private constructor(ptr: number, obj: bindings.LDKEvent.DiscardFunding) { + super(null, ptr); + this.channel_id = obj.channel_id; + this.transaction = obj.transaction; + } } public Event clone() { number ret = bindings.Event_clone(this.ptr); @@ -165,15 +186,15 @@ export class ChannelClosed extends Event { return ret_hu_conv; } - public static Event constructor_payment_sent(Uint8Array payment_preimage) { - number ret = bindings.Event_payment_sent(payment_preimage); + public static Event constructor_payment_sent(Uint8Array payment_preimage, Uint8Array payment_hash) { + number ret = bindings.Event_payment_sent(payment_preimage, payment_hash); Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } - public static Event constructor_payment_path_failed(Uint8Array payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path) { - number ret = bindings.Event_payment_path_failed(payment_hash, rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null); + public static Event constructor_payment_path_failed(Uint8Array payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, Option_u64Z short_channel_id) { + number ret = bindings.Event_payment_path_failed(payment_hash, rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null, short_channel_id.ptr); Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; @@ -200,8 +221,15 @@ export class ChannelClosed extends Event { return ret_hu_conv; } - public static Event constructor_channel_closed(Uint8Array channel_id, ClosureReason reason) { - number ret = bindings.Event_channel_closed(channel_id, reason.ptr); + public static Event constructor_channel_closed(Uint8Array channel_id, number user_channel_id, ClosureReason reason) { + number ret = bindings.Event_channel_closed(channel_id, user_channel_id, reason.ptr); + Event ret_hu_conv = Event.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static Event constructor_discard_funding(Uint8Array channel_id, Uint8Array transaction) { + number ret = bindings.Event_discard_funding(channel_id, transaction); Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/LockedChannelMonitor.ts b/ts/structs/LockedChannelMonitor.ts new file mode 100644 index 00000000..e7f467e0 --- /dev/null +++ b/ts/structs/LockedChannelMonitor.ts @@ -0,0 +1,20 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class LockedChannelMonitor extends CommonBase implements AutoCloseable { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + public close() { + + if (this.ptr != 0) { + bindings.LockedChannelMonitor_free(this.ptr); + } + } +} diff --git a/ts/structs/NodeId.ts b/ts/structs/NodeId.ts new file mode 100644 index 00000000..c08e5632 --- /dev/null +++ b/ts/structs/NodeId.ts @@ -0,0 +1,56 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class NodeId extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.NodeId_free(this.ptr); + } + } + public NodeId clone() { + number ret = bindings.NodeId_clone(this.ptr); + const ret_hu_conv: NodeId = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public static NodeId constructor_from_pubkey(Uint8Array pubkey) { + number ret = bindings.NodeId_from_pubkey(pubkey); + const ret_hu_conv: NodeId = new NodeId(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public Uint8Array as_slice() { + Uint8Array ret = bindings.NodeId_as_slice(this.ptr); + return ret; + } + + public number hash() { + number ret = bindings.NodeId_hash(this.ptr); + return ret; + } + + public Uint8Array write() { + Uint8Array ret = bindings.NodeId_write(this.ptr); + return ret; + } + + public static Result_NodeIdDecodeErrorZ constructor_read(Uint8Array ser) { + number ret = bindings.NodeId_read(ser); + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Option_CVec_NetAddressZZ.ts b/ts/structs/Option_CVec_NetAddressZZ.ts new file mode 100644 index 00000000..2a71cc86 --- /dev/null +++ b/ts/structs/Option_CVec_NetAddressZZ.ts @@ -0,0 +1,64 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +export default class COption_CVec_NetAddressZZ extends CommonBase { + protected constructor(_dummy: object, ptr: number) { super(ptr); } + protected finalize() { + super.finalize(); + if (this.ptr != 0) { bindings.COption_CVec_NetAddressZZ_free(this.ptr); } + } + static constr_from_ptr(ptr: number): COption_CVec_NetAddressZZ { + const raw_val: bindings.LDKCOption_CVec_NetAddressZZ = bindings.LDKCOption_CVec_NetAddressZZ_ref_from_ptr(ptr); + if (raw_val instanceof bindings.LDKCOption_CVec_NetAddressZZ.Some) { + return new Some(this.ptr, raw_val); + } + if (raw_val instanceof bindings.LDKCOption_CVec_NetAddressZZ.None) { + return new None(this.ptr, raw_val); + } + throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface + } + +} +export class Some extends COption_CVec_NetAddressZZ { + public some: NetAddress[]; + private constructor(ptr: number, obj: bindings.LDKCOption_CVec_NetAddressZZ.Some) { + super(null, ptr); + const some: number[] = obj.some; + NetAddress[] some_conv_12_arr = new NetAddress[some.length]; + for (int m = 0; m < some.length; m++) { + number some_conv_12 = some[m]; + NetAddress some_conv_12_hu_conv = 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; + } + this.some = some_conv_12_arr; + } +} +export class None extends COption_CVec_NetAddressZZ { + private constructor(ptr: number, obj: bindings.LDKCOption_CVec_NetAddressZZ.None) { + super(null, ptr); + } +} + public static Option_CVec_NetAddressZZ constructor_some(NetAddress[] o) { + number ret = bindings.COption_CVec_NetAddressZZ_some(o != null ? Arrays.stream(o).map(o_conv_12 -> o_conv_12.ptr).toArray(number[]::new) : null); + Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static Option_CVec_NetAddressZZ constructor_none() { + number ret = bindings.COption_CVec_NetAddressZZ_none(); + Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public Option_CVec_NetAddressZZ clone() { + number ret = bindings.COption_CVec_NetAddressZZ_clone(this.ptr); + Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/ts/structs/PaymentId.ts b/ts/structs/PaymentId.ts new file mode 100644 index 00000000..4657874f --- /dev/null +++ b/ts/structs/PaymentId.ts @@ -0,0 +1,50 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class PaymentId extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.PaymentId_free(this.ptr); + } + } + public number hash() { + number ret = bindings.PaymentId_hash(this.ptr); + return ret; + } + + public PaymentId clone() { + number ret = bindings.PaymentId_clone(this.ptr); + const ret_hu_conv: PaymentId = new PaymentId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public boolean eq(PaymentId b) { + boolean ret = bindings.PaymentId_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + + public Uint8Array write() { + Uint8Array ret = bindings.PaymentId_write(this.ptr); + return ret; + } + + public static Result_PaymentIdDecodeErrorZ constructor_read(Uint8Array ser) { + number ret = bindings.PaymentId_read(ser); + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/ReadOnlyNetworkGraph.ts b/ts/structs/ReadOnlyNetworkGraph.ts index 54cb431a..d60088fc 100644 --- a/ts/structs/ReadOnlyNetworkGraph.ts +++ b/ts/structs/ReadOnlyNetworkGraph.ts @@ -18,4 +18,11 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ReadOnlyNetworkGraph_free(this.ptr); } } + public Option_CVec_NetAddressZZ get_addresses(Uint8Array pubkey) { + number ret = bindings.ReadOnlyNetworkGraph_get_addresses(this.ptr, pubkey); + Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + } diff --git a/ts/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.ts b/ts/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.ts new file mode 100644 index 00000000..9f4b0123 --- /dev/null +++ b/ts/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.ts @@ -0,0 +1,58 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends CommonBase { + private Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(ptr); } super.finalize(); + } + + static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_result_ok(ptr)) { + return new Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_OK(null, ptr); + } else { + return new Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_Err(null, ptr); + } + } + public static final class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_OK extends Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { + public final TwoTuple_PaymentHashPaymentIdZ res; + private Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_ok(ptr); + TwoTuple_PaymentHashPaymentIdZ res_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_Err extends Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { + public final PaymentSendFailure err; + private Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_get_err(ptr); + PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ constructor_ok(TwoTuple_PaymentHashPaymentIdZ o) { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o != null ? o.ptr : 0); + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ constructor_err(PaymentSendFailure e) { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e.ptr); + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ clone() { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(this.ptr); + Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_LockedChannelMonitorNoneZ.ts b/ts/structs/Result_LockedChannelMonitorNoneZ.ts new file mode 100644 index 00000000..67ab8e15 --- /dev/null +++ b/ts/structs/Result_LockedChannelMonitorNoneZ.ts @@ -0,0 +1,56 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_LockedChannelMonitorNoneZ extends CommonBase { + private Result_LockedChannelMonitorNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_LockedChannelMonitorNoneZ_free(ptr); } super.finalize(); + } + + static Result_LockedChannelMonitorNoneZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_LockedChannelMonitorNoneZ_result_ok(ptr)) { + return new Result_LockedChannelMonitorNoneZ_OK(null, ptr); + } else { + return new Result_LockedChannelMonitorNoneZ_Err(null, ptr); + } + } + public static final class Result_LockedChannelMonitorNoneZ_OK extends Result_LockedChannelMonitorNoneZ { + public final LockedChannelMonitor res; + private Result_LockedChannelMonitorNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_LockedChannelMonitorNoneZ_get_ok(ptr); + const res_hu_conv: LockedChannelMonitor = new LockedChannelMonitor(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_LockedChannelMonitorNoneZ_Err extends Result_LockedChannelMonitorNoneZ { + private Result_LockedChannelMonitorNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + public static Result_LockedChannelMonitorNoneZ constructor_ok(LockedChannelMonitor o) { + number ret = bindings.CResult_LockedChannelMonitorNoneZ_ok(o == null ? 0 : o.ptr & ~1); + Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(o); + // Due to rust's strict-ownership memory model, in some cases we need to "move" + // an object to pass exclusive ownership to the function being called. + // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object + // at the FFI layer, creating a new object which Rust can claim ownership of + // However, in some cases (eg here), there is no way to clone an object, and thus + // we actually have to pass full ownership to Rust. + // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object. + o.ptr = 0; + return ret_hu_conv; + } + + public static Result_LockedChannelMonitorNoneZ constructor_err() { + number ret = bindings.CResult_LockedChannelMonitorNoneZ_err(); + Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_NodeIdDecodeErrorZ.ts b/ts/structs/Result_NodeIdDecodeErrorZ.ts new file mode 100644 index 00000000..1a6ec7e0 --- /dev/null +++ b/ts/structs/Result_NodeIdDecodeErrorZ.ts @@ -0,0 +1,58 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_NodeIdDecodeErrorZ extends CommonBase { + private Result_NodeIdDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NodeIdDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_NodeIdDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_NodeIdDecodeErrorZ_result_ok(ptr)) { + return new Result_NodeIdDecodeErrorZ_OK(null, ptr); + } else { + return new Result_NodeIdDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_NodeIdDecodeErrorZ_OK extends Result_NodeIdDecodeErrorZ { + public final NodeId res; + private Result_NodeIdDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_NodeIdDecodeErrorZ_get_ok(ptr); + const res_hu_conv: NodeId = new NodeId(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_NodeIdDecodeErrorZ_Err extends Result_NodeIdDecodeErrorZ { + public final DecodeError err; + private Result_NodeIdDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_NodeIdDecodeErrorZ_get_err(ptr); + const err_hu_conv: DecodeError = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result_NodeIdDecodeErrorZ constructor_ok(NodeId o) { + number ret = bindings.CResult_NodeIdDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_NodeIdDecodeErrorZ constructor_err(DecodeError e) { + number ret = bindings.CResult_NodeIdDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_NodeIdDecodeErrorZ clone() { + number ret = bindings.CResult_NodeIdDecodeErrorZ_clone(this.ptr); + Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_PaymentHashPaymentSendFailureZ.ts b/ts/structs/Result_PaymentHashPaymentSendFailureZ.ts deleted file mode 100644 index e1648c3b..00000000 --- a/ts/structs/Result_PaymentHashPaymentSendFailureZ.ts +++ /dev/null @@ -1,55 +0,0 @@ - -import CommonBase from './CommonBase'; -import * as bindings from '../bindings' // TODO: figure out location - -public class Result_PaymentHashPaymentSendFailureZ extends CommonBase { - private Result_PaymentHashPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_PaymentHashPaymentSendFailureZ_free(ptr); } super.finalize(); - } - - static Result_PaymentHashPaymentSendFailureZ constr_from_ptr(long ptr) { - if (bindings.LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(ptr)) { - return new Result_PaymentHashPaymentSendFailureZ_OK(null, ptr); - } else { - return new Result_PaymentHashPaymentSendFailureZ_Err(null, ptr); - } - } - public static final class Result_PaymentHashPaymentSendFailureZ_OK extends Result_PaymentHashPaymentSendFailureZ { - public final Uint8Array res; - private Result_PaymentHashPaymentSendFailureZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - this.res = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(ptr); - } - } - - public static final class Result_PaymentHashPaymentSendFailureZ_Err extends Result_PaymentHashPaymentSendFailureZ { - public final PaymentSendFailure err; - private Result_PaymentHashPaymentSendFailureZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - number err = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_err(ptr); - PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - } - - public static Result_PaymentHashPaymentSendFailureZ constructor_ok(Uint8Array o) { - number ret = bindings.CResult_PaymentHashPaymentSendFailureZ_ok(o); - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - public static Result_PaymentHashPaymentSendFailureZ constructor_err(PaymentSendFailure e) { - number ret = bindings.CResult_PaymentHashPaymentSendFailureZ_err(e.ptr); - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - public Result_PaymentHashPaymentSendFailureZ clone() { - number ret = bindings.CResult_PaymentHashPaymentSendFailureZ_clone(this.ptr); - Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/ts/structs/Result_PaymentIdDecodeErrorZ.ts b/ts/structs/Result_PaymentIdDecodeErrorZ.ts new file mode 100644 index 00000000..2c4fa275 --- /dev/null +++ b/ts/structs/Result_PaymentIdDecodeErrorZ.ts @@ -0,0 +1,58 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_PaymentIdDecodeErrorZ extends CommonBase { + private Result_PaymentIdDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentIdDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_PaymentIdDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PaymentIdDecodeErrorZ_result_ok(ptr)) { + return new Result_PaymentIdDecodeErrorZ_OK(null, ptr); + } else { + return new Result_PaymentIdDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_PaymentIdDecodeErrorZ_OK extends Result_PaymentIdDecodeErrorZ { + public final PaymentId res; + private Result_PaymentIdDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_PaymentIdDecodeErrorZ_get_ok(ptr); + const res_hu_conv: PaymentId = new PaymentId(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PaymentIdDecodeErrorZ_Err extends Result_PaymentIdDecodeErrorZ { + public final DecodeError err; + private Result_PaymentIdDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_PaymentIdDecodeErrorZ_get_err(ptr); + const err_hu_conv: DecodeError = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result_PaymentIdDecodeErrorZ constructor_ok(PaymentId o) { + number ret = bindings.CResult_PaymentIdDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_PaymentIdDecodeErrorZ constructor_err(DecodeError e) { + number ret = bindings.CResult_PaymentIdDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_PaymentIdDecodeErrorZ clone() { + number ret = bindings.CResult_PaymentIdDecodeErrorZ_clone(this.ptr); + Result_PaymentIdDecodeErrorZ ret_hu_conv = Result_PaymentIdDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_PaymentIdPaymentSendFailureZ.ts b/ts/structs/Result_PaymentIdPaymentSendFailureZ.ts new file mode 100644 index 00000000..b8dd9ebf --- /dev/null +++ b/ts/structs/Result_PaymentIdPaymentSendFailureZ.ts @@ -0,0 +1,58 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { + private Result_PaymentIdPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentIdPaymentSendFailureZ_free(ptr); } super.finalize(); + } + + static Result_PaymentIdPaymentSendFailureZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PaymentIdPaymentSendFailureZ_result_ok(ptr)) { + return new Result_PaymentIdPaymentSendFailureZ_OK(null, ptr); + } else { + return new Result_PaymentIdPaymentSendFailureZ_Err(null, ptr); + } + } + public static final class Result_PaymentIdPaymentSendFailureZ_OK extends Result_PaymentIdPaymentSendFailureZ { + public final PaymentId res; + private Result_PaymentIdPaymentSendFailureZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_PaymentIdPaymentSendFailureZ_get_ok(ptr); + const res_hu_conv: PaymentId = new PaymentId(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_PaymentIdPaymentSendFailureZ_Err extends Result_PaymentIdPaymentSendFailureZ { + public final PaymentSendFailure err; + private Result_PaymentIdPaymentSendFailureZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_PaymentIdPaymentSendFailureZ_get_err(ptr); + PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result_PaymentIdPaymentSendFailureZ constructor_ok(PaymentId o) { + number ret = bindings.CResult_PaymentIdPaymentSendFailureZ_ok(o == null ? 0 : o.ptr & ~1); + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_PaymentIdPaymentSendFailureZ constructor_err(PaymentSendFailure e) { + number ret = bindings.CResult_PaymentIdPaymentSendFailureZ_err(e.ptr); + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_PaymentIdPaymentSendFailureZ clone() { + number ret = bindings.CResult_PaymentIdPaymentSendFailureZ_clone(this.ptr); + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result__u832APIErrorZ.ts b/ts/structs/Result__u832APIErrorZ.ts new file mode 100644 index 00000000..f3105277 --- /dev/null +++ b/ts/structs/Result__u832APIErrorZ.ts @@ -0,0 +1,55 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result__u832APIErrorZ extends CommonBase { + private Result__u832APIErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult__u832APIErrorZ_free(ptr); } super.finalize(); + } + + static Result__u832APIErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult__u832APIErrorZ_result_ok(ptr)) { + return new Result__u832APIErrorZ_OK(null, ptr); + } else { + return new Result__u832APIErrorZ_Err(null, ptr); + } + } + public static final class Result__u832APIErrorZ_OK extends Result__u832APIErrorZ { + public final Uint8Array res; + private Result__u832APIErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult__u832APIErrorZ_get_ok(ptr); + } + } + + public static final class Result__u832APIErrorZ_Err extends Result__u832APIErrorZ { + public final APIError err; + private Result__u832APIErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult__u832APIErrorZ_get_err(ptr); + APIError err_hu_conv = APIError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result__u832APIErrorZ constructor_ok(Uint8Array o) { + number ret = bindings.CResult__u832APIErrorZ_ok(o); + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result__u832APIErrorZ constructor_err(APIError e) { + number ret = bindings.CResult__u832APIErrorZ_err(e.ptr); + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result__u832APIErrorZ clone() { + number ret = bindings.CResult__u832APIErrorZ_clone(this.ptr); + Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Score.ts b/ts/structs/Score.ts new file mode 100644 index 00000000..6372374a --- /dev/null +++ b/ts/structs/Score.ts @@ -0,0 +1,59 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export class Score extends CommonBase { + + bindings_instance?: bindings.LDKScore; + + constructor(ptr?: number, arg?: bindings.LDKScore) { + if (Number.isFinite(ptr)) { + super(ptr); + this.bindings_instance = null; + } else { + // TODO: private constructor instantiation + super(bindings.LDKScore_new(arg)); + this.ptrs_to.push(arg); + + } + } + + protected finalize() { + if (this.ptr != 0) { + bindings.Score_free(this.ptr); + } + super.finalize(); + } + + static new_impl(arg: ScoreInterface): Score { + const impl_holder: LDKScoreHolder = new LDKScoreHolder(); + let structImplementation = { + // todo: in-line interface filling + channel_penalty_msat (short_channel_id: number): number { + number ret = arg.channel_penalty_msat(short_channel_id); + return ret; + }, + + + }; + impl_holder.held = new Score (null, structImplementation); + } + } + + export interface ScoreInterface { + channel_penalty_msat(short_channel_id: number): number; + + } + + class LDKScoreHolder { + held: Score; + } + public number channel_penalty_msat(number short_channel_id) { + number ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id); + return ret; + } + +} diff --git a/ts/structs/Scorer.ts b/ts/structs/Scorer.ts new file mode 100644 index 00000000..b60d103b --- /dev/null +++ b/ts/structs/Scorer.ts @@ -0,0 +1,42 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class Scorer extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.Scorer_free(this.ptr); + } + } + public static Scorer constructor_new(number base_penalty_msat) { + number ret = bindings.Scorer_new(base_penalty_msat); + const ret_hu_conv: Scorer = new Scorer(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static Scorer constructor_default() { + number ret = bindings.Scorer_default(); + const ret_hu_conv: Scorer = new Scorer(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public Score as_Score() { + number ret = bindings.Scorer_as_Score(this.ptr); + Score ret_hu_conv = new Score(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/ts/structs/ShutdownScript.ts b/ts/structs/ShutdownScript.ts index f829f7d2..c035f7c9 100644 --- a/ts/structs/ShutdownScript.ts +++ b/ts/structs/ShutdownScript.ts @@ -36,20 +36,6 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } - public static ShutdownScript constructor_new_p2pkh(Uint8Array pubkey_hash) { - number ret = bindings.ShutdownScript_new_p2pkh(pubkey_hash); - const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - public static ShutdownScript constructor_new_p2sh(Uint8Array script_hash) { - number ret = bindings.ShutdownScript_new_p2sh(script_hash); - const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - public static ShutdownScript constructor_new_p2wpkh(Uint8Array pubkey_hash) { number ret = bindings.ShutdownScript_new_p2wpkh(pubkey_hash); const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret); diff --git a/ts/structs/TwoTuple_PaymentHashPaymentIdZ.ts b/ts/structs/TwoTuple_PaymentHashPaymentIdZ.ts new file mode 100644 index 00000000..c4759b19 --- /dev/null +++ b/ts/structs/TwoTuple_PaymentHashPaymentIdZ.ts @@ -0,0 +1,47 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class C2Tuple_PaymentHashPaymentIdZ extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.C2Tuple_PaymentHashPaymentIdZ_free(this.ptr); + } + } + public Uint8Array get_a() { + Uint8Array ret = bindings.C2Tuple_PaymentHashPaymentIdZ_get_a(this.ptr); + return ret; + } + + public PaymentId get_b() { + number ret = bindings.C2Tuple_PaymentHashPaymentIdZ_get_b(this.ptr); + const ret_hu_conv: PaymentId = new PaymentId(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public TwoTuple_PaymentHashPaymentIdZ clone() { + number ret = bindings.C2Tuple_PaymentHashPaymentIdZ_clone(this.ptr); + TwoTuple_PaymentHashPaymentIdZ ret_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public static TwoTuple_PaymentHashPaymentIdZ constructor_new(Uint8Array a, PaymentId b) { + number ret = bindings.C2Tuple_PaymentHashPaymentIdZ_new(a, b == null ? 0 : b.ptr & ~1); + TwoTuple_PaymentHashPaymentIdZ ret_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + +} diff --git a/ts/structs/UtilMethods.ts b/ts/structs/UtilMethods.ts index 9e1cf0c8..d1faeb04 100644 --- a/ts/structs/UtilMethods.ts +++ b/ts/structs/UtilMethods.ts @@ -97,21 +97,23 @@ return ret; } - public static Result_RouteLightningErrorZ constructor_get_keysend_route(Uint8Array our_node_id, NetworkGraph network, Uint8Array payee, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger) { - number ret = bindings.get_keysend_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr); + public static Result_RouteLightningErrorZ constructor_get_keysend_route(Uint8Array our_node_pubkey, NetworkGraph network, Uint8Array payee, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger, Score scorer) { + number ret = bindings.get_keysend_route(our_node_pubkey, network == null ? 0 : network.ptr & ~1, payee, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(network); for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; ret_hu_conv.ptrs_to.add(logger); + ret_hu_conv.ptrs_to.add(scorer); return ret_hu_conv; } - public static Result_RouteLightningErrorZ constructor_get_route(Uint8Array our_node_id, NetworkGraph network, Uint8Array payee, InvoiceFeatures payee_features, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger) { - number ret = bindings.get_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, payee_features == null ? 0 : payee_features.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr); + public static Result_RouteLightningErrorZ constructor_get_route(Uint8Array our_node_pubkey, NetworkGraph network, Uint8Array payee, InvoiceFeatures payee_features, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger, Score scorer) { + number ret = bindings.get_route(our_node_pubkey, network == null ? 0 : network.ptr & ~1, payee, payee_features == null ? 0 : payee_features.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(network); for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; ret_hu_conv.ptrs_to.add(logger); + ret_hu_conv.ptrs_to.add(scorer); return ret_hu_conv; }