From: Matt Corallo Date: Mon, 1 Mar 2021 17:37:30 +0000 (-0500) Subject: Update bindings to latest upstream. X-Git-Tag: v0.0.98~13^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=276893d3b8bd3fcb2bb10e3cab73a69d34831909;p=ldk-java Update bindings to latest upstream. --- diff --git a/liblightningjni.so b/liblightningjni.so index b151f89d..62a2a84d 100755 Binary files a/liblightningjni.so and b/liblightningjni.so differ diff --git a/src/main/java/org/ldk/enums/LDKSecp256k1Error.java b/src/main/java/org/ldk/enums/LDKSecp256k1Error.java index 60c6de32..7bfe1415 100644 --- a/src/main/java/org/ldk/enums/LDKSecp256k1Error.java +++ b/src/main/java/org/ldk/enums/LDKSecp256k1Error.java @@ -8,8 +8,8 @@ public enum LDKSecp256k1Error { LDKSecp256k1Error_InvalidSecretKey, LDKSecp256k1Error_InvalidRecoveryId, LDKSecp256k1Error_InvalidTweak, + LDKSecp256k1Error_TweakCheckFailed, LDKSecp256k1Error_NotEnoughMemory, - LDKSecp256k1Error_CallbackPanicked, ; static native void init(); static { init(); } } \ No newline at end of file diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 498b353a..efeb7e95 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -295,10 +295,19 @@ public class bindings { public static native boolean LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(long arg); public static native void LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(long arg); public static native LDKChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(long arg); + public static class LDKMonitorEvent { + private LDKMonitorEvent() {} + public final static class HTLCEvent extends LDKMonitorEvent { + HTLCEvent() { } + } + public final static class CommitmentTxBroadcasted extends LDKMonitorEvent { + CommitmentTxBroadcasted() { } + } + static native void init(); + } + static { LDKMonitorEvent.init(); } + public static native LDKMonitorEvent LDKMonitorEvent_ref_from_ptr(long ptr); public static native long LDKCVec_MonitorEventZ_new(long[] elems); - public static native long LDKC2Tuple_u64u64Z_new(long a, long b); - public static native long LDKC2Tuple_u64u64Z_get_a(long ptr); - public static native long LDKC2Tuple_u64u64Z_get_b(long ptr); public static class LDKSpendableOutputDescriptor { private LDKSpendableOutputDescriptor() {} public final static class StaticOutput extends LDKSpendableOutputDescriptor { @@ -306,20 +315,11 @@ public class bindings { public long output; StaticOutput(long outpoint, long output) { this.outpoint = outpoint; this.output = output; } } - public final static class DynamicOutputP2WSH extends LDKSpendableOutputDescriptor { - public long outpoint; - public byte[] per_commitment_point; - public short to_self_delay; - public long output; - public long key_derivation_params; - public byte[] revocation_pubkey; - DynamicOutputP2WSH(long outpoint, byte[] per_commitment_point, short to_self_delay, long output, long key_derivation_params, byte[] revocation_pubkey) { this.outpoint = outpoint; this.per_commitment_point = per_commitment_point; this.to_self_delay = to_self_delay; this.output = output; this.key_derivation_params = key_derivation_params; this.revocation_pubkey = revocation_pubkey; } + public final static class DelayedPaymentOutput extends LDKSpendableOutputDescriptor { + DelayedPaymentOutput() { } } - public final static class StaticOutputCounterpartyPayment extends LDKSpendableOutputDescriptor { - public long outpoint; - public long output; - public long key_derivation_params; - StaticOutputCounterpartyPayment(long outpoint, long output, long key_derivation_params) { this.outpoint = outpoint; this.output = output; this.key_derivation_params = key_derivation_params; } + public final static class StaticPaymentOutput extends LDKSpendableOutputDescriptor { + StaticPaymentOutput() { } } static native void init(); } @@ -400,10 +400,10 @@ public class bindings { public static native boolean LDKCResult_SignatureNoneZ_result_ok(long arg); public static native byte[] LDKCResult_SignatureNoneZ_get_ok(long arg); public static native void LDKCResult_SignatureNoneZ_get_err(long arg); - public interface LDKChannelKeys { + public interface LDKSign { byte[] get_per_commitment_point(long idx); byte[] release_commitment_secret(long idx); - long key_derivation_params(); + byte[] channel_keys_id(); long sign_counterparty_commitment(long commitment_tx); long sign_holder_commitment_and_htlcs(long commitment_tx); long sign_justice_transaction(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); @@ -413,31 +413,31 @@ public class bindings { void ready_channel(long channel_parameters); byte[] write(); } - public static native long LDKChannelKeys_new(LDKChannelKeys impl, long pubkeys); - // LDKPublicKey ChannelKeys_get_per_commitment_point LDKChannelKeys* this_arg, uint64_t idx - public static native byte[] ChannelKeys_get_per_commitment_point(long this_arg, long idx); - // LDKThirtyTwoBytes ChannelKeys_release_commitment_secret LDKChannelKeys* this_arg, uint64_t idx - public static native byte[] ChannelKeys_release_commitment_secret(long this_arg, long idx); - // LDKC2Tuple_u64u64Z ChannelKeys_key_derivation_params LDKChannelKeys* this_arg - public static native long ChannelKeys_key_derivation_params(long this_arg); - // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ChannelKeys_sign_counterparty_commitment LDKChannelKeys* this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx - public static native long ChannelKeys_sign_counterparty_commitment(long this_arg, long commitment_tx); - // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ChannelKeys_sign_holder_commitment_and_htlcs LDKChannelKeys* this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx - public static native long ChannelKeys_sign_holder_commitment_and_htlcs(long this_arg, long commitment_tx); - // LDKCResult_SignatureNoneZ ChannelKeys_sign_justice_transaction LDKChannelKeys* this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc - public static native long ChannelKeys_sign_justice_transaction(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); - // LDKCResult_SignatureNoneZ ChannelKeys_sign_counterparty_htlc_transaction LDKChannelKeys* this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc - public static native long ChannelKeys_sign_counterparty_htlc_transaction(long this_arg, byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc); - // LDKCResult_SignatureNoneZ ChannelKeys_sign_closing_transaction LDKChannelKeys* this_arg, struct LDKTransaction closing_tx - public static native long ChannelKeys_sign_closing_transaction(long this_arg, byte[] closing_tx); - // LDKCResult_SignatureNoneZ ChannelKeys_sign_channel_announcement LDKChannelKeys* this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg - public static native long ChannelKeys_sign_channel_announcement(long this_arg, long msg); - // void ChannelKeys_ready_channel LDKChannelKeys* this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters - public static native void ChannelKeys_ready_channel(long this_arg, long channel_parameters); - // LDKCVec_u8Z ChannelKeys_write LDKChannelKeys* this_arg - public static native byte[] ChannelKeys_write(long this_arg); - // LDKChannelPublicKeys ChannelKeys_get_pubkeys LDKChannelKeys* this_arg - public static native long ChannelKeys_get_pubkeys(long this_arg); + public static native long LDKSign_new(LDKSign impl, long pubkeys); + // LDKPublicKey Sign_get_per_commitment_point LDKSign* this_arg, uint64_t idx + public static native byte[] Sign_get_per_commitment_point(long this_arg, long idx); + // LDKThirtyTwoBytes Sign_release_commitment_secret LDKSign* this_arg, uint64_t idx + public static native byte[] Sign_release_commitment_secret(long this_arg, long idx); + // LDKThirtyTwoBytes Sign_channel_keys_id LDKSign* this_arg + public static native byte[] Sign_channel_keys_id(long this_arg); + // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ Sign_sign_counterparty_commitment LDKSign* this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx + public static native long Sign_sign_counterparty_commitment(long this_arg, long commitment_tx); + // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ Sign_sign_holder_commitment_and_htlcs LDKSign* this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx + public static native long Sign_sign_holder_commitment_and_htlcs(long this_arg, long commitment_tx); + // LDKCResult_SignatureNoneZ Sign_sign_justice_transaction LDKSign* this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc + public static native long Sign_sign_justice_transaction(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc); + // LDKCResult_SignatureNoneZ Sign_sign_counterparty_htlc_transaction LDKSign* this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc + public static native long Sign_sign_counterparty_htlc_transaction(long this_arg, byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc); + // LDKCResult_SignatureNoneZ Sign_sign_closing_transaction LDKSign* this_arg, struct LDKTransaction closing_tx + public static native long Sign_sign_closing_transaction(long this_arg, byte[] closing_tx); + // LDKCResult_SignatureNoneZ Sign_sign_channel_announcement LDKSign* this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg + public static native long Sign_sign_channel_announcement(long this_arg, long msg); + // void Sign_ready_channel LDKSign* this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters + public static native void Sign_ready_channel(long this_arg, long channel_parameters); + // LDKCVec_u8Z Sign_write LDKSign* this_arg + public static native byte[] Sign_write(long this_arg); + // LDKChannelPublicKeys Sign_get_pubkeys LDKSign* this_arg + public static native long Sign_get_pubkeys(long this_arg); public static native long LDKC2Tuple_BlockHashChannelMonitorZ_new(byte[] a, long b); public static native byte[] LDKC2Tuple_BlockHashChannelMonitorZ_get_a(long ptr); public static native long LDKC2Tuple_BlockHashChannelMonitorZ_get_b(long ptr); @@ -476,7 +476,27 @@ public class bindings { public static native boolean LDKCResult_NoneAPIErrorZ_result_ok(long arg); public static native void LDKCResult_NoneAPIErrorZ_get_ok(long arg); 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 long LDKCVec_ChannelDetailsZ_new(long[] elems); + public static class LDKPaymentSendFailure { + private LDKPaymentSendFailure() {} + public final static class ParameterError extends LDKPaymentSendFailure { + ParameterError() { } + } + public final static class PathParameterError extends LDKPaymentSendFailure { + PathParameterError() { } + } + public final static class AllFailedRetrySafe extends LDKPaymentSendFailure { + AllFailedRetrySafe() { } + } + public final static class PartialFailure extends LDKPaymentSendFailure { + PartialFailure() { } + } + static native void init(); + } + static { LDKPaymentSendFailure.init(); } + public static native LDKPaymentSendFailure LDKPaymentSendFailure_ref_from_ptr(long ptr); 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); @@ -499,14 +519,14 @@ public class bindings { public static native long LDKBroadcasterInterface_new(LDKBroadcasterInterface impl); // void BroadcasterInterface_broadcast_transaction LDKBroadcasterInterface* this_arg, struct LDKTransaction tx public static native void BroadcasterInterface_broadcast_transaction(long this_arg, byte[] tx); - public static native boolean LDKCResult_ChannelKeysDecodeErrorZ_result_ok(long arg); - public static native long LDKCResult_ChannelKeysDecodeErrorZ_get_ok(long arg); - public static native long LDKCResult_ChannelKeysDecodeErrorZ_get_err(long arg); + public static native boolean LDKCResult_SignDecodeErrorZ_result_ok(long arg); + public static native long LDKCResult_SignDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_SignDecodeErrorZ_get_err(long arg); public interface LDKKeysInterface { byte[] get_node_secret(); byte[] get_destination_script(); byte[] get_shutdown_pubkey(); - long get_channel_keys(boolean inbound, long channel_value_satoshis); + long get_channel_signer(boolean inbound, long channel_value_satoshis); byte[] get_secure_random_bytes(); long read_chan_signer(byte[] reader); } @@ -517,11 +537,11 @@ public class bindings { public static native byte[] KeysInterface_get_destination_script(long this_arg); // LDKPublicKey KeysInterface_get_shutdown_pubkey LDKKeysInterface* this_arg public static native byte[] KeysInterface_get_shutdown_pubkey(long this_arg); - // LDKChannelKeys KeysInterface_get_channel_keys LDKKeysInterface* this_arg, bool inbound, uint64_t channel_value_satoshis - public static native long KeysInterface_get_channel_keys(long this_arg, boolean inbound, long channel_value_satoshis); + // LDKSign KeysInterface_get_channel_signer LDKKeysInterface* this_arg, bool inbound, uint64_t channel_value_satoshis + public static native long KeysInterface_get_channel_signer(long this_arg, boolean inbound, long channel_value_satoshis); // LDKThirtyTwoBytes KeysInterface_get_secure_random_bytes LDKKeysInterface* this_arg public static native byte[] KeysInterface_get_secure_random_bytes(long this_arg); - // LDKCResult_ChannelKeysDecodeErrorZ KeysInterface_read_chan_signer LDKKeysInterface* this_arg, struct LDKu8slice reader + // LDKCResult_SignDecodeErrorZ KeysInterface_read_chan_signer LDKKeysInterface* this_arg, struct LDKu8slice reader public static native long KeysInterface_read_chan_signer(long this_arg, byte[] reader); public interface LDKFeeEstimator { int get_est_sat_per_1000_weight(LDKConfirmationTarget confirmation_target); @@ -542,9 +562,16 @@ public class bindings { public static native boolean LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(long arg); public static native long LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(long arg); public static native long LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(long arg); - public static native boolean LDKCResult_InMemoryChannelKeysDecodeErrorZ_result_ok(long arg); - public static native long LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_ok(long arg); - public static native long LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_err(long arg); + public static native boolean LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(long arg); + public static native byte[][] LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(long arg); + public static native void LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(long arg); + public static native boolean LDKCResult_InMemorySignerDecodeErrorZ_result_ok(long arg); + public static native long LDKCResult_InMemorySignerDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_InMemorySignerDecodeErrorZ_get_err(long arg); + public static native long LDKCVec_TxOutZ_new(long[] elems); + public static native boolean LDKCResult_TransactionNoneZ_result_ok(long arg); + public static native byte[] LDKCResult_TransactionNoneZ_get_ok(long arg); + public static native void LDKCResult_TransactionNoneZ_get_err(long arg); public static native long LDKCVec_RouteHopZ_new(long[] elems); public static native boolean LDKCResult_RouteDecodeErrorZ_result_ok(long arg); public static native long LDKCResult_RouteDecodeErrorZ_get_ok(long arg); @@ -674,6 +701,15 @@ public class bindings { public static native long LDKAccess_new(LDKAccess impl); // LDKCResult_TxOutAccessErrorZ Access_get_utxo LDKAccess* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id public static native long Access_get_utxo(long this_arg, byte[] genesis_hash, long short_channel_id); + public interface LDKListen { + void block_connected(byte[] block, int height); + void block_disconnected(byte[] header, int height); + } + public static native long LDKListen_new(LDKListen impl); + // void Listen_block_connected LDKListen* this_arg, struct LDKu8slice block, uint32_t height + public static native void Listen_block_connected(long this_arg, byte[] block, int height); + // void Listen_block_disconnected LDKListen* this_arg, const uint8_t (*header)[80], uint32_t height + public static native void Listen_block_disconnected(long this_arg, byte[] header, int height); public interface LDKFilter { void register_tx(byte[] txid, byte[] script_pubkey); void register_output(long outpoint, byte[] script_pubkey); @@ -698,7 +734,7 @@ public class bindings { void handle_funding_created(byte[] their_node_id, long msg); void handle_funding_signed(byte[] their_node_id, long msg); void handle_funding_locked(byte[] their_node_id, long msg); - void handle_shutdown(byte[] their_node_id, long msg); + void handle_shutdown(byte[] their_node_id, long their_features, long msg); void handle_closing_signed(byte[] their_node_id, long msg); void handle_update_add_htlc(byte[] their_node_id, long msg); void handle_update_fulfill_htlc(byte[] their_node_id, long msg); @@ -724,8 +760,8 @@ public class bindings { public static native void ChannelMessageHandler_handle_funding_signed(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_funding_locked LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_funding_locked(long this_arg, byte[] their_node_id, long msg); - // void ChannelMessageHandler_handle_shutdown LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg - public static native void ChannelMessageHandler_handle_shutdown(long this_arg, byte[] their_node_id, long msg); + // void ChannelMessageHandler_handle_shutdown LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg + public static native void ChannelMessageHandler_handle_shutdown(long this_arg, byte[] their_node_id, long their_features, long msg); // void ChannelMessageHandler_handle_closing_signed LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg public static native void ChannelMessageHandler_handle_closing_signed(long this_arg, byte[] their_node_id, long msg); // void ChannelMessageHandler_handle_update_add_htlc LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg @@ -1001,6 +1037,8 @@ public class bindings { public static native long CResult_ChannelInfoDecodeErrorZ_err(long e); // void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); public static native void CResult_ChannelInfoDecodeErrorZ_free(long _res); + // struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_ChannelInfoDecodeErrorZ_clone(long orig); // struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); public static native long CResult_RoutingFeesDecodeErrorZ_ok(long o); // struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); @@ -1035,6 +1073,8 @@ public class bindings { public static native long CResult_NetworkGraphDecodeErrorZ_err(long e); // void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); 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 LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); public static native long C2Tuple_usizeTransactionZ_new(long a, byte[] b); // void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); @@ -1135,6 +1175,10 @@ public class bindings { public static native void CResult_NoneAPIErrorZ_free(long _res); // struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); public static native long CResult_NoneAPIErrorZ_clone(long orig); + // void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); + 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); // void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); public static native void CVec_ChannelDetailsZ_free(long[] _res); // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); @@ -1157,12 +1201,6 @@ public class bindings { public static native long CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(long e); // void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); public static native void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(long _res); - // struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); - public static native long C2Tuple_u64u64Z_clone(long orig); - // struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); - public static native long C2Tuple_u64u64Z_new(long a, long b); - // void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); - public static native void C2Tuple_u64u64Z_free(long _res); // struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); public static native long CResult_SpendableOutputDescriptorDecodeErrorZ_ok(long o); // struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); @@ -1193,22 +1231,40 @@ public class bindings { public static native void CResult_SignatureNoneZ_free(long _res); // struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig); public static native long CResult_SignatureNoneZ_clone(long orig); - // struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_ok(struct LDKChannelKeys o); - public static native long CResult_ChannelKeysDecodeErrorZ_ok(long o); - // struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_ChannelKeysDecodeErrorZ_err(long e); - // void CResult_ChannelKeysDecodeErrorZ_free(struct LDKCResult_ChannelKeysDecodeErrorZ _res); - public static native void CResult_ChannelKeysDecodeErrorZ_free(long _res); - // struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelKeysDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_ChannelKeysDecodeErrorZ_clone(long orig); - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o); - public static native long CResult_InMemoryChannelKeysDecodeErrorZ_ok(long o); - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_InMemoryChannelKeysDecodeErrorZ_err(long e); - // void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res); - public static native void CResult_InMemoryChannelKeysDecodeErrorZ_free(long _res); - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_clone(const struct LDKCResult_InMemoryChannelKeysDecodeErrorZ *NONNULL_PTR orig); - public static native long CResult_InMemoryChannelKeysDecodeErrorZ_clone(long orig); + // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); + public static native long CResult_SignDecodeErrorZ_ok(long o); + // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_SignDecodeErrorZ_err(long e); + // void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); + public static native void CResult_SignDecodeErrorZ_free(long _res); + // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_SignDecodeErrorZ_clone(long orig); + // void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); + public static native void CVec_CVec_u8ZZ_free(byte[][] _res); + // struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); + public static native long CResult_CVec_CVec_u8ZZNoneZ_ok(byte[][] o); + // struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); + public static native long CResult_CVec_CVec_u8ZZNoneZ_err(); + // void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); + public static native void CResult_CVec_CVec_u8ZZNoneZ_free(long _res); + // struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); + public static native long CResult_CVec_CVec_u8ZZNoneZ_clone(long orig); + // struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); + public static native long CResult_InMemorySignerDecodeErrorZ_ok(long o); + // struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_InMemorySignerDecodeErrorZ_err(long e); + // void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); + public static native void CResult_InMemorySignerDecodeErrorZ_free(long _res); + // struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); + public static native long CResult_InMemorySignerDecodeErrorZ_clone(long orig); + // void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); + public static native void CVec_TxOutZ_free(long[] _res); + // struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); + public static native long CResult_TransactionNoneZ_ok(byte[] o); + // struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); + public static native long CResult_TransactionNoneZ_err(); + // void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); + public static native void CResult_TransactionNoneZ_free(long _res); // void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); public static native void CVec_RouteHopZ_free(long[] _res); // void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); @@ -1643,6 +1699,8 @@ public class bindings { public static native LDKAccessError AccessError_clone(long orig); // void Access_free(struct LDKAccess this_ptr); public static native void Access_free(long this_ptr); + // void Listen_free(struct LDKListen this_ptr); + public static native void Listen_free(long this_ptr); // void Watch_free(struct LDKWatch this_ptr); public static native void Watch_free(long this_ptr); // void Filter_free(struct LDKFilter this_ptr); @@ -1741,6 +1799,58 @@ public class bindings { public static native byte[] OutPoint_write(long obj); // struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); public static native long OutPoint_read(byte[] ser); + // void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_ptr); + public static native void DelayedPaymentOutputDescriptor_free(long this_ptr); + // struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + public static native long DelayedPaymentOutputDescriptor_get_outpoint(long this_ptr); + // void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + public static native void DelayedPaymentOutputDescriptor_set_outpoint(long this_ptr, long val); + // struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + public static native byte[] DelayedPaymentOutputDescriptor_get_per_commitment_point(long this_ptr); + // void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + public static native void DelayedPaymentOutputDescriptor_set_per_commitment_point(long this_ptr, byte[] val); + // uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + public static native short DelayedPaymentOutputDescriptor_get_to_self_delay(long this_ptr); + // void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); + public static native void DelayedPaymentOutputDescriptor_set_to_self_delay(long this_ptr, short val); + // void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + public static native void DelayedPaymentOutputDescriptor_set_output(long this_ptr, long val); + // struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + public static native byte[] DelayedPaymentOutputDescriptor_get_revocation_pubkey(long this_ptr); + // void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + public static native void DelayedPaymentOutputDescriptor_set_revocation_pubkey(long this_ptr, byte[] val); + // const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + public static native byte[] DelayedPaymentOutputDescriptor_get_channel_keys_id(long this_ptr); + // void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + public static native void DelayedPaymentOutputDescriptor_set_channel_keys_id(long this_ptr, byte[] val); + // uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + public static native long DelayedPaymentOutputDescriptor_get_channel_value_satoshis(long this_ptr); + // void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + public static native void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(long this_ptr, long val); + // MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + public static native long DelayedPaymentOutputDescriptor_new(long outpoint_arg, byte[] per_commitment_point_arg, short to_self_delay_arg, long output_arg, byte[] revocation_pubkey_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg); + // struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); + public static native long DelayedPaymentOutputDescriptor_clone(long orig); + // void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_ptr); + public static native void StaticPaymentOutputDescriptor_free(long this_ptr); + // struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + public static native long StaticPaymentOutputDescriptor_get_outpoint(long this_ptr); + // void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + public static native void StaticPaymentOutputDescriptor_set_outpoint(long this_ptr, long val); + // void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + public static native void StaticPaymentOutputDescriptor_set_output(long this_ptr, long val); + // const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + public static native byte[] StaticPaymentOutputDescriptor_get_channel_keys_id(long this_ptr); + // void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + public static native void StaticPaymentOutputDescriptor_set_channel_keys_id(long this_ptr, byte[] val); + // uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + public static native long StaticPaymentOutputDescriptor_get_channel_value_satoshis(long this_ptr); + // void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + public static native void StaticPaymentOutputDescriptor_set_channel_value_satoshis(long this_ptr, long val); + // MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + public static native long StaticPaymentOutputDescriptor_new(long outpoint_arg, long output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg); + // struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); + public static native long StaticPaymentOutputDescriptor_clone(long orig); // void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); public static native void SpendableOutputDescriptor_free(long this_ptr); // struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); @@ -1749,66 +1859,72 @@ public class bindings { public static native byte[] SpendableOutputDescriptor_write(long obj); // struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); public static native long SpendableOutputDescriptor_read(byte[] ser); - // struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig); - public static native long ChannelKeys_clone(long orig); - // void ChannelKeys_free(struct LDKChannelKeys this_ptr); - public static native void ChannelKeys_free(long this_ptr); + // struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); + public static native long Sign_clone(long orig); + // void Sign_free(struct LDKSign this_ptr); + public static native void Sign_free(long this_ptr); // void KeysInterface_free(struct LDKKeysInterface this_ptr); public static native void KeysInterface_free(long this_ptr); - // void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr); - public static native void InMemoryChannelKeys_free(long this_ptr); - // const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - public static native byte[] InMemoryChannelKeys_get_funding_key(long this_ptr); - // void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - public static native void InMemoryChannelKeys_set_funding_key(long this_ptr, byte[] val); - // const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - public static native byte[] InMemoryChannelKeys_get_revocation_base_key(long this_ptr); - // void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - public static native void InMemoryChannelKeys_set_revocation_base_key(long this_ptr, byte[] val); - // const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - public static native byte[] InMemoryChannelKeys_get_payment_key(long this_ptr); - // void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - public static native void InMemoryChannelKeys_set_payment_key(long this_ptr, byte[] val); - // const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - public static native byte[] InMemoryChannelKeys_get_delayed_payment_base_key(long this_ptr); - // void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - public static native void InMemoryChannelKeys_set_delayed_payment_base_key(long this_ptr, byte[] val); - // const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - public static native byte[] InMemoryChannelKeys_get_htlc_base_key(long this_ptr); - // void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - public static native void InMemoryChannelKeys_set_htlc_base_key(long this_ptr, byte[] val); - // const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - public static native byte[] InMemoryChannelKeys_get_commitment_seed(long this_ptr); - // void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - public static native void InMemoryChannelKeys_set_commitment_seed(long this_ptr, byte[] val); - // struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig); - public static native long InMemoryChannelKeys_clone(long orig); - // MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKC2Tuple_u64u64Z key_derivation_params); - public static native long InMemoryChannelKeys_new(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, long key_derivation_params); - // MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - public static native long InMemoryChannelKeys_counterparty_pubkeys(long this_arg); - // MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - public static native short InMemoryChannelKeys_counterparty_selected_contest_delay(long this_arg); - // MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - public static native short InMemoryChannelKeys_holder_selected_contest_delay(long this_arg); - // MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - public static native boolean InMemoryChannelKeys_is_outbound(long this_arg); - // MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - public static native long InMemoryChannelKeys_funding_outpoint(long this_arg); - // MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - public static native long InMemoryChannelKeys_get_channel_parameters(long this_arg); - // struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - public static native long InMemoryChannelKeys_as_ChannelKeys(long this_arg); - // struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj); - public static native byte[] InMemoryChannelKeys_write(long obj); - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser); - public static native long InMemoryChannelKeys_read(byte[] ser); + // void InMemorySigner_free(struct LDKInMemorySigner this_ptr); + public static native void InMemorySigner_free(long this_ptr); + // const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + public static native byte[] InMemorySigner_get_funding_key(long this_ptr); + // void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + public static native void InMemorySigner_set_funding_key(long this_ptr, byte[] val); + // const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + public static native byte[] InMemorySigner_get_revocation_base_key(long this_ptr); + // void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + public static native void InMemorySigner_set_revocation_base_key(long this_ptr, byte[] val); + // const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + public static native byte[] InMemorySigner_get_payment_key(long this_ptr); + // void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + public static native void InMemorySigner_set_payment_key(long this_ptr, byte[] val); + // const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + public static native byte[] InMemorySigner_get_delayed_payment_base_key(long this_ptr); + // void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + public static native void InMemorySigner_set_delayed_payment_base_key(long this_ptr, byte[] val); + // const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + public static native byte[] InMemorySigner_get_htlc_base_key(long this_ptr); + // void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + public static native void InMemorySigner_set_htlc_base_key(long this_ptr, byte[] val); + // const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + public static native byte[] InMemorySigner_get_commitment_seed(long this_ptr); + // void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + public static native void InMemorySigner_set_commitment_seed(long this_ptr, byte[] val); + // struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); + public static native long InMemorySigner_clone(long orig); + // MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + public static native long InMemorySigner_new(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id); + // MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native long InMemorySigner_counterparty_pubkeys(long this_arg); + // MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native short InMemorySigner_counterparty_selected_contest_delay(long this_arg); + // MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native short InMemorySigner_holder_selected_contest_delay(long this_arg); + // MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native boolean InMemorySigner_is_outbound(long this_arg); + // MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native long InMemorySigner_funding_outpoint(long this_arg); + // MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native long InMemorySigner_get_channel_parameters(long this_arg); + // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); + public static native long InMemorySigner_sign_counterparty_payment_input(long this_arg, byte[] spend_tx, long input_idx, long descriptor); + // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); + public static native long InMemorySigner_sign_dynamic_p2wsh_input(long this_arg, byte[] spend_tx, long input_idx, long descriptor); + // struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native long InMemorySigner_as_Sign(long this_arg); + // struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); + public static native byte[] InMemorySigner_write(long obj); + // struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); + public static native long InMemorySigner_read(byte[] ser); // void KeysManager_free(struct LDKKeysManager this_ptr); public static native void KeysManager_free(long this_ptr); - // MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos); - public static native long KeysManager_new(byte[] seed, LDKNetwork network, long starting_time_secs, int starting_time_nanos); - // MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2); - public static native long KeysManager_derive_channel_keys(long this_arg, long channel_value_satoshis, long params_1, long params_2); + // MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); + public static native long KeysManager_new(byte[] seed, long starting_time_secs, int starting_time_nanos); + // MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); + public static native long KeysManager_derive_channel_keys(long this_arg, long channel_value_satoshis, byte[] params); + // MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); + 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 ChannelManager_free(struct LDKChannelManager this_ptr); @@ -1889,10 +2005,14 @@ public class bindings { public static native long ChannelManager_as_MessageSendEventsProvider(long this_arg); // struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_as_EventsProvider(long this_arg); + // struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native long ChannelManager_as_Listen(long this_arg); // void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); public static native void ChannelManager_block_connected(long this_arg, byte[] header, long[] txdata, int height); // void ChannelManager_block_disconnected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80]); public static native void ChannelManager_block_disconnected(long this_arg, byte[] header); + // void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg); + public static native void ChannelManager_await_persistable_update(long this_arg); // struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_as_ChannelMessageHandler(long this_arg); // struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); @@ -1933,6 +2053,12 @@ public class bindings { public static native long DecodeError_clone(long orig); // void Init_free(struct LDKInit this_ptr); public static native void Init_free(long this_ptr); + // struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); + public static native long Init_get_features(long this_ptr); + // void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); + public static native void Init_set_features(long this_ptr, long val); + // MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); + public static native long Init_new(long features_arg); // struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); public static native long Init_clone(long orig); // void ErrorMessage_free(struct LDKErrorMessage this_ptr); @@ -3173,6 +3299,8 @@ public class bindings { public static native long get_route(byte[] our_node_id, long network, byte[] target, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger); // void NetworkGraph_free(struct LDKNetworkGraph this_ptr); public static native void NetworkGraph_free(long this_ptr); + // struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); + public static native long NetworkGraph_clone(long orig); // void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr); public static native void LockedNetworkGraph_free(long this_ptr); // void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_ptr); @@ -3247,6 +3375,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); + // 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); public static native byte[] ChannelInfo_write(long obj); // struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); diff --git a/src/main/java/org/ldk/structs/ChainMonitor.java b/src/main/java/org/ldk/structs/ChainMonitor.java index 951ca5df..737433d8 100644 --- a/src/main/java/org/ldk/structs/ChainMonitor.java +++ b/src/main/java/org/ldk/structs/ChainMonitor.java @@ -15,7 +15,7 @@ public class ChainMonitor extends CommonBase { } public void block_connected(byte[] header, TwoTuple[] txdata, int height) { - bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(arr_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_24.a, arr_conv_24.b)).toArray(), height); + bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(txdata_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_24.a, txdata_conv_24.b)).toArray(), height); /* TODO 2 TwoTuple */; } diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index 5850917a..90f1f4b7 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -80,6 +80,13 @@ public class ChannelInfo extends CommonBase { this.ptrs_to.add(val); } + public ChannelInfo clone() { + long ret = bindings.ChannelInfo_clone(this.ptr); + ChannelInfo ret_hu_conv = new ChannelInfo(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + public byte[] write() { byte[] ret = bindings.ChannelInfo_write(this.ptr); return ret; diff --git a/src/main/java/org/ldk/structs/ChannelKeys.java b/src/main/java/org/ldk/structs/ChannelKeys.java deleted file mode 100644 index 500e6930..00000000 --- a/src/main/java/org/ldk/structs/ChannelKeys.java +++ /dev/null @@ -1,184 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; - -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class ChannelKeys extends CommonBase { - final bindings.LDKChannelKeys bindings_instance; - ChannelKeys(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } - private ChannelKeys(bindings.LDKChannelKeys arg, ChannelPublicKeys pubkeys) { - super(bindings.LDKChannelKeys_new(arg, pubkeys == null ? 0 : pubkeys.ptr & ~1)); - this.ptrs_to.add(arg); - this.ptrs_to.add(pubkeys); - this.bindings_instance = arg; - } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.ChannelKeys_free(ptr); } super.finalize(); - } - - public static interface ChannelKeysInterface { - byte[] get_per_commitment_point(long idx); - byte[] release_commitment_secret(long idx); - TwoTuple key_derivation_params(); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx); - Result_SignatureNoneZ sign_justice_transaction(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc); - Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc); - Result_SignatureNoneZ sign_closing_transaction(byte[] closing_tx); - Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg); - void ready_channel(ChannelTransactionParameters channel_parameters); - byte[] write(); - } - private static class LDKChannelKeysHolder { ChannelKeys held; } - public static ChannelKeys new_impl(ChannelKeysInterface arg, ChannelPublicKeys pubkeys) { - final LDKChannelKeysHolder impl_holder = new LDKChannelKeysHolder(); - impl_holder.held = new ChannelKeys(new bindings.LDKChannelKeys() { - @Override public byte[] get_per_commitment_point(long idx) { - byte[] ret = arg.get_per_commitment_point(idx); - return ret; - } - @Override public byte[] release_commitment_secret(long idx) { - byte[] ret = arg.release_commitment_secret(idx); - return ret; - } - @Override public long key_derivation_params() { - TwoTuple ret = arg.key_derivation_params(); - long result = bindings.C2Tuple_u64u64Z_new(ret.a, ret.b); - return result; - } - @Override public long sign_counterparty_commitment(long commitment_tx) { - CommitmentTransaction commitment_tx_hu_conv = new CommitmentTransaction(null, commitment_tx); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv); - long result = ret != null ? ret.ptr : 0; - return result; - } - @Override public long sign_holder_commitment_and_htlcs(long commitment_tx) { - HolderCommitmentTransaction commitment_tx_hu_conv = new HolderCommitmentTransaction(null, commitment_tx); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv); - long result = ret != null ? ret.ptr : 0; - return result; - } - @Override public long sign_justice_transaction(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc) { - HTLCOutputInCommitment htlc_hu_conv = new HTLCOutputInCommitment(null, htlc); - Result_SignatureNoneZ ret = arg.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc_hu_conv); - long result = ret != null ? ret.ptr : 0; - return result; - } - @Override public long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc) { - HTLCOutputInCommitment htlc_hu_conv = new HTLCOutputInCommitment(null, htlc); - Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv); - long result = ret != null ? ret.ptr : 0; - return result; - } - @Override public long sign_closing_transaction(byte[] closing_tx) { - Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx); - long result = ret != null ? ret.ptr : 0; - return result; - } - @Override public long sign_channel_announcement(long msg) { - UnsignedChannelAnnouncement msg_hu_conv = new UnsignedChannelAnnouncement(null, msg); - Result_SignatureNoneZ ret = arg.sign_channel_announcement(msg_hu_conv); - long result = ret != null ? ret.ptr : 0; - return result; - } - @Override public void ready_channel(long channel_parameters) { - ChannelTransactionParameters channel_parameters_hu_conv = new ChannelTransactionParameters(null, channel_parameters); - arg.ready_channel(channel_parameters_hu_conv); - } - @Override public byte[] write() { - byte[] ret = arg.write(); - return ret; - } - }, pubkeys); - return impl_holder.held; - } - public byte[] get_per_commitment_point(long idx) { - byte[] ret = bindings.ChannelKeys_get_per_commitment_point(this.ptr, idx); - return ret; - } - - public byte[] release_commitment_secret(long idx) { - byte[] ret = bindings.ChannelKeys_release_commitment_secret(this.ptr, idx); - return ret; - } - - public TwoTuple key_derivation_params() { - long ret = bindings.ChannelKeys_key_derivation_params(this.ptr); - long ret_a = bindings.LDKC2Tuple_u64u64Z_get_a(ret); - long ret_b = bindings.LDKC2Tuple_u64u64Z_get_b(ret); - TwoTuple ret_conv = new TwoTuple(ret_a, ret_b, () -> { - bindings.C2Tuple_u64u64Z_free(ret); - }); - return ret_conv; - } - - public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx) { - long ret = bindings.ChannelKeys_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(commitment_tx); - return ret_hu_conv; - } - - public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) { - long ret = bindings.ChannelKeys_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(commitment_tx); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_justice_transaction(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc) { - long ret = bindings.ChannelKeys_sign_justice_transaction(this.ptr, justice_tx, input, amount, per_commitment_key, htlc == null ? 0 : htlc.ptr & ~1); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(htlc); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc) { - long ret = bindings.ChannelKeys_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, per_commitment_point, htlc == null ? 0 : htlc.ptr & ~1); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(htlc); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_closing_transaction(byte[] closing_tx) { - long ret = bindings.ChannelKeys_sign_closing_transaction(this.ptr, closing_tx); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) { - long ret = bindings.ChannelKeys_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(msg); - return ret_hu_conv; - } - - public void ready_channel(ChannelTransactionParameters channel_parameters) { - bindings.ChannelKeys_ready_channel(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1); - this.ptrs_to.add(channel_parameters); - } - - public byte[] write() { - byte[] ret = bindings.ChannelKeys_write(this.ptr); - return ret; - } - - public ChannelPublicKeys get_pubkeys() { - long ret = bindings.ChannelKeys_get_pubkeys(this.ptr); - ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public ChannelKeys clone() { - long ret = bindings.ChannelKeys_clone(this.ptr); - ChannelKeys ret_hu_conv = new ChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index b89636f6..4a141dee 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -36,26 +36,26 @@ public class ChannelManager extends CommonBase { public ChannelDetails[] list_channels() { long[] ret = bindings.ChannelManager_list_channels(this.ptr); - ChannelDetails[] arr_conv_16_arr = new ChannelDetails[ret.length]; + ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret.length]; for (int q = 0; q < ret.length; q++) { - long arr_conv_16 = ret[q]; - ChannelDetails arr_conv_16_hu_conv = new ChannelDetails(null, arr_conv_16); - arr_conv_16_hu_conv.ptrs_to.add(this); - arr_conv_16_arr[q] = arr_conv_16_hu_conv; + long ret_conv_16 = ret[q]; + ChannelDetails ret_conv_16_hu_conv = new ChannelDetails(null, ret_conv_16); + ret_conv_16_hu_conv.ptrs_to.add(this); + ret_conv_16_arr[q] = ret_conv_16_hu_conv; } - return arr_conv_16_arr; + return ret_conv_16_arr; } public ChannelDetails[] list_usable_channels() { long[] ret = bindings.ChannelManager_list_usable_channels(this.ptr); - ChannelDetails[] arr_conv_16_arr = new ChannelDetails[ret.length]; + ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret.length]; for (int q = 0; q < ret.length; q++) { - long arr_conv_16 = ret[q]; - ChannelDetails arr_conv_16_hu_conv = new ChannelDetails(null, arr_conv_16); - arr_conv_16_hu_conv.ptrs_to.add(this); - arr_conv_16_arr[q] = arr_conv_16_hu_conv; + long ret_conv_16 = ret[q]; + ChannelDetails ret_conv_16_hu_conv = new ChannelDetails(null, ret_conv_16); + ret_conv_16_hu_conv.ptrs_to.add(this); + ret_conv_16_arr[q] = ret_conv_16_hu_conv; } - return arr_conv_16_arr; + return ret_conv_16_arr; } public Result_NoneAPIErrorZ close_channel(byte[] channel_id) { @@ -87,7 +87,7 @@ public class ChannelManager extends CommonBase { } public void broadcast_node_announcement(byte[] rgb, byte[] alias, NetAddress[] addresses) { - bindings.ChannelManager_broadcast_node_announcement(this.ptr, rgb, alias, Arrays.stream(addresses).mapToLong(arr_conv_12 -> arr_conv_12.ptr).toArray()); + bindings.ChannelManager_broadcast_node_announcement(this.ptr, rgb, alias, Arrays.stream(addresses).mapToLong(addresses_conv_12 -> addresses_conv_12.ptr).toArray()); /* TODO 2 NetAddress */; } @@ -133,8 +133,15 @@ public class ChannelManager extends CommonBase { return ret_hu_conv; } + public Listen as_Listen() { + long ret = bindings.ChannelManager_as_Listen(this.ptr); + Listen ret_hu_conv = new Listen(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + public void block_connected(byte[] header, TwoTuple[] txdata, int height) { - bindings.ChannelManager_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(arr_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_24.a, arr_conv_24.b)).toArray(), height); + bindings.ChannelManager_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(txdata_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_24.a, txdata_conv_24.b)).toArray(), height); /* TODO 2 TwoTuple */; } @@ -142,6 +149,10 @@ public class ChannelManager extends CommonBase { bindings.ChannelManager_block_disconnected(this.ptr, header); } + public void await_persistable_update() { + bindings.ChannelManager_await_persistable_update(this.ptr); + } + public ChannelMessageHandler as_ChannelMessageHandler() { long ret = bindings.ChannelManager_as_ChannelMessageHandler(this.ptr); ChannelMessageHandler ret_hu_conv = new ChannelMessageHandler(null, ret); diff --git a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java index 96b198da..5653e5d4 100644 --- a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java +++ b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java @@ -87,7 +87,7 @@ public class ChannelManagerReadArgs extends CommonBase { } public static ChannelManagerReadArgs constructor_new(KeysInterface keys_manager, FeeEstimator fee_estimator, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Logger logger, UserConfig default_config, ChannelMonitor[] channel_monitors) { - long ret = bindings.ChannelManagerReadArgs_new(keys_manager == null ? 0 : keys_manager.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr & ~1, Arrays.stream(channel_monitors).mapToLong(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray()); + long ret = bindings.ChannelManagerReadArgs_new(keys_manager == null ? 0 : keys_manager.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr & ~1, Arrays.stream(channel_monitors).mapToLong(channel_monitors_conv_16 -> channel_monitors_conv_16 == null ? 0 : channel_monitors_conv_16.ptr & ~1).toArray()); ChannelManagerReadArgs ret_hu_conv = new ChannelManagerReadArgs(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(keys_manager); diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java index 6c395670..2b9aebe4 100644 --- a/src/main/java/org/ldk/structs/ChannelMessageHandler.java +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -26,7 +26,7 @@ public class ChannelMessageHandler extends CommonBase { void handle_funding_created(byte[] their_node_id, FundingCreated msg); void handle_funding_signed(byte[] their_node_id, FundingSigned msg); void handle_funding_locked(byte[] their_node_id, FundingLocked msg); - void handle_shutdown(byte[] their_node_id, Shutdown msg); + void handle_shutdown(byte[] their_node_id, InitFeatures their_features, Shutdown msg); void handle_closing_signed(byte[] their_node_id, ClosingSigned msg); void handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg); void handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg); @@ -69,9 +69,10 @@ public class ChannelMessageHandler extends CommonBase { FundingLocked msg_hu_conv = new FundingLocked(null, msg); arg.handle_funding_locked(their_node_id, msg_hu_conv); } - @Override public void handle_shutdown(byte[] their_node_id, long msg) { + @Override public void handle_shutdown(byte[] their_node_id, long their_features, long msg) { + InitFeatures their_features_hu_conv = new InitFeatures(null, their_features); Shutdown msg_hu_conv = new Shutdown(null, msg); - arg.handle_shutdown(their_node_id, msg_hu_conv); + arg.handle_shutdown(their_node_id, their_features_hu_conv, msg_hu_conv); } @Override public void handle_closing_signed(byte[] their_node_id, long msg) { ClosingSigned msg_hu_conv = new ClosingSigned(null, msg); @@ -154,8 +155,9 @@ public class ChannelMessageHandler extends CommonBase { this.ptrs_to.add(msg); } - public void handle_shutdown(byte[] their_node_id, Shutdown msg) { - bindings.ChannelMessageHandler_handle_shutdown(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); + public void handle_shutdown(byte[] their_node_id, InitFeatures their_features, Shutdown msg) { + bindings.ChannelMessageHandler_handle_shutdown(this.ptr, their_node_id, their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1); + this.ptrs_to.add(their_features); this.ptrs_to.add(msg); } diff --git a/src/main/java/org/ldk/structs/ChannelMonitor.java b/src/main/java/org/ldk/structs/ChannelMonitor.java index e19dfe42..84f7f4e8 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitor.java +++ b/src/main/java/org/ldk/structs/ChannelMonitor.java @@ -56,26 +56,26 @@ public class ChannelMonitor extends CommonBase { public MonitorEvent[] get_and_clear_pending_monitor_events() { long[] ret = bindings.ChannelMonitor_get_and_clear_pending_monitor_events(this.ptr); - MonitorEvent[] arr_conv_14_arr = new MonitorEvent[ret.length]; + MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length]; for (int o = 0; o < ret.length; o++) { - long arr_conv_14 = ret[o]; - MonitorEvent arr_conv_14_hu_conv = new MonitorEvent(null, arr_conv_14); - arr_conv_14_hu_conv.ptrs_to.add(this); - arr_conv_14_arr[o] = arr_conv_14_hu_conv; + long ret_conv_14 = ret[o]; + MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14); + ret_conv_14_hu_conv.ptrs_to.add(this); + ret_conv_14_arr[o] = ret_conv_14_hu_conv; } - return arr_conv_14_arr; + return ret_conv_14_arr; } public Event[] get_and_clear_pending_events() { long[] ret = bindings.ChannelMonitor_get_and_clear_pending_events(this.ptr); - Event[] arr_conv_7_arr = new Event[ret.length]; + Event[] ret_conv_7_arr = new Event[ret.length]; for (int h = 0; h < ret.length; h++) { - long arr_conv_7 = ret[h]; - Event arr_conv_7_hu_conv = Event.constr_from_ptr(arr_conv_7); - arr_conv_7_hu_conv.ptrs_to.add(this); - arr_conv_7_arr[h] = arr_conv_7_hu_conv; + long ret_conv_7 = ret[h]; + Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7); + ret_conv_7_hu_conv.ptrs_to.add(this); + ret_conv_7_arr[h] = ret_conv_7_hu_conv; } - return arr_conv_7_arr; + return ret_conv_7_arr; } public byte[][] get_latest_holder_commitment_txn(Logger logger) { @@ -85,33 +85,33 @@ public class ChannelMonitor extends CommonBase { } public TwoTuple[]>[] block_connected(byte[] header, TwoTuple[] txdata, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { - long[] ret = bindings.ChannelMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(arr_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_24.a, arr_conv_24.b)).toArray(), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); - TwoTuple[]>[] arr_conv_46_arr = new TwoTuple[ret.length]; + long[] ret = bindings.ChannelMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(txdata_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_24.a, txdata_conv_24.b)).toArray(), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + TwoTuple[]>[] ret_conv_46_arr = new TwoTuple[ret.length]; for (int u = 0; u < ret.length; u++) { - long arr_conv_46 = ret[u]; - byte[] arr_conv_46_a = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(arr_conv_46); - long[] arr_conv_46_b = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(arr_conv_46); - TwoTuple[] arr_conv_26_arr = new TwoTuple[arr_conv_46_b.length]; - for (int a = 0; a < arr_conv_46_b.length; a++) { - long arr_conv_26 = arr_conv_46_b[a]; - int arr_conv_26_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(arr_conv_26); - long arr_conv_26_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(arr_conv_26)); - TxOut arr_conv_26_b_conv = new TxOut(null, arr_conv_26_b);; - TwoTuple arr_conv_26_conv = new TwoTuple(arr_conv_26_a, arr_conv_26_b_conv, () -> { - bindings.C2Tuple_u32TxOutZ_free(arr_conv_26); + long ret_conv_46 = ret[u]; + byte[] ret_conv_46_a = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(ret_conv_46); + long[] ret_conv_46_b = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(ret_conv_46); + TwoTuple[] ret_conv_46_b_conv_26_arr = new TwoTuple[ret_conv_46_b.length]; + for (int a = 0; a < ret_conv_46_b.length; a++) { + long ret_conv_46_b_conv_26 = ret_conv_46_b[a]; + int ret_conv_46_b_conv_26_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(ret_conv_46_b_conv_26); + long ret_conv_46_b_conv_26_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(ret_conv_46_b_conv_26)); + TxOut ret_conv_46_b_conv_26_b_conv = new TxOut(null, ret_conv_46_b_conv_26_b);; + TwoTuple ret_conv_46_b_conv_26_conv = new TwoTuple(ret_conv_46_b_conv_26_a, ret_conv_46_b_conv_26_b_conv, () -> { + bindings.C2Tuple_u32TxOutZ_free(ret_conv_46_b_conv_26); }); - arr_conv_26_b_conv.ptrs_to.add(arr_conv_26_conv); - arr_conv_26_arr[a] = arr_conv_26_conv; + ret_conv_46_b_conv_26_b_conv.ptrs_to.add(ret_conv_46_b_conv_26_conv); + ret_conv_46_b_conv_26_arr[a] = ret_conv_46_b_conv_26_conv; }; - TwoTuple[]> arr_conv_46_conv = new TwoTuple[]>(arr_conv_46_a, arr_conv_26_arr); + TwoTuple[]> ret_conv_46_conv = new TwoTuple[]>(ret_conv_46_a, ret_conv_46_b_conv_26_arr); // Warning: We may not free the C tuple object! - arr_conv_46_arr[u] = arr_conv_46_conv; + ret_conv_46_arr[u] = ret_conv_46_conv; } /* TODO 2 TwoTuple */; this.ptrs_to.add(broadcaster); this.ptrs_to.add(fee_estimator); this.ptrs_to.add(logger); - return arr_conv_46_arr; + return ret_conv_46_arr; } public void block_disconnected(byte[] header, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { diff --git a/src/main/java/org/ldk/structs/CommitmentUpdate.java b/src/main/java/org/ldk/structs/CommitmentUpdate.java index d6fdfa20..b6c5d482 100644 --- a/src/main/java/org/ldk/structs/CommitmentUpdate.java +++ b/src/main/java/org/ldk/structs/CommitmentUpdate.java @@ -15,22 +15,22 @@ public class CommitmentUpdate extends CommonBase { } public void set_update_add_htlcs(UpdateAddHTLC[] val) { - bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_15 -> arr_conv_15 == null ? 0 : arr_conv_15.ptr & ~1).toArray()); + bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, Arrays.stream(val).mapToLong(val_conv_15 -> val_conv_15 == null ? 0 : val_conv_15.ptr & ~1).toArray()); /* TODO 2 UpdateAddHTLC */; } public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) { - bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_19 -> arr_conv_19 == null ? 0 : arr_conv_19.ptr & ~1).toArray()); + bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, Arrays.stream(val).mapToLong(val_conv_19 -> val_conv_19 == null ? 0 : val_conv_19.ptr & ~1).toArray()); /* TODO 2 UpdateFulfillHTLC */; } public void set_update_fail_htlcs(UpdateFailHTLC[] val) { - bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray()); + bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, Arrays.stream(val).mapToLong(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr & ~1).toArray()); /* TODO 2 UpdateFailHTLC */; } public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) { - bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_25 -> arr_conv_25 == null ? 0 : arr_conv_25.ptr & ~1).toArray()); + bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, Arrays.stream(val).mapToLong(val_conv_25 -> val_conv_25 == null ? 0 : val_conv_25.ptr & ~1).toArray()); /* TODO 2 UpdateFailMalformedHTLC */; } @@ -59,7 +59,7 @@ public class CommitmentUpdate extends CommonBase { } public static CommitmentUpdate constructor_new(UpdateAddHTLC[] update_add_htlcs_arg, UpdateFulfillHTLC[] update_fulfill_htlcs_arg, UpdateFailHTLC[] update_fail_htlcs_arg, UpdateFailMalformedHTLC[] update_fail_malformed_htlcs_arg, UpdateFee update_fee_arg, CommitmentSigned commitment_signed_arg) { - long ret = bindings.CommitmentUpdate_new(Arrays.stream(update_add_htlcs_arg).mapToLong(arr_conv_15 -> arr_conv_15 == null ? 0 : arr_conv_15.ptr & ~1).toArray(), Arrays.stream(update_fulfill_htlcs_arg).mapToLong(arr_conv_19 -> arr_conv_19 == null ? 0 : arr_conv_19.ptr & ~1).toArray(), Arrays.stream(update_fail_htlcs_arg).mapToLong(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray(), Arrays.stream(update_fail_malformed_htlcs_arg).mapToLong(arr_conv_25 -> arr_conv_25 == null ? 0 : arr_conv_25.ptr & ~1).toArray(), update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1); + long ret = bindings.CommitmentUpdate_new(Arrays.stream(update_add_htlcs_arg).mapToLong(update_add_htlcs_arg_conv_15 -> update_add_htlcs_arg_conv_15 == null ? 0 : update_add_htlcs_arg_conv_15.ptr & ~1).toArray(), Arrays.stream(update_fulfill_htlcs_arg).mapToLong(update_fulfill_htlcs_arg_conv_19 -> update_fulfill_htlcs_arg_conv_19 == null ? 0 : update_fulfill_htlcs_arg_conv_19.ptr & ~1).toArray(), Arrays.stream(update_fail_htlcs_arg).mapToLong(update_fail_htlcs_arg_conv_16 -> update_fail_htlcs_arg_conv_16 == null ? 0 : update_fail_htlcs_arg_conv_16.ptr & ~1).toArray(), Arrays.stream(update_fail_malformed_htlcs_arg).mapToLong(update_fail_malformed_htlcs_arg_conv_25 -> update_fail_malformed_htlcs_arg_conv_25 == null ? 0 : update_fail_malformed_htlcs_arg_conv_25.ptr & ~1).toArray(), update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1); CommitmentUpdate ret_hu_conv = new CommitmentUpdate(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); /* TODO 2 UpdateAddHTLC */; diff --git a/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java b/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java new file mode 100644 index 00000000..fd70cb97 --- /dev/null +++ b/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java @@ -0,0 +1,93 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class DelayedPaymentOutputDescriptor extends CommonBase { + DelayedPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.DelayedPaymentOutputDescriptor_free(ptr); } + } + + public OutPoint get_outpoint() { + long ret = bindings.DelayedPaymentOutputDescriptor_get_outpoint(this.ptr); + OutPoint ret_hu_conv = new OutPoint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public void set_outpoint(OutPoint val) { + bindings.DelayedPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + public byte[] get_per_commitment_point() { + byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr); + return ret; + } + + public void set_per_commitment_point(byte[] val) { + bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, val); + } + + public short get_to_self_delay() { + short ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr); + return ret; + } + + public void set_to_self_delay(short val) { + bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val); + } + + public void set_output(TxOut val) { + bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr); + } + + public byte[] get_revocation_pubkey() { + byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr); + return ret; + } + + public void set_revocation_pubkey(byte[] val) { + bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, val); + } + + public byte[] get_channel_keys_id() { + byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr); + return ret; + } + + public void set_channel_keys_id(byte[] val) { + bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, val); + } + + public long get_channel_value_satoshis() { + long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr); + return ret; + } + + public void set_channel_value_satoshis(long val) { + bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val); + } + + public static DelayedPaymentOutputDescriptor constructor_new(OutPoint outpoint_arg, byte[] per_commitment_point_arg, short to_self_delay_arg, TxOut output_arg, byte[] revocation_pubkey_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) { + long ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, per_commitment_point_arg, to_self_delay_arg, output_arg.ptr, revocation_pubkey_arg, channel_keys_id_arg, channel_value_satoshis_arg); + DelayedPaymentOutputDescriptor ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(outpoint_arg); + return ret_hu_conv; + } + + public DelayedPaymentOutputDescriptor clone() { + long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr); + DelayedPaymentOutputDescriptor ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(this); + 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 83ffeb55..abc24cec 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -103,14 +103,14 @@ public class Event extends CommonBase { private SpendableOutputs(long ptr, bindings.LDKEvent.SpendableOutputs obj) { super(null, ptr); long[] outputs = obj.outputs; - SpendableOutputDescriptor[] arr_conv_27_arr = new SpendableOutputDescriptor[outputs.length]; + SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs.length]; for (int b = 0; b < outputs.length; b++) { - long arr_conv_27 = outputs[b]; - SpendableOutputDescriptor arr_conv_27_hu_conv = SpendableOutputDescriptor.constr_from_ptr(arr_conv_27); - arr_conv_27_hu_conv.ptrs_to.add(this); - arr_conv_27_arr[b] = arr_conv_27_hu_conv; + long outputs_conv_27 = outputs[b]; + SpendableOutputDescriptor outputs_conv_27_hu_conv = SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27); + outputs_conv_27_hu_conv.ptrs_to.add(this); + outputs_conv_27_arr[b] = outputs_conv_27_hu_conv; } - this.outputs = arr_conv_27_arr; + this.outputs = outputs_conv_27_arr; } } } diff --git a/src/main/java/org/ldk/structs/EventsProvider.java b/src/main/java/org/ldk/structs/EventsProvider.java index f7218d2b..7bcb3367 100644 --- a/src/main/java/org/ldk/structs/EventsProvider.java +++ b/src/main/java/org/ldk/structs/EventsProvider.java @@ -28,7 +28,7 @@ public class EventsProvider extends CommonBase { impl_holder.held = new EventsProvider(new bindings.LDKEventsProvider() { @Override public long[] get_and_clear_pending_events() { Event[] ret = arg.get_and_clear_pending_events(); - long[] result = Arrays.stream(ret).mapToLong(arr_conv_7 -> arr_conv_7.ptr).toArray(); + long[] result = Arrays.stream(ret).mapToLong(ret_conv_7 -> ret_conv_7.ptr).toArray(); /* TODO 2 Event */; return result; } @@ -37,14 +37,14 @@ public class EventsProvider extends CommonBase { } public Event[] get_and_clear_pending_events() { long[] ret = bindings.EventsProvider_get_and_clear_pending_events(this.ptr); - Event[] arr_conv_7_arr = new Event[ret.length]; + Event[] ret_conv_7_arr = new Event[ret.length]; for (int h = 0; h < ret.length; h++) { - long arr_conv_7 = ret[h]; - Event arr_conv_7_hu_conv = Event.constr_from_ptr(arr_conv_7); - arr_conv_7_hu_conv.ptrs_to.add(this); - arr_conv_7_arr[h] = arr_conv_7_hu_conv; + long ret_conv_7 = ret[h]; + Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7); + ret_conv_7_hu_conv.ptrs_to.add(this); + ret_conv_7_arr[h] = ret_conv_7_hu_conv; } - return arr_conv_7_arr; + return ret_conv_7_arr; } } diff --git a/src/main/java/org/ldk/structs/InMemoryChannelKeys.java b/src/main/java/org/ldk/structs/InMemoryChannelKeys.java deleted file mode 100644 index fa9ad9d5..00000000 --- a/src/main/java/org/ldk/structs/InMemoryChannelKeys.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; - -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class InMemoryChannelKeys extends CommonBase { - InMemoryChannelKeys(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.InMemoryChannelKeys_free(ptr); } - } - - public byte[] get_funding_key() { - byte[] ret = bindings.InMemoryChannelKeys_get_funding_key(this.ptr); - return ret; - } - - public void set_funding_key(byte[] val) { - bindings.InMemoryChannelKeys_set_funding_key(this.ptr, val); - } - - public byte[] get_revocation_base_key() { - byte[] ret = bindings.InMemoryChannelKeys_get_revocation_base_key(this.ptr); - return ret; - } - - public void set_revocation_base_key(byte[] val) { - bindings.InMemoryChannelKeys_set_revocation_base_key(this.ptr, val); - } - - public byte[] get_payment_key() { - byte[] ret = bindings.InMemoryChannelKeys_get_payment_key(this.ptr); - return ret; - } - - public void set_payment_key(byte[] val) { - bindings.InMemoryChannelKeys_set_payment_key(this.ptr, val); - } - - public byte[] get_delayed_payment_base_key() { - byte[] ret = bindings.InMemoryChannelKeys_get_delayed_payment_base_key(this.ptr); - return ret; - } - - public void set_delayed_payment_base_key(byte[] val) { - bindings.InMemoryChannelKeys_set_delayed_payment_base_key(this.ptr, val); - } - - public byte[] get_htlc_base_key() { - byte[] ret = bindings.InMemoryChannelKeys_get_htlc_base_key(this.ptr); - return ret; - } - - public void set_htlc_base_key(byte[] val) { - bindings.InMemoryChannelKeys_set_htlc_base_key(this.ptr, val); - } - - public byte[] get_commitment_seed() { - byte[] ret = bindings.InMemoryChannelKeys_get_commitment_seed(this.ptr); - return ret; - } - - public void set_commitment_seed(byte[] val) { - bindings.InMemoryChannelKeys_set_commitment_seed(this.ptr, val); - } - - public InMemoryChannelKeys clone() { - long ret = bindings.InMemoryChannelKeys_clone(this.ptr); - InMemoryChannelKeys ret_hu_conv = new InMemoryChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public static InMemoryChannelKeys constructor_new(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, TwoTuple key_derivation_params) { - long ret = bindings.InMemoryChannelKeys_new(funding_key, revocation_base_key, payment_key, delayed_payment_base_key, htlc_base_key, commitment_seed, channel_value_satoshis, bindings.C2Tuple_u64u64Z_new(key_derivation_params.a, key_derivation_params.b)); - InMemoryChannelKeys ret_hu_conv = new InMemoryChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - public ChannelPublicKeys counterparty_pubkeys() { - long ret = bindings.InMemoryChannelKeys_counterparty_pubkeys(this.ptr); - ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public short counterparty_selected_contest_delay() { - short ret = bindings.InMemoryChannelKeys_counterparty_selected_contest_delay(this.ptr); - return ret; - } - - public short holder_selected_contest_delay() { - short ret = bindings.InMemoryChannelKeys_holder_selected_contest_delay(this.ptr); - return ret; - } - - public boolean is_outbound() { - boolean ret = bindings.InMemoryChannelKeys_is_outbound(this.ptr); - return ret; - } - - public OutPoint funding_outpoint() { - long ret = bindings.InMemoryChannelKeys_funding_outpoint(this.ptr); - OutPoint ret_hu_conv = new OutPoint(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public ChannelTransactionParameters get_channel_parameters() { - long ret = bindings.InMemoryChannelKeys_get_channel_parameters(this.ptr); - ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public ChannelKeys as_ChannelKeys() { - long ret = bindings.InMemoryChannelKeys_as_ChannelKeys(this.ptr); - ChannelKeys ret_hu_conv = new ChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public byte[] write() { - byte[] ret = bindings.InMemoryChannelKeys_write(this.ptr); - return ret; - } - - public static Result_InMemoryChannelKeysDecodeErrorZ constructor_read(byte[] ser) { - long ret = bindings.InMemoryChannelKeys_read(ser); - Result_InMemoryChannelKeysDecodeErrorZ ret_hu_conv = Result_InMemoryChannelKeysDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/InMemorySigner.java b/src/main/java/org/ldk/structs/InMemorySigner.java new file mode 100644 index 00000000..5bf7ca9b --- /dev/null +++ b/src/main/java/org/ldk/structs/InMemorySigner.java @@ -0,0 +1,153 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class InMemorySigner extends CommonBase { + InMemorySigner(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.InMemorySigner_free(ptr); } + } + + public byte[] get_funding_key() { + byte[] ret = bindings.InMemorySigner_get_funding_key(this.ptr); + return ret; + } + + public void set_funding_key(byte[] val) { + bindings.InMemorySigner_set_funding_key(this.ptr, val); + } + + public byte[] get_revocation_base_key() { + byte[] ret = bindings.InMemorySigner_get_revocation_base_key(this.ptr); + return ret; + } + + public void set_revocation_base_key(byte[] val) { + bindings.InMemorySigner_set_revocation_base_key(this.ptr, val); + } + + public byte[] get_payment_key() { + byte[] ret = bindings.InMemorySigner_get_payment_key(this.ptr); + return ret; + } + + public void set_payment_key(byte[] val) { + bindings.InMemorySigner_set_payment_key(this.ptr, val); + } + + public byte[] get_delayed_payment_base_key() { + byte[] ret = bindings.InMemorySigner_get_delayed_payment_base_key(this.ptr); + return ret; + } + + public void set_delayed_payment_base_key(byte[] val) { + bindings.InMemorySigner_set_delayed_payment_base_key(this.ptr, val); + } + + public byte[] get_htlc_base_key() { + byte[] ret = bindings.InMemorySigner_get_htlc_base_key(this.ptr); + return ret; + } + + public void set_htlc_base_key(byte[] val) { + bindings.InMemorySigner_set_htlc_base_key(this.ptr, val); + } + + public byte[] get_commitment_seed() { + byte[] ret = bindings.InMemorySigner_get_commitment_seed(this.ptr); + return ret; + } + + public void set_commitment_seed(byte[] val) { + bindings.InMemorySigner_set_commitment_seed(this.ptr, val); + } + + public InMemorySigner clone() { + long ret = bindings.InMemorySigner_clone(this.ptr); + InMemorySigner ret_hu_conv = new InMemorySigner(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public static InMemorySigner constructor_new(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id) { + long ret = bindings.InMemorySigner_new(funding_key, revocation_base_key, payment_key, delayed_payment_base_key, htlc_base_key, commitment_seed, channel_value_satoshis, channel_keys_id); + InMemorySigner ret_hu_conv = new InMemorySigner(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public ChannelPublicKeys counterparty_pubkeys() { + long ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr); + ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public short counterparty_selected_contest_delay() { + short ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr); + return ret; + } + + public short holder_selected_contest_delay() { + short ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr); + return ret; + } + + public boolean is_outbound() { + boolean ret = bindings.InMemorySigner_is_outbound(this.ptr); + return ret; + } + + public OutPoint funding_outpoint() { + long ret = bindings.InMemorySigner_funding_outpoint(this.ptr); + OutPoint ret_hu_conv = new OutPoint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public ChannelTransactionParameters get_channel_parameters() { + long ret = bindings.InMemorySigner_get_channel_parameters(this.ptr); + ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(byte[] spend_tx, long input_idx, StaticPaymentOutputDescriptor descriptor) { + long ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); + Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(descriptor); + return ret_hu_conv; + } + + public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, DelayedPaymentOutputDescriptor descriptor) { + long ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); + Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(descriptor); + return ret_hu_conv; + } + + public Sign as_Sign() { + long ret = bindings.InMemorySigner_as_Sign(this.ptr); + Sign ret_hu_conv = new Sign(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public byte[] write() { + byte[] ret = bindings.InMemorySigner_write(this.ptr); + return ret; + } + + public static Result_InMemorySignerDecodeErrorZ constructor_read(byte[] ser) { + long ret = bindings.InMemorySigner_read(ser); + Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index cadc4f31..867b1ab9 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -14,6 +14,26 @@ public class Init extends CommonBase { if (ptr != 0) { bindings.Init_free(ptr); } } + public InitFeatures get_features() { + long ret = bindings.Init_get_features(this.ptr); + InitFeatures ret_hu_conv = new InitFeatures(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public void set_features(InitFeatures val) { + bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + public static Init constructor_new(InitFeatures features_arg) { + long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1); + Init ret_hu_conv = new Init(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(features_arg); + return ret_hu_conv; + } + public Init clone() { long ret = bindings.Init_clone(this.ptr); Init ret_hu_conv = new Init(null, ret); diff --git a/src/main/java/org/ldk/structs/KeysInterface.java b/src/main/java/org/ldk/structs/KeysInterface.java index 84a27623..d3463631 100644 --- a/src/main/java/org/ldk/structs/KeysInterface.java +++ b/src/main/java/org/ldk/structs/KeysInterface.java @@ -23,9 +23,9 @@ public class KeysInterface extends CommonBase { byte[] get_node_secret(); byte[] get_destination_script(); byte[] get_shutdown_pubkey(); - ChannelKeys get_channel_keys(boolean inbound, long channel_value_satoshis); + Sign get_channel_signer(boolean inbound, long channel_value_satoshis); byte[] get_secure_random_bytes(); - Result_ChannelKeysDecodeErrorZ read_chan_signer(byte[] reader); + Result_SignDecodeErrorZ read_chan_signer(byte[] reader); } private static class LDKKeysInterfaceHolder { KeysInterface held; } public static KeysInterface new_impl(KeysInterfaceInterface arg) { @@ -43,8 +43,8 @@ public class KeysInterface extends CommonBase { byte[] ret = arg.get_shutdown_pubkey(); return ret; } - @Override public long get_channel_keys(boolean inbound, long channel_value_satoshis) { - ChannelKeys ret = arg.get_channel_keys(inbound, channel_value_satoshis); + @Override public long get_channel_signer(boolean inbound, long channel_value_satoshis) { + Sign ret = arg.get_channel_signer(inbound, channel_value_satoshis); long result = ret == null ? 0 : ret.ptr; impl_holder.held.ptrs_to.add(ret); return result; @@ -54,7 +54,7 @@ public class KeysInterface extends CommonBase { return ret; } @Override public long read_chan_signer(byte[] reader) { - Result_ChannelKeysDecodeErrorZ ret = arg.read_chan_signer(reader); + Result_SignDecodeErrorZ ret = arg.read_chan_signer(reader); long result = ret != null ? ret.ptr : 0; return result; } @@ -76,9 +76,9 @@ public class KeysInterface extends CommonBase { return ret; } - public ChannelKeys get_channel_keys(boolean inbound, long channel_value_satoshis) { - long ret = bindings.KeysInterface_get_channel_keys(this.ptr, inbound, channel_value_satoshis); - ChannelKeys ret_hu_conv = new ChannelKeys(null, ret); + public Sign get_channel_signer(boolean inbound, long channel_value_satoshis) { + long ret = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis); + Sign ret_hu_conv = new Sign(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -88,9 +88,9 @@ public class KeysInterface extends CommonBase { return ret; } - public Result_ChannelKeysDecodeErrorZ read_chan_signer(byte[] reader) { + public Result_SignDecodeErrorZ read_chan_signer(byte[] reader) { long ret = bindings.KeysInterface_read_chan_signer(this.ptr, reader); - Result_ChannelKeysDecodeErrorZ ret_hu_conv = Result_ChannelKeysDecodeErrorZ.constr_from_ptr(ret); + Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/KeysManager.java b/src/main/java/org/ldk/structs/KeysManager.java index 16a4a873..c0c4cfe6 100644 --- a/src/main/java/org/ldk/structs/KeysManager.java +++ b/src/main/java/org/ldk/structs/KeysManager.java @@ -14,20 +14,28 @@ public class KeysManager extends CommonBase { if (ptr != 0) { bindings.KeysManager_free(ptr); } } - public static KeysManager constructor_new(byte[] seed, LDKNetwork network, long starting_time_secs, int starting_time_nanos) { - long ret = bindings.KeysManager_new(seed, network, starting_time_secs, starting_time_nanos); + public static KeysManager constructor_new(byte[] seed, long starting_time_secs, int starting_time_nanos) { + long ret = bindings.KeysManager_new(seed, starting_time_secs, starting_time_nanos); KeysManager ret_hu_conv = new KeysManager(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } - public InMemoryChannelKeys derive_channel_keys(long channel_value_satoshis, long params_1, long params_2) { - long ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, params_1, params_2); - InMemoryChannelKeys ret_hu_conv = new InMemoryChannelKeys(null, ret); + public InMemorySigner derive_channel_keys(long channel_value_satoshis, byte[] params) { + long ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, params); + InMemorySigner ret_hu_conv = new InMemorySigner(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight) { + long ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray(), Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray(), change_destination_script, feerate_sat_per_1000_weight); + Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); + /* TODO 2 SpendableOutputDescriptor */; + /* TODO 2 TxOut */; + return ret_hu_conv; + } + public KeysInterface as_KeysInterface() { long ret = bindings.KeysManager_as_KeysInterface(this.ptr); KeysInterface ret_hu_conv = new KeysInterface(null, ret); diff --git a/src/main/java/org/ldk/structs/Listen.java b/src/main/java/org/ldk/structs/Listen.java new file mode 100644 index 00000000..075137cb --- /dev/null +++ b/src/main/java/org/ldk/structs/Listen.java @@ -0,0 +1,47 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Listen extends CommonBase { + final bindings.LDKListen bindings_instance; + Listen(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private Listen(bindings.LDKListen arg) { + super(bindings.LDKListen_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.Listen_free(ptr); } super.finalize(); + } + + public static interface ListenInterface { + void block_connected(byte[] block, int height); + void block_disconnected(byte[] header, int height); + } + private static class LDKListenHolder { Listen held; } + public static Listen new_impl(ListenInterface arg) { + final LDKListenHolder impl_holder = new LDKListenHolder(); + impl_holder.held = new Listen(new bindings.LDKListen() { + @Override public void block_connected(byte[] block, int height) { + arg.block_connected(block, height); + } + @Override public void block_disconnected(byte[] header, int height) { + arg.block_disconnected(header, height); + } + }); + return impl_holder.held; + } + public void block_connected(byte[] block, int height) { + bindings.Listen_block_connected(this.ptr, block, height); + } + + public void block_disconnected(byte[] header, int height) { + bindings.Listen_block_disconnected(this.ptr, header, height); + } + +} diff --git a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java index 6237ba35..c8bc2387 100644 --- a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java +++ b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java @@ -28,7 +28,7 @@ public class MessageSendEventsProvider extends CommonBase { impl_holder.held = new MessageSendEventsProvider(new bindings.LDKMessageSendEventsProvider() { @Override public long[] get_and_clear_pending_msg_events() { MessageSendEvent[] ret = arg.get_and_clear_pending_msg_events(); - long[] result = Arrays.stream(ret).mapToLong(arr_conv_18 -> arr_conv_18.ptr).toArray(); + long[] result = Arrays.stream(ret).mapToLong(ret_conv_18 -> ret_conv_18.ptr).toArray(); /* TODO 2 MessageSendEvent */; return result; } @@ -37,14 +37,14 @@ public class MessageSendEventsProvider extends CommonBase { } public MessageSendEvent[] get_and_clear_pending_msg_events() { long[] ret = bindings.MessageSendEventsProvider_get_and_clear_pending_msg_events(this.ptr); - MessageSendEvent[] arr_conv_18_arr = new MessageSendEvent[ret.length]; + MessageSendEvent[] ret_conv_18_arr = new MessageSendEvent[ret.length]; for (int s = 0; s < ret.length; s++) { - long arr_conv_18 = ret[s]; - MessageSendEvent arr_conv_18_hu_conv = MessageSendEvent.constr_from_ptr(arr_conv_18); - arr_conv_18_hu_conv.ptrs_to.add(this); - arr_conv_18_arr[s] = arr_conv_18_hu_conv; + long ret_conv_18 = ret[s]; + MessageSendEvent ret_conv_18_hu_conv = MessageSendEvent.constr_from_ptr(ret_conv_18); + ret_conv_18_hu_conv.ptrs_to.add(this); + ret_conv_18_arr[s] = ret_conv_18_hu_conv; } - return arr_conv_18_arr; + return ret_conv_18_arr; } } diff --git a/src/main/java/org/ldk/structs/MonitorEvent.java b/src/main/java/org/ldk/structs/MonitorEvent.java index 68106397..c6500e64 100644 --- a/src/main/java/org/ldk/structs/MonitorEvent.java +++ b/src/main/java/org/ldk/structs/MonitorEvent.java @@ -7,18 +7,31 @@ import java.util.Arrays; @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class MonitorEvent extends CommonBase { - MonitorEvent(Object _dummy, long ptr) { super(ptr); } + private MonitorEvent(Object _dummy, long ptr) { super(ptr); } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); if (ptr != 0) { bindings.MonitorEvent_free(ptr); } } - - public MonitorEvent clone() { - long ret = bindings.MonitorEvent_clone(this.ptr); - MonitorEvent ret_hu_conv = new MonitorEvent(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; + static MonitorEvent constr_from_ptr(long ptr) { + bindings.LDKMonitorEvent raw_val = bindings.LDKMonitorEvent_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKMonitorEvent.HTLCEvent.class) { + return new HTLCEvent(ptr, (bindings.LDKMonitorEvent.HTLCEvent)raw_val); + } + if (raw_val.getClass() == bindings.LDKMonitorEvent.CommitmentTxBroadcasted.class) { + return new CommitmentTxBroadcasted(ptr, (bindings.LDKMonitorEvent.CommitmentTxBroadcasted)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface } + public final static class HTLCEvent extends MonitorEvent { + private HTLCEvent(long ptr, bindings.LDKMonitorEvent.HTLCEvent obj) { + super(null, ptr); + } + } + public final static class CommitmentTxBroadcasted extends MonitorEvent { + private CommitmentTxBroadcasted(long ptr, bindings.LDKMonitorEvent.CommitmentTxBroadcasted obj) { + super(null, ptr); + } + } } diff --git a/src/main/java/org/ldk/structs/NetGraphMsgHandler.java b/src/main/java/org/ldk/structs/NetGraphMsgHandler.java index 2351063e..898c536c 100644 --- a/src/main/java/org/ldk/structs/NetGraphMsgHandler.java +++ b/src/main/java/org/ldk/structs/NetGraphMsgHandler.java @@ -23,12 +23,13 @@ public class NetGraphMsgHandler extends CommonBase { return ret_hu_conv; } - public static NetGraphMsgHandler constructor_from_net_graph(Access chain_access, Logger logger, byte[] network_graph_genesis_hash) { - long ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, bindings.NetworkGraph_new(network_graph_genesis_hash)); + public static NetGraphMsgHandler constructor_from_net_graph(Access chain_access, Logger logger, NetworkGraph network_graph) { + long ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, network_graph == null ? 0 : network_graph.ptr & ~1); NetGraphMsgHandler ret_hu_conv = new NetGraphMsgHandler(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(chain_access); ret_hu_conv.ptrs_to.add(logger); + ret_hu_conv.ptrs_to.add(network_graph); return ret_hu_conv; } diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java index 9ed88b6d..b8badcc5 100644 --- a/src/main/java/org/ldk/structs/NetworkGraph.java +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -14,6 +14,13 @@ public class NetworkGraph extends CommonBase { if (ptr != 0) { bindings.NetworkGraph_free(ptr); } } + public NetworkGraph clone() { + long ret = bindings.NetworkGraph_clone(this.ptr); + NetworkGraph ret_hu_conv = new NetworkGraph(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + public byte[] write() { byte[] ret = bindings.NetworkGraph_write(this.ptr); return ret; diff --git a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java index 3c633bbf..561b4dd3 100644 --- a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java +++ b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java @@ -54,7 +54,7 @@ public class NodeAnnouncementInfo extends CommonBase { } public void set_addresses(NetAddress[] val) { - bindings.NodeAnnouncementInfo_set_addresses(this.ptr, Arrays.stream(val).mapToLong(arr_conv_12 -> arr_conv_12.ptr).toArray()); + bindings.NodeAnnouncementInfo_set_addresses(this.ptr, Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray()); /* TODO 2 NetAddress */; } @@ -71,7 +71,7 @@ public class NodeAnnouncementInfo extends CommonBase { } public static NodeAnnouncementInfo constructor_new(NodeFeatures features_arg, int last_update_arg, byte[] rgb_arg, byte[] alias_arg, NetAddress[] addresses_arg, NodeAnnouncement announcement_message_arg) { - long ret = bindings.NodeAnnouncementInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, last_update_arg, rgb_arg, alias_arg, Arrays.stream(addresses_arg).mapToLong(arr_conv_12 -> arr_conv_12.ptr).toArray(), announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); + long ret = bindings.NodeAnnouncementInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, last_update_arg, rgb_arg, alias_arg, Arrays.stream(addresses_arg).mapToLong(addresses_arg_conv_12 -> addresses_arg_conv_12.ptr).toArray(), announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); NodeAnnouncementInfo ret_hu_conv = new NodeAnnouncementInfo(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(features_arg); diff --git a/src/main/java/org/ldk/structs/PaymentSendFailure.java b/src/main/java/org/ldk/structs/PaymentSendFailure.java index 48fd7a02..af08d8cc 100644 --- a/src/main/java/org/ldk/structs/PaymentSendFailure.java +++ b/src/main/java/org/ldk/structs/PaymentSendFailure.java @@ -7,18 +7,47 @@ import java.util.Arrays; @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class PaymentSendFailure extends CommonBase { - PaymentSendFailure(Object _dummy, long ptr) { super(ptr); } + private PaymentSendFailure(Object _dummy, long ptr) { super(ptr); } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { super.finalize(); if (ptr != 0) { bindings.PaymentSendFailure_free(ptr); } } - - public PaymentSendFailure clone() { - long ret = bindings.PaymentSendFailure_clone(this.ptr); - PaymentSendFailure ret_hu_conv = new PaymentSendFailure(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; + static PaymentSendFailure constr_from_ptr(long ptr) { + bindings.LDKPaymentSendFailure raw_val = bindings.LDKPaymentSendFailure_ref_from_ptr(ptr); + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.ParameterError.class) { + return new ParameterError(ptr, (bindings.LDKPaymentSendFailure.ParameterError)raw_val); + } + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.PathParameterError.class) { + return new PathParameterError(ptr, (bindings.LDKPaymentSendFailure.PathParameterError)raw_val); + } + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.AllFailedRetrySafe.class) { + return new AllFailedRetrySafe(ptr, (bindings.LDKPaymentSendFailure.AllFailedRetrySafe)raw_val); + } + if (raw_val.getClass() == bindings.LDKPaymentSendFailure.PartialFailure.class) { + return new PartialFailure(ptr, (bindings.LDKPaymentSendFailure.PartialFailure)raw_val); + } + assert false; return null; // Unreachable without extending the (internal) bindings interface } + public final static class ParameterError extends PaymentSendFailure { + private ParameterError(long ptr, bindings.LDKPaymentSendFailure.ParameterError obj) { + super(null, ptr); + } + } + public final static class PathParameterError extends PaymentSendFailure { + private PathParameterError(long ptr, bindings.LDKPaymentSendFailure.PathParameterError obj) { + super(null, ptr); + } + } + public final static class AllFailedRetrySafe extends PaymentSendFailure { + private AllFailedRetrySafe(long ptr, bindings.LDKPaymentSendFailure.AllFailedRetrySafe obj) { + super(null, ptr); + } + } + public final static class PartialFailure extends PaymentSendFailure { + private PartialFailure(long ptr, bindings.LDKPaymentSendFailure.PartialFailure obj) { + super(null, ptr); + } + } } diff --git a/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java new file mode 100644 index 00000000..b1ade8ba --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_AcceptChannelDecodeErrorZ extends CommonBase { + private Result_AcceptChannelDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_AcceptChannelDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_AcceptChannelDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_AcceptChannelDecodeErrorZ_result_ok(ptr)) { + return new Result_AcceptChannelDecodeErrorZ_OK(null, ptr); + } else { + return new Result_AcceptChannelDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_AcceptChannelDecodeErrorZ_OK extends Result_AcceptChannelDecodeErrorZ { + public final AcceptChannel res; + private Result_AcceptChannelDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_AcceptChannelDecodeErrorZ_get_ok(ptr); + AcceptChannel res_hu_conv = new AcceptChannel(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_AcceptChannelDecodeErrorZ_OK(AcceptChannel res) { + this(null, bindings.CResult_AcceptChannelDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_AcceptChannelDecodeErrorZ_Err extends Result_AcceptChannelDecodeErrorZ { + public final DecodeError err; + private Result_AcceptChannelDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_AcceptChannelDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_AcceptChannelDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_AcceptChannelDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java new file mode 100644 index 00000000..4eb9142f --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { + private Result_AnnouncementSignaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_AnnouncementSignaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_AnnouncementSignaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_AnnouncementSignaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_AnnouncementSignaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_AnnouncementSignaturesDecodeErrorZ_OK extends Result_AnnouncementSignaturesDecodeErrorZ { + public final AnnouncementSignatures res; + private Result_AnnouncementSignaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(ptr); + AnnouncementSignatures res_hu_conv = new AnnouncementSignatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_AnnouncementSignaturesDecodeErrorZ_OK(AnnouncementSignatures res) { + this(null, bindings.CResult_AnnouncementSignaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_AnnouncementSignaturesDecodeErrorZ_Err extends Result_AnnouncementSignaturesDecodeErrorZ { + public final DecodeError err; + private Result_AnnouncementSignaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_AnnouncementSignaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_AnnouncementSignaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java new file mode 100644 index 00000000..ad631f5e --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { + private Result_BuiltCommitmentTransactionDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_BuiltCommitmentTransactionDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(ptr)) { + return new Result_BuiltCommitmentTransactionDecodeErrorZ_OK(null, ptr); + } else { + return new Result_BuiltCommitmentTransactionDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_BuiltCommitmentTransactionDecodeErrorZ_OK extends Result_BuiltCommitmentTransactionDecodeErrorZ { + public final BuiltCommitmentTransaction res; + private Result_BuiltCommitmentTransactionDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(ptr); + BuiltCommitmentTransaction res_hu_conv = new BuiltCommitmentTransaction(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_BuiltCommitmentTransactionDecodeErrorZ_OK(BuiltCommitmentTransaction res) { + this(null, bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_BuiltCommitmentTransactionDecodeErrorZ_Err extends Result_BuiltCommitmentTransactionDecodeErrorZ { + public final DecodeError err; + private Result_BuiltCommitmentTransactionDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_BuiltCommitmentTransactionDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_CVec_CVec_u8ZZNoneZ.java b/src/main/java/org/ldk/structs/Result_CVec_CVec_u8ZZNoneZ.java new file mode 100644 index 00000000..8667abc4 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_CVec_CVec_u8ZZNoneZ.java @@ -0,0 +1,41 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_CVec_CVec_u8ZZNoneZ extends CommonBase { + private Result_CVec_CVec_u8ZZNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CVec_CVec_u8ZZNoneZ_free(ptr); } super.finalize(); + } + + static Result_CVec_CVec_u8ZZNoneZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(ptr)) { + return new Result_CVec_CVec_u8ZZNoneZ_OK(null, ptr); + } else { + return new Result_CVec_CVec_u8ZZNoneZ_Err(null, ptr); + } + } + public static final class Result_CVec_CVec_u8ZZNoneZ_OK extends Result_CVec_CVec_u8ZZNoneZ { + public final byte[][] res; + private Result_CVec_CVec_u8ZZNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(ptr); + } + public Result_CVec_CVec_u8ZZNoneZ_OK(byte[][] res) { + this(null, bindings.CResult_CVec_CVec_u8ZZNoneZ_ok(res)); + } + } + + public static final class Result_CVec_CVec_u8ZZNoneZ_Err extends Result_CVec_CVec_u8ZZNoneZ { + private Result_CVec_CVec_u8ZZNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + public Result_CVec_CVec_u8ZZNoneZ_Err() { + this(null, bindings.CResult_CVec_CVec_u8ZZNoneZ_err()); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java new file mode 100644 index 00000000..d0dd49e1 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { + private Result_ChannelAnnouncementDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelAnnouncementDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelAnnouncementDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelAnnouncementDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelAnnouncementDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelAnnouncementDecodeErrorZ_OK extends Result_ChannelAnnouncementDecodeErrorZ { + public final ChannelAnnouncement res; + private Result_ChannelAnnouncementDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(ptr); + ChannelAnnouncement res_hu_conv = new ChannelAnnouncement(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelAnnouncementDecodeErrorZ_OK(ChannelAnnouncement res) { + this(null, bindings.CResult_ChannelAnnouncementDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelAnnouncementDecodeErrorZ_Err extends Result_ChannelAnnouncementDecodeErrorZ { + public final DecodeError err; + private Result_ChannelAnnouncementDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelAnnouncementDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ChannelAnnouncementDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelAnnouncementDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java new file mode 100644 index 00000000..f58e2d12 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ChannelConfigDecodeErrorZ extends CommonBase { + private Result_ChannelConfigDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelConfigDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelConfigDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelConfigDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelConfigDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelConfigDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelConfigDecodeErrorZ_OK extends Result_ChannelConfigDecodeErrorZ { + public final ChannelConfig res; + private Result_ChannelConfigDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelConfigDecodeErrorZ_get_ok(ptr); + ChannelConfig res_hu_conv = new ChannelConfig(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelConfigDecodeErrorZ_OK(ChannelConfig res) { + this(null, bindings.CResult_ChannelConfigDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelConfigDecodeErrorZ_Err extends Result_ChannelConfigDecodeErrorZ { + public final DecodeError err; + private Result_ChannelConfigDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelConfigDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ChannelConfigDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelConfigDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java new file mode 100644 index 00000000..e8042219 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ChannelFeaturesDecodeErrorZ extends CommonBase { + private Result_ChannelFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelFeaturesDecodeErrorZ_OK extends Result_ChannelFeaturesDecodeErrorZ { + public final ChannelFeatures res; + private Result_ChannelFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(ptr); + ChannelFeatures res_hu_conv = new ChannelFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelFeaturesDecodeErrorZ_OK(ChannelFeatures res) { + this(null, bindings.CResult_ChannelFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelFeaturesDecodeErrorZ_Err extends Result_ChannelFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_ChannelFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ChannelFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java new file mode 100644 index 00000000..ca7a8b3d --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ChannelInfoDecodeErrorZ extends CommonBase { + private Result_ChannelInfoDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelInfoDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelInfoDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelInfoDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelInfoDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelInfoDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelInfoDecodeErrorZ_OK extends Result_ChannelInfoDecodeErrorZ { + public final ChannelInfo res; + private Result_ChannelInfoDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelInfoDecodeErrorZ_get_ok(ptr); + ChannelInfo res_hu_conv = new ChannelInfo(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelInfoDecodeErrorZ_OK(ChannelInfo res) { + this(null, bindings.CResult_ChannelInfoDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelInfoDecodeErrorZ_Err extends Result_ChannelInfoDecodeErrorZ { + public final DecodeError err; + private Result_ChannelInfoDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelInfoDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ChannelInfoDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelInfoDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java new file mode 100644 index 00000000..3093a787 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { + private Result_ChannelPublicKeysDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelPublicKeysDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelPublicKeysDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelPublicKeysDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelPublicKeysDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelPublicKeysDecodeErrorZ_OK extends Result_ChannelPublicKeysDecodeErrorZ { + public final ChannelPublicKeys res; + private Result_ChannelPublicKeysDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(ptr); + ChannelPublicKeys res_hu_conv = new ChannelPublicKeys(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelPublicKeysDecodeErrorZ_OK(ChannelPublicKeys res) { + this(null, bindings.CResult_ChannelPublicKeysDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelPublicKeysDecodeErrorZ_Err extends Result_ChannelPublicKeysDecodeErrorZ { + public final DecodeError err; + private Result_ChannelPublicKeysDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ChannelPublicKeysDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelPublicKeysDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java new file mode 100644 index 00000000..49ba747a --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase { + private Result_ChannelTransactionParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelTransactionParametersDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelTransactionParametersDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelTransactionParametersDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelTransactionParametersDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelTransactionParametersDecodeErrorZ_OK extends Result_ChannelTransactionParametersDecodeErrorZ { + public final ChannelTransactionParameters res; + private Result_ChannelTransactionParametersDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(ptr); + ChannelTransactionParameters res_hu_conv = new ChannelTransactionParameters(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelTransactionParametersDecodeErrorZ_OK(ChannelTransactionParameters res) { + this(null, bindings.CResult_ChannelTransactionParametersDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelTransactionParametersDecodeErrorZ_Err extends Result_ChannelTransactionParametersDecodeErrorZ { + public final DecodeError err; + private Result_ChannelTransactionParametersDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ChannelTransactionParametersDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelTransactionParametersDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java new file mode 100644 index 00000000..7609ceac --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { + private Result_ChannelUpdateDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelUpdateDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelUpdateDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelUpdateDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelUpdateDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelUpdateDecodeErrorZ_OK extends Result_ChannelUpdateDecodeErrorZ { + public final ChannelUpdate res; + private Result_ChannelUpdateDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(ptr); + ChannelUpdate res_hu_conv = new ChannelUpdate(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelUpdateDecodeErrorZ_OK(ChannelUpdate res) { + this(null, bindings.CResult_ChannelUpdateDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelUpdateDecodeErrorZ_Err extends Result_ChannelUpdateDecodeErrorZ { + public final DecodeError err; + private Result_ChannelUpdateDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelUpdateDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ChannelUpdateDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelUpdateDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java new file mode 100644 index 00000000..b02b6924 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ClosingSignedDecodeErrorZ extends CommonBase { + private Result_ClosingSignedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ClosingSignedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ClosingSignedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ClosingSignedDecodeErrorZ_result_ok(ptr)) { + return new Result_ClosingSignedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ClosingSignedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ClosingSignedDecodeErrorZ_OK extends Result_ClosingSignedDecodeErrorZ { + public final ClosingSigned res; + private Result_ClosingSignedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ClosingSignedDecodeErrorZ_get_ok(ptr); + ClosingSigned res_hu_conv = new ClosingSigned(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ClosingSignedDecodeErrorZ_OK(ClosingSigned res) { + this(null, bindings.CResult_ClosingSignedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ClosingSignedDecodeErrorZ_Err extends Result_ClosingSignedDecodeErrorZ { + public final DecodeError err; + private Result_ClosingSignedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ClosingSignedDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ClosingSignedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ClosingSignedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java new file mode 100644 index 00000000..da17497b --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { + private Result_CommitmentSignedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CommitmentSignedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CommitmentSignedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(ptr)) { + return new Result_CommitmentSignedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CommitmentSignedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CommitmentSignedDecodeErrorZ_OK extends Result_CommitmentSignedDecodeErrorZ { + public final CommitmentSigned res; + private Result_CommitmentSignedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(ptr); + CommitmentSigned res_hu_conv = new CommitmentSigned(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_CommitmentSignedDecodeErrorZ_OK(CommitmentSigned res) { + this(null, bindings.CResult_CommitmentSignedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_CommitmentSignedDecodeErrorZ_Err extends Result_CommitmentSignedDecodeErrorZ { + public final DecodeError err; + private Result_CommitmentSignedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_CommitmentSignedDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_CommitmentSignedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_CommitmentSignedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java new file mode 100644 index 00000000..43d4745b --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { + private Result_CommitmentTransactionDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CommitmentTransactionDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CommitmentTransactionDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(ptr)) { + return new Result_CommitmentTransactionDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CommitmentTransactionDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CommitmentTransactionDecodeErrorZ_OK extends Result_CommitmentTransactionDecodeErrorZ { + public final CommitmentTransaction res; + private Result_CommitmentTransactionDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(ptr); + CommitmentTransaction res_hu_conv = new CommitmentTransaction(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_CommitmentTransactionDecodeErrorZ_OK(CommitmentTransaction res) { + this(null, bindings.CResult_CommitmentTransactionDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_CommitmentTransactionDecodeErrorZ_Err extends Result_CommitmentTransactionDecodeErrorZ { + public final DecodeError err; + private Result_CommitmentTransactionDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_CommitmentTransactionDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_CommitmentTransactionDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java new file mode 100644 index 00000000..aa3bc8e4 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends CommonBase { + private Result_CounterpartyChannelTransactionParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CounterpartyChannelTransactionParametersDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(ptr)) { + return new Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK extends Result_CounterpartyChannelTransactionParametersDecodeErrorZ { + public final CounterpartyChannelTransactionParameters res; + private Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(ptr); + CounterpartyChannelTransactionParameters res_hu_conv = new CounterpartyChannelTransactionParameters(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK(CounterpartyChannelTransactionParameters res) { + this(null, bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err extends Result_CounterpartyChannelTransactionParametersDecodeErrorZ { + public final DecodeError err; + private Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java new file mode 100644 index 00000000..ae050e88 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { + private Result_DirectionalChannelInfoDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_DirectionalChannelInfoDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_DirectionalChannelInfoDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(ptr)) { + return new Result_DirectionalChannelInfoDecodeErrorZ_OK(null, ptr); + } else { + return new Result_DirectionalChannelInfoDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_DirectionalChannelInfoDecodeErrorZ_OK extends Result_DirectionalChannelInfoDecodeErrorZ { + public final DirectionalChannelInfo res; + private Result_DirectionalChannelInfoDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(ptr); + DirectionalChannelInfo res_hu_conv = new DirectionalChannelInfo(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_DirectionalChannelInfoDecodeErrorZ_OK(DirectionalChannelInfo res) { + this(null, bindings.CResult_DirectionalChannelInfoDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_DirectionalChannelInfoDecodeErrorZ_Err extends Result_DirectionalChannelInfoDecodeErrorZ { + public final DecodeError err; + private Result_DirectionalChannelInfoDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_DirectionalChannelInfoDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_DirectionalChannelInfoDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java new file mode 100644 index 00000000..026c7f18 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_FundingCreatedDecodeErrorZ extends CommonBase { + private Result_FundingCreatedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_FundingCreatedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_FundingCreatedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_FundingCreatedDecodeErrorZ_result_ok(ptr)) { + return new Result_FundingCreatedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_FundingCreatedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_FundingCreatedDecodeErrorZ_OK extends Result_FundingCreatedDecodeErrorZ { + public final FundingCreated res; + private Result_FundingCreatedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_FundingCreatedDecodeErrorZ_get_ok(ptr); + FundingCreated res_hu_conv = new FundingCreated(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_FundingCreatedDecodeErrorZ_OK(FundingCreated res) { + this(null, bindings.CResult_FundingCreatedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_FundingCreatedDecodeErrorZ_Err extends Result_FundingCreatedDecodeErrorZ { + public final DecodeError err; + private Result_FundingCreatedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_FundingCreatedDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_FundingCreatedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_FundingCreatedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_FundingLockedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingLockedDecodeErrorZ.java new file mode 100644 index 00000000..c43294ab --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_FundingLockedDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_FundingLockedDecodeErrorZ extends CommonBase { + private Result_FundingLockedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_FundingLockedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_FundingLockedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_FundingLockedDecodeErrorZ_result_ok(ptr)) { + return new Result_FundingLockedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_FundingLockedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_FundingLockedDecodeErrorZ_OK extends Result_FundingLockedDecodeErrorZ { + public final FundingLocked res; + private Result_FundingLockedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_FundingLockedDecodeErrorZ_get_ok(ptr); + FundingLocked res_hu_conv = new FundingLocked(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_FundingLockedDecodeErrorZ_OK(FundingLocked res) { + this(null, bindings.CResult_FundingLockedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_FundingLockedDecodeErrorZ_Err extends Result_FundingLockedDecodeErrorZ { + public final DecodeError err; + private Result_FundingLockedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_FundingLockedDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_FundingLockedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_FundingLockedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java new file mode 100644 index 00000000..aaa7de2d --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_FundingSignedDecodeErrorZ extends CommonBase { + private Result_FundingSignedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_FundingSignedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_FundingSignedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_FundingSignedDecodeErrorZ_result_ok(ptr)) { + return new Result_FundingSignedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_FundingSignedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_FundingSignedDecodeErrorZ_OK extends Result_FundingSignedDecodeErrorZ { + public final FundingSigned res; + private Result_FundingSignedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_FundingSignedDecodeErrorZ_get_ok(ptr); + FundingSigned res_hu_conv = new FundingSigned(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_FundingSignedDecodeErrorZ_OK(FundingSigned res) { + this(null, bindings.CResult_FundingSignedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_FundingSignedDecodeErrorZ_Err extends Result_FundingSignedDecodeErrorZ { + public final DecodeError err; + private Result_FundingSignedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_FundingSignedDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_FundingSignedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_FundingSignedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java new file mode 100644 index 00000000..b9a23fb4 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { + private Result_HTLCOutputInCommitmentDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_HTLCOutputInCommitmentDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(ptr)) { + return new Result_HTLCOutputInCommitmentDecodeErrorZ_OK(null, ptr); + } else { + return new Result_HTLCOutputInCommitmentDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_HTLCOutputInCommitmentDecodeErrorZ_OK extends Result_HTLCOutputInCommitmentDecodeErrorZ { + public final HTLCOutputInCommitment res; + private Result_HTLCOutputInCommitmentDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(ptr); + HTLCOutputInCommitment res_hu_conv = new HTLCOutputInCommitment(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_HTLCOutputInCommitmentDecodeErrorZ_OK(HTLCOutputInCommitment res) { + this(null, bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_HTLCOutputInCommitmentDecodeErrorZ_Err extends Result_HTLCOutputInCommitmentDecodeErrorZ { + public final DecodeError err; + private Result_HTLCOutputInCommitmentDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_HTLCOutputInCommitmentDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java new file mode 100644 index 00000000..73b3d202 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { + private Result_HTLCUpdateDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_HTLCUpdateDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_HTLCUpdateDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(ptr)) { + return new Result_HTLCUpdateDecodeErrorZ_OK(null, ptr); + } else { + return new Result_HTLCUpdateDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_HTLCUpdateDecodeErrorZ_OK extends Result_HTLCUpdateDecodeErrorZ { + public final HTLCUpdate res; + private Result_HTLCUpdateDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(ptr); + HTLCUpdate res_hu_conv = new HTLCUpdate(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_HTLCUpdateDecodeErrorZ_OK(HTLCUpdate res) { + this(null, bindings.CResult_HTLCUpdateDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_HTLCUpdateDecodeErrorZ_Err extends Result_HTLCUpdateDecodeErrorZ { + public final DecodeError err; + private Result_HTLCUpdateDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_HTLCUpdateDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_HTLCUpdateDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_HTLCUpdateDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java new file mode 100644 index 00000000..1aefd3d2 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { + private Result_HolderCommitmentTransactionDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_HolderCommitmentTransactionDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(ptr)) { + return new Result_HolderCommitmentTransactionDecodeErrorZ_OK(null, ptr); + } else { + return new Result_HolderCommitmentTransactionDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_HolderCommitmentTransactionDecodeErrorZ_OK extends Result_HolderCommitmentTransactionDecodeErrorZ { + public final HolderCommitmentTransaction res; + private Result_HolderCommitmentTransactionDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(ptr); + HolderCommitmentTransaction res_hu_conv = new HolderCommitmentTransaction(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_HolderCommitmentTransactionDecodeErrorZ_OK(HolderCommitmentTransaction res) { + this(null, bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_HolderCommitmentTransactionDecodeErrorZ_Err extends Result_HolderCommitmentTransactionDecodeErrorZ { + public final DecodeError err; + private Result_HolderCommitmentTransactionDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_HolderCommitmentTransactionDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_InMemoryChannelKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InMemoryChannelKeysDecodeErrorZ.java deleted file mode 100644 index a47ae762..00000000 --- a/src/main/java/org/ldk/structs/Result_InMemoryChannelKeysDecodeErrorZ.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; - -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class Result_InMemoryChannelKeysDecodeErrorZ extends CommonBase { - private Result_InMemoryChannelKeysDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_InMemoryChannelKeysDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_InMemoryChannelKeysDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.LDKCResult_InMemoryChannelKeysDecodeErrorZ_result_ok(ptr)) { - return new Result_InMemoryChannelKeysDecodeErrorZ_OK(null, ptr); - } else { - return new Result_InMemoryChannelKeysDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_InMemoryChannelKeysDecodeErrorZ_OK extends Result_InMemoryChannelKeysDecodeErrorZ { - public final InMemoryChannelKeys res; - private Result_InMemoryChannelKeysDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - long res = bindings.LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_ok(ptr); - InMemoryChannelKeys res_hu_conv = new InMemoryChannelKeys(null, res); - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - public Result_InMemoryChannelKeysDecodeErrorZ_OK(InMemoryChannelKeys res) { - this(null, bindings.CResult_InMemoryChannelKeysDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); - this.ptrs_to.add(res); - } - } - - public static final class Result_InMemoryChannelKeysDecodeErrorZ_Err extends Result_InMemoryChannelKeysDecodeErrorZ { - public final DecodeError err; - private Result_InMemoryChannelKeysDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_err(ptr); - DecodeError err_hu_conv = new DecodeError(null, err); - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - public Result_InMemoryChannelKeysDecodeErrorZ_Err(DecodeError err) { - this(null, bindings.CResult_InMemoryChannelKeysDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); - this.ptrs_to.add(err); - } - } -} diff --git a/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java new file mode 100644 index 00000000..997fd164 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_InMemorySignerDecodeErrorZ extends CommonBase { + private Result_InMemorySignerDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_InMemorySignerDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_InMemorySignerDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_InMemorySignerDecodeErrorZ_result_ok(ptr)) { + return new Result_InMemorySignerDecodeErrorZ_OK(null, ptr); + } else { + return new Result_InMemorySignerDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_InMemorySignerDecodeErrorZ_OK extends Result_InMemorySignerDecodeErrorZ { + public final InMemorySigner res; + private Result_InMemorySignerDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_InMemorySignerDecodeErrorZ_get_ok(ptr); + InMemorySigner res_hu_conv = new InMemorySigner(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_InMemorySignerDecodeErrorZ_OK(InMemorySigner res) { + this(null, bindings.CResult_InMemorySignerDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_InMemorySignerDecodeErrorZ_Err extends Result_InMemorySignerDecodeErrorZ { + public final DecodeError err; + private Result_InMemorySignerDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_InMemorySignerDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_InMemorySignerDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_InMemorySignerDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java new file mode 100644 index 00000000..fd401383 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_InitFeaturesDecodeErrorZ extends CommonBase { + private Result_InitFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_InitFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_InitFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_InitFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_InitFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_InitFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_InitFeaturesDecodeErrorZ_OK extends Result_InitFeaturesDecodeErrorZ { + public final InitFeatures res; + private Result_InitFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_InitFeaturesDecodeErrorZ_get_ok(ptr); + InitFeatures res_hu_conv = new InitFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_InitFeaturesDecodeErrorZ_OK(InitFeatures res) { + this(null, bindings.CResult_InitFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_InitFeaturesDecodeErrorZ_Err extends Result_InitFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_InitFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_InitFeaturesDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_InitFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_InitFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java index a475625d..5d626453 100644 --- a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java @@ -31,14 +31,6 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { public Result_NetworkGraphDecodeErrorZ_OK(NetworkGraph res) { this(null, bindings.CResult_NetworkGraphDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); this.ptrs_to.add(res); - // 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 this 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 this call, res is reset to null and is now a dummy object. - res.ptr = 0; } } diff --git a/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java new file mode 100644 index 00000000..5c10a66e --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { + private Result_NodeAnnouncementDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NodeAnnouncementDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_NodeAnnouncementDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(ptr)) { + return new Result_NodeAnnouncementDecodeErrorZ_OK(null, ptr); + } else { + return new Result_NodeAnnouncementDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_NodeAnnouncementDecodeErrorZ_OK extends Result_NodeAnnouncementDecodeErrorZ { + public final NodeAnnouncement res; + private Result_NodeAnnouncementDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(ptr); + NodeAnnouncement res_hu_conv = new NodeAnnouncement(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_NodeAnnouncementDecodeErrorZ_OK(NodeAnnouncement res) { + this(null, bindings.CResult_NodeAnnouncementDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_NodeAnnouncementDecodeErrorZ_Err extends Result_NodeAnnouncementDecodeErrorZ { + public final DecodeError err; + private Result_NodeAnnouncementDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_NodeAnnouncementDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_NodeAnnouncementDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_NodeAnnouncementDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java new file mode 100644 index 00000000..bc6d6682 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_NodeFeaturesDecodeErrorZ extends CommonBase { + private Result_NodeFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NodeFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_NodeFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_NodeFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_NodeFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_NodeFeaturesDecodeErrorZ_OK extends Result_NodeFeaturesDecodeErrorZ { + public final NodeFeatures res; + private Result_NodeFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(ptr); + NodeFeatures res_hu_conv = new NodeFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_NodeFeaturesDecodeErrorZ_OK(NodeFeatures res) { + this(null, bindings.CResult_NodeFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_NodeFeaturesDecodeErrorZ_Err extends Result_NodeFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_NodeFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_NodeFeaturesDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_NodeFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_NodeFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java index 7b0f72bc..d0ed47a4 100644 --- a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java @@ -33,13 +33,12 @@ public class Result_NonePaymentSendFailureZ extends CommonBase { private Result_NonePaymentSendFailureZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); long err = bindings.LDKCResult_NonePaymentSendFailureZ_get_err(ptr); - PaymentSendFailure err_hu_conv = new PaymentSendFailure(null, err); + PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } public Result_NonePaymentSendFailureZ_Err(PaymentSendFailure err) { - this(null, bindings.CResult_NonePaymentSendFailureZ_err(err == null ? 0 : err.ptr & ~1)); - this.ptrs_to.add(err); + this(null, bindings.CResult_NonePaymentSendFailureZ_err(err.ptr)); } } } diff --git a/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java new file mode 100644 index 00000000..e8915617 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_OpenChannelDecodeErrorZ extends CommonBase { + private Result_OpenChannelDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_OpenChannelDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_OpenChannelDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_OpenChannelDecodeErrorZ_result_ok(ptr)) { + return new Result_OpenChannelDecodeErrorZ_OK(null, ptr); + } else { + return new Result_OpenChannelDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_OpenChannelDecodeErrorZ_OK extends Result_OpenChannelDecodeErrorZ { + public final OpenChannel res; + private Result_OpenChannelDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_OpenChannelDecodeErrorZ_get_ok(ptr); + OpenChannel res_hu_conv = new OpenChannel(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_OpenChannelDecodeErrorZ_OK(OpenChannel res) { + this(null, bindings.CResult_OpenChannelDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_OpenChannelDecodeErrorZ_Err extends Result_OpenChannelDecodeErrorZ { + public final DecodeError err; + private Result_OpenChannelDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_OpenChannelDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_OpenChannelDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_OpenChannelDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java new file mode 100644 index 00000000..8f59f086 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_OutPointDecodeErrorZ extends CommonBase { + private Result_OutPointDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_OutPointDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_OutPointDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_OutPointDecodeErrorZ_result_ok(ptr)) { + return new Result_OutPointDecodeErrorZ_OK(null, ptr); + } else { + return new Result_OutPointDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_OutPointDecodeErrorZ_OK extends Result_OutPointDecodeErrorZ { + public final OutPoint res; + private Result_OutPointDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_OutPointDecodeErrorZ_get_ok(ptr); + OutPoint res_hu_conv = new OutPoint(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_OutPointDecodeErrorZ_OK(OutPoint res) { + this(null, bindings.CResult_OutPointDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_OutPointDecodeErrorZ_Err extends Result_OutPointDecodeErrorZ { + public final DecodeError err; + private Result_OutPointDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_OutPointDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_OutPointDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_OutPointDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_PublicKeyErrorZ.java b/src/main/java/org/ldk/structs/Result_PublicKeyErrorZ.java new file mode 100644 index 00000000..f941cd25 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PublicKeyErrorZ.java @@ -0,0 +1,43 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_PublicKeyErrorZ extends CommonBase { + private Result_PublicKeyErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PublicKeyErrorZ_free(ptr); } super.finalize(); + } + + static Result_PublicKeyErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PublicKeyErrorZ_result_ok(ptr)) { + return new Result_PublicKeyErrorZ_OK(null, ptr); + } else { + return new Result_PublicKeyErrorZ_Err(null, ptr); + } + } + public static final class Result_PublicKeyErrorZ_OK extends Result_PublicKeyErrorZ { + public final byte[] res; + private Result_PublicKeyErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_PublicKeyErrorZ_get_ok(ptr); + } + public Result_PublicKeyErrorZ_OK(byte[] res) { + this(null, bindings.CResult_PublicKeyErrorZ_ok(res)); + } + } + + public static final class Result_PublicKeyErrorZ_Err extends Result_PublicKeyErrorZ { + public final LDKSecp256k1Error err; + private Result_PublicKeyErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_PublicKeyErrorZ_get_err(ptr); + } + public Result_PublicKeyErrorZ_Err(LDKSecp256k1Error err) { + this(null, bindings.CResult_PublicKeyErrorZ_err(err)); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java new file mode 100644 index 00000000..207f5b7c --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { + private Result_RevokeAndACKDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_RevokeAndACKDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_RevokeAndACKDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(ptr)) { + return new Result_RevokeAndACKDecodeErrorZ_OK(null, ptr); + } else { + return new Result_RevokeAndACKDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_RevokeAndACKDecodeErrorZ_OK extends Result_RevokeAndACKDecodeErrorZ { + public final RevokeAndACK res; + private Result_RevokeAndACKDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(ptr); + RevokeAndACK res_hu_conv = new RevokeAndACK(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_RevokeAndACKDecodeErrorZ_OK(RevokeAndACK res) { + this(null, bindings.CResult_RevokeAndACKDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_RevokeAndACKDecodeErrorZ_Err extends Result_RevokeAndACKDecodeErrorZ { + public final DecodeError err; + private Result_RevokeAndACKDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_RevokeAndACKDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_RevokeAndACKDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_RevokeAndACKDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java new file mode 100644 index 00000000..1d323536 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java @@ -0,0 +1,43 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_SecretKeyErrorZ extends CommonBase { + private Result_SecretKeyErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_SecretKeyErrorZ_free(ptr); } super.finalize(); + } + + static Result_SecretKeyErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_SecretKeyErrorZ_result_ok(ptr)) { + return new Result_SecretKeyErrorZ_OK(null, ptr); + } else { + return new Result_SecretKeyErrorZ_Err(null, ptr); + } + } + public static final class Result_SecretKeyErrorZ_OK extends Result_SecretKeyErrorZ { + public final byte[] res; + private Result_SecretKeyErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_SecretKeyErrorZ_get_ok(ptr); + } + public Result_SecretKeyErrorZ_OK(byte[] res) { + this(null, bindings.CResult_SecretKeyErrorZ_ok(res)); + } + } + + public static final class Result_SecretKeyErrorZ_Err extends Result_SecretKeyErrorZ { + public final LDKSecp256k1Error err; + private Result_SecretKeyErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_SecretKeyErrorZ_get_err(ptr); + } + public Result_SecretKeyErrorZ_Err(LDKSecp256k1Error err) { + this(null, bindings.CResult_SecretKeyErrorZ_err(err)); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java new file mode 100644 index 00000000..c696120f --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_ShutdownDecodeErrorZ extends CommonBase { + private Result_ShutdownDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ShutdownDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ShutdownDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ShutdownDecodeErrorZ_result_ok(ptr)) { + return new Result_ShutdownDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ShutdownDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ShutdownDecodeErrorZ_OK extends Result_ShutdownDecodeErrorZ { + public final Shutdown res; + private Result_ShutdownDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ShutdownDecodeErrorZ_get_ok(ptr); + Shutdown res_hu_conv = new Shutdown(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ShutdownDecodeErrorZ_OK(Shutdown res) { + this(null, bindings.CResult_ShutdownDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ShutdownDecodeErrorZ_Err extends Result_ShutdownDecodeErrorZ { + public final DecodeError err; + private Result_ShutdownDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ShutdownDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_ShutdownDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ShutdownDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java new file mode 100644 index 00000000..b5b33d5a --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_SignDecodeErrorZ extends CommonBase { + private Result_SignDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_SignDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_SignDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_SignDecodeErrorZ_result_ok(ptr)) { + return new Result_SignDecodeErrorZ_OK(null, ptr); + } else { + return new Result_SignDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_SignDecodeErrorZ_OK extends Result_SignDecodeErrorZ { + public final Sign res; + private Result_SignDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_SignDecodeErrorZ_get_ok(ptr); + Sign ret_hu_conv = new Sign(null, res); + ret_hu_conv.ptrs_to.add(this); + this.res = ret_hu_conv; + } + public Result_SignDecodeErrorZ_OK(Sign res) { + this(null, bindings.CResult_SignDecodeErrorZ_ok(res == null ? 0 : res.ptr)); + this.ptrs_to.add(res); + } + } + + public static final class Result_SignDecodeErrorZ_Err extends Result_SignDecodeErrorZ { + public final DecodeError err; + private Result_SignDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_SignDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_SignDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_SignDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_TransactionNoneZ.java b/src/main/java/org/ldk/structs/Result_TransactionNoneZ.java new file mode 100644 index 00000000..d03b5284 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_TransactionNoneZ.java @@ -0,0 +1,41 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_TransactionNoneZ extends CommonBase { + private Result_TransactionNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_TransactionNoneZ_free(ptr); } super.finalize(); + } + + static Result_TransactionNoneZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_TransactionNoneZ_result_ok(ptr)) { + return new Result_TransactionNoneZ_OK(null, ptr); + } else { + return new Result_TransactionNoneZ_Err(null, ptr); + } + } + public static final class Result_TransactionNoneZ_OK extends Result_TransactionNoneZ { + public final byte[] res; + private Result_TransactionNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_TransactionNoneZ_get_ok(ptr); + } + public Result_TransactionNoneZ_OK(byte[] res) { + this(null, bindings.CResult_TransactionNoneZ_ok(res)); + } + } + + public static final class Result_TransactionNoneZ_Err extends Result_TransactionNoneZ { + private Result_TransactionNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + public Result_TransactionNoneZ_Err() { + this(null, bindings.CResult_TransactionNoneZ_err()); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java new file mode 100644 index 00000000..f1f5d238 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { + private Result_TxCreationKeysDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_TxCreationKeysDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_TxCreationKeysDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(ptr)) { + return new Result_TxCreationKeysDecodeErrorZ_OK(null, ptr); + } else { + return new Result_TxCreationKeysDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_TxCreationKeysDecodeErrorZ_OK extends Result_TxCreationKeysDecodeErrorZ { + public final TxCreationKeys res; + private Result_TxCreationKeysDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(ptr); + TxCreationKeys res_hu_conv = new TxCreationKeys(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_TxCreationKeysDecodeErrorZ_OK(TxCreationKeys res) { + this(null, bindings.CResult_TxCreationKeysDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_TxCreationKeysDecodeErrorZ_Err extends Result_TxCreationKeysDecodeErrorZ { + public final DecodeError err; + private Result_TxCreationKeysDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_TxCreationKeysDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_TxCreationKeysDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_TxCreationKeysDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_TxCreationKeysErrorZ.java b/src/main/java/org/ldk/structs/Result_TxCreationKeysErrorZ.java new file mode 100644 index 00000000..3d951aa9 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_TxCreationKeysErrorZ.java @@ -0,0 +1,47 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_TxCreationKeysErrorZ extends CommonBase { + private Result_TxCreationKeysErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_TxCreationKeysErrorZ_free(ptr); } super.finalize(); + } + + static Result_TxCreationKeysErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_TxCreationKeysErrorZ_result_ok(ptr)) { + return new Result_TxCreationKeysErrorZ_OK(null, ptr); + } else { + return new Result_TxCreationKeysErrorZ_Err(null, ptr); + } + } + public static final class Result_TxCreationKeysErrorZ_OK extends Result_TxCreationKeysErrorZ { + public final TxCreationKeys res; + private Result_TxCreationKeysErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_TxCreationKeysErrorZ_get_ok(ptr); + TxCreationKeys res_hu_conv = new TxCreationKeys(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_TxCreationKeysErrorZ_OK(TxCreationKeys res) { + this(null, bindings.CResult_TxCreationKeysErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_TxCreationKeysErrorZ_Err extends Result_TxCreationKeysErrorZ { + public final LDKSecp256k1Error err; + private Result_TxCreationKeysErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_TxCreationKeysErrorZ_get_err(ptr); + } + public Result_TxCreationKeysErrorZ_Err(LDKSecp256k1Error err) { + this(null, bindings.CResult_TxCreationKeysErrorZ_err(err)); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java new file mode 100644 index 00000000..83251e55 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateAddHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateAddHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateAddHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateAddHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateAddHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateAddHTLCDecodeErrorZ_OK extends Result_UpdateAddHTLCDecodeErrorZ { + public final UpdateAddHTLC res; + private Result_UpdateAddHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(ptr); + UpdateAddHTLC res_hu_conv = new UpdateAddHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateAddHTLCDecodeErrorZ_OK(UpdateAddHTLC res) { + this(null, bindings.CResult_UpdateAddHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateAddHTLCDecodeErrorZ_Err extends Result_UpdateAddHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateAddHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_UpdateAddHTLCDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_UpdateAddHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateAddHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java new file mode 100644 index 00000000..77ebe7ed --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateFailHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFailHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFailHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFailHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFailHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFailHTLCDecodeErrorZ_OK extends Result_UpdateFailHTLCDecodeErrorZ { + public final UpdateFailHTLC res; + private Result_UpdateFailHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(ptr); + UpdateFailHTLC res_hu_conv = new UpdateFailHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFailHTLCDecodeErrorZ_OK(UpdateFailHTLC res) { + this(null, bindings.CResult_UpdateFailHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFailHTLCDecodeErrorZ_Err extends Result_UpdateFailHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFailHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_UpdateFailHTLCDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_UpdateFailHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFailHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java new file mode 100644 index 00000000..0cedc44c --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateFailMalformedHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFailMalformedHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFailMalformedHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFailMalformedHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFailMalformedHTLCDecodeErrorZ_OK extends Result_UpdateFailMalformedHTLCDecodeErrorZ { + public final UpdateFailMalformedHTLC res; + private Result_UpdateFailMalformedHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(ptr); + UpdateFailMalformedHTLC res_hu_conv = new UpdateFailMalformedHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFailMalformedHTLCDecodeErrorZ_OK(UpdateFailMalformedHTLC res) { + this(null, bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFailMalformedHTLCDecodeErrorZ_Err extends Result_UpdateFailMalformedHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFailMalformedHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_UpdateFailMalformedHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java new file mode 100644 index 00000000..05d4a28a --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_UpdateFeeDecodeErrorZ extends CommonBase { + private Result_UpdateFeeDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFeeDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFeeDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFeeDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFeeDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFeeDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFeeDecodeErrorZ_OK extends Result_UpdateFeeDecodeErrorZ { + public final UpdateFee res; + private Result_UpdateFeeDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_UpdateFeeDecodeErrorZ_get_ok(ptr); + UpdateFee res_hu_conv = new UpdateFee(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFeeDecodeErrorZ_OK(UpdateFee res) { + this(null, bindings.CResult_UpdateFeeDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFeeDecodeErrorZ_Err extends Result_UpdateFeeDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFeeDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_UpdateFeeDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_UpdateFeeDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFeeDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java new file mode 100644 index 00000000..fb60f5e0 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java @@ -0,0 +1,51 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateFulfillHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFulfillHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFulfillHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFulfillHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFulfillHTLCDecodeErrorZ_OK extends Result_UpdateFulfillHTLCDecodeErrorZ { + public final UpdateFulfillHTLC res; + private Result_UpdateFulfillHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(ptr); + UpdateFulfillHTLC res_hu_conv = new UpdateFulfillHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFulfillHTLCDecodeErrorZ_OK(UpdateFulfillHTLC res) { + this(null, bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFulfillHTLCDecodeErrorZ_Err extends Result_UpdateFulfillHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFulfillHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + public Result_UpdateFulfillHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/src/main/java/org/ldk/structs/Route.java b/src/main/java/org/ldk/structs/Route.java index a5b6a421..a05f15b6 100644 --- a/src/main/java/org/ldk/structs/Route.java +++ b/src/main/java/org/ldk/structs/Route.java @@ -15,12 +15,12 @@ public class Route extends CommonBase { } public void set_paths(RouteHop[][] val) { - bindings.Route_set_paths(this.ptr, Arrays.stream(val).map(arr_conv_12 -> Arrays.stream(arr_conv_12).mapToLong(arr_conv_10 -> arr_conv_10 == null ? 0 : arr_conv_10.ptr & ~1).toArray()).toArray(long[][]::new)); + bindings.Route_set_paths(this.ptr, Arrays.stream(val).map(val_conv_12 -> Arrays.stream(val_conv_12).mapToLong(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray()).toArray(long[][]::new)); /* TODO 2 RouteHop[] */; } public static Route constructor_new(RouteHop[][] paths_arg) { - long ret = bindings.Route_new(Arrays.stream(paths_arg).map(arr_conv_12 -> Arrays.stream(arr_conv_12).mapToLong(arr_conv_10 -> arr_conv_10 == null ? 0 : arr_conv_10.ptr & ~1).toArray()).toArray(long[][]::new)); + long ret = bindings.Route_new(Arrays.stream(paths_arg).map(paths_arg_conv_12 -> Arrays.stream(paths_arg_conv_12).mapToLong(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray()).toArray(long[][]::new)); Route ret_hu_conv = new Route(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); /* TODO 2 RouteHop[] */; diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java index 8a50a54b..4efd6b24 100644 --- a/src/main/java/org/ldk/structs/RoutingMessageHandler.java +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -61,13 +61,13 @@ public class RoutingMessageHandler extends CommonBase { } @Override public long[] get_next_channel_announcements(long starting_point, byte batch_amount) { ThreeTuple[] ret = arg.get_next_channel_announcements(starting_point, batch_amount); - long[] result = Arrays.stream(ret).mapToLong(arr_conv_63 -> bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(arr_conv_63.a == null ? 0 : arr_conv_63.a.ptr & ~1, arr_conv_63.b == null ? 0 : arr_conv_63.b.ptr & ~1, arr_conv_63.c == null ? 0 : arr_conv_63.c.ptr & ~1)).toArray(); + long[] result = Arrays.stream(ret).mapToLong(ret_conv_63 -> bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(ret_conv_63.a == null ? 0 : ret_conv_63.a.ptr & ~1, ret_conv_63.b == null ? 0 : ret_conv_63.b.ptr & ~1, ret_conv_63.c == null ? 0 : ret_conv_63.c.ptr & ~1)).toArray(); /* TODO 2 ThreeTuple */; return result; } @Override public long[] get_next_node_announcements(byte[] starting_point, byte batch_amount) { NodeAnnouncement[] ret = arg.get_next_node_announcements(starting_point, batch_amount); - long[] result = Arrays.stream(ret).mapToLong(arr_conv_18 -> arr_conv_18 == null ? 0 : arr_conv_18.ptr & ~1).toArray(); + long[] result = Arrays.stream(ret).mapToLong(ret_conv_18 -> ret_conv_18 == null ? 0 : ret_conv_18.ptr & ~1).toArray(); /* TODO 2 NodeAnnouncement */; return result; } @@ -134,39 +134,39 @@ public class RoutingMessageHandler extends CommonBase { public ThreeTuple[] get_next_channel_announcements(long starting_point, byte batch_amount) { long[] ret = bindings.RoutingMessageHandler_get_next_channel_announcements(this.ptr, starting_point, batch_amount); - ThreeTuple[] arr_conv_63_arr = new ThreeTuple[ret.length]; + ThreeTuple[] ret_conv_63_arr = new ThreeTuple[ret.length]; for (int l = 0; l < ret.length; l++) { - long arr_conv_63 = ret[l]; - long arr_conv_63_a = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(arr_conv_63); - ChannelAnnouncement arr_conv_63_a_hu_conv = new ChannelAnnouncement(null, arr_conv_63_a); - arr_conv_63_a_hu_conv.ptrs_to.add(this);; - long arr_conv_63_b = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(arr_conv_63); - ChannelUpdate arr_conv_63_b_hu_conv = new ChannelUpdate(null, arr_conv_63_b); - arr_conv_63_b_hu_conv.ptrs_to.add(this);; - long arr_conv_63_c = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(arr_conv_63); - ChannelUpdate arr_conv_63_c_hu_conv = new ChannelUpdate(null, arr_conv_63_c); - arr_conv_63_c_hu_conv.ptrs_to.add(this);; - ThreeTuple arr_conv_63_conv = new ThreeTuple(arr_conv_63_a_hu_conv, arr_conv_63_b_hu_conv, arr_conv_63_c_hu_conv, () -> { - bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arr_conv_63); + long ret_conv_63 = ret[l]; + long ret_conv_63_a = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(ret_conv_63); + ChannelAnnouncement ret_conv_63_a_hu_conv = new ChannelAnnouncement(null, ret_conv_63_a); + ret_conv_63_a_hu_conv.ptrs_to.add(this);; + long ret_conv_63_b = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(ret_conv_63); + ChannelUpdate ret_conv_63_b_hu_conv = new ChannelUpdate(null, ret_conv_63_b); + ret_conv_63_b_hu_conv.ptrs_to.add(this);; + long ret_conv_63_c = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(ret_conv_63); + ChannelUpdate ret_conv_63_c_hu_conv = new ChannelUpdate(null, ret_conv_63_c); + ret_conv_63_c_hu_conv.ptrs_to.add(this);; + ThreeTuple ret_conv_63_conv = new ThreeTuple(ret_conv_63_a_hu_conv, ret_conv_63_b_hu_conv, ret_conv_63_c_hu_conv, () -> { + bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(ret_conv_63); }); - arr_conv_63_a_hu_conv.ptrs_to.add(arr_conv_63_conv); - arr_conv_63_b_hu_conv.ptrs_to.add(arr_conv_63_conv); - arr_conv_63_c_hu_conv.ptrs_to.add(arr_conv_63_conv); - arr_conv_63_arr[l] = arr_conv_63_conv; + ret_conv_63_a_hu_conv.ptrs_to.add(ret_conv_63_conv); + ret_conv_63_b_hu_conv.ptrs_to.add(ret_conv_63_conv); + ret_conv_63_c_hu_conv.ptrs_to.add(ret_conv_63_conv); + ret_conv_63_arr[l] = ret_conv_63_conv; } - return arr_conv_63_arr; + return ret_conv_63_arr; } public NodeAnnouncement[] get_next_node_announcements(byte[] starting_point, byte batch_amount) { long[] ret = bindings.RoutingMessageHandler_get_next_node_announcements(this.ptr, starting_point, batch_amount); - NodeAnnouncement[] arr_conv_18_arr = new NodeAnnouncement[ret.length]; + NodeAnnouncement[] ret_conv_18_arr = new NodeAnnouncement[ret.length]; for (int s = 0; s < ret.length; s++) { - long arr_conv_18 = ret[s]; - NodeAnnouncement arr_conv_18_hu_conv = new NodeAnnouncement(null, arr_conv_18); - arr_conv_18_hu_conv.ptrs_to.add(this); - arr_conv_18_arr[s] = arr_conv_18_hu_conv; + long ret_conv_18 = ret[s]; + NodeAnnouncement ret_conv_18_hu_conv = new NodeAnnouncement(null, ret_conv_18); + ret_conv_18_hu_conv.ptrs_to.add(this); + ret_conv_18_arr[s] = ret_conv_18_hu_conv; } - return arr_conv_18_arr; + return ret_conv_18_arr; } public void sync_routing_table(byte[] their_node_id, Init init) { diff --git a/src/main/java/org/ldk/structs/Sign.java b/src/main/java/org/ldk/structs/Sign.java new file mode 100644 index 00000000..1ab9848a --- /dev/null +++ b/src/main/java/org/ldk/structs/Sign.java @@ -0,0 +1,178 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class Sign extends CommonBase { + final bindings.LDKSign bindings_instance; + Sign(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private Sign(bindings.LDKSign arg, ChannelPublicKeys pubkeys) { + super(bindings.LDKSign_new(arg, pubkeys == null ? 0 : pubkeys.ptr & ~1)); + this.ptrs_to.add(arg); + this.ptrs_to.add(pubkeys); + this.bindings_instance = arg; + } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.Sign_free(ptr); } super.finalize(); + } + + public static interface SignInterface { + byte[] get_per_commitment_point(long idx); + byte[] release_commitment_secret(long idx); + byte[] channel_keys_id(); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx); + Result_SignatureNoneZ sign_justice_transaction(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc); + Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc); + Result_SignatureNoneZ sign_closing_transaction(byte[] closing_tx); + Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg); + void ready_channel(ChannelTransactionParameters channel_parameters); + byte[] write(); + } + private static class LDKSignHolder { Sign held; } + public static Sign new_impl(SignInterface arg, ChannelPublicKeys pubkeys) { + final LDKSignHolder impl_holder = new LDKSignHolder(); + impl_holder.held = new Sign(new bindings.LDKSign() { + @Override public byte[] get_per_commitment_point(long idx) { + byte[] ret = arg.get_per_commitment_point(idx); + return ret; + } + @Override public byte[] release_commitment_secret(long idx) { + byte[] ret = arg.release_commitment_secret(idx); + return ret; + } + @Override public byte[] channel_keys_id() { + byte[] ret = arg.channel_keys_id(); + return ret; + } + @Override public long sign_counterparty_commitment(long commitment_tx) { + CommitmentTransaction commitment_tx_hu_conv = new CommitmentTransaction(null, commitment_tx); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv); + long result = ret != null ? ret.ptr : 0; + return result; + } + @Override public long sign_holder_commitment_and_htlcs(long commitment_tx) { + HolderCommitmentTransaction commitment_tx_hu_conv = new HolderCommitmentTransaction(null, commitment_tx); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv); + long result = ret != null ? ret.ptr : 0; + return result; + } + @Override public long sign_justice_transaction(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc) { + HTLCOutputInCommitment htlc_hu_conv = new HTLCOutputInCommitment(null, htlc); + Result_SignatureNoneZ ret = arg.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc_hu_conv); + long result = ret != null ? ret.ptr : 0; + return result; + } + @Override public long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc) { + HTLCOutputInCommitment htlc_hu_conv = new HTLCOutputInCommitment(null, htlc); + Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv); + long result = ret != null ? ret.ptr : 0; + return result; + } + @Override public long sign_closing_transaction(byte[] closing_tx) { + Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx); + long result = ret != null ? ret.ptr : 0; + return result; + } + @Override public long sign_channel_announcement(long msg) { + UnsignedChannelAnnouncement msg_hu_conv = new UnsignedChannelAnnouncement(null, msg); + Result_SignatureNoneZ ret = arg.sign_channel_announcement(msg_hu_conv); + long result = ret != null ? ret.ptr : 0; + return result; + } + @Override public void ready_channel(long channel_parameters) { + ChannelTransactionParameters channel_parameters_hu_conv = new ChannelTransactionParameters(null, channel_parameters); + arg.ready_channel(channel_parameters_hu_conv); + } + @Override public byte[] write() { + byte[] ret = arg.write(); + return ret; + } + }, pubkeys); + return impl_holder.held; + } + public byte[] get_per_commitment_point(long idx) { + byte[] ret = bindings.Sign_get_per_commitment_point(this.ptr, idx); + return ret; + } + + public byte[] release_commitment_secret(long idx) { + byte[] ret = bindings.Sign_release_commitment_secret(this.ptr, idx); + return ret; + } + + public byte[] channel_keys_id() { + byte[] ret = bindings.Sign_channel_keys_id(this.ptr); + return ret; + } + + public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx) { + long ret = bindings.Sign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(commitment_tx); + return ret_hu_conv; + } + + public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) { + long ret = bindings.Sign_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(commitment_tx); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_justice_transaction(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc) { + long ret = bindings.Sign_sign_justice_transaction(this.ptr, justice_tx, input, amount, per_commitment_key, htlc == null ? 0 : htlc.ptr & ~1); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(htlc); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc) { + long ret = bindings.Sign_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, per_commitment_point, htlc == null ? 0 : htlc.ptr & ~1); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(htlc); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_closing_transaction(byte[] closing_tx) { + long ret = bindings.Sign_sign_closing_transaction(this.ptr, closing_tx); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) { + long ret = bindings.Sign_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(msg); + return ret_hu_conv; + } + + public void ready_channel(ChannelTransactionParameters channel_parameters) { + bindings.Sign_ready_channel(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1); + this.ptrs_to.add(channel_parameters); + } + + public byte[] write() { + byte[] ret = bindings.Sign_write(this.ptr); + return ret; + } + + public ChannelPublicKeys get_pubkeys() { + long ret = bindings.Sign_get_pubkeys(this.ptr); + ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public Sign clone() { + long ret = bindings.Sign_clone(this.ptr); + Sign ret_hu_conv = new Sign(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java index eda82f8e..3dabd15a 100644 --- a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java @@ -18,11 +18,11 @@ public class SpendableOutputDescriptor extends CommonBase { if (raw_val.getClass() == bindings.LDKSpendableOutputDescriptor.StaticOutput.class) { return new StaticOutput(ptr, (bindings.LDKSpendableOutputDescriptor.StaticOutput)raw_val); } - if (raw_val.getClass() == bindings.LDKSpendableOutputDescriptor.DynamicOutputP2WSH.class) { - return new DynamicOutputP2WSH(ptr, (bindings.LDKSpendableOutputDescriptor.DynamicOutputP2WSH)raw_val); + if (raw_val.getClass() == bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput.class) { + return new DelayedPaymentOutput(ptr, (bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput)raw_val); } - if (raw_val.getClass() == bindings.LDKSpendableOutputDescriptor.StaticOutputCounterpartyPayment.class) { - return new StaticOutputCounterpartyPayment(ptr, (bindings.LDKSpendableOutputDescriptor.StaticOutputCounterpartyPayment)raw_val); + if (raw_val.getClass() == bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput.class) { + return new StaticPaymentOutput(ptr, (bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput)raw_val); } assert false; return null; // Unreachable without extending the (internal) bindings interface } @@ -41,54 +41,14 @@ public class SpendableOutputDescriptor extends CommonBase { this.output = output_conv; } } - public final static class DynamicOutputP2WSH extends SpendableOutputDescriptor { - public final OutPoint outpoint; - public final byte[] per_commitment_point; - public final short to_self_delay; - public final TxOut output; - public final TwoTuple key_derivation_params; - public final byte[] revocation_pubkey; - private DynamicOutputP2WSH(long ptr, bindings.LDKSpendableOutputDescriptor.DynamicOutputP2WSH obj) { + public final static class DelayedPaymentOutput extends SpendableOutputDescriptor { + private DelayedPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput obj) { super(null, ptr); - long outpoint = obj.outpoint; - OutPoint outpoint_hu_conv = new OutPoint(null, outpoint); - outpoint_hu_conv.ptrs_to.add(this); - this.outpoint = outpoint_hu_conv; - this.per_commitment_point = obj.per_commitment_point; - this.to_self_delay = obj.to_self_delay; - long output = obj.output; - TxOut output_conv = new TxOut(null, output); - this.output = output_conv; - long key_derivation_params = obj.key_derivation_params; - long key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params); - long key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params); - TwoTuple key_derivation_params_conv = new TwoTuple(key_derivation_params_a, key_derivation_params_b, () -> { - bindings.C2Tuple_u64u64Z_free(key_derivation_params); - }); - this.key_derivation_params = key_derivation_params_conv; - this.revocation_pubkey = obj.revocation_pubkey; } } - public final static class StaticOutputCounterpartyPayment extends SpendableOutputDescriptor { - public final OutPoint outpoint; - public final TxOut output; - public final TwoTuple key_derivation_params; - private StaticOutputCounterpartyPayment(long ptr, bindings.LDKSpendableOutputDescriptor.StaticOutputCounterpartyPayment obj) { + public final static class StaticPaymentOutput extends SpendableOutputDescriptor { + private StaticPaymentOutput(long ptr, bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput obj) { super(null, ptr); - long outpoint = obj.outpoint; - OutPoint outpoint_hu_conv = new OutPoint(null, outpoint); - outpoint_hu_conv.ptrs_to.add(this); - this.outpoint = outpoint_hu_conv; - long output = obj.output; - TxOut output_conv = new TxOut(null, output); - this.output = output_conv; - long key_derivation_params = obj.key_derivation_params; - long key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params); - long key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params); - TwoTuple key_derivation_params_conv = new TwoTuple(key_derivation_params_a, key_derivation_params_b, () -> { - bindings.C2Tuple_u64u64Z_free(key_derivation_params); - }); - this.key_derivation_params = key_derivation_params_conv; } } } diff --git a/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java b/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java new file mode 100644 index 00000000..6fd5fd7a --- /dev/null +++ b/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java @@ -0,0 +1,66 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; + +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class StaticPaymentOutputDescriptor extends CommonBase { + StaticPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.StaticPaymentOutputDescriptor_free(ptr); } + } + + public OutPoint get_outpoint() { + long ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr); + OutPoint ret_hu_conv = new OutPoint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public void set_outpoint(OutPoint val) { + bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + public void set_output(TxOut val) { + bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr); + } + + public byte[] get_channel_keys_id() { + byte[] ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr); + return ret; + } + + public void set_channel_keys_id(byte[] val) { + bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, val); + } + + public long get_channel_value_satoshis() { + long ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr); + return ret; + } + + public void set_channel_value_satoshis(long val) { + bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val); + } + + public static StaticPaymentOutputDescriptor constructor_new(OutPoint outpoint_arg, TxOut output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) { + long ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, output_arg.ptr, channel_keys_id_arg, channel_value_satoshis_arg); + StaticPaymentOutputDescriptor ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(outpoint_arg); + return ret_hu_conv; + } + + public StaticPaymentOutputDescriptor clone() { + long ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr); + StaticPaymentOutputDescriptor ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java index 94016eb9..606b202d 100644 --- a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java @@ -63,7 +63,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { } public void set_addresses(NetAddress[] val) { - bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, Arrays.stream(val).mapToLong(arr_conv_12 -> arr_conv_12.ptr).toArray()); + bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray()); /* TODO 2 NetAddress */; } diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index 8f2f7f34..3a1bcbfe 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -11,7 +11,7 @@ public class UtilMethods { } public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ constructor_BlockHashChannelManagerZ_read(byte[] ser, KeysInterface arg_keys_manager, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) { - long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr & ~1, Arrays.stream(arg_channel_monitors).mapToLong(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray())); + long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr & ~1, Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr & ~1).toArray())); Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(arg_keys_manager); ret_hu_conv.ptrs_to.add(arg_fee_estimator); diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index db7d4392..c9b156fb 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -48,7 +48,7 @@ public class Watch extends CommonBase { } @Override public long[] release_pending_monitor_events() { MonitorEvent[] ret = arg.release_pending_monitor_events(); - long[] result = Arrays.stream(ret).mapToLong(arr_conv_14 -> arr_conv_14 == null ? 0 : arr_conv_14.ptr & ~1).toArray(); + long[] result = Arrays.stream(ret).mapToLong(ret_conv_14 -> ret_conv_14.ptr).toArray(); /* TODO 2 MonitorEvent */; return result; } @@ -73,14 +73,14 @@ public class Watch extends CommonBase { public MonitorEvent[] release_pending_monitor_events() { long[] ret = bindings.Watch_release_pending_monitor_events(this.ptr); - MonitorEvent[] arr_conv_14_arr = new MonitorEvent[ret.length]; + MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length]; for (int o = 0; o < ret.length; o++) { - long arr_conv_14 = ret[o]; - MonitorEvent arr_conv_14_hu_conv = new MonitorEvent(null, arr_conv_14); - arr_conv_14_hu_conv.ptrs_to.add(this); - arr_conv_14_arr[o] = arr_conv_14_hu_conv; + long ret_conv_14 = ret[o]; + MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14); + ret_conv_14_hu_conv.ptrs_to.add(this); + ret_conv_14_arr[o] = ret_conv_14_hu_conv; } - return arr_conv_14_arr; + return ret_conv_14_arr; } } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 9cfa668a..ecf9820b 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -5,10 +5,123 @@ #include #include -#define MALLOC(a, _) malloc(a) -#define FREE(p) if ((long)(p) > 1024) { free(p); } -#define DO_ASSERT(a) (void)(a) -#define CHECK(a) +#include +// Always run a, then assert it is true: +#define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0) +// Assert a is true or do nothing +#define CHECK(a) DO_ASSERT(a) + +// Running a leak check across all the allocations and frees of the JDK is a mess, +// so instead we implement our own naive leak checker here, relying on the -wrap +// linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated +// and free'd in Rust or C across the generated bindings shared library. +#include +#include +#include +static mtx_t allocation_mtx; + +void __attribute__((constructor)) init_mtx() { + DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success); +} + +#define BT_MAX 128 +typedef struct allocation { + struct allocation* next; + void* ptr; + const char* struct_name; + void* bt[BT_MAX]; + int bt_len; + size_t alloc_len; +} allocation; +static allocation* allocation_ll = NULL; + +void* __real_malloc(size_t len); +void* __real_calloc(size_t nmemb, size_t len); +static void new_allocation(void* res, const char* struct_name, size_t len) { + allocation* new_alloc = __real_malloc(sizeof(allocation)); + new_alloc->ptr = res; + new_alloc->struct_name = struct_name; + new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX); + new_alloc->alloc_len = len; + DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success); + new_alloc->next = allocation_ll; + allocation_ll = new_alloc; + DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success); +} +static void* MALLOC(size_t len, const char* struct_name) { + void* res = __real_malloc(len); + new_allocation(res, struct_name, len); + return res; +} +void __real_free(void* ptr); +static void alloc_freed(void* ptr) { + allocation* p = NULL; + DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success); + allocation* it = allocation_ll; + while (it->ptr != ptr) { + p = it; it = it->next; + if (it == NULL) { + fprintf(stderr, "Tried to free unknown pointer %p at:\n", ptr); + void* bt[BT_MAX]; + int bt_len = backtrace(bt, BT_MAX); + backtrace_symbols_fd(bt, bt_len, STDERR_FILENO); + fprintf(stderr, "\n\n"); + DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success); + return; // addrsan should catch malloc-unknown and print more info than we have + } + } + if (p) { p->next = it->next; } else { allocation_ll = it->next; } + DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success); + DO_ASSERT(it->ptr == ptr); + __real_free(it); +} +static void FREE(void* ptr) { + if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys + alloc_freed(ptr); + __real_free(ptr); +} + +void* __wrap_malloc(size_t len) { + void* res = __real_malloc(len); + new_allocation(res, "malloc call", len); + return res; +} +void* __wrap_calloc(size_t nmemb, size_t len) { + void* res = __real_calloc(nmemb, len); + new_allocation(res, "calloc call", len); + return res; +} +void __wrap_free(void* ptr) { + if (ptr == NULL) return; + alloc_freed(ptr); + __real_free(ptr); +} + +void* __real_realloc(void* ptr, size_t newlen); +void* __wrap_realloc(void* ptr, size_t len) { + if (ptr != NULL) alloc_freed(ptr); + void* res = __real_realloc(ptr, len); + new_allocation(res, "realloc call", len); + return res; +} +void __wrap_reallocarray(void* ptr, size_t new_sz) { + // Rust doesn't seem to use reallocarray currently + DO_ASSERT(false); +} + +void __attribute__((destructor)) check_leaks() { + size_t alloc_count = 0; + size_t alloc_size = 0; + for (allocation* a = allocation_ll; a != NULL; a = a->next) { + fprintf(stderr, "%s %p (%lu bytes) remains:\n", a->struct_name, a->ptr, a->alloc_len); + backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO); + fprintf(stderr, "\n\n"); + alloc_count++; + alloc_size += a->alloc_len; + } + fprintf(stderr, "%lu allocations remained for %lu bytes.\n", alloc_count, alloc_size); + DO_ASSERT(allocation_ll == NULL); +} static jmethodID ordinal_meth = NULL; static jmethodID slicedef_meth = NULL; @@ -308,8 +421,8 @@ static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass case 4: return LDKSecp256k1Error_InvalidSecretKey; case 5: return LDKSecp256k1Error_InvalidRecoveryId; case 6: return LDKSecp256k1Error_InvalidTweak; - case 7: return LDKSecp256k1Error_NotEnoughMemory; - case 8: return LDKSecp256k1Error_CallbackPanicked; + case 7: return LDKSecp256k1Error_TweakCheckFailed; + case 8: return LDKSecp256k1Error_NotEnoughMemory; } abort(); } @@ -321,8 +434,8 @@ static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL; static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL; static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL; static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL; +static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL; static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL; -static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, jclass clz) { LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz); CHECK(LDKSecp256k1Error_class != NULL); @@ -340,10 +453,10 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, j CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL); LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;"); CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL); + LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/LDKSecp256k1Error;"); + CHECK(LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL); LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;"); CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL); - LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;"); - CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL); } static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) { switch (val) { @@ -361,10 +474,10 @@ static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error va return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId); case LDKSecp256k1Error_InvalidTweak: return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak); + case LDKSecp256k1Error_TweakCheckFailed: + return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed); case LDKSecp256k1Error_NotEnoughMemory: return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory); - case LDKSecp256k1Error_CallbackPanicked: - return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked); default: abort(); } } @@ -634,9 +747,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1Sign jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < res_var.datalen; i++) { - int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form); - (*env)->SetObjectArrayElement(env, res_arr, i, arr_conv_8_arr); + int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form); + (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr); } return res_arr; } @@ -1594,6 +1707,34 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonit jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err)); return err_conv; } +static jclass LDKMonitorEvent_HTLCEvent_class = NULL; +static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL; +static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL; +static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) { + LDKMonitorEvent_HTLCEvent_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;")); + CHECK(LDKMonitorEvent_HTLCEvent_class != NULL); + LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "", "()V"); + CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL); + LDKMonitorEvent_CommitmentTxBroadcasted_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;")); + CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL); + LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "", "()V"); + CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr; + switch(obj->tag) { + case LDKMonitorEvent_HTLCEvent: { + return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth); + } + case LDKMonitorEvent_CommitmentTxBroadcasted: { + return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth); + } + default: abort(); + } +} JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ"); ret->datalen = (*env)->GetArrayLength(env, elems); @@ -1604,10 +1745,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new 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]; - LDKMonitorEvent 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 = MonitorEvent_clone(&arr_elem_conv); + LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); ret->data[i] = arr_elem_conv; } (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); @@ -1621,42 +1760,28 @@ static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_Monit } return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - ret->a = a; - ret->b = b; - return (long)ret; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) { - LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1); - return tuple->a; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) { - LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1); - return tuple->b; -} static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL; static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL; -static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL; -static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL; -static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL; -static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL; +static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL; +static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL; +static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL; +static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) { LDKSpendableOutputDescriptor_StaticOutput_class = (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;")); CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL); LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "", "(JJ)V"); CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL); - LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;")); - CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL); - LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "", "(J[BSJJ[B)V"); - CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL); - LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;")); - CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL); - LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "", "(JJJ)V"); - CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL); + LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;")); + CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL); + LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "", "()V"); + CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL); + LDKSpendableOutputDescriptor_StaticPaymentOutput_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;")); + CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL); + LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "", "()V"); + CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr; @@ -1669,27 +1794,11 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescripto long output_ref = ((long)&obj->static_output.output) | 1; return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref); } - case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: { - LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint; - CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long outpoint_ref = (long)outpoint_var.inner & ~1; - int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form); - long output_ref = ((long)&obj->dynamic_output_p2wsh.output) | 1; - long key_derivation_params_ref = (long)(&obj->dynamic_output_p2wsh.key_derivation_params) | 1; - int8_tArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form); - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, (long)output_ref, key_derivation_params_ref, revocation_pubkey_arr); + case LDKSpendableOutputDescriptor_DelayedPaymentOutput: { + return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth); } - case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: { - LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint; - CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long outpoint_ref = (long)outpoint_var.inner & ~1; - long output_ref = ((long)&obj->static_output_counterparty_payment.output) | 1; - long key_derivation_params_ref = (long)(&obj->static_output_counterparty_payment.key_derivation_params) | 1; - return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, (long)output_ref, key_derivation_params_ref); + case LDKSpendableOutputDescriptor_StaticPaymentOutput: { + return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth); } default: abort(); } @@ -1813,8 +1922,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen); int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL); for (size_t b = 0; b < outputs_var.datalen; b++) { - long arr_conv_27_ref = ((long)&outputs_var.data[b]) | 1; - outputs_arr_ptr[b] = arr_conv_27_ref; + long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1; + outputs_arr_ptr[b] = outputs_conv_27_ref; } (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0); return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr); @@ -2012,10 +2121,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tup b_constr.data = NULL; int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL); for (size_t a = 0; a < b_constr.datalen; a++) { - int64_t arr_conv_26 = b_vals[a]; - LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1); - FREE((void*)arr_conv_26); - b_constr.data[a] = arr_conv_26_conv; + int64_t b_conv_26 = b_vals[a]; + LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1); + FREE((void*)b_conv_26); + b_constr.data[a] = b_conv_26_conv; } (*env)->ReleaseLongArrayElements(env, b, b_vals, 0); ret->b = b_constr; @@ -2033,8 +2142,8 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen); int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL); for (size_t a = 0; a < b_var.datalen; a++) { - long arr_conv_26_ref = (long)(&b_var.data[a]) | 1; - b_arr_ptr[a] = arr_conv_26_ref; + long b_conv_26_ref = (long)(&b_var.data[a]) | 1; + b_arr_ptr[a] = b_conv_26_ref; } (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0); return b_arr; @@ -2070,11 +2179,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1 else b_constr.data = NULL; for (size_t i = 0; i < b_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - b_constr.data[i] = arr_conv_8_ref; + int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i); + LDKSignature b_conv_8_ref; + CHECK((*env)->GetArrayLength(env, b_conv_8) == 64); + (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form); + b_constr.data[i] = b_conv_8_ref; } ret->b = b_constr; return (long)ret; @@ -2091,9 +2200,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureC jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < b_var.datalen; i++) { - int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form); - (*env)->SetObjectArrayElement(env, b_arr, i, arr_conv_8_arr); + int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form); + (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr); } return b_arr; } @@ -2126,13 +2235,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1ge CHECK(!val->result_ok); return *val->contents.err; } -typedef struct LDKChannelKeys_JCalls { +typedef struct LDKSign_JCalls { atomic_size_t refcnt; JavaVM *vm; jweak o; jmethodID get_per_commitment_point_meth; jmethodID release_commitment_secret_meth; - jmethodID key_derivation_params_meth; + jmethodID channel_keys_id_meth; jmethodID sign_counterparty_commitment_meth; jmethodID sign_holder_commitment_and_htlcs_meth; jmethodID sign_justice_transaction_meth; @@ -2141,9 +2250,9 @@ typedef struct LDKChannelKeys_JCalls { jmethodID sign_channel_announcement_meth; jmethodID ready_channel_meth; jmethodID write_meth; -} LDKChannelKeys_JCalls; -static void LDKChannelKeys_JCalls_free(void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; +} LDKSign_JCalls; +static void LDKSign_JCalls_free(void* this_arg) { + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -2152,42 +2261,43 @@ static void LDKChannelKeys_JCalls_free(void* this_arg) { } } LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx); - LDKPublicKey arg_ref; - CHECK((*env)->GetArrayLength(env, arg) == 33); - (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form); - return arg_ref; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx); + LDKPublicKey ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 33); + (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form); + return ret_ref; } LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx); - LDKThirtyTwoBytes arg_ref; - CHECK((*env)->GetArrayLength(env, arg) == 32); - (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data); - return arg_ref; -} -LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx); + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + return ret_ref; +} +LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) { + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth); - LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)ret) & ~1); - ret_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)ret); - return ret_conv; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth); + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + return ret_ref; } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); LDKCommitmentTransaction commitment_tx_var = *commitment_tx; @@ -2206,7 +2316,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_j return ret_conv; } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx; @@ -2225,7 +2335,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl return ret_conv; } LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); LDKTransaction justice_tx_var = justice_tx; @@ -2250,7 +2360,7 @@ LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, L return ret_conv; } LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); LDKTransaction htlc_tx_var = htlc_tx; @@ -2275,7 +2385,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* t return ret_conv; } LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); LDKTransaction closing_tx_var = closing_tx; @@ -2290,7 +2400,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, L return ret_conv; } LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); LDKUnsignedChannelAnnouncement msg_var = *msg; @@ -2309,7 +2419,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, return ret_conv; } void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; @@ -2325,27 +2435,27 @@ void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref); } LDKCVec_u8Z write_jcall(const void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); - LDKCVec_u8Z arg_ref; - arg_ref.datalen = (*env)->GetArrayLength(env, arg); - arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data); - return arg_ref; -} -static void* LDKChannelKeys_JCalls_clone(const void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); + LDKCVec_u8Z ret_ref; + ret_ref.datalen = (*env)->GetArrayLength(env, ret); + ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); + return ret_ref; +} +static void* LDKSign_JCalls_clone(const void* this_arg) { + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); return (void*) this_arg; } -static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { +static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { jclass c = (*env)->GetObjectClass(env, o); CHECK(c != NULL); - LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls"); + LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls"); atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); @@ -2353,8 +2463,8 @@ static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobje CHECK(calls->get_per_commitment_point_meth != NULL); calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B"); CHECK(calls->release_commitment_secret_meth != NULL); - calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J"); - CHECK(calls->key_derivation_params_meth != NULL); + calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B"); + CHECK(calls->channel_keys_id_meth != NULL); calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J"); CHECK(calls->sign_counterparty_commitment_meth != NULL); calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J"); @@ -2377,11 +2487,11 @@ static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobje pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0); pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv); - LDKChannelKeys ret = { + LDKSign ret = { .this_arg = (void*) calls, .get_per_commitment_point = get_per_commitment_point_jcall, .release_commitment_secret = release_commitment_secret_jcall, - .key_derivation_params = key_derivation_params_jcall, + .channel_keys_id = channel_keys_id_jcall, .sign_counterparty_commitment = sign_counterparty_commitment_jcall, .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall, .sign_justice_transaction = sign_justice_transaction_jcall, @@ -2389,42 +2499,42 @@ static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobje .sign_closing_transaction = sign_closing_transaction_jcall, .sign_channel_announcement = sign_channel_announcement_jcall, .ready_channel = ready_channel_jcall, - .clone = LDKChannelKeys_JCalls_clone, + .clone = LDKSign_JCalls_clone, .write = write_jcall, - .free = LDKChannelKeys_JCalls_free, + .free = LDKSign_JCalls_free, .pubkeys = pubkeys_conv, .set_pubkeys = NULL, }; return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { - LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *res_ptr = LDKChannelKeys_init(env, clz, o, pubkeys); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) { + LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign"); + *res_ptr = LDKSign_init(env, clz, o, pubkeys); return (long)res_ptr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form); - return arg_arr; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form); + return ret_arr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - int8_tArray arg_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data); - return arg_arr; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data); + return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg); - return (long)ret_ref; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data); + return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = (void*)(commitment_tx & (~1)); commitment_tx_conv.is_owned = false; @@ -2433,8 +2543,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterp return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKHolderCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = (void*)(commitment_tx & (~1)); commitment_tx_conv.is_owned = false; @@ -2443,8 +2553,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1 return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1justice_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx); justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); @@ -2462,8 +2572,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_ return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKTransaction htlc_tx_ref; htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx); htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes"); @@ -2480,8 +2590,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterp return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKTransaction closing_tx_ref; closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx); closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes"); @@ -2492,8 +2602,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_ return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKUnsignedChannelAnnouncement msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = false; @@ -2502,31 +2612,31 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_ return (long)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKChannelTransactionParameters channel_parameters_conv; channel_parameters_conv.inner = (void*)(channel_parameters & (~1)); channel_parameters_conv.is_owned = false; (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; } -LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) { +LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) { if (this_arg->set_pubkeys != NULL) this_arg->set_pubkeys(this_arg); return this_arg->pubkeys; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -2679,6 +2789,56 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1 long err_ref = ((long)&(*val->contents.err)) | 1; return err_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ"); + ret->datalen = (*env)->GetArrayLength(env, elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ 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]; + LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); + ret->data[i] = arr_elem_conv; + } + (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); + } + return (long)ret; +} +static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { + LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); + } + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ"); + ret->datalen = (*env)->GetArrayLength(env, elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ 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]; + LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); + ret->data[i] = arr_elem_conv; + } + (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); + } + return (long)ret; +} +static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { + LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = APIError_clone(&orig->data[i]); + } + return ret; +} JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ"); ret->datalen = (*env)->GetArrayLength(env, elems); @@ -2706,6 +2866,54 @@ static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_C } return ret; } +static jclass LDKPaymentSendFailure_ParameterError_class = NULL; +static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL; +static jclass LDKPaymentSendFailure_PathParameterError_class = NULL; +static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL; +static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL; +static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL; +static jclass LDKPaymentSendFailure_PartialFailure_class = NULL; +static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) { + LDKPaymentSendFailure_ParameterError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;")); + CHECK(LDKPaymentSendFailure_ParameterError_class != NULL); + LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "", "()V"); + CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL); + LDKPaymentSendFailure_PathParameterError_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;")); + CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL); + LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "", "()V"); + CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL); + LDKPaymentSendFailure_AllFailedRetrySafe_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;")); + CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL); + LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "", "()V"); + CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL); + LDKPaymentSendFailure_PartialFailure_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;")); + CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL); + LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "", "()V"); + CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL); +} +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { + LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr; + switch(obj->tag) { + case LDKPaymentSendFailure_ParameterError: { + return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth); + } + case LDKPaymentSendFailure_PathParameterError: { + return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth); + } + case LDKPaymentSendFailure_AllFailedRetrySafe: { + return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth); + } + case LDKPaymentSendFailure_PartialFailure: { + return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth); + } + default: abort(); + } +} 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; } @@ -2717,10 +2925,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFai JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1); CHECK(!val->result_ok); - LDKPaymentSendFailure err_var = (*val->contents.err); - CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long err_ref = (long)err_var.inner & ~1; + long err_ref = ((long)&(*val->contents.err)) | 1; return err_ref; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { @@ -2823,24 +3028,22 @@ LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth); - LDKCVec_MonitorEventZ arg_constr; - arg_constr.datalen = (*env)->GetArrayLength(env, arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements"); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth); + LDKCVec_MonitorEventZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements"); else - arg_constr.data = NULL; - int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL); - for (size_t o = 0; o < arg_constr.datalen; o++) { - int64_t arr_conv_14 = arg_vals[o]; - LDKMonitorEvent arr_conv_14_conv; - arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1)); - arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0); - arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv); - arg_constr.data[o] = arr_conv_14_conv; - } - (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0); - return arg_constr; + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t o = 0; o < ret_constr.datalen; o++) { + int64_t ret_conv_14 = ret_vals[o]; + LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1); + ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14); + ret_constr.data[o] = ret_conv_14_conv; + } + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); + return ret_constr; } static void* LDKWatch_JCalls_clone(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; @@ -2911,14 +3114,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pendin int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t o = 0; o < ret_var.datalen; o++) { - LDKMonitorEvent arr_conv_14_var = ret_var.data[o]; - CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_14_ref = (long)arr_conv_14_var.inner; - if (arr_conv_14_var.is_owned) { - arr_conv_14_ref |= 1; - } - ret_arr_ptr[o] = arr_conv_14_ref; + LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]); + long ret_conv_14_ref = (long)ret_conv_14_copy; + ret_arr_ptr[o] = ret_conv_14_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -2989,18 +3188,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcas (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref); } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { - return ((LDKCResult_ChannelKeysDecodeErrorZ*)arg)->result_ok; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = ChannelKeys_clone(&(*val->contents.result)); + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = Sign_clone(&(*val->contents.result)); return (long)ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -3015,7 +3214,7 @@ typedef struct LDKKeysInterface_JCalls { jmethodID get_node_secret_meth; jmethodID get_destination_script_meth; jmethodID get_shutdown_pubkey_meth; - jmethodID get_channel_keys_meth; + jmethodID get_channel_signer_meth; jmethodID get_secure_random_bytes_meth; jmethodID read_chan_signer_meth; } LDKKeysInterface_JCalls; @@ -3034,11 +3233,11 @@ LDKSecretKey get_node_secret_jcall(const void* this_arg) { DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); - LDKSecretKey arg_ref; - CHECK((*env)->GetArrayLength(env, arg) == 32); - (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes); - return arg_ref; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); + LDKSecretKey ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes); + return ret_ref; } LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -3046,12 +3245,12 @@ LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); - LDKCVec_u8Z arg_ref; - arg_ref.datalen = (*env)->GetArrayLength(env, arg); - arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes"); - (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data); - return arg_ref; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); + LDKCVec_u8Z ret_ref; + ret_ref.datalen = (*env)->GetArrayLength(env, ret); + ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data); + return ret_ref; } LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -3059,21 +3258,21 @@ LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth); - LDKPublicKey arg_ref; - CHECK((*env)->GetArrayLength(env, arg) == 33); - (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form); - return arg_ref; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth); + LDKPublicKey ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 33); + (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form); + return ret_ref; } -LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { +LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis); - LDKChannelKeys ret_conv = *(LDKChannelKeys*)(((uint64_t)ret) & ~1); - ret_conv = ChannelKeys_clone(ret); + LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis); + LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1); + ret_conv = Sign_clone(ret); return ret_conv; } LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { @@ -3082,13 +3281,13 @@ LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); - LDKThirtyTwoBytes arg_ref; - CHECK((*env)->GetArrayLength(env, arg) == 32); - (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data); - return arg_ref; + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + return ret_ref; } -LDKCResult_ChannelKeysDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) { +LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); @@ -3097,9 +3296,9 @@ LDKCResult_ChannelKeysDecodeErrorZ read_chan_signer_jcall(const void* this_arg, (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - LDKCResult_ChannelKeysDecodeErrorZ* ret = (LDKCResult_ChannelKeysDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr); - LDKCResult_ChannelKeysDecodeErrorZ ret_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)ret) & ~1); - ret_conv = CResult_ChannelKeysDecodeErrorZ_clone((LDKCResult_ChannelKeysDecodeErrorZ*)ret); + LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr); + LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1); + ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret); return ret_conv; } static void* LDKKeysInterface_JCalls_clone(const void* this_arg) { @@ -3120,8 +3319,8 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j CHECK(calls->get_destination_script_meth != NULL); calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B"); CHECK(calls->get_shutdown_pubkey_meth != NULL); - calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J"); - CHECK(calls->get_channel_keys_meth != NULL); + calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J"); + CHECK(calls->get_channel_signer_meth != NULL); calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B"); CHECK(calls->get_secure_random_bytes_meth != NULL); calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J"); @@ -3132,7 +3331,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j .get_node_secret = get_node_secret_jcall, .get_destination_script = get_destination_script_jcall, .get_shutdown_pubkey = get_shutdown_pubkey_jcall, - .get_channel_keys = get_channel_keys_jcall, + .get_channel_signer = get_channel_signer_jcall, .get_secure_random_bytes = get_secure_random_bytes_jcall, .read_chan_signer = read_chan_signer_jcall, .free = LDKKeysInterface_JCalls_free, @@ -3146,39 +3345,39 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEn } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - int8_tArray arg_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes); + return ret_arr; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form); + return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis); + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis); return (long)ret; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - int8_tArray arg_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data); + return ret_arr; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) { @@ -3186,7 +3385,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1 LDKu8slice reader_ref; reader_ref.datalen = (*env)->GetArrayLength(env, reader); reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL); - LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref); (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0); return (long)ret_conv; @@ -3365,20 +3564,49 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutput long err_ref = (long)err_var.inner & ~1; return err_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { - return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok; +static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) { + LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = CVec_u8Z_clone(&orig->data[i]); + } + return ret; +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok; +} +JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKCVec_CVec_u8ZZ res_var = (*val->contents.result); + jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL); + ; + for (size_t i = 0; i < res_var.datalen; i++) { + LDKCVec_u8Z res_conv_8_var = res_var.data[i]; + int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen); + (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data); + (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr); + } + return res_arr; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInMemoryChannelKeys res_var = (*val->contents.result); + LDKInMemorySigner res_var = (*val->contents.result); CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long res_ref = (long)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -3386,6 +3614,47 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannel long err_ref = (long)err_var.inner & ~1; return err_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { + LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ"); + ret->datalen = (*env)->GetArrayLength(env, elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ 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]; + LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); + ret->data[i] = arr_elem_conv; + } + (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0); + } + return (long)ret; +} +static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) { + LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = TxOut_clone(&orig->data[i]); + } + return ret; +} +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) { + return ((LDKCResult_TransactionNoneZ*)arg)->result_ok; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKTransaction res_var = (*val->contents.result); + int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen); + (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data); + return res_arr; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) { LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ"); ret->datalen = (*env)->GetArrayLength(env, elems); @@ -4303,22 +4572,22 @@ LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* thi DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth); - LDKCVec_MessageSendEventZ arg_constr; - arg_constr.datalen = (*env)->GetArrayLength(env, arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements"); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth); + LDKCVec_MessageSendEventZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements"); else - arg_constr.data = NULL; - int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL); - for (size_t s = 0; s < arg_constr.datalen; s++) { - int64_t arr_conv_18 = arg_vals[s]; - LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1); - FREE((void*)arr_conv_18); - arg_constr.data[s] = arr_conv_18_conv; + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t s = 0; s < ret_constr.datalen; s++) { + int64_t ret_conv_18 = ret_vals[s]; + LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1); + ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18); + ret_constr.data[s] = ret_conv_18_conv; } - (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0); - return arg_constr; + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); + return ret_constr; } static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) { LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; @@ -4353,10 +4622,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvi int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t s = 0; s < ret_var.datalen; s++) { - LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); - *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]); - long arr_conv_18_ref = (long)arr_conv_18_copy; - ret_arr_ptr[s] = arr_conv_18_ref; + LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); + *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]); + long ret_conv_18_ref = (long)ret_conv_18_copy; + ret_arr_ptr[s] = ret_conv_18_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -4384,22 +4653,22 @@ LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) { DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth); - LDKCVec_EventZ arg_constr; - arg_constr.datalen = (*env)->GetArrayLength(env, arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements"); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth); + LDKCVec_EventZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements"); else - arg_constr.data = NULL; - int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL); - for (size_t h = 0; h < arg_constr.datalen; h++) { - int64_t arr_conv_7 = arg_vals[h]; - LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1); - FREE((void*)arr_conv_7); - arg_constr.data[h] = arr_conv_7_conv; + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t h = 0; h < ret_constr.datalen; h++) { + int64_t ret_conv_7 = ret_vals[h]; + LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1); + ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7); + ret_constr.data[h] = ret_conv_7_conv; } - (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0); - return arg_constr; + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); + return ret_constr; } static void* LDKEventsProvider_JCalls_clone(const void* this_arg) { LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; @@ -4434,10 +4703,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1a int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t h = 0; h < ret_var.datalen; h++) { - LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *arr_conv_7_copy = Event_clone(&ret_var.data[h]); - long arr_conv_7_ref = (long)arr_conv_7_copy; - ret_arr_ptr[h] = arr_conv_7_ref; + LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_conv_7_copy = Event_clone(&ret_var.data[h]); + long ret_conv_7_ref = (long)ret_conv_7_copy; + ret_arr_ptr[h] = ret_conv_7_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -4510,6 +4779,91 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *e return (long)ret_conv; } +typedef struct LDKListen_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID block_connected_meth; + jmethodID block_disconnected_meth; +} LDKListen_JCalls; +static void LDKListen_JCalls_free(void* this_arg) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + FREE(j_calls); + } +} +void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + JNIEnv *env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); + LDKu8slice block_var = block; + int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen); + (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + return (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height); +} +void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + JNIEnv *env; + DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); + int8_tArray header_arr = (*env)->NewByteArray(env, 80); + (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + return (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height); +} +static void* LDKListen_JCalls_clone(const void* this_arg) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); + return (void*) this_arg; +} +static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V"); + CHECK(calls->block_connected_meth != NULL); + calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V"); + CHECK(calls->block_disconnected_meth != NULL); + + LDKListen ret = { + .this_arg = (void*) calls, + .block_connected = block_connected_jcall, + .block_disconnected = block_disconnected_jcall, + .free = LDKListen_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) { + LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen"); + *res_ptr = LDKListen_init(env, clz, o); + return (long)res_ptr; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) { + LDKListen* this_arg_conv = (LDKListen*)this_arg; + LDKu8slice block_ref; + block_ref.datalen = (*env)->GetArrayLength(env, block); + block_ref.data = (*env)->GetByteArrayElements (env, block, NULL); + (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height); + (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) { + LDKListen* this_arg_conv = (LDKListen*)this_arg; + unsigned char header_arr[80]; + CHECK((*env)->GetArrayLength(env, header) == 80); + (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr); + unsigned char (*header_ref)[80] = &header_arr; + (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height); +} + typedef struct LDKFilter_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -4888,12 +5242,20 @@ void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_i CHECK(obj != NULL); return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref); } -void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) { +void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; JNIEnv *env; DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33); (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form); + LDKInitFeatures their_features_var = *their_features; + their_features_var = InitFeatures_clone(their_features); + CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long their_features_ref = (long)their_features_var.inner; + if (their_features_var.is_owned) { + their_features_ref |= 1; + } LDKShutdown msg_var = *msg; msg_var = Shutdown_clone(msg); CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -4904,7 +5266,7 @@ void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, con } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref); + return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); } void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -5155,7 +5517,7 @@ static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *en CHECK(calls->handle_funding_signed_meth != NULL); calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V"); CHECK(calls->handle_funding_locked_meth != NULL); - calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V"); + calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V"); CHECK(calls->handle_shutdown_meth != NULL); calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V"); CHECK(calls->handle_closing_signed_meth != NULL); @@ -5279,15 +5641,18 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) { LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; CHECK((*env)->GetArrayLength(env, their_node_id) == 33); (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form); + LDKInitFeatures their_features_conv; + their_features_conv.inner = (void*)(their_features & (~1)); + their_features_conv.is_owned = false; LDKShutdown msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = false; - (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); + (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) { @@ -5528,22 +5893,22 @@ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6) == JNI_OK); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); - LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr; - arg_constr.datalen = (*env)->GetArrayLength(env, arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements"); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); + LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements"); else - arg_constr.data = NULL; - int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL); - for (size_t l = 0; l < arg_constr.datalen; l++) { - int64_t arr_conv_63 = arg_vals[l]; - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1); - FREE((void*)arr_conv_63); - arg_constr.data[l] = arr_conv_63_conv; + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t l = 0; l < ret_constr.datalen; l++) { + int64_t ret_conv_63 = ret_vals[l]; + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1); + ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63); + ret_constr.data[l] = ret_conv_63_conv; } - (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0); - return arg_constr; + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); + return ret_constr; } LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; @@ -5553,24 +5918,24 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form); jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); - LDKCVec_NodeAnnouncementZ arg_constr; - arg_constr.datalen = (*env)->GetArrayLength(env, arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements"); + int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); + LDKCVec_NodeAnnouncementZ ret_constr; + ret_constr.datalen = (*env)->GetArrayLength(env, ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements"); else - arg_constr.data = NULL; - int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL); - for (size_t s = 0; s < arg_constr.datalen; s++) { - int64_t arr_conv_18 = arg_vals[s]; - LDKNodeAnnouncement arr_conv_18_conv; - arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1)); - arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0); - arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv); - arg_constr.data[s] = arr_conv_18_conv; - } - (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0); - return arg_constr; + ret_constr.data = NULL; + int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL); + for (size_t s = 0; s < ret_constr.datalen; s++) { + int64_t ret_conv_18 = ret_vals[s]; + LDKNodeAnnouncement ret_conv_18_conv; + ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1)); + ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0); + ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv); + ret_constr.data[s] = ret_conv_18_conv; + } + (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0); + return ret_constr; } void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; @@ -5772,9 +6137,9 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t l = 0; l < ret_var.datalen; l++) { - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ"); - *arr_conv_63_ref = ret_var.data[l]; - ret_arr_ptr[l] = (long)arr_conv_63_ref; + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ"); + *ret_conv_63_ref = ret_var.data[l]; + ret_arr_ptr[l] = (long)ret_conv_63_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -5790,14 +6155,14 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t s = 0; s < ret_var.datalen; s++) { - LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s]; - CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_18_ref = (long)arr_conv_18_var.inner; - if (arr_conv_18_var.is_owned) { - arr_conv_18_ref |= 1; + LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s]; + CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_conv_18_ref = (long)ret_conv_18_var.inner; + if (ret_conv_18_var.is_owned) { + ret_conv_18_ref |= 1; } - ret_arr_ptr[s] = arr_conv_18_ref; + ret_arr_ptr[s] = ret_conv_18_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -6255,11 +6620,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv else _res_constr.data = NULL; for (size_t i = 0; i < _res_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - _res_constr.data[i] = arr_conv_8_ref; + int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); + LDKSignature _res_conv_8_ref; + CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64); + (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form); + _res_constr.data[i] = _res_conv_8_ref; } CVec_SignatureZ_free(_res_constr); } @@ -6397,11 +6762,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNo else o_constr.data = NULL; for (size_t i = 0; i < o_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, o, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - o_constr.data[i] = arr_conv_8_ref; + int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i); + LDKSignature o_conv_8_ref; + CHECK((*env)->GetArrayLength(env, o_conv_8) == 64); + (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form); + o_constr.data[i] = o_conv_8_ref; } LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ"); *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr); @@ -6436,11 +6801,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv else _res_constr.data = NULL; for (size_t i = 0; i < _res_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); - LDKPublicKey arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 33); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form); - _res_constr.data[i] = arr_conv_8_ref; + int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); + LDKPublicKey _res_conv_8_ref; + CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33); + (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form); + _res_constr.data[i] = _res_conv_8_ref; } CVec_PublicKeyZ_free(_res_constr); } @@ -6733,10 +7098,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnounce _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t l = 0; l < _res_constr.datalen; l++) { - int64_t arr_conv_63 = _res_vals[l]; - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1); - FREE((void*)arr_conv_63); - _res_constr.data[l] = arr_conv_63_conv; + int64_t _res_conv_63 = _res_vals[l]; + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1); + FREE((void*)_res_conv_63); + _res_constr.data[l] = _res_conv_63_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr); @@ -6751,11 +7116,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free( _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t s = 0; s < _res_constr.datalen; s++) { - int64_t arr_conv_18 = _res_vals[s]; - LDKNodeAnnouncement arr_conv_18_conv; - arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1)); - arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0); - _res_constr.data[s] = arr_conv_18_conv; + int64_t _res_conv_18 = _res_vals[s]; + LDKNodeAnnouncement _res_conv_18_conv; + _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1)); + _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0); + _res_constr.data[s] = _res_conv_18_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_NodeAnnouncementZ_free(_res_constr); @@ -6800,10 +7165,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free( _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t s = 0; s < _res_constr.datalen; s++) { - int64_t arr_conv_18 = _res_vals[s]; - LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1); - FREE((void*)arr_conv_18); - _res_constr.data[s] = arr_conv_18_conv; + int64_t _res_conv_18 = _res_vals[s]; + LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1); + FREE((void*)_res_conv_18); + _res_constr.data[s] = _res_conv_18_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_MessageSendEventZ_free(_res_constr); @@ -6847,7 +7212,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeE LDKChannelInfo 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 LDKChannelInfo + o_conv = ChannelInfo_clone(&o_conv); LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv); return (long)ret_conv; @@ -6870,6 +7235,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErro CResult_ChannelInfoDecodeErrorZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv); + return (long)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKRoutingFees o_conv; o_conv.inner = (void*)(o & (~1)); @@ -6913,10 +7285,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t m = 0; m < _res_constr.datalen; m++) { - int64_t arr_conv_12 = _res_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - _res_constr.data[m] = arr_conv_12_conv; + int64_t _res_conv_12 = _res_vals[m]; + LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1); + FREE((void*)_res_conv_12); + _res_constr.data[m] = _res_conv_12_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_NetAddressZ_free(_res_constr); @@ -6965,8 +7337,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t g = 0; g < _res_constr.datalen; g++) { - int64_t arr_conv_6 = _res_vals[g]; - _res_constr.data[g] = arr_conv_6; + int64_t _res_conv_6 = _res_vals[g]; + _res_constr.data[g] = _res_conv_6; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_u64Z_free(_res_constr); @@ -7010,7 +7382,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecode LDKNetworkGraph 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 LDKNetworkGraph + o_conv = NetworkGraph_clone(&o_conv); LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv); return (long)ret_conv; @@ -7033,6 +7405,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErr CResult_NetworkGraphDecodeErrorZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1); + LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); + *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv); + return (long)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) { LDKTransaction b_ref; b_ref.datalen = (*env)->GetArrayLength(env, b); @@ -7060,10 +7439,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactio _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t y = 0; y < _res_constr.datalen; y++) { - int64_t arr_conv_24 = _res_vals[y]; - LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1); - FREE((void*)arr_conv_24); - _res_constr.data[y] = arr_conv_24_conv; + int64_t _res_conv_24 = _res_vals[y]; + LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1); + FREE((void*)_res_conv_24); + _res_constr.data[y] = _res_conv_24_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_C2Tuple_usizeTransactionZZ_free(_res_constr); @@ -7105,11 +7484,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIE _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t o = 0; o < _res_constr.datalen; o++) { - int64_t arr_conv_14 = _res_vals[o]; - LDKMonitorEvent arr_conv_14_conv; - arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1)); - arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0); - _res_constr.data[o] = arr_conv_14_conv; + int64_t _res_conv_14 = _res_vals[o]; + LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1); + FREE((void*)_res_conv_14); + _res_constr.data[o] = _res_conv_14_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_MonitorEventZ_free(_res_constr); @@ -7124,10 +7502,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t h = 0; h < _res_constr.datalen; h++) { - int64_t arr_conv_7 = _res_vals[h]; - LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1); - FREE((void*)arr_conv_7); - _res_constr.data[h] = arr_conv_7_conv; + int64_t _res_conv_7 = _res_vals[h]; + LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1); + FREE((void*)_res_conv_7); + _res_constr.data[h] = _res_conv_7_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_EventZ_free(_res_constr); @@ -7301,13 +7679,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEn else _res_constr.data = NULL; for (size_t i = 0; i < _res_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); - LDKTransaction arr_conv_8_ref; - arr_conv_8_ref.datalen = (*env)->GetArrayLength(env, arr_conv_8); - arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes"); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data); - arr_conv_8_ref.data_is_owned = true; - _res_constr.data[i] = arr_conv_8_ref; + int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); + LDKTransaction _res_conv_8_ref; + _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8); + _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes"); + (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data); + _res_conv_8_ref.data_is_owned = true; + _res_constr.data[i] = _res_conv_8_ref; } CVec_TransactionZ_free(_res_constr); } @@ -7343,10 +7721,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1fre _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t a = 0; a < _res_constr.datalen; a++) { - int64_t arr_conv_26 = _res_vals[a]; - LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1); - FREE((void*)arr_conv_26); - _res_constr.data[a] = arr_conv_26_conv; + int64_t _res_conv_26 = _res_vals[a]; + LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1); + FREE((void*)_res_conv_26); + _res_constr.data[a] = _res_conv_26_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_C2Tuple_u32TxOutZZ_free(_res_constr); @@ -7364,10 +7742,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_ b_constr.data = NULL; int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL); for (size_t a = 0; a < b_constr.datalen; a++) { - int64_t arr_conv_26 = b_vals[a]; - LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1); - FREE((void*)arr_conv_26); - b_constr.data[a] = arr_conv_26_conv; + int64_t b_conv_26 = b_vals[a]; + LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1); + FREE((void*)b_conv_26); + b_constr.data[a] = b_conv_26_conv; } (*env)->ReleaseLongArrayElements(env, b, b_vals, 0); LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); @@ -7391,10 +7769,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tup _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t u = 0; u < _res_constr.datalen; u++) { - int64_t arr_conv_46 = _res_vals[u]; - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_conv_46) & ~1); - FREE((void*)arr_conv_46); - _res_constr.data[u] = arr_conv_46_conv; + int64_t _res_conv_46 = _res_vals[u]; + LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1); + FREE((void*)_res_conv_46); + _res_constr.data[u] = _res_conv_46_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr); @@ -7454,10 +7832,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescripto _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t b = 0; b < _res_constr.datalen; b++) { - int64_t arr_conv_27 = _res_vals[b]; - LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_conv_27) & ~1); - FREE((void*)arr_conv_27); - _res_constr.data[b] = arr_conv_27_conv; + int64_t _res_conv_27 = _res_vals[b]; + LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1); + FREE((void*)_res_conv_27); + _res_constr.data[b] = _res_conv_27_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_SpendableOutputDescriptorZ_free(_res_constr); @@ -7520,6 +7898,42 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clo return (long)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_CResult_NoneAPIErrorZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t w = 0; w < _res_constr.datalen; w++) { + int64_t _res_conv_22 = _res_vals[w]; + LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1); + FREE((void*)_res_conv_22); + _res_constr.data[w] = _res_conv_22_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_CResult_NoneAPIErrorZZ_free(_res_constr); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_APIErrorZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ 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]; + LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1); + FREE((void*)_res_conv_10); + _res_constr.data[k] = _res_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_APIErrorZ_free(_res_constr); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_ChannelDetailsZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -7529,11 +7943,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JN _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t q = 0; q < _res_constr.datalen; q++) { - int64_t arr_conv_16 = _res_vals[q]; - LDKChannelDetails arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - _res_constr.data[q] = arr_conv_16_conv; + int64_t _res_conv_16 = _res_vals[q]; + LDKChannelDetails _res_conv_16_conv; + _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); + _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); + _res_constr.data[q] = _res_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_ChannelDetailsZ_free(_res_constr); @@ -7546,10 +7960,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) { - LDKPaymentSendFailure e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - e_conv = PaymentSendFailure_clone(&e_conv); + LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); + FREE((void*)e); LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv); return (long)ret_conv; @@ -7578,11 +7990,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JN _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t q = 0; q < _res_constr.datalen; q++) { - int64_t arr_conv_16 = _res_vals[q]; - LDKChannelMonitor arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - _res_constr.data[q] = arr_conv_16_conv; + int64_t _res_conv_16 = _res_vals[q]; + LDKChannelMonitor _res_conv_16_conv; + _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); + _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); + _res_constr.data[q] = _res_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_ChannelMonitorZ_free(_res_constr); @@ -7633,26 +8045,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashCha CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1); - LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - *ret_ref = C2Tuple_u64u64Z_clone(orig_conv); - return (long)ret_ref; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) { - LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - *ret_ref = C2Tuple_u64u64Z_new(a, b); - return (long)ret_ref; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)_res) & ~1); - FREE((void*)_res); - C2Tuple_u64u64Z_free(_res_conv); -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1); FREE((void*)o); @@ -7703,11 +8095,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1Sig else b_constr.data = NULL; for (size_t i = 0; i < b_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - b_constr.data[i] = arr_conv_8_ref; + int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i); + LDKSignature b_conv_8_ref; + CHECK((*env)->GetArrayLength(env, b_conv_8) == 64); + (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form); + b_constr.data[i] = b_conv_8_ref; } LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ"); *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr); @@ -7778,75 +8170,175 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1cl return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKChannelKeys o_conv = *(LDKChannelKeys*)(((uint64_t)o) & ~1); - if (o_conv.free == LDKChannelKeys_JCalls_free) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1); + if (o_conv.free == LDKSign_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKChannelKeys_JCalls_clone(o_conv.this_arg); + LDKSign_JCalls_clone(o_conv.this_arg); } - LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); - *ret_conv = CResult_ChannelKeysDecodeErrorZ_ok(o_conv); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv); return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_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_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); - *ret_conv = CResult_ChannelKeysDecodeErrorZ_err(e_conv); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + *ret_conv = CResult_SignDecodeErrorZ_err(e_conv); return (long)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; - LDKCResult_ChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1); + LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_ChannelKeysDecodeErrorZ_free(_res_conv); + CResult_SignDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_ChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelKeysDecodeErrorZ*)(orig & ~1); - LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); - *ret_conv = CResult_ChannelKeysDecodeErrorZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv); return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKInMemoryChannelKeys o_conv; - o_conv.inner = (void*)(o & (~1)); - o_conv.is_owned = (o & 1) || (o == 0); - o_conv = InMemoryChannelKeys_clone(&o_conv); - LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv); - return (long)ret_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) { + LDKCVec_CVec_u8ZZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements"); + else + _res_constr.data = NULL; + for (size_t i = 0; i < _res_constr.datalen; i++) { + int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i); + LDKCVec_u8Z _res_conv_8_ref; + _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8); + _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data); + _res_constr.data[i] = _res_conv_8_ref; + } + CVec_CVec_u8ZZ_free(_res_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_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_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv); - return (long)ret_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) { + LDKCVec_CVec_u8ZZ o_constr; + o_constr.datalen = (*env)->GetArrayLength(env, o); + if (o_constr.datalen > 0) + o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements"); + else + o_constr.data = NULL; + for (size_t i = 0; i < o_constr.datalen; i++) { + int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i); + LDKCVec_u8Z o_conv_8_ref; + o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8); + o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data); + o_constr.data[i] = o_conv_8_ref; + } + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr); + return (long)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err(); + return (long)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; - LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1); + LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv); + CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1); + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv); + return (long)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKInMemorySigner o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + o_conv = InMemorySigner_clone(&o_conv); + LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv); + return (long)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_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_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv); + return (long)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_InMemorySignerDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1); + LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv); + return (long)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { + LDKCVec_TxOutZ _res_constr; + _res_constr.datalen = (*env)->GetArrayLength(env, _res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements"); + else + _res_constr.data = NULL; + int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); + for (size_t h = 0; h < _res_constr.datalen; h++) { + int64_t _res_conv_7 = _res_vals[h]; + LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1); + FREE((void*)_res_conv_7); + _res_constr.data[h] = _res_conv_7_conv; + } + (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); + CVec_TxOutZ_free(_res_constr); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKTransaction o_ref; + o_ref.datalen = (*env)->GetArrayLength(env, o); + o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes"); + (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data); + o_ref.data_is_owned = true; + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = CResult_TransactionNoneZ_ok(o_ref); + return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_InMemoryChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(orig & ~1); - LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = CResult_TransactionNoneZ_err(); return (long)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_TransactionNoneZ_free(_res_conv); +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_RouteHopZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -7856,11 +8348,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _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 arr_conv_10 = _res_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - _res_constr.data[k] = arr_conv_10_conv; + int64_t _res_conv_10 = _res_vals[k]; + LDKRouteHop _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_RouteHopZ_free(_res_constr); @@ -7874,23 +8366,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(J else _res_constr.data = NULL; for (size_t m = 0; m < _res_constr.datalen; m++) { - int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, _res, m); - LDKCVec_RouteHopZ arr_conv_12_constr; - arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12); - if (arr_conv_12_constr.datalen > 0) - arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m); + LDKCVec_RouteHopZ _res_conv_12_constr; + _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12); + if (_res_conv_12_constr.datalen > 0) + _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); else - arr_conv_12_constr.data = NULL; - int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL); - for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) { - int64_t arr_conv_10 = arr_conv_12_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - arr_conv_12_constr.data[k] = arr_conv_10_conv; + _res_conv_12_constr.data = NULL; + int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL); + for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) { + int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k]; + LDKRouteHop _res_conv_12_conv_10_conv; + _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1)); + _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0); + _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv; } - (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0); - _res_constr.data[m] = arr_conv_12_constr; + (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0); + _res_constr.data[m] = _res_conv_12_constr; } CVec_CVec_RouteHopZZ_free(_res_constr); } @@ -7938,11 +8430,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t l = 0; l < _res_constr.datalen; l++) { - int64_t arr_conv_11 = _res_vals[l]; - LDKRouteHint arr_conv_11_conv; - arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1)); - arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0); - _res_constr.data[l] = arr_conv_11_conv; + int64_t _res_conv_11 = _res_vals[l]; + LDKRouteHint _res_conv_11_conv; + _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1)); + _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0); + _res_constr.data[l] = _res_conv_11_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_RouteHintZ_free(_res_constr); @@ -8051,11 +8543,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNI _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t p = 0; p < _res_constr.datalen; p++) { - int64_t arr_conv_15 = _res_vals[p]; - LDKUpdateAddHTLC arr_conv_15_conv; - arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1)); - arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0); - _res_constr.data[p] = arr_conv_15_conv; + int64_t _res_conv_15 = _res_vals[p]; + LDKUpdateAddHTLC _res_conv_15_conv; + _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1)); + _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0); + _res_constr.data[p] = _res_conv_15_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_UpdateAddHTLCZ_free(_res_constr); @@ -8070,11 +8562,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t t = 0; t < _res_constr.datalen; t++) { - int64_t arr_conv_19 = _res_vals[t]; - LDKUpdateFulfillHTLC arr_conv_19_conv; - arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1)); - arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0); - _res_constr.data[t] = arr_conv_19_conv; + int64_t _res_conv_19 = _res_vals[t]; + LDKUpdateFulfillHTLC _res_conv_19_conv; + _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1)); + _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0); + _res_constr.data[t] = _res_conv_19_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_UpdateFulfillHTLCZ_free(_res_constr); @@ -8089,11 +8581,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JN _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t q = 0; q < _res_constr.datalen; q++) { - int64_t arr_conv_16 = _res_vals[q]; - LDKUpdateFailHTLC arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - _res_constr.data[q] = arr_conv_16_conv; + int64_t _res_conv_16 = _res_vals[q]; + LDKUpdateFailHTLC _res_conv_16_conv; + _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); + _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); + _res_constr.data[q] = _res_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_UpdateFailHTLCZ_free(_res_constr); @@ -8108,11 +8600,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ _res_constr.data = NULL; int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL); for (size_t z = 0; z < _res_constr.datalen; z++) { - int64_t arr_conv_25 = _res_vals[z]; - LDKUpdateFailMalformedHTLC arr_conv_25_conv; - arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1)); - arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0); - _res_constr.data[z] = arr_conv_25_conv; + int64_t _res_conv_25 = _res_vals[z]; + LDKUpdateFailMalformedHTLC _res_conv_25_conv; + _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1)); + _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0); + _res_constr.data[z] = _res_conv_25_conv; } (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0); CVec_UpdateFailMalformedHTLCZ_free(_res_constr); @@ -9189,11 +9681,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, j JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; - LDKCVec_u8Z arg_var = Event_write(obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Event_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 void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -9631,11 +10123,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JN LDKChannelConfig obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelConfig_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_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -9791,6 +10283,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jcla Access_free(this_ptr_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Listen_free(this_ptr_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); @@ -9848,10 +10347,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected txdata_constr.data = NULL; int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL); for (size_t y = 0; y < txdata_constr.datalen; y++) { - int64_t arr_conv_24 = txdata_vals[y]; - LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1); - FREE((void*)arr_conv_24); - txdata_constr.data[y] = arr_conv_24_conv; + int64_t txdata_conv_24 = txdata_vals[y]; + LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1); + FREE((void*)txdata_conv_24); + txdata_constr.data[y] = txdata_conv_24_conv; } (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0); ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height); @@ -9958,11 +10457,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1w LDKChannelMonitorUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelMonitorUpdate_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_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -10003,23 +10502,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(J } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKMonitorEvent this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + if ((this_ptr & 1) != 0) return; + LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); MonitorEvent_free(this_ptr_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKMonitorEvent orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv); - CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long ret_ref = (long)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig; + LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_copy = MonitorEvent_clone(orig_conv); + long ret_ref = (long)ret_copy; return ret_ref; } @@ -10048,11 +10541,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEn LDKHTLCUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = HTLCUpdate_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_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -10090,11 +10583,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(J LDKChannelMonitor obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelMonitor_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_ChannelMonitor_1update_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) { @@ -10137,14 +10630,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1a int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t o = 0; o < ret_var.datalen; o++) { - LDKMonitorEvent arr_conv_14_var = ret_var.data[o]; - CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_14_ref = (long)arr_conv_14_var.inner; - if (arr_conv_14_var.is_owned) { - arr_conv_14_ref |= 1; - } - ret_arr_ptr[o] = arr_conv_14_ref; + LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]); + long ret_conv_14_ref = (long)ret_conv_14_copy; + ret_arr_ptr[o] = ret_conv_14_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -10159,10 +10648,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1a int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t h = 0; h < ret_var.datalen; h++) { - LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *arr_conv_7_copy = Event_clone(&ret_var.data[h]); - long arr_conv_7_ref = (long)arr_conv_7_copy; - ret_arr_ptr[h] = arr_conv_7_ref; + LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_conv_7_copy = Event_clone(&ret_var.data[h]); + long ret_conv_7_ref = (long)ret_conv_7_copy; + ret_arr_ptr[h] = ret_conv_7_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -10178,11 +10667,11 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1l jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < ret_var.datalen; i++) { - LDKTransaction arr_conv_8_var = ret_var.data[i]; - int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, arr_conv_8_var.datalen); - (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data); - Transaction_free(arr_conv_8_var); - (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr); + LDKTransaction ret_conv_8_var = ret_var.data[i]; + int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen); + (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data); + Transaction_free(ret_conv_8_var); + (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); } FREE(ret_var.data); return ret_arr; @@ -10204,10 +10693,10 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_ txdata_constr.data = NULL; int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL); for (size_t y = 0; y < txdata_constr.datalen; y++) { - int64_t arr_conv_24 = txdata_vals[y]; - LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1); - FREE((void*)arr_conv_24); - txdata_constr.data[y] = arr_conv_24_conv; + int64_t txdata_conv_24 = txdata_vals[y]; + LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1); + FREE((void*)txdata_conv_24); + txdata_constr.data[y] = txdata_conv_24_conv; } (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1); @@ -10229,9 +10718,9 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t u = 0; u < ret_var.datalen; u++) { - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); - *arr_conv_46_ref = ret_var.data[u]; - ret_arr_ptr[u] = (long)arr_conv_46_ref; + LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); + *ret_conv_46_ref = ret_var.data[u]; + ret_arr_ptr[u] = (long)ret_conv_46_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -10289,45 +10778,352 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jc OutPoint_free(this_ptr_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKOutPoint this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKOutPoint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv)); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKOutPoint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKThirtyTwoBytes val_ref; + CHECK((*env)->GetArrayLength(env, val) == 32); + (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); + OutPoint_set_txid(&this_ptr_conv, val_ref); +} + +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKOutPoint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = OutPoint_get_index(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKOutPoint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + OutPoint_set_index(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) { + LDKThirtyTwoBytes txid_arg_ref; + CHECK((*env)->GetArrayLength(env, txid_arg) == 32); + (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data); + LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKOutPoint orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKOutPoint ret_var = OutPoint_clone(&orig_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKOutPoint this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data); + return ret_arr; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKOutPoint obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = OutPoint_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_OutPoint_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_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ"); + *ret_conv = OutPoint_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (long)ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + DelayedPaymentOutputDescriptor_free(this_ptr_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = OutPoint_clone(&val_conv); + DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDelayedPaymentOutputDescriptor 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, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKDelayedPaymentOutputDescriptor 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); + DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref); +} + +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1); + FREE((void*)val); + DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDelayedPaymentOutputDescriptor 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, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKDelayedPaymentOutputDescriptor 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); + DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv)); + return ret_arr; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKThirtyTwoBytes val_ref; + CHECK((*env)->GetArrayLength(env, val) == 32); + (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); + DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) { + LDKOutPoint outpoint_arg_conv; + outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1)); + outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0); + outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv); + LDKPublicKey per_commitment_point_arg_ref; + CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33); + (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form); + LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1); + FREE((void*)output_arg); + LDKPublicKey revocation_pubkey_arg_ref; + CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33); + (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form); + LDKThirtyTwoBytes channel_keys_id_arg_ref; + CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32); + (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data); + LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKDelayedPaymentOutputDescriptor orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + StaticPaymentOutputDescriptor_free(this_ptr_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = OutPoint_clone(&val_conv); + StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1); + FREE((void*)val); + StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv); +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv)); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv)); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKOutPoint this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKThirtyTwoBytes val_ref; CHECK((*env)->GetArrayLength(env, val) == 32); (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); - OutPoint_set_txid(&this_ptr_conv, val_ref); + StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref); } -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKOutPoint this_ptr_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = OutPoint_get_index(&this_ptr_conv); + int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { - LDKOutPoint this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - OutPoint_set_index(&this_ptr_conv, val); + StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) { - LDKThirtyTwoBytes txid_arg_ref; - CHECK((*env)->GetArrayLength(env, txid_arg) == 32); - (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data); - LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) { + LDKOutPoint outpoint_arg_conv; + outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1)); + outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0); + outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv); + LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1); + FREE((void*)output_arg); + LDKThirtyTwoBytes channel_keys_id_arg_ref; + CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32); + (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data); + LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10337,11 +11133,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKOutPoint orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKStaticPaymentOutputDescriptor orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKOutPoint ret_var = OutPoint_clone(&orig_conv); + LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10351,36 +11147,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env return ret_ref; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKOutPoint this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data); - return arg_arr; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKOutPoint obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_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_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ"); - *ret_conv = OutPoint_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (long)ret_conv; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1); @@ -10398,11 +11164,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj; - LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = SpendableOutputDescriptor_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_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -10415,18 +11181,18 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1 return (long)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig; - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = ChannelKeys_clone(orig_conv); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKSign* orig_conv = (LDKSign*)orig; + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = Sign_clone(orig_conv); return (long)ret; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; - LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)(((uint64_t)this_ptr) & ~1); + LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1); FREE((void*)this_ptr); - ChannelKeys_free(this_ptr_conv); + Sign_free(this_ptr_conv); } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -10436,132 +11202,132 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *en KeysInterface_free(this_ptr_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - InMemoryChannelKeys_free(this_ptr_conv); + InMemorySigner_free(this_ptr_conv); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv)); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv)); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK((*env)->GetArrayLength(env, val) == 32); (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes); - InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref); + InMemorySigner_set_funding_key(&this_ptr_conv, val_ref); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv)); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv)); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK((*env)->GetArrayLength(env, val) == 32); (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes); - InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref); + InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv)); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv)); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK((*env)->GetArrayLength(env, val) == 32); (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes); - InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref); + InMemorySigner_set_payment_key(&this_ptr_conv, val_ref); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv)); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv)); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK((*env)->GetArrayLength(env, val) == 32); (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes); - InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref); + InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv)); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv)); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK((*env)->GetArrayLength(env, val) == 32); (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes); - InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref); + InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref); } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; int8_tArray ret_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv)); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv)); return ret_arr; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKThirtyTwoBytes val_ref; CHECK((*env)->GetArrayLength(env, val) == 32); (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data); - InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref); + InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKInMemoryChannelKeys orig_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKInMemorySigner orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv); + LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10571,7 +11337,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone( return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int64_t key_derivation_params) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { LDKSecretKey funding_key_ref; CHECK((*env)->GetArrayLength(env, funding_key) == 32); (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes); @@ -10590,9 +11356,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JN LDKThirtyTwoBytes commitment_seed_ref; CHECK((*env)->GetArrayLength(env, commitment_seed) == 32); (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data); - LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)key_derivation_params) & ~1); - FREE((void*)key_derivation_params); - LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv); + LDKThirtyTwoBytes channel_keys_id_ref; + CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32); + (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data); + LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10602,11 +11369,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JN return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv); + LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10616,35 +11383,35 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counte return ret_ref; } -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv); + int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv); return ret_val; } -JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv); + int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv); return ret_val; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv); + jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv); return ret_val; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv); + LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10654,11 +11421,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1fundin return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv); + LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10668,32 +11435,66 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1c return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKTransaction spend_tx_ref; + spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx); + spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes"); + (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data); + spend_tx_ref.data_is_owned = true; + LDKStaticPaymentOutputDescriptor descriptor_conv; + descriptor_conv.inner = (void*)(descriptor & (~1)); + descriptor_conv.is_owned = false; + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv); + return (long)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKTransaction spend_tx_ref; + spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx); + spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes"); + (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data); + spend_tx_ref.data_is_owned = true; + LDKDelayedPaymentOutputDescriptor descriptor_conv; + descriptor_conv.inner = (void*)(descriptor & (~1)); + descriptor_conv.is_owned = false; + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv); + return (long)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv); + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = InMemorySigner_as_Sign(&this_arg_conv); return (long)ret; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKInMemoryChannelKeys obj_conv; +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKInMemorySigner obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = InMemorySigner_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_InMemoryChannelKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_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_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = InMemoryChannelKeys_read(ser_ref); + LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = InMemorySigner_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (long)ret_conv; } @@ -10705,13 +11506,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, KeysManager_free(this_ptr_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, jclass network, int64_t starting_time_secs, int32_t starting_time_nanos) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) { unsigned char seed_arr[32]; CHECK((*env)->GetArrayLength(env, seed) == 32); (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr); unsigned char (*seed_ref)[32] = &seed_arr; - LDKNetwork network_conv = LDKNetwork_from_java(env, network); - LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos); + LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10721,11 +11521,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *en return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int64_t params_1, int64_t params_2) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) { LDKKeysManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2); + unsigned char params_arr[32]; + CHECK((*env)->GetArrayLength(env, params) == 32); + (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr); + unsigned char (*params_ref)[32] = ¶ms_arr; + LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -10735,6 +11539,47 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channe return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKCVec_SpendableOutputDescriptorZ descriptors_constr; + descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors); + if (descriptors_constr.datalen > 0) + descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements"); + else + descriptors_constr.data = NULL; + int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL); + for (size_t b = 0; b < descriptors_constr.datalen; b++) { + int64_t descriptors_conv_27 = descriptors_vals[b]; + LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1); + FREE((void*)descriptors_conv_27); + descriptors_constr.data[b] = descriptors_conv_27_conv; + } + (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0); + LDKCVec_TxOutZ outputs_constr; + outputs_constr.datalen = (*env)->GetArrayLength(env, outputs); + if (outputs_constr.datalen > 0) + outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements"); + else + outputs_constr.data = NULL; + int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL); + for (size_t h = 0; h < outputs_constr.datalen; h++) { + int64_t outputs_conv_7 = outputs_vals[h]; + LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1); + FREE((void*)outputs_conv_7); + outputs_constr.data[h] = outputs_conv_7_conv; + } + (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0); + LDKCVec_u8Z change_destination_script_ref; + change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script); + change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes"); + (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data); + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight); + return (long)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) { LDKKeysManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -10781,9 +11626,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1re LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -10911,23 +11756,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEn } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKPaymentSendFailure this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + if ((this_ptr & 1) != 0) return; + LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); PaymentSendFailure_free(this_ptr_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKPaymentSendFailure orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKPaymentSendFailure ret_var = PaymentSendFailure_clone(&orig_conv); - CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long ret_ref = (long)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig; + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(orig_conv); + long ret_ref = (long)ret_copy; return ret_ref; } @@ -10996,14 +11835,14 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t q = 0; q < ret_var.datalen; q++) { - LDKChannelDetails arr_conv_16_var = ret_var.data[q]; - CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_16_ref = (long)arr_conv_16_var.inner; - if (arr_conv_16_var.is_owned) { - arr_conv_16_ref |= 1; + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_conv_16_ref = (long)ret_conv_16_var.inner; + if (ret_conv_16_var.is_owned) { + ret_conv_16_ref |= 1; } - ret_arr_ptr[q] = arr_conv_16_ref; + ret_arr_ptr[q] = ret_conv_16_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -11018,14 +11857,14 @@ JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen); int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL); for (size_t q = 0; q < ret_var.datalen; q++) { - LDKChannelDetails arr_conv_16_var = ret_var.data[q]; - CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_16_ref = (long)arr_conv_16_var.inner; - if (arr_conv_16_var.is_owned) { - arr_conv_16_ref |= 1; + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_conv_16_ref = (long)ret_conv_16_var.inner; + if (ret_conv_16_var.is_owned) { + ret_conv_16_ref |= 1; } - ret_arr_ptr[q] = arr_conv_16_ref; + ret_arr_ptr[q] = ret_conv_16_ref; } (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0); FREE(ret_var.data); @@ -11116,10 +11955,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1nod addresses_constr.data = NULL; int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL); for (size_t m = 0; m < addresses_constr.datalen; m++) { - int64_t arr_conv_12 = addresses_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - addresses_constr.data[m] = arr_conv_12_conv; + int64_t addresses_conv_12 = addresses_vals[m]; + LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1); + FREE((void*)addresses_conv_12); + addresses_constr.data[m] = addresses_conv_12_conv; } (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0); ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr); @@ -11172,9 +12011,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) { @@ -11205,6 +12044,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsP return (long)ret; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen"); + *ret = ChannelManager_as_Listen(&this_arg_conv); + return (long)ret; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -11221,10 +12069,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connect txdata_constr.data = NULL; int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL); for (size_t y = 0; y < txdata_constr.datalen; y++) { - int64_t arr_conv_24 = txdata_vals[y]; - LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1); - FREE((void*)arr_conv_24); - txdata_constr.data[y] = arr_conv_24_conv; + int64_t txdata_conv_24 = txdata_vals[y]; + LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1); + FREE((void*)txdata_conv_24); + txdata_constr.data[y] = txdata_conv_24_conv; } (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0); ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height); @@ -11241,6 +12089,13 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconn ChannelManager_block_disconnected(&this_arg_conv, header_ref); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + ChannelManager_await_persistable_update(&this_arg_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -11254,11 +12109,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(J LDKChannelManager obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelManager_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 void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -11431,11 +12286,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new channel_monitors_constr.data = NULL; int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL); for (size_t q = 0; q < channel_monitors_constr.datalen; q++) { - int64_t arr_conv_16 = channel_monitors_vals[q]; - LDKChannelMonitor arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - channel_monitors_constr.data[q] = arr_conv_16_conv; + int64_t channel_monitors_conv_16 = channel_monitors_vals[q]; + LDKChannelMonitor channel_monitors_conv_16_conv; + channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1)); + channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0); + channel_monitors_constr.data[q] = channel_monitors_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0); LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr); @@ -11490,6 +12345,46 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass Init_free(this_ptr_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKInitFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = InitFeatures_clone(&val_conv); + Init_set_features(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) { + LDKInitFeatures 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 = InitFeatures_clone(&features_arg_conv); + LDKInit ret_var = Init_new(features_arg_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) { LDKInit orig_conv; orig_conv.inner = (void*)(orig & (~1)); @@ -11875,9 +12770,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1fundi LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -11894,9 +12789,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revoc LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -11913,9 +12808,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payme LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -11932,9 +12827,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delay LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -11951,9 +12846,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_ LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -11970,9 +12865,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12149,9 +13044,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1fun LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12168,9 +13063,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1rev LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12187,9 +13082,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1pay LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12206,9 +13101,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1del LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12225,9 +13120,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htl LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12244,9 +13139,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1fir LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12337,9 +13232,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1si LDKFundingCreated this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12416,9 +13311,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1sig LDKFundingSigned this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12492,9 +13387,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1nex LDKFundingLocked this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12568,10 +13463,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpu LDKShutdown this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - return arg_arr; + LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -12662,9 +13557,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1sig LDKClosingSigned this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13058,9 +13953,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1 LDKCommitmentSigned this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13084,11 +13979,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1s else val_constr.data = NULL; for (size_t i = 0; i < val_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - val_constr.data[i] = arr_conv_8_ref; + int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i); + LDKSignature val_conv_8_ref; + CHECK((*env)->GetArrayLength(env, val_conv_8) == 64); + (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form); + val_constr.data[i] = val_conv_8_ref; } CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr); } @@ -13107,11 +14002,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEn else htlc_signatures_arg_constr.data = NULL; for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - htlc_signatures_arg_constr.data[i] = arr_conv_8_ref; + int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i); + LDKSignature htlc_signatures_arg_conv_8_ref; + CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64); + (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form); + htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref; } LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -13186,9 +14081,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next LDKRevokeAndACK this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13334,9 +14229,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1m LDKDataLossProtect this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13495,9 +14390,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_ LDKAnnouncementSignatures this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13514,9 +14409,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_ LDKAnnouncementSignatures this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13580,11 +14475,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *e JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKNetAddress* obj_conv = (LDKNetAddress*)obj; - LDKCVec_u8Z arg_var = NetAddress_write(obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NetAddress_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_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -13648,9 +14543,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncemen LDKUnsignedNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13713,10 +14608,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_ val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t m = 0; m < val_constr.datalen; m++) { - int64_t arr_conv_12 = val_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - val_constr.data[m] = arr_conv_12_conv; + int64_t val_conv_12 = val_vals[m]; + LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); + FREE((void*)val_conv_12); + val_constr.data[m] = val_conv_12_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr); @@ -13747,9 +14642,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1 LDKNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13889,9 +14784,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnounce LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13908,9 +14803,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnounce LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13927,9 +14822,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnounce LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13946,9 +14841,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnounce LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -13986,9 +14881,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1ge LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -14005,9 +14900,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1ge LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -14024,9 +14919,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1ge LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -14043,9 +14938,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1ge LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -14280,9 +15175,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1sig LDKChannelUpdate this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -14519,8 +15414,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_ val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t g = 0; g < val_constr.datalen; g++) { - int64_t arr_conv_6 = val_vals[g]; - val_constr.data[g] = arr_conv_6; + int64_t val_conv_6 = val_vals[g]; + val_constr.data[g] = val_conv_6; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr); @@ -14538,8 +15433,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIE short_channel_ids_arg_constr.data = NULL; int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL); for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) { - int64_t arr_conv_6 = short_channel_ids_arg_vals[g]; - short_channel_ids_arg_constr.data[g] = arr_conv_6; + int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g]; + short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6; } (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0); LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr); @@ -14604,8 +15499,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1sho val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t g = 0; g < val_constr.datalen; g++) { - int64_t arr_conv_6 = val_vals[g]; - val_constr.data[g] = arr_conv_6; + int64_t val_conv_6 = val_vals[g]; + val_constr.data[g] = val_conv_6; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr); @@ -14623,8 +15518,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(J short_channel_ids_arg_constr.data = NULL; int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL); for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) { - int64_t arr_conv_6 = short_channel_ids_arg_vals[g]; - short_channel_ids_arg_constr.data[g] = arr_conv_6; + int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g]; + short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6; } (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0); LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr); @@ -14915,12 +15810,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_ val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t p = 0; p < val_constr.datalen; p++) { - int64_t arr_conv_15 = val_vals[p]; - LDKUpdateAddHTLC arr_conv_15_conv; - arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1)); - arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0); - arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv); - val_constr.data[p] = arr_conv_15_conv; + int64_t val_conv_15 = val_vals[p]; + LDKUpdateAddHTLC val_conv_15_conv; + val_conv_15_conv.inner = (void*)(val_conv_15 & (~1)); + val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0); + val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv); + val_constr.data[p] = val_conv_15_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr); @@ -14938,12 +15833,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_ val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t t = 0; t < val_constr.datalen; t++) { - int64_t arr_conv_19 = val_vals[t]; - LDKUpdateFulfillHTLC arr_conv_19_conv; - arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1)); - arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0); - arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv); - val_constr.data[t] = arr_conv_19_conv; + int64_t val_conv_19 = val_vals[t]; + LDKUpdateFulfillHTLC val_conv_19_conv; + val_conv_19_conv.inner = (void*)(val_conv_19 & (~1)); + val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0); + val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv); + val_constr.data[t] = val_conv_19_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr); @@ -14961,12 +15856,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_ val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t q = 0; q < val_constr.datalen; q++) { - int64_t arr_conv_16 = val_vals[q]; - LDKUpdateFailHTLC arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv); - val_constr.data[q] = arr_conv_16_conv; + int64_t val_conv_16 = val_vals[q]; + LDKUpdateFailHTLC val_conv_16_conv; + val_conv_16_conv.inner = (void*)(val_conv_16 & (~1)); + val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0); + val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv); + val_constr.data[q] = val_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr); @@ -14984,12 +15879,12 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_ val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t z = 0; z < val_constr.datalen; z++) { - int64_t arr_conv_25 = val_vals[z]; - LDKUpdateFailMalformedHTLC arr_conv_25_conv; - arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1)); - arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0); - arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv); - val_constr.data[z] = arr_conv_25_conv; + int64_t val_conv_25 = val_vals[z]; + LDKUpdateFailMalformedHTLC val_conv_25_conv; + val_conv_25_conv.inner = (void*)(val_conv_25 & (~1)); + val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0); + val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv); + val_constr.data[z] = val_conv_25_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr); @@ -15054,12 +15949,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEn update_add_htlcs_arg_constr.data = NULL; int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL); for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) { - int64_t arr_conv_15 = update_add_htlcs_arg_vals[p]; - LDKUpdateAddHTLC arr_conv_15_conv; - arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1)); - arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0); - arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv); - update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv; + int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p]; + LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv; + update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1)); + update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0); + update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv); + update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv; } (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0); LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr; @@ -15070,12 +15965,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEn update_fulfill_htlcs_arg_constr.data = NULL; int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL); for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) { - int64_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t]; - LDKUpdateFulfillHTLC arr_conv_19_conv; - arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1)); - arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0); - arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv); - update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv; + int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t]; + LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv; + update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1)); + update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0); + update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv); + update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv; } (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0); LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr; @@ -15086,12 +15981,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEn update_fail_htlcs_arg_constr.data = NULL; int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL); for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) { - int64_t arr_conv_16 = update_fail_htlcs_arg_vals[q]; - LDKUpdateFailHTLC arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv); - update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv; + int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q]; + LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv; + update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1)); + update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0); + update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv); + update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv; } (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0); LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr; @@ -15102,12 +15997,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEn update_fail_malformed_htlcs_arg_constr.data = NULL; int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL); for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) { - int64_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z]; - LDKUpdateFailMalformedHTLC arr_conv_25_conv; - arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1)); - arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0); - arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv); - update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv; + int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z]; + LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv; + update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1)); + update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0); + update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv); + update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv; } (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0); LDKUpdateFee update_fee_arg_conv; @@ -15175,11 +16070,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JN LDKAcceptChannel obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = AcceptChannel_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_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15196,11 +16091,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_ LDKAnnouncementSignatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = AnnouncementSignatures_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_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15217,11 +16112,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1wri LDKChannelReestablish obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelReestablish_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_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15238,11 +16133,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JN LDKClosingSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ClosingSigned_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_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15259,11 +16154,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write LDKCommitmentSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = CommitmentSigned_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_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15280,11 +16175,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(J LDKFundingCreated obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = FundingCreated_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_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15301,11 +16196,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JN LDKFundingSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = FundingSigned_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_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15322,11 +16217,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JN LDKFundingLocked obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = FundingLocked_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_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15343,11 +16238,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env LDKInit obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Init_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Init_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_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15364,11 +16259,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIE LDKOpenChannel obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = OpenChannel_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_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15385,11 +16280,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNI LDKRevokeAndACK obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = RevokeAndACK_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_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15406,11 +16301,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv LDKShutdown obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Shutdown_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_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15427,11 +16322,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(J LDKUpdateFailHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFailHTLC_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_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15448,11 +16343,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC LDKUpdateFailMalformedHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_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_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15469,11 +16364,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv LDKUpdateFee obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFee_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_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15490,11 +16385,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1writ LDKUpdateFulfillHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFulfillHTLC_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_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15511,11 +16406,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JN LDKUpdateAddHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateAddHTLC_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_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15532,11 +16427,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env LDKPing obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Ping_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Ping_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_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15553,11 +16448,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env LDKPong obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Pong_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Pong_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_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15574,11 +16469,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnounce LDKUnsignedChannelAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_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_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15595,11 +16490,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1wr LDKChannelAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelAnnouncement_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_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15616,11 +16511,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1 LDKUnsignedChannelUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UnsignedChannelUpdate_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_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15637,11 +16532,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JN LDKChannelUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelUpdate_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_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15658,11 +16553,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNI LDKErrorMessage obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ErrorMessage_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_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15679,11 +16574,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncemen LDKUnsignedNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_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_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15700,11 +16595,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write LDKNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NodeAnnouncement_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_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15731,11 +16626,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1w LDKQueryShortChannelIds obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = QueryShortChannelIds_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_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15752,11 +16647,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd LDKReplyShortChannelIdsEnd obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_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_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15773,11 +16668,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1writ LDKQueryChannelRange obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = QueryChannelRange_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_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15794,11 +16689,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1writ LDKReplyChannelRange obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ReplyChannelRange_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_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -15815,11 +16710,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1 LDKGossipTimestampFilter obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = GossipTimestampFilter_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 void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -15993,9 +16888,9 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL); ; for (size_t i = 0; i < ret_var.datalen; i++) { - int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form); - (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr); + int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form); + (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr); } FREE(ret_var.data); return ret_arr; @@ -16093,9 +16988,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secr CHECK((*env)->GetArrayLength(env, commitment_seed) == 32); (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr); unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr; - int8_tArray arg_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data); + return ret_arr; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) { @@ -16160,9 +17055,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1pe LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16179,9 +17074,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1re LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16198,9 +17093,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1br LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16217,9 +17112,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1co LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16236,9 +17131,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1br LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16295,11 +17190,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(J LDKTxCreationKeys obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = TxCreationKeys_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_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -16323,9 +17218,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_ LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16342,9 +17237,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_ LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16361,9 +17256,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_ LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16380,9 +17275,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_ LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16399,9 +17294,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_ LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -16458,11 +17353,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1writ LDKChannelPublicKeys obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelPublicKeys_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_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -16518,11 +17413,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeem LDKPublicKey broadcaster_delayed_payment_key_ref; CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33); (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form); - LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref); + 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 void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -16614,11 +17509,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_ LDKHTLCOutputInCommitment obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = HTLCOutputInCommitment_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_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -16638,11 +17533,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript LDKTxCreationKeys keys_conv; keys_conv.inner = (void*)(keys & (~1)); keys_conv.is_owned = false; - LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) { @@ -16652,11 +17547,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemsc LDKPublicKey countersignatory_ref; CHECK((*env)->GetArrayLength(env, countersignatory) == 33); (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form); - LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { @@ -16673,11 +17568,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transactio LDKPublicKey revocation_key_ref; CHECK((*env)->GetArrayLength(env, revocation_key) == 33); (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form); - LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - Transaction_free(arg_var); - return arg_arr; + LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + Transaction_free(ret_var); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -16945,11 +17840,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTran LDKCounterpartyChannelTransactionParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_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_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -16966,11 +17861,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParam LDKChannelTransactionParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelTransactionParameters_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_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -17059,9 +17954,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransac LDKHolderCommitmentTransaction this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -17085,11 +17980,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1s else val_constr.data = NULL; for (size_t i = 0; i < val_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - val_constr.data[i] = arr_conv_8_ref; + int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i); + LDKSignature val_conv_8_ref; + CHECK((*env)->GetArrayLength(env, val_conv_8) == 64); + (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form); + val_constr.data[i] = val_conv_8_ref; } HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr); } @@ -17112,11 +18007,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransac LDKHolderCommitmentTransaction obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = HolderCommitmentTransaction_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_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -17144,11 +18039,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction else counterparty_htlc_sigs_constr.data = NULL; for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) { - int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i); - LDKSignature arr_conv_8_ref; - CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64); - (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form); - counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref; + int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i); + LDKSignature counterparty_htlc_sigs_conv_8_ref; + CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64); + (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form); + counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref; } LDKPublicKey holder_funding_key_ref; CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33); @@ -17177,11 +18072,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransact LDKBuiltCommitmentTransaction this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - Transaction_free(arg_var); - return arg_arr; + LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + Transaction_free(ret_var); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -17252,11 +18147,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransact LDKBuiltCommitmentTransaction obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_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_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -17276,10 +18171,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransact LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript); funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL); - int8_tArray arg_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data); + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data); (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0); - return arg_arr; + return ret_arr; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) { @@ -17293,10 +18188,10 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransact LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript); funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL); - int8_tArray arg_arr = (*env)->NewByteArray(env, 64); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form); + int8_tArray ret_arr = (*env)->NewByteArray(env, 64); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form); (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0); - return arg_arr; + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -17324,11 +18219,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1 LDKCommitmentTransaction obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = CommitmentTransaction_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_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -17416,9 +18311,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransa LDKTrustedCommitmentTransaction this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 32); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data); + return ret_arr; } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) { @@ -17609,33 +18504,33 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNI LDKInitFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = InitFeatures_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = InitFeatures_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKNodeFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeFeatures_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NodeFeatures_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 int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKChannelFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelFeatures_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelFeatures_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_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -17679,9 +18574,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(J LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form); - return arg_arr; + 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) { @@ -17843,24 +18738,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, else val_constr.data = NULL; for (size_t m = 0; m < val_constr.datalen; m++) { - int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, val, m); - LDKCVec_RouteHopZ arr_conv_12_constr; - arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12); - if (arr_conv_12_constr.datalen > 0) - arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + 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 - arr_conv_12_constr.data = NULL; - int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL); - for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) { - int64_t arr_conv_10 = arr_conv_12_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv); - arr_conv_12_constr.data[k] = arr_conv_10_conv; + 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, arr_conv_12, arr_conv_12_vals, 0); - val_constr.data[m] = arr_conv_12_constr; + (*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); } @@ -17873,24 +18768,24 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jcl else paths_arg_constr.data = NULL; for (size_t m = 0; m < paths_arg_constr.datalen; m++) { - int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m); - LDKCVec_RouteHopZ arr_conv_12_constr; - arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12); - if (arr_conv_12_constr.datalen > 0) - arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + 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 - arr_conv_12_constr.data = NULL; - int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL); - for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) { - int64_t arr_conv_10 = arr_conv_12_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv); - arr_conv_12_constr.data[k] = arr_conv_10_conv; + 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, arr_conv_12, arr_conv_12_vals, 0); - paths_arg_constr.data[m] = arr_conv_12_constr; + (*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((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -17920,11 +18815,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *en LDKRoute obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Route_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + 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) { @@ -17948,9 +18843,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1no LDKRouteHint this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form); - return arg_arr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 33); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form); + return ret_arr; } JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) { @@ -18083,11 +18978,11 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jcl 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 arr_conv_16 = first_hops_vals[q]; - LDKChannelDetails arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - first_hops_constr.data[q] = arr_conv_16_conv; + 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); LDKCVec_RouteHintZ last_hops_constr; @@ -18098,12 +18993,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jcl 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 arr_conv_11 = last_hops_vals[l]; - LDKRouteHint arr_conv_11_conv; - arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1)); - arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0); - arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv); - last_hops_constr.data[l] = arr_conv_11_conv; + 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); @@ -18124,6 +19019,20 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env NetworkGraph_free(this_ptr_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); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKLockedNetworkGraph this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -18168,7 +19077,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1n LDKNetworkGraph network_graph_conv; network_graph_conv.inner = (void*)(network_graph & (~1)); network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); - // Warning: we need a move here but no clone is available for LDKNetworkGraph + network_graph_conv = NetworkGraph_clone(&network_graph_conv); LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -18360,11 +19269,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_ LDKDirectionalChannelInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + 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) { @@ -18413,9 +19322,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_ LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form); - return arg_arr; + 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) { @@ -18457,9 +19366,9 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_ LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = (*env)->NewByteArray(env, 33); - (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form); - return arg_arr; + 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) { @@ -18522,15 +19431,29 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelInfo orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKChannelInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelInfo_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_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -18619,11 +19542,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIE LDKRoutingFees obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = RoutingFees_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 void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { @@ -18723,10 +19646,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1add val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t m = 0; m < val_constr.datalen; m++) { - int64_t arr_conv_12 = val_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - val_constr.data[m] = arr_conv_12_conv; + int64_t val_conv_12 = val_vals[m]; + LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); + FREE((void*)val_conv_12); + val_constr.data[m] = val_conv_12_conv; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr); @@ -18776,10 +19699,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(J addresses_arg_constr.data = NULL; int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL); for (size_t m = 0; m < addresses_arg_constr.datalen; m++) { - int64_t arr_conv_12 = addresses_arg_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - addresses_arg_constr.data[m] = arr_conv_12_conv; + int64_t addresses_arg_conv_12 = addresses_arg_vals[m]; + LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1); + FREE((void*)addresses_arg_conv_12); + addresses_arg_constr.data[m] = addresses_arg_conv_12_conv; } (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0); LDKNodeAnnouncement announcement_message_arg_conv; @@ -18814,11 +19737,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1w LDKNodeAnnouncementInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NodeAnnouncementInfo_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_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -18850,8 +19773,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv val_constr.data = NULL; int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL); for (size_t g = 0; g < val_constr.datalen; g++) { - int64_t arr_conv_6 = val_vals[g]; - val_constr.data[g] = arr_conv_6; + int64_t val_conv_6 = val_vals[g]; + val_constr.data[g] = val_conv_6; } (*env)->ReleaseLongArrayElements(env, val, val_vals, 0); NodeInfo_set_channels(&this_ptr_conv, val_constr); @@ -18916,8 +19839,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, channels_arg_constr.data = NULL; int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL); for (size_t g = 0; g < channels_arg_constr.datalen; g++) { - int64_t arr_conv_6 = channels_arg_vals[g]; - channels_arg_constr.data[g] = arr_conv_6; + int64_t channels_arg_conv_6 = channels_arg_vals[g]; + channels_arg_constr.data[g] = channels_arg_conv_6; } (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0); LDKRoutingFees lowest_inbound_channel_fees_arg_conv; @@ -18956,11 +19879,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv LDKNodeInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NodeInfo_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_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) { @@ -18977,11 +19900,11 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNI LDKNetworkGraph obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv); - int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen); - (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NetworkGraph_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_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) { diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index e8cce821..d4b2b752 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -953,35 +953,19 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMoni /* * Class: org_ldk_impl_bindings - * Method: LDKCVec_MonitorEventZ_new - * Signature: ([J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new - (JNIEnv *, jclass, jlongArray); - -/* - * Class: org_ldk_impl_bindings - * Method: LDKC2Tuple_u64u64Z_new - * Signature: (JJ)J + * Method: LDKMonitorEvent_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKMonitorEvent; */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1new - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: LDKC2Tuple_u64u64Z_get_a - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKC2Tuple_u64u64Z_get_b - * Signature: (J)J + * Method: LDKCVec_MonitorEventZ_new + * Signature: ([J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new + (JNIEnv *, jclass, jlongArray); /* * Class: org_ldk_impl_bindings @@ -1273,106 +1257,106 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1ge /* * Class: org_ldk_impl_bindings - * Method: LDKChannelKeys_new - * Signature: (Lorg/ldk/impl/bindings/LDKChannelKeys;J)J + * Method: LDKSign_new + * Signature: (Lorg/ldk/impl/bindings/LDKSign;J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSign_1new (JNIEnv *, jclass, jobject, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_get_per_commitment_point + * Method: Sign_get_per_commitment_point * Signature: (JJ)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Sign_1get_1per_1commitment_1point (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_release_commitment_secret + * Method: Sign_release_commitment_secret * Signature: (JJ)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Sign_1release_1commitment_1secret (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_key_derivation_params - * Signature: (J)J + * Method: Sign_channel_keys_id + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Sign_1channel_1keys_1id (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_sign_counterparty_commitment + * Method: Sign_sign_counterparty_commitment * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1counterparty_1commitment (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_sign_holder_commitment_and_htlcs + * Method: Sign_sign_holder_commitment_and_htlcs * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1and_1htlcs +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1holder_1commitment_1and_1htlcs (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_sign_justice_transaction + * Method: Sign_sign_justice_transaction * Signature: (J[BJJ[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1justice_1transaction (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_sign_counterparty_htlc_transaction + * Method: Sign_sign_counterparty_htlc_transaction * Signature: (J[BJJ[BJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1counterparty_1htlc_1transaction (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong, jbyteArray, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_sign_closing_transaction + * Method: Sign_sign_closing_transaction * Signature: (J[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1closing_1transaction (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_sign_channel_announcement + * Method: Sign_sign_channel_announcement * Signature: (JJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1sign_1channel_1announcement (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_ready_channel + * Method: Sign_ready_channel * Signature: (JJ)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1ready_1channel (JNIEnv *, jclass, jlong, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_write + * Method: Sign_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Sign_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_get_pubkeys + * Method: Sign_get_pubkeys * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1get_1pubkeys (JNIEnv *, jclass, jlong); /* @@ -1479,6 +1463,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVec_CResult_NoneAPIErrorZZ_new + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVec_APIErrorZ_new + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: LDKCVec_ChannelDetailsZ_new @@ -1487,6 +1487,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1ge JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new (JNIEnv *, jclass, jlongArray); +/* + * Class: org_ldk_impl_bindings + * Method: LDKPaymentSendFailure_ref_from_ptr + * Signature: (J)Lorg/ldk/impl/bindings/LDKPaymentSendFailure; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_NonePaymentSendFailureZ_result_ok @@ -1569,26 +1577,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcas /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_ChannelKeysDecodeErrorZ_result_ok + * Method: LDKCResult_SignDecodeErrorZ_result_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1result_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_ChannelKeysDecodeErrorZ_get_ok + * Method: LDKCResult_SignDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_ChannelKeysDecodeErrorZ_get_err + * Method: LDKCResult_SignDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelKeysDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -1625,10 +1633,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shut /* * Class: org_ldk_impl_bindings - * Method: KeysInterface_get_channel_keys + * Method: KeysInterface_get_channel_signer * Signature: (JZJ)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer (JNIEnv *, jclass, jlong, jboolean, jlong); /* @@ -1745,26 +1753,82 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDe /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_InMemoryChannelKeysDecodeErrorZ_result_ok + * Method: LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_ok + * Method: LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok + * Signature: (J)[[B + */ +JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_CVec_CVec_u8ZZNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_InMemorySignerDecodeErrorZ_result_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_InMemorySignerDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_err + * Method: LDKCResult_InMemorySignerDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCVec_TxOutZ_new + * Signature: ([J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_TransactionNoneZ_result_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_TransactionNoneZ_get_ok + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_TransactionNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -2703,6 +2767,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo (JNIEnv *, jclass, jlong, jbyteArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKListen_new + * Signature: (Lorg/ldk/impl/bindings/LDKListen;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKListen_1new + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: Listen_block_connected + * Signature: (J[BI)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected + (JNIEnv *, jclass, jlong, jbyteArray, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: Listen_block_disconnected + * Signature: (J[BI)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected + (JNIEnv *, jclass, jlong, jbyteArray, jint); + /* * Class: org_ldk_impl_bindings * Method: LDKFilter_new @@ -2802,10 +2890,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_ /* * Class: org_ldk_impl_bindings * Method: ChannelMessageHandler_handle_shutdown - * Signature: (J[BJ)V + * Signature: (J[BJJ)V */ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown - (JNIEnv *, jclass, jlong, jbyteArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -3839,6 +3927,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErr JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_ChannelInfoDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: CResult_RoutingFeesDecodeErrorZ_ok @@ -3975,6 +4071,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeEr JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NetworkGraphDecodeErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: C2Tuple_usizeTransactionZ_new @@ -4375,6 +4479,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: CVec_CResult_NoneAPIErrorZZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CVec_APIErrorZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free + (JNIEnv *, jclass, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: CVec_ChannelDetailsZ_free @@ -4463,30 +4583,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashCh JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_u64u64Z_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_u64u64Z_new - * Signature: (JJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new - (JNIEnv *, jclass, jlong, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: C2Tuple_u64u64Z_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: CResult_SpendableOutputDescriptorDecodeErrorZ_ok @@ -4609,66 +4705,138 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clon /* * Class: org_ldk_impl_bindings - * Method: CResult_ChannelKeysDecodeErrorZ_ok + * Method: CResult_SignDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SignDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_SignDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ChannelKeysDecodeErrorZ_err + * Method: CResult_SignDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ChannelKeysDecodeErrorZ_free + * Method: CVec_CVec_u8ZZ_free + * Signature: ([[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free + (JNIEnv *, jclass, jobjectArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CVec_CVec_u8ZZNoneZ_ok + * Signature: ([[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok + (JNIEnv *, jclass, jobjectArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CVec_CVec_u8ZZNoneZ_err + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_CVec_CVec_u8ZZNoneZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ChannelKeysDecodeErrorZ_clone + * Method: CResult_CVec_CVec_u8ZZNoneZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelKeysDecodeErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InMemoryChannelKeysDecodeErrorZ_ok + * Method: CResult_InMemorySignerDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InMemoryChannelKeysDecodeErrorZ_err + * Method: CResult_InMemorySignerDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InMemoryChannelKeysDecodeErrorZ_free + * Method: CResult_InMemorySignerDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InMemoryChannelKeysDecodeErrorZ_clone + * Method: CResult_InMemorySignerDecodeErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CVec_TxOutZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TransactionNoneZ_ok + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TransactionNoneZ_err + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_TransactionNoneZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free (JNIEnv *, jclass, jlong); /* @@ -6407,6 +6575,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_AccessError_1clone JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Listen_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Watch_free @@ -6799,6 +6975,214 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_get_outpoint + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_set_outpoint + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_get_per_commitment_point + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_set_per_commitment_point + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_get_to_self_delay + * Signature: (J)S + */ +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_set_to_self_delay + * Signature: (JS)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay + (JNIEnv *, jclass, jlong, jshort); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_set_output + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_get_revocation_pubkey + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_set_revocation_pubkey + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_get_channel_keys_id + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_set_channel_keys_id + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_get_channel_value_satoshis + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_set_channel_value_satoshis + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_new + * Signature: (J[BSJ[B[BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new + (JNIEnv *, jclass, jlong, jbyteArray, jshort, jlong, jbyteArray, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: DelayedPaymentOutputDescriptor_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_get_outpoint + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_set_outpoint + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_set_output + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_get_channel_keys_id + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_set_channel_keys_id + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id + (JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_get_channel_value_satoshis + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_set_channel_value_satoshis + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_new + * Signature: (JJ[BJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new + (JNIEnv *, jclass, jlong, jlong, jbyteArray, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: StaticPaymentOutputDescriptor_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: SpendableOutputDescriptor_free @@ -6833,18 +7217,18 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1re /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_clone + * Method: Sign_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sign_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: ChannelKeys_free + * Method: Sign_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free (JNIEnv *, jclass, jlong); /* @@ -6857,194 +7241,210 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_free + * Method: InMemorySigner_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_get_funding_key + * Method: InMemorySigner_get_funding_key * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_set_funding_key + * Method: InMemorySigner_set_funding_key * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_get_revocation_base_key + * Method: InMemorySigner_get_revocation_base_key * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_set_revocation_base_key + * Method: InMemorySigner_set_revocation_base_key * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_get_payment_key + * Method: InMemorySigner_get_payment_key * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_set_payment_key + * Method: InMemorySigner_set_payment_key * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_get_delayed_payment_base_key + * Method: InMemorySigner_get_delayed_payment_base_key * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_set_delayed_payment_base_key + * Method: InMemorySigner_set_delayed_payment_base_key * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_get_htlc_base_key + * Method: InMemorySigner_get_htlc_base_key * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_set_htlc_base_key + * Method: InMemorySigner_set_htlc_base_key * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_get_commitment_seed + * Method: InMemorySigner_get_commitment_seed * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_set_commitment_seed + * Method: InMemorySigner_set_commitment_seed * Signature: (J[B)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed (JNIEnv *, jclass, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_clone + * Method: InMemorySigner_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_new - * Signature: ([B[B[B[B[B[BJJ)J + * Method: InMemorySigner_new + * Signature: ([B[B[B[B[B[BJ[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new - (JNIEnv *, jclass, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jlong, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1new + (JNIEnv *, jclass, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jbyteArray, jlong, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_counterparty_pubkeys + * Method: InMemorySigner_counterparty_pubkeys * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_counterparty_selected_contest_delay + * Method: InMemorySigner_counterparty_selected_contest_delay * Signature: (J)S */ -JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_holder_selected_contest_delay + * Method: InMemorySigner_holder_selected_contest_delay * Signature: (J)S */ -JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_is_outbound + * Method: InMemorySigner_is_outbound * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_funding_outpoint + * Method: InMemorySigner_funding_outpoint * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_get_channel_parameters + * Method: InMemorySigner_get_channel_parameters * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_as_ChannelKeys + * Method: InMemorySigner_sign_counterparty_payment_input + * Signature: (J[BJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InMemorySigner_sign_dynamic_p2wsh_input + * Signature: (J[BJJ)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: InMemorySigner_as_Sign * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_write + * Method: InMemorySigner_write * Signature: (J)[B */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: InMemoryChannelKeys_read + * Method: InMemorySigner_read * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read (JNIEnv *, jclass, jbyteArray); /* @@ -7058,18 +7458,26 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free /* * Class: org_ldk_impl_bindings * Method: KeysManager_new - * Signature: ([BLorg/ldk/enums/LDKNetwork;JI)J + * Signature: ([BJI)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1new - (JNIEnv *, jclass, jbyteArray, jobject, jlong, jint); + (JNIEnv *, jclass, jbyteArray, jlong, jint); /* * Class: org_ldk_impl_bindings * Method: KeysManager_derive_channel_keys - * Signature: (JJJJ)J + * Signature: (JJ[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys - (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: KeysManager_spend_spendable_outputs + * Signature: (J[J[J[BI)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs + (JNIEnv *, jclass, jlong, jlongArray, jlongArray, jbyteArray, jint); /* * Class: org_ldk_impl_bindings @@ -7391,6 +7799,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSe JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_as_Listen + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_block_connected @@ -7407,6 +7823,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connect JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected (JNIEnv *, jclass, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_await_persistable_update + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_as_ChannelMessageHandler @@ -7567,6 +7991,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Init_get_features + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1get_1features + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Init_set_features + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: Init_new + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1new + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Init_clone @@ -12527,6 +12975,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: NetworkGraph_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LockedNetworkGraph_free @@ -12823,6 +13279,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcemen JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelInfo_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelInfo_write diff --git a/src/main/jni/org_ldk_impl_bindings_LDKMonitorEvent.h b/src/main/jni/org_ldk_impl_bindings_LDKMonitorEvent.h new file mode 100644 index 00000000..2b898a07 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKMonitorEvent.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKMonitorEvent */ + +#ifndef _Included_org_ldk_impl_bindings_LDKMonitorEvent +#define _Included_org_ldk_impl_bindings_LDKMonitorEvent +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKMonitorEvent + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKPaymentSendFailure.h b/src/main/jni/org_ldk_impl_bindings_LDKPaymentSendFailure.h new file mode 100644 index 00000000..3bffa6a0 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKPaymentSendFailure.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKPaymentSendFailure */ + +#ifndef _Included_org_ldk_impl_bindings_LDKPaymentSendFailure +#define _Included_org_ldk_impl_bindings_LDKPaymentSendFailure +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKPaymentSendFailure + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ts/bindings.c b/ts/bindings.c index 7570bb2b..fc4a25bb 100644 --- a/ts/bindings.c +++ b/ts/bindings.c @@ -13,13 +13,93 @@ static inline void assert(bool expression) { if (!expression) { abort(); } } -void *malloc(size_t size); -void free(void *ptr); +// Always run a, then assert it is true: +#define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0) +// Assert a is true or do nothing +#define CHECK(a) DO_ASSERT(a) + +// Running a leak check across all the allocations and frees of the JDK is a mess, +// so instead we implement our own naive leak checker here, relying on the -wrap +// linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated +// and free'd in Rust or C across the generated bindings shared library. + +#define BT_MAX 128 +typedef struct allocation { + struct allocation* next; + void* ptr; + const char* struct_name; +} allocation; +static allocation* allocation_ll = NULL; + +void* __real_malloc(size_t len); +void* __real_calloc(size_t nmemb, size_t len); +static void new_allocation(void* res, const char* struct_name) { + allocation* new_alloc = __real_malloc(sizeof(allocation)); + new_alloc->ptr = res; + new_alloc->struct_name = struct_name; + new_alloc->next = allocation_ll; + allocation_ll = new_alloc; +} +static void* MALLOC(size_t len, const char* struct_name) { + void* res = __real_malloc(len); + new_allocation(res, struct_name); + return res; +} +void __real_free(void* ptr); +static void alloc_freed(void* ptr) { + allocation* p = NULL; + allocation* it = allocation_ll; + while (it->ptr != ptr) { + p = it; it = it->next; + if (it == NULL) { + //XXX: fprintf(stderr, "Tried to free unknown pointer %p\n", ptr); + return; // addrsan should catch malloc-unknown and print more info than we have + } + } + if (p) { p->next = it->next; } else { allocation_ll = it->next; } + DO_ASSERT(it->ptr == ptr); + __real_free(it); +} +static void FREE(void* ptr) { + if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys + alloc_freed(ptr); + __real_free(ptr); +} + +void* __wrap_malloc(size_t len) { + void* res = __real_malloc(len); + new_allocation(res, "malloc call"); + return res; +} +void* __wrap_calloc(size_t nmemb, size_t len) { + void* res = __real_calloc(nmemb, len); + new_allocation(res, "calloc call"); + return res; +} +void __wrap_free(void* ptr) { + if (ptr == NULL) return; + alloc_freed(ptr); + __real_free(ptr); +} -#define MALLOC(a, _) malloc(a) -#define FREE(p) if ((long)(p) > 1024) { free(p); } -#define DO_ASSERT(a) (void)(a) -#define CHECK(a) +void* __real_realloc(void* ptr, size_t newlen); +void* __wrap_realloc(void* ptr, size_t len) { + if (ptr != NULL) alloc_freed(ptr); + void* res = __real_realloc(ptr, len); + new_allocation(res, "realloc call"); + return res; +} +void __wrap_reallocarray(void* ptr, size_t new_sz) { + // Rust doesn't seem to use reallocarray currently + DO_ASSERT(false); +} + +void __attribute__((destructor)) check_leaks() { + for (allocation* a = allocation_ll; a != NULL; a = a->next) { + //XXX: fprintf(stderr, "%s %p remains\n", a->struct_name, a->ptr); + } + DO_ASSERT(allocation_ll == NULL); +} // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed) _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec and [u8] need to have been mapped identically"); @@ -147,8 +227,8 @@ static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) { case 4: return LDKSecp256k1Error_InvalidSecretKey; case 5: return LDKSecp256k1Error_InvalidRecoveryId; case 6: return LDKSecp256k1Error_InvalidTweak; - case 7: return LDKSecp256k1Error_NotEnoughMemory; - case 8: return LDKSecp256k1Error_CallbackPanicked; + case 7: return LDKSecp256k1Error_TweakCheckFailed; + case 8: return LDKSecp256k1Error_NotEnoughMemory; } abort(); } @@ -161,8 +241,8 @@ static inline int32_t LDKSecp256k1Error_to_js(LDKSecp256k1Error val) { case LDKSecp256k1Error_InvalidSecretKey: return 4; case LDKSecp256k1Error_InvalidRecoveryId: return 5; case LDKSecp256k1Error_InvalidTweak: return 6; - case LDKSecp256k1Error_NotEnoughMemory: return 7; - case LDKSecp256k1Error_CallbackPanicked: return 8; + case LDKSecp256k1Error_TweakCheckFailed: return 7; + case LDKSecp256k1Error_NotEnoughMemory: return 8; default: abort(); } } @@ -430,9 +510,9 @@ ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNo ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4); for (size_t m = 0; m < res_var.datalen; m++) { - int8_tArray arr_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arr_conv_12_arr + 4), res_var.data[m].compact_form, 64); - res_arr_ptr[m] = arr_conv_12_arr; + int8_tArray res_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_conv_12_arr + 4), res_var.data[m].compact_form, 64); + res_arr_ptr[m] = res_conv_12_arr; } return res_arr; } @@ -1180,6 +1260,18 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneChannelMonito uint32_t err_conv = LDKChannelMonitorUpdateErr_to_js((*val->contents.err)); return err_conv; } +uint32_t __attribute__((visibility("default"))) TS_LDKMonitorEvent_ref_from_ptr(uint32_t ptr) { + LDKMonitorEvent *obj = (LDKMonitorEvent*)ptr; + switch(obj->tag) { + case LDKMonitorEvent_HTLCEvent: { + return 0 /* LDKMonitorEvent - HTLCEvent */; + } + case LDKMonitorEvent_CommitmentTxBroadcasted: { + return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; + } + default: abort(); + } +} uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(uint32_tArray elems) { LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ"); ret->datalen = *((uint32_t*)elems); @@ -1190,10 +1282,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCVec_MonitorEventZ_new(ui uint32_t *java_elems = (uint32_t*)(elems + 4); for (size_t i = 0; i < ret->datalen; i++) { uint32_t arr_elem = java_elems[i]; - LDKMonitorEvent 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 = MonitorEvent_clone(&arr_elem_conv); + LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); ret->data[i] = arr_elem_conv; } } @@ -1206,20 +1296,6 @@ static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_Monit } return ret; } -uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u64u64Z_new(int64_t a, int64_t b) { - LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - ret->a = a; - ret->b = b; - return (long)ret; -} -int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u64u64Z_get_a(uint32_t ptr) { - LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1); - return tuple->a; -} -int64_t __attribute__((visibility("default"))) TS_LDKC2Tuple_u64u64Z_get_b(uint32_t ptr) { - LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1); - return tuple->b; -} uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) { LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr; switch(obj->tag) { @@ -1231,27 +1307,11 @@ uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ long output_ref = ((long)&obj->static_output.output) | 1; return 0 /* LDKSpendableOutputDescriptor - StaticOutput */; (void) outpoint_ref; (void) (long)output_ref; } - case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: { - LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint; - CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long outpoint_ref = (long)outpoint_var.inner & ~1; - int8_tArray per_commitment_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(per_commitment_point_arr + 4), obj->dynamic_output_p2wsh.per_commitment_point.compressed_form, 33); - long output_ref = ((long)&obj->dynamic_output_p2wsh.output) | 1; - long key_derivation_params_ref = (long)(&obj->dynamic_output_p2wsh.key_derivation_params) | 1; - int8_tArray revocation_pubkey_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(revocation_pubkey_arr + 4), obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form, 33); - return 0 /* LDKSpendableOutputDescriptor - DynamicOutputP2WSH */; (void) outpoint_ref; (void) per_commitment_point_arr; (void) obj->dynamic_output_p2wsh.to_self_delay; (void) (long)output_ref; (void) key_derivation_params_ref; (void) revocation_pubkey_arr; + case LDKSpendableOutputDescriptor_DelayedPaymentOutput: { + return 0 /* LDKSpendableOutputDescriptor - DelayedPaymentOutput */; } - case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: { - LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint; - CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long outpoint_ref = (long)outpoint_var.inner & ~1; - long output_ref = ((long)&obj->static_output_counterparty_payment.output) | 1; - long key_derivation_params_ref = (long)(&obj->static_output_counterparty_payment.key_derivation_params) | 1; - return 0 /* LDKSpendableOutputDescriptor - StaticOutputCounterpartyPayment */; (void) outpoint_ref; (void) (long)output_ref; (void) key_derivation_params_ref; + case LDKSpendableOutputDescriptor_StaticPaymentOutput: { + return 0 /* LDKSpendableOutputDescriptor - StaticPaymentOutput */; } default: abort(); } @@ -1323,8 +1383,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ uint32_tArray outputs_arr = init_arr(outputs_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); uint32_t *outputs_arr_ptr = (uint32_t*)(outputs_arr + 4); for (size_t b = 0; b < outputs_var.datalen; b++) { - long arr_conv_27_ref = ((long)&outputs_var.data[b]) | 1; - outputs_arr_ptr[b] = arr_conv_27_ref; + long outputs_conv_27_ref = ((long)&outputs_var.data[b]) | 1; + outputs_arr_ptr[b] = outputs_conv_27_ref; } return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr; } @@ -1519,10 +1579,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2Tuple_ b_constr.data = NULL; uint32_t* b_vals = (uint32_t*)(b + 4); for (size_t z = 0; z < b_constr.datalen; z++) { - uint32_t arr_conv_25 = b_vals[z]; - LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_25) & ~1); - FREE((void*)arr_conv_25); - b_constr.data[z] = arr_conv_25_conv; + uint32_t b_conv_25 = b_vals[z]; + LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1); + FREE((void*)b_conv_25); + b_constr.data[z] = b_conv_25_conv; } ret->b = b_constr; return (long)ret; @@ -1539,8 +1599,8 @@ uint32_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_TxidCVec_C2T uint32_tArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); uint32_t *b_arr_ptr = (uint32_t*)(b_arr + 4); for (size_t z = 0; z < b_var.datalen; z++) { - long arr_conv_25_ref = (long)(&b_var.data[z]) | 1; - b_arr_ptr[z] = arr_conv_25_ref; + long b_conv_25_ref = (long)(&b_var.data[z]) | 1; + b_arr_ptr[z] = b_conv_25_ref; } return b_arr; } @@ -1575,11 +1635,11 @@ uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_Sig b_constr.data = NULL; int8_tArray* b_vals = (int8_tArray*)(b + 4); for (size_t m = 0; m < b_constr.datalen; m++) { - int8_tArray arr_conv_12 = b_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - b_constr.data[m] = arr_conv_12_ref; + int8_tArray b_conv_12 = b_vals[m]; + LDKSignature b_conv_12_ref; + CHECK(*((uint32_t*)b_conv_12) == 64); + memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64); + b_constr.data[m] = b_conv_12_ref; } ret->b = b_constr; return (long)ret; @@ -1596,9 +1656,9 @@ ptrArray __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_Sig ptrArray b_arr = init_arr(b_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); int8_tArray *b_arr_ptr = (int8_tArray*)(b_arr + 4); for (size_t m = 0; m < b_var.datalen; m++) { - int8_tArray arr_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arr_conv_12_arr + 4), b_var.data[m].compact_form, 64); - b_arr_ptr[m] = arr_conv_12_arr; + int8_tArray b_conv_12_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(b_conv_12_arr + 4), b_var.data[m].compact_form, 64); + b_arr_ptr[m] = b_conv_12_arr; } return b_arr; } @@ -1631,11 +1691,11 @@ void __attribute__((visibility("default"))) TS_LDKCResult_SignatureNoneZ_get_er CHECK(!val->result_ok); return *val->contents.err; } -typedef struct LDKChannelKeys_JCalls { +typedef struct LDKSign_JCalls { atomic_size_t refcnt; uint32_t get_per_commitment_point_meth; uint32_t release_commitment_secret_meth; - uint32_t key_derivation_params_meth; + uint32_t channel_keys_id_meth; uint32_t sign_counterparty_commitment_meth; uint32_t sign_holder_commitment_and_htlcs_meth; uint32_t sign_justice_transaction_meth; @@ -1644,13 +1704,13 @@ typedef struct LDKChannelKeys_JCalls { uint32_t sign_channel_announcement_meth; uint32_t ready_channel_meth; uint32_t write_meth; -} LDKChannelKeys_JCalls; -static void LDKChannelKeys_JCalls_free(void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; +} LDKSign_JCalls; +static void LDKSign_JCalls_free(void* this_arg) { + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { js_free(j_calls->get_per_commitment_point_meth); js_free(j_calls->release_commitment_secret_meth); - js_free(j_calls->key_derivation_params_meth); + js_free(j_calls->channel_keys_id_meth); js_free(j_calls->sign_counterparty_commitment_meth); js_free(j_calls->sign_holder_commitment_and_htlcs_meth); js_free(j_calls->sign_justice_transaction_meth); @@ -1663,30 +1723,31 @@ static void LDKChannelKeys_JCalls_free(void* this_arg) { } } LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - int8_tArray arg = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx); - LDKPublicKey arg_ref; - CHECK(*((uint32_t*)arg) == 33); - memcpy(arg_ref.compressed_form, (uint8_t*)(arg + 4), 33); - return arg_ref; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; + int8_tArray ret = js_invoke_function_1(j_calls->get_per_commitment_point_meth, idx); + LDKPublicKey ret_ref; + CHECK(*((uint32_t*)ret) == 33); + memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33); + return ret_ref; } LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - int8_tArray arg = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx); - LDKThirtyTwoBytes arg_ref; - CHECK(*((uint32_t*)arg) == 32); - memcpy(arg_ref.data, (uint8_t*)(arg + 4), 32); - return arg_ref; -} -LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)js_invoke_function_0(j_calls->key_derivation_params_meth); - LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)ret) & ~1); - ret_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)ret); - return ret_conv; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; + int8_tArray ret = js_invoke_function_1(j_calls->release_commitment_secret_meth, idx); + LDKThirtyTwoBytes ret_ref; + CHECK(*((uint32_t*)ret) == 32); + memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); + return ret_ref; +} +LDKThirtyTwoBytes channel_keys_id_jcall(const void* this_arg) { + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; + int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth); + LDKThirtyTwoBytes ret_ref; + CHECK(*((uint32_t*)ret) == 32); + memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); + return ret_ref; } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKCommitmentTransaction commitment_tx_var = *commitment_tx; commitment_tx_var = CommitmentTransaction_clone(commitment_tx); CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -1701,7 +1762,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_j return ret_conv; } LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx; commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx); CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -1716,7 +1777,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl return ret_conv; } LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKTransaction justice_tx_var = justice_tx; int8_tArray justice_tx_arr = init_arr(justice_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(justice_tx_arr + 4), justice_tx_var.data, justice_tx_var.datalen); @@ -1737,7 +1798,7 @@ LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, L return ret_conv; } LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKTransaction htlc_tx_var = htlc_tx; int8_tArray htlc_tx_arr = init_arr(htlc_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(htlc_tx_arr + 4), htlc_tx_var.data, htlc_tx_var.datalen); @@ -1758,7 +1819,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* t return ret_conv; } LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKTransaction closing_tx_var = closing_tx; int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen); @@ -1769,7 +1830,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, L return ret_conv; } LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKUnsignedChannelAnnouncement msg_var = *msg; msg_var = UnsignedChannelAnnouncement_clone(msg); CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -1784,7 +1845,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, return ret_conv; } void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters); CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -1796,21 +1857,21 @@ void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * js_invoke_function_1(j_calls->ready_channel_meth, channel_parameters_ref); } LDKCVec_u8Z write_jcall(const void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; - int8_tArray arg = js_invoke_function_0(j_calls->write_meth); - LDKCVec_u8Z arg_ref; - arg_ref.datalen = *((uint32_t*)arg); - arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes"); - memcpy(arg_ref.data, (uint8_t*)(arg + 4), arg_ref.datalen); - return arg_ref; -} -static void* LDKChannelKeys_JCalls_clone(const void* this_arg) { - LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg; + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; + int8_tArray ret = js_invoke_function_0(j_calls->write_meth); + LDKCVec_u8Z ret_ref; + ret_ref.datalen = *((uint32_t*)ret); + ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); + memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen); + return ret_ref; +} +static void* LDKSign_JCalls_clone(const void* this_arg) { + LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); return (void*) this_arg; } -static inline LDKChannelKeys LDKChannelKeys_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) { - LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls"); +static inline LDKSign LDKSign_init (/*TODO: JS Object Reference */void* o, uint32_t pubkeys) { + LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls"); atomic_init(&calls->refcnt, 1); //TODO: Assign calls->o from o @@ -1819,11 +1880,11 @@ static inline LDKChannelKeys LDKChannelKeys_init (/*TODO: JS Object Reference */ pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0); pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv); - LDKChannelKeys ret = { + LDKSign ret = { .this_arg = (void*) calls, .get_per_commitment_point = get_per_commitment_point_jcall, .release_commitment_secret = release_commitment_secret_jcall, - .key_derivation_params = key_derivation_params_jcall, + .channel_keys_id = channel_keys_id_jcall, .sign_counterparty_commitment = sign_counterparty_commitment_jcall, .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall, .sign_justice_transaction = sign_justice_transaction_jcall, @@ -1831,42 +1892,42 @@ static inline LDKChannelKeys LDKChannelKeys_init (/*TODO: JS Object Reference */ .sign_closing_transaction = sign_closing_transaction_jcall, .sign_channel_announcement = sign_channel_announcement_jcall, .ready_channel = ready_channel_jcall, - .clone = LDKChannelKeys_JCalls_clone, + .clone = LDKSign_JCalls_clone, .write = write_jcall, - .free = LDKChannelKeys_JCalls_free, + .free = LDKSign_JCalls_free, .pubkeys = pubkeys_conv, .set_pubkeys = NULL, }; return ret; } -long __attribute__((visibility("default"))) TS_LDKChannelKeys_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) { - LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *res_ptr = LDKChannelKeys_init(o, pubkeys); +long __attribute__((visibility("default"))) TS_LDKSign_new(/*TODO: JS Object Reference */void* o, uint32_t pubkeys) { + LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign"); + *res_ptr = LDKSign_init(o, pubkeys); return (long)res_ptr; } -int8_tArray __attribute__((visibility("default"))) TS_ChannelKeys_get_per_commitment_point(uint32_t this_arg, int64_t idx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33); - return arg_arr; +int8_tArray __attribute__((visibility("default"))) TS_Sign_get_per_commitment_point(uint32_t this_arg, int64_t idx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33); + return ret_arr; } -int8_tArray __attribute__((visibility("default"))) TS_ChannelKeys_release_commitment_secret(uint32_t this_arg, int64_t idx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32); - return arg_arr; +int8_tArray __attribute__((visibility("default"))) TS_Sign_release_commitment_secret(uint32_t this_arg, int64_t idx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32); + return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_key_derivation_params(uint32_t this_arg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg); - return (long)ret_ref; +int8_tArray __attribute__((visibility("default"))) TS_Sign_channel_keys_id(uint32_t this_arg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32); + return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +uint32_t __attribute__((visibility("default"))) TS_Sign_sign_counterparty_commitment(uint32_t this_arg, uint32_t commitment_tx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = (void*)(commitment_tx & (~1)); commitment_tx_conv.is_owned = false; @@ -1875,8 +1936,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_counterpart return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +uint32_t __attribute__((visibility("default"))) TS_Sign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKHolderCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = (void*)(commitment_tx & (~1)); commitment_tx_conv.is_owned = false; @@ -1885,8 +1946,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_holder_comm return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_justice_transaction(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +uint32_t __attribute__((visibility("default"))) TS_Sign_sign_justice_transaction(uint32_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, uint32_t htlc) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = *((uint32_t*)justice_tx); justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); @@ -1904,8 +1965,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_justice_tra return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_counterparty_htlc_transaction(uint32_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +uint32_t __attribute__((visibility("default"))) TS_Sign_sign_counterparty_htlc_transaction(uint32_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, uint32_t htlc) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKTransaction htlc_tx_ref; htlc_tx_ref.datalen = *((uint32_t*)htlc_tx); htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes"); @@ -1922,8 +1983,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_counterpart return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +uint32_t __attribute__((visibility("default"))) TS_Sign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKTransaction closing_tx_ref; closing_tx_ref.datalen = *((uint32_t*)closing_tx); closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes"); @@ -1934,8 +1995,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_closing_tra return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_channel_announcement(uint32_t this_arg, uint32_t msg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +uint32_t __attribute__((visibility("default"))) TS_Sign_sign_channel_announcement(uint32_t this_arg, uint32_t msg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKUnsignedChannelAnnouncement msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = false; @@ -1944,31 +2005,31 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_sign_channel_ann return (long)ret_conv; } -void __attribute__((visibility("default"))) TS_ChannelKeys_ready_channel(uint32_t this_arg, uint32_t channel_parameters) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; +void __attribute__((visibility("default"))) TS_Sign_ready_channel(uint32_t this_arg, uint32_t channel_parameters) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; LDKChannelTransactionParameters channel_parameters_conv; channel_parameters_conv.inner = (void*)(channel_parameters & (~1)); channel_parameters_conv.is_owned = false; (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv); } -int8_tArray __attribute__((visibility("default"))) TS_ChannelKeys_write(uint32_t this_arg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; +int8_tArray __attribute__((visibility("default"))) TS_Sign_write(uint32_t this_arg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg); + 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; } -LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) { +LDKChannelPublicKeys LDKSign_set_get_pubkeys(LDKSign* this_arg) { if (this_arg->set_pubkeys != NULL) this_arg->set_pubkeys(this_arg); return this_arg->pubkeys; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_get_pubkeys(uint32_t this_arg) { - LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg; - LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv); +uint32_t __attribute__((visibility("default"))) TS_Sign_get_pubkeys(uint32_t this_arg) { + LDKSign* this_arg_conv = (LDKSign*)this_arg; + LDKChannelPublicKeys ret_var = LDKSign_set_get_pubkeys(this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -2084,6 +2145,54 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneAPIErrorZ_get long err_ref = ((long)&(*val->contents.err)) | 1; return err_ref; } +uint32_t __attribute__((visibility("default"))) TS_LDKCVec_CResult_NoneAPIErrorZZ_new(uint32_tArray elems) { + LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ"); + ret->datalen = *((uint32_t*)elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ 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]; + LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); + ret->data[i] = arr_elem_conv; + } + } + return (long)ret; +} +static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { + LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); + } + return ret; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCVec_APIErrorZ_new(uint32_tArray elems) { + LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ"); + ret->datalen = *((uint32_t*)elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ 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]; + LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); + ret->data[i] = arr_elem_conv; + } + } + return (long)ret; +} +static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { + LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = APIError_clone(&orig->data[i]); + } + return ret; +} uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelDetailsZ_new(uint32_tArray elems) { LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ"); ret->datalen = *((uint32_t*)elems); @@ -2110,6 +2219,24 @@ static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_C } return ret; } +uint32_t __attribute__((visibility("default"))) TS_LDKPaymentSendFailure_ref_from_ptr(uint32_t ptr) { + LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)ptr; + switch(obj->tag) { + case LDKPaymentSendFailure_ParameterError: { + return 0 /* LDKPaymentSendFailure - ParameterError */; + } + case LDKPaymentSendFailure_PathParameterError: { + return 0 /* LDKPaymentSendFailure - PathParameterError */; + } + case LDKPaymentSendFailure_AllFailedRetrySafe: { + return 0 /* LDKPaymentSendFailure - AllFailedRetrySafe */; + } + case LDKPaymentSendFailure_PartialFailure: { + return 0 /* LDKPaymentSendFailure - PartialFailure */; + } + default: abort(); + } +} jboolean __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_result_ok(uint32_t arg) { return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok; } @@ -2121,10 +2248,7 @@ void __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailur uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFailureZ_get_err(uint32_t arg) { LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1); CHECK(!val->result_ok); - LDKPaymentSendFailure err_var = (*val->contents.err); - CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long err_ref = (long)err_var.inner & ~1; + long err_ref = ((long)&(*val->contents.err)) | 1; return err_ref; } uint32_t __attribute__((visibility("default"))) TS_LDKCVec_ChannelMonitorZ_new(uint32_tArray elems) { @@ -2212,23 +2336,21 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_ar } LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; - uint32_tArray arg = js_invoke_function_0(j_calls->release_pending_monitor_events_meth); - LDKCVec_MonitorEventZ arg_constr; - arg_constr.datalen = *((uint32_t*)arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements"); + uint32_tArray ret = js_invoke_function_0(j_calls->release_pending_monitor_events_meth); + LDKCVec_MonitorEventZ ret_constr; + ret_constr.datalen = *((uint32_t*)ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements"); else - arg_constr.data = NULL; - uint32_t* arg_vals = (uint32_t*)(arg + 4); - for (size_t o = 0; o < arg_constr.datalen; o++) { - uint32_t arr_conv_14 = arg_vals[o]; - LDKMonitorEvent arr_conv_14_conv; - arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1)); - arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0); - arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv); - arg_constr.data[o] = arr_conv_14_conv; - } - return arg_constr; + ret_constr.data = NULL; + uint32_t* ret_vals = (uint32_t*)(ret + 4); + for (size_t o = 0; o < ret_constr.datalen; o++) { + uint32_t ret_conv_14 = ret_vals[o]; + LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1); + ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)ret_conv_14); + ret_constr.data[o] = ret_conv_14_conv; + } + return ret_constr; } static void* LDKWatch_JCalls_clone(const void* this_arg) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; @@ -2290,14 +2412,10 @@ uint32_tArray __attribute__((visibility("default"))) TS_Watch_release_pending_m 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 o = 0; o < ret_var.datalen; o++) { - LDKMonitorEvent arr_conv_14_var = ret_var.data[o]; - CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_14_ref = (long)arr_conv_14_var.inner; - if (arr_conv_14_var.is_owned) { - arr_conv_14_ref |= 1; - } - ret_arr_ptr[o] = arr_conv_14_ref; + LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]); + long ret_conv_14_ref = (long)ret_conv_14_copy; + ret_arr_ptr[o] = ret_conv_14_ref; } FREE(ret_var.data); return ret_arr; @@ -2354,18 +2472,18 @@ void __attribute__((visibility("default"))) TS_BroadcasterInterface_broadcast_t (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref); } -jboolean __attribute__((visibility("default"))) TS_LDKCResult_ChannelKeysDecodeErrorZ_result_ok(uint32_t arg) { - return ((LDKCResult_ChannelKeysDecodeErrorZ*)arg)->result_ok; +jboolean __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelKeysDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = ChannelKeys_clone(&(*val->contents.result)); + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = Sign_clone(&(*val->contents.result)); return (long)ret; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelKeysDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_ChannelKeysDecodeErrorZ *val = (LDKCResult_ChannelKeysDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -2378,7 +2496,7 @@ typedef struct LDKKeysInterface_JCalls { uint32_t get_node_secret_meth; uint32_t get_destination_script_meth; uint32_t get_shutdown_pubkey_meth; - uint32_t get_channel_keys_meth; + uint32_t get_channel_signer_meth; uint32_t get_secure_random_bytes_meth; uint32_t read_chan_signer_meth; } LDKKeysInterface_JCalls; @@ -2388,7 +2506,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { js_free(j_calls->get_node_secret_meth); js_free(j_calls->get_destination_script_meth); js_free(j_calls->get_shutdown_pubkey_meth); - js_free(j_calls->get_channel_keys_meth); + js_free(j_calls->get_channel_signer_meth); js_free(j_calls->get_secure_random_bytes_meth); js_free(j_calls->read_chan_signer_meth); FREE(j_calls); @@ -2396,52 +2514,52 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { } LDKSecretKey get_node_secret_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - int8_tArray arg = js_invoke_function_0(j_calls->get_node_secret_meth); - LDKSecretKey arg_ref; - CHECK(*((uint32_t*)arg) == 32); - memcpy(arg_ref.bytes, (uint8_t*)(arg + 4), 32); - return arg_ref; + int8_tArray ret = js_invoke_function_0(j_calls->get_node_secret_meth); + LDKSecretKey ret_ref; + CHECK(*((uint32_t*)ret) == 32); + memcpy(ret_ref.bytes, (uint8_t*)(ret + 4), 32); + return ret_ref; } LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - int8_tArray arg = js_invoke_function_0(j_calls->get_destination_script_meth); - LDKCVec_u8Z arg_ref; - arg_ref.datalen = *((uint32_t*)arg); - arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes"); - memcpy(arg_ref.data, (uint8_t*)(arg + 4), arg_ref.datalen); - return arg_ref; + int8_tArray ret = js_invoke_function_0(j_calls->get_destination_script_meth); + LDKCVec_u8Z ret_ref; + ret_ref.datalen = *((uint32_t*)ret); + ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); + memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen); + return ret_ref; } LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - int8_tArray arg = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth); - LDKPublicKey arg_ref; - CHECK(*((uint32_t*)arg) == 33); - memcpy(arg_ref.compressed_form, (uint8_t*)(arg + 4), 33); - return arg_ref; + int8_tArray ret = js_invoke_function_0(j_calls->get_shutdown_pubkey_meth); + LDKPublicKey ret_ref; + CHECK(*((uint32_t*)ret) == 33); + memcpy(ret_ref.compressed_form, (uint8_t*)(ret + 4), 33); + return ret_ref; } -LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { +LDKSign get_channel_signer_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - LDKChannelKeys* ret = (LDKChannelKeys*)js_invoke_function_2(j_calls->get_channel_keys_meth, inbound, channel_value_satoshis); - LDKChannelKeys ret_conv = *(LDKChannelKeys*)(((uint64_t)ret) & ~1); - ret_conv = ChannelKeys_clone(ret); + LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis); + LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1); + ret_conv = Sign_clone(ret); return ret_conv; } LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - int8_tArray arg = js_invoke_function_0(j_calls->get_secure_random_bytes_meth); - LDKThirtyTwoBytes arg_ref; - CHECK(*((uint32_t*)arg) == 32); - memcpy(arg_ref.data, (uint8_t*)(arg + 4), 32); - return arg_ref; + int8_tArray ret = js_invoke_function_0(j_calls->get_secure_random_bytes_meth); + LDKThirtyTwoBytes ret_ref; + CHECK(*((uint32_t*)ret) == 32); + memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); + return ret_ref; } -LDKCResult_ChannelKeysDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) { +LDKCResult_SignDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; LDKu8slice reader_var = reader; int8_tArray reader_arr = init_arr(reader_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(reader_arr + 4), reader_var.data, reader_var.datalen); - LDKCResult_ChannelKeysDecodeErrorZ* ret = (LDKCResult_ChannelKeysDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr); - LDKCResult_ChannelKeysDecodeErrorZ ret_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)ret) & ~1); - ret_conv = CResult_ChannelKeysDecodeErrorZ_clone((LDKCResult_ChannelKeysDecodeErrorZ*)ret); + LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr); + LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1); + ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)ret); return ret_conv; } static void* LDKKeysInterface_JCalls_clone(const void* this_arg) { @@ -2459,7 +2577,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Referenc .get_node_secret = get_node_secret_jcall, .get_destination_script = get_destination_script_jcall, .get_shutdown_pubkey = get_shutdown_pubkey_jcall, - .get_channel_keys = get_channel_keys_jcall, + .get_channel_signer = get_channel_signer_jcall, .get_secure_random_bytes = get_secure_random_bytes_jcall, .read_chan_signer = read_chan_signer_jcall, .free = LDKKeysInterface_JCalls_free, @@ -2473,39 +2591,39 @@ long __attribute__((visibility("default"))) TS_LDKKeysInterface_new(/*TODO: JS } int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_node_secret(uint32_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32); - return arg_arr; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes, 32); + return ret_arr; } int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_destination_script(uint32_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); + 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; } int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form, 33); + return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_keys(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) { +uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis); + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis); return (long)ret; } int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) { LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg; - int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32); - return arg_arr; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32); + return ret_arr; } uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_signer(uint32_t this_arg, int8_tArray reader) { @@ -2513,7 +2631,7 @@ uint32_t __attribute__((visibility("default"))) TS_KeysInterface_read_chan_sign LDKu8slice reader_ref; reader_ref.datalen = *((uint32_t*)reader); reader_ref.data = (int8_t*)(reader + 4); - LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref); return (long)ret_conv; } @@ -2665,20 +2783,49 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SpendableOutputDe long err_ref = (long)err_var.inner & ~1; return err_ref; } -jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemoryChannelKeysDecodeErrorZ_result_ok(uint32_t arg) { - return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok; +static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) { + LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = CVec_u8Z_clone(&orig->data[i]); + } + return ret; +} +jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(uint32_t arg) { + return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok; +} +ptrArray __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(uint32_t arg) { + LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKCVec_CVec_u8ZZ res_var = (*val->contents.result); + ptrArray res_arr = init_arr(res_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); + int8_tArray *res_arr_ptr = (int8_tArray*)(res_arr + 4); + for (size_t m = 0; m < res_var.datalen; m++) { + LDKCVec_u8Z res_conv_12_var = res_var.data[m]; + int8_tArray res_conv_12_arr = init_arr(res_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_conv_12_arr + 4), res_conv_12_var.data, res_conv_12_var.datalen); + res_arr_ptr[m] = res_conv_12_arr; + } + return res_arr; +} +void __attribute__((visibility("default"))) TS_LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(uint32_t arg) { + LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +jboolean __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_result_ok(uint32_t arg) { + return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInMemoryChannelKeys res_var = (*val->contents.result); + LDKInMemorySigner res_var = (*val->contents.result); CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long res_ref = (long)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemorySignerDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -2686,6 +2833,46 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InMemoryChannelKe long err_ref = (long)err_var.inner & ~1; return err_ref; } +uint32_t __attribute__((visibility("default"))) TS_LDKCVec_TxOutZ_new(uint32_tArray elems) { + LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ"); + ret->datalen = *((uint32_t*)elems); + if (ret->datalen == 0) { + ret->data = NULL; + } else { + ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ 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]; + LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1); + FREE((void*)arr_elem); + ret->data[i] = arr_elem_conv; + } + } + return (long)ret; +} +static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) { + LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = TxOut_clone(&orig->data[i]); + } + return ret; +} +jboolean __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_result_ok(uint32_t arg) { + return ((LDKCResult_TransactionNoneZ*)arg)->result_ok; +} +int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_ok(uint32_t arg) { + LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKTransaction res_var = (*val->contents.result); + int8_tArray res_arr = init_arr(res_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_arr + 4), res_var.data, res_var.datalen); + return res_arr; +} +void __attribute__((visibility("default"))) TS_LDKCResult_TransactionNoneZ_get_err(uint32_t arg) { + LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} uint32_t __attribute__((visibility("default"))) TS_LDKCVec_RouteHopZ_new(uint32_tArray elems) { LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ"); ret->datalen = *((uint32_t*)elems); @@ -3589,21 +3776,21 @@ static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) { } LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) { LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; - uint32_tArray arg = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth); - LDKCVec_MessageSendEventZ arg_constr; - arg_constr.datalen = *((uint32_t*)arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements"); + uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_events_meth); + LDKCVec_MessageSendEventZ ret_constr; + ret_constr.datalen = *((uint32_t*)ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements"); else - arg_constr.data = NULL; - uint32_t* arg_vals = (uint32_t*)(arg + 4); - for (size_t s = 0; s < arg_constr.datalen; s++) { - uint32_t arr_conv_18 = arg_vals[s]; - LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1); - FREE((void*)arr_conv_18); - arg_constr.data[s] = arr_conv_18_conv; + ret_constr.data = NULL; + uint32_t* ret_vals = (uint32_t*)(ret + 4); + for (size_t s = 0; s < ret_constr.datalen; s++) { + uint32_t ret_conv_18 = ret_vals[s]; + LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1); + ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)ret_conv_18); + ret_constr.data[s] = ret_conv_18_conv; } - return arg_constr; + return ret_constr; } static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) { LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; @@ -3633,10 +3820,10 @@ uint32_tArray __attribute__((visibility("default"))) TS_MessageSendEventsProvid 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 s = 0; s < ret_var.datalen; s++) { - LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); - *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]); - long arr_conv_18_ref = (long)arr_conv_18_copy; - ret_arr_ptr[s] = arr_conv_18_ref; + LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); + *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]); + long ret_conv_18_ref = (long)ret_conv_18_copy; + ret_arr_ptr[s] = ret_conv_18_ref; } FREE(ret_var.data); return ret_arr; @@ -3655,21 +3842,21 @@ static void LDKEventsProvider_JCalls_free(void* this_arg) { } LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) { LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; - uint32_tArray arg = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth); - LDKCVec_EventZ arg_constr; - arg_constr.datalen = *((uint32_t*)arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements"); + uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_events_meth); + LDKCVec_EventZ ret_constr; + ret_constr.datalen = *((uint32_t*)ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements"); else - arg_constr.data = NULL; - uint32_t* arg_vals = (uint32_t*)(arg + 4); - for (size_t h = 0; h < arg_constr.datalen; h++) { - uint32_t arr_conv_7 = arg_vals[h]; - LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1); - FREE((void*)arr_conv_7); - arg_constr.data[h] = arr_conv_7_conv; + ret_constr.data = NULL; + uint32_t* ret_vals = (uint32_t*)(ret + 4); + for (size_t h = 0; h < ret_constr.datalen; h++) { + uint32_t ret_conv_7 = ret_vals[h]; + LDKEvent ret_conv_7_conv = *(LDKEvent*)(((uint64_t)ret_conv_7) & ~1); + ret_conv_7_conv = Event_clone((LDKEvent*)ret_conv_7); + ret_constr.data[h] = ret_conv_7_conv; } - return arg_constr; + return ret_constr; } static void* LDKEventsProvider_JCalls_clone(const void* this_arg) { LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; @@ -3699,10 +3886,10 @@ uint32_tArray __attribute__((visibility("default"))) TS_EventsProvider_get_and_ 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 h = 0; h < ret_var.datalen; h++) { - LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *arr_conv_7_copy = Event_clone(&ret_var.data[h]); - long arr_conv_7_ref = (long)arr_conv_7_copy; - ret_arr_ptr[h] = arr_conv_7_ref; + LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_conv_7_copy = Event_clone(&ret_var.data[h]); + long ret_conv_7_ref = (long)ret_conv_7_copy; + ret_arr_ptr[h] = ret_conv_7_ref; } FREE(ret_var.data); return ret_arr; @@ -3761,6 +3948,72 @@ uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t thi return (long)ret_conv; } +typedef struct LDKListen_JCalls { + atomic_size_t refcnt; + uint32_t block_connected_meth; + uint32_t block_disconnected_meth; +} LDKListen_JCalls; +static void LDKListen_JCalls_free(void* this_arg) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + js_free(j_calls->block_connected_meth); + js_free(j_calls->block_disconnected_meth); + FREE(j_calls); + } +} +void block_connected_jcall(const void* this_arg, LDKu8slice block, uint32_t height) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + LDKu8slice block_var = block; + int8_tArray block_arr = init_arr(block_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(block_arr + 4), block_var.data, block_var.datalen); + js_invoke_function_2(j_calls->block_connected_meth, block_arr, height); +} +void block_disconnected_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + int8_tArray header_arr = init_arr(80, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(header_arr + 4), *header, 80); + js_invoke_function_2(j_calls->block_disconnected_meth, header_arr, height); +} +static void* LDKListen_JCalls_clone(const void* this_arg) { + LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); + return (void*) this_arg; +} +static inline LDKListen LDKListen_init (/*TODO: JS Object Reference */void* o) { + LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls"); + atomic_init(&calls->refcnt, 1); + //TODO: Assign calls->o from o + + LDKListen ret = { + .this_arg = (void*) calls, + .block_connected = block_connected_jcall, + .block_disconnected = block_disconnected_jcall, + .free = LDKListen_JCalls_free, + }; + return ret; +} +long __attribute__((visibility("default"))) TS_LDKListen_new(/*TODO: JS Object Reference */void* o) { + LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen"); + *res_ptr = LDKListen_init(o); + return (long)res_ptr; +} +void __attribute__((visibility("default"))) TS_Listen_block_connected(uint32_t this_arg, int8_tArray block, int32_t height) { + LDKListen* this_arg_conv = (LDKListen*)this_arg; + LDKu8slice block_ref; + block_ref.datalen = *((uint32_t*)block); + block_ref.data = (int8_t*)(block + 4); + (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height); +} + +void __attribute__((visibility("default"))) TS_Listen_block_disconnected(uint32_t this_arg, int8_tArray header, int32_t height) { + LDKListen* this_arg_conv = (LDKListen*)this_arg; + unsigned char header_arr[80]; + CHECK(*((uint32_t*)header) == 80); + memcpy(header_arr, (uint8_t*)(header + 4), 80); + unsigned char (*header_ref)[80] = &header_arr; + (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height); +} + typedef struct LDKFilter_JCalls { atomic_size_t refcnt; uint32_t register_tx_meth; @@ -4095,10 +4348,18 @@ void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_i } js_invoke_function_2(j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref); } -void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) { +void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(their_node_id_arr + 4), their_node_id.compressed_form, 33); + LDKInitFeatures their_features_var = *their_features; + their_features_var = InitFeatures_clone(their_features); + CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long their_features_ref = (long)their_features_var.inner; + if (their_features_var.is_owned) { + their_features_ref |= 1; + } LDKShutdown msg_var = *msg; msg_var = Shutdown_clone(msg); CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -4107,7 +4368,7 @@ void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, con if (msg_var.is_owned) { msg_ref |= 1; } - js_invoke_function_2(j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref); + js_invoke_function_3(j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); } void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -4389,15 +4650,18 @@ void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_fun (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) { +void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_shutdown(uint32_t this_arg, int8_tArray their_node_id, uint32_t their_features, uint32_t msg) { LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg; LDKPublicKey their_node_id_ref; CHECK(*((uint32_t*)their_node_id) == 33); memcpy(their_node_id_ref.compressed_form, (uint8_t*)(their_node_id + 4), 33); + LDKInitFeatures their_features_conv; + their_features_conv.inner = (void*)(their_features & (~1)); + their_features_conv.is_owned = false; LDKShutdown msg_conv; msg_conv.inner = (void*)(msg & (~1)); msg_conv.is_owned = false; - (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); + (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv); } void __attribute__((visibility("default"))) TS_ChannelMessageHandler_handle_closing_signed(uint32_t this_arg, int8_tArray their_node_id, uint32_t msg) { @@ -4624,43 +4888,43 @@ void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFa } LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - uint32_tArray arg = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); - LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr; - arg_constr.datalen = *((uint32_t*)arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements"); + uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); + LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr; + ret_constr.datalen = *((uint32_t*)ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements"); else - arg_constr.data = NULL; - uint32_t* arg_vals = (uint32_t*)(arg + 4); - for (size_t l = 0; l < arg_constr.datalen; l++) { - uint32_t arr_conv_63 = arg_vals[l]; - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1); - FREE((void*)arr_conv_63); - arg_constr.data[l] = arr_conv_63_conv; + ret_constr.data = NULL; + uint32_t* ret_vals = (uint32_t*)(ret + 4); + for (size_t l = 0; l < ret_constr.datalen; l++) { + uint32_t ret_conv_63 = ret_vals[l]; + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1); + ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ret_conv_63); + ret_constr.data[l] = ret_conv_63_conv; } - return arg_constr; + return ret_constr; } LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray starting_point_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(starting_point_arr + 4), starting_point.compressed_form, 33); - uint32_tArray arg = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); - LDKCVec_NodeAnnouncementZ arg_constr; - arg_constr.datalen = *((uint32_t*)arg); - if (arg_constr.datalen > 0) - arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements"); + uint32_tArray ret = js_invoke_function_2(j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); + LDKCVec_NodeAnnouncementZ ret_constr; + ret_constr.datalen = *((uint32_t*)ret); + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements"); else - arg_constr.data = NULL; - uint32_t* arg_vals = (uint32_t*)(arg + 4); - for (size_t s = 0; s < arg_constr.datalen; s++) { - uint32_t arr_conv_18 = arg_vals[s]; - LDKNodeAnnouncement arr_conv_18_conv; - arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1)); - arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0); - arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv); - arg_constr.data[s] = arr_conv_18_conv; - } - return arg_constr; + ret_constr.data = NULL; + uint32_t* ret_vals = (uint32_t*)(ret + 4); + for (size_t s = 0; s < ret_constr.datalen; s++) { + uint32_t ret_conv_18 = ret_vals[s]; + LDKNodeAnnouncement ret_conv_18_conv; + ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1)); + ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0); + ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv); + ret_constr.data[s] = ret_conv_18_conv; + } + return ret_constr; } void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; @@ -4817,9 +5081,9 @@ uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_g 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 l = 0; l < ret_var.datalen; l++) { - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ"); - *arr_conv_63_ref = ret_var.data[l]; - ret_arr_ptr[l] = (long)arr_conv_63_ref; + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ"); + *ret_conv_63_ref = ret_var.data[l]; + ret_arr_ptr[l] = (long)ret_conv_63_ref; } FREE(ret_var.data); return ret_arr; @@ -4834,14 +5098,14 @@ uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_g 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 s = 0; s < ret_var.datalen; s++) { - LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s]; - CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_18_ref = (long)arr_conv_18_var.inner; - if (arr_conv_18_var.is_owned) { - arr_conv_18_ref |= 1; + LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s]; + CHECK((((long)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_conv_18_ref = (long)ret_conv_18_var.inner; + if (ret_conv_18_var.is_owned) { + ret_conv_18_ref |= 1; } - ret_arr_ptr[s] = arr_conv_18_ref; + ret_arr_ptr[s] = ret_conv_18_ref; } FREE(ret_var.data); return ret_arr; @@ -5270,11 +5534,11 @@ void __attribute__((visibility("default"))) TS_CVec_SignatureZ_free(ptrArray _r _res_constr.data = NULL; int8_tArray* _res_vals = (int8_tArray*)(_res + 4); for (size_t m = 0; m < _res_constr.datalen; m++) { - int8_tArray arr_conv_12 = _res_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - _res_constr.data[m] = arr_conv_12_ref; + int8_tArray _res_conv_12 = _res_vals[m]; + LDKSignature _res_conv_12_ref; + CHECK(*((uint32_t*)_res_conv_12) == 64); + memcpy(_res_conv_12_ref.compact_form, (uint8_t*)(_res_conv_12 + 4), 64); + _res_constr.data[m] = _res_conv_12_ref; } CVec_SignatureZ_free(_res_constr); } @@ -5413,11 +5677,11 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ o_constr.data = NULL; int8_tArray* o_vals = (int8_tArray*)(o + 4); for (size_t m = 0; m < o_constr.datalen; m++) { - int8_tArray arr_conv_12 = o_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - o_constr.data[m] = arr_conv_12_ref; + int8_tArray o_conv_12 = o_vals[m]; + LDKSignature o_conv_12_ref; + CHECK(*((uint32_t*)o_conv_12) == 64); + memcpy(o_conv_12_ref.compact_form, (uint8_t*)(o_conv_12 + 4), 64); + o_constr.data[m] = o_conv_12_ref; } LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ"); *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr); @@ -5453,11 +5717,11 @@ void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _r _res_constr.data = NULL; int8_tArray* _res_vals = (int8_tArray*)(_res + 4); for (size_t m = 0; m < _res_constr.datalen; m++) { - int8_tArray arr_conv_12 = _res_vals[m]; - LDKPublicKey arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 33); - memcpy(arr_conv_12_ref.compressed_form, (uint8_t*)(arr_conv_12 + 4), 33); - _res_constr.data[m] = arr_conv_12_ref; + int8_tArray _res_conv_12 = _res_vals[m]; + LDKPublicKey _res_conv_12_ref; + CHECK(*((uint32_t*)_res_conv_12) == 33); + memcpy(_res_conv_12_ref.compressed_form, (uint8_t*)(_res_conv_12 + 4), 33); + _res_constr.data[m] = _res_conv_12_ref; } CVec_PublicKeyZ_free(_res_constr); } @@ -5750,10 +6014,10 @@ void __attribute__((visibility("default"))) TS_CVec_C3Tuple_ChannelAnnouncement _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t l = 0; l < _res_constr.datalen; l++) { - uint32_t arr_conv_63 = _res_vals[l]; - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1); - FREE((void*)arr_conv_63); - _res_constr.data[l] = arr_conv_63_conv; + uint32_t _res_conv_63 = _res_vals[l]; + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1); + FREE((void*)_res_conv_63); + _res_constr.data[l] = _res_conv_63_conv; } CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr); } @@ -5767,11 +6031,11 @@ void __attribute__((visibility("default"))) TS_CVec_NodeAnnouncementZ_free(uint _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t s = 0; s < _res_constr.datalen; s++) { - uint32_t arr_conv_18 = _res_vals[s]; - LDKNodeAnnouncement arr_conv_18_conv; - arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1)); - arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0); - _res_constr.data[s] = arr_conv_18_conv; + uint32_t _res_conv_18 = _res_vals[s]; + LDKNodeAnnouncement _res_conv_18_conv; + _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1)); + _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0); + _res_constr.data[s] = _res_conv_18_conv; } CVec_NodeAnnouncementZ_free(_res_constr); } @@ -5815,10 +6079,10 @@ void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t s = 0; s < _res_constr.datalen; s++) { - uint32_t arr_conv_18 = _res_vals[s]; - LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1); - FREE((void*)arr_conv_18); - _res_constr.data[s] = arr_conv_18_conv; + uint32_t _res_conv_18 = _res_vals[s]; + LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1); + FREE((void*)_res_conv_18); + _res_constr.data[s] = _res_conv_18_conv; } CVec_MessageSendEventZ_free(_res_constr); } @@ -5861,7 +6125,7 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErr LDKChannelInfo 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 LDKChannelInfo + o_conv = ChannelInfo_clone(&o_conv); LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv); return (long)ret_conv; @@ -5884,6 +6148,13 @@ void __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_ CResult_ChannelInfoDecodeErrorZ_free(_res_conv); } +uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelInfoDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1); + LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ"); + *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv); + return (long)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_CResult_RoutingFeesDecodeErrorZ_ok(uint32_t o) { LDKRoutingFees o_conv; o_conv.inner = (void*)(o & (~1)); @@ -5927,10 +6198,10 @@ void __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tAr _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t m = 0; m < _res_constr.datalen; m++) { - uint32_t arr_conv_12 = _res_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - _res_constr.data[m] = arr_conv_12_conv; + uint32_t _res_conv_12 = _res_vals[m]; + LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1); + FREE((void*)_res_conv_12); + _res_constr.data[m] = _res_conv_12_conv; } CVec_NetAddressZ_free(_res_constr); } @@ -5978,8 +6249,8 @@ void __attribute__((visibility("default"))) TS_CVec_u64Z_free(int64_tArray _res _res_constr.data = NULL; int64_t* _res_vals = (int64_t*)(_res + 4); for (size_t i = 0; i < _res_constr.datalen; i++) { - int64_t arr_conv_8 = _res_vals[i]; - _res_constr.data[i] = arr_conv_8; + int64_t _res_conv_8 = _res_vals[i]; + _res_constr.data[i] = _res_conv_8; } CVec_u64Z_free(_res_constr); } @@ -6022,7 +6293,7 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeEr LDKNetworkGraph 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 LDKNetworkGraph + o_conv = NetworkGraph_clone(&o_conv); LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv); return (long)ret_conv; @@ -6045,6 +6316,13 @@ void __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_free(_res_conv); } +uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1); + LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ"); + *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv); + return (long)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_C2Tuple_usizeTransactionZ_new(int64_t a, int8_tArray b) { LDKTransaction b_ref; b_ref.datalen = *((uint32_t*)b); @@ -6072,10 +6350,10 @@ void __attribute__((visibility("default"))) TS_CVec_C2Tuple_usizeTransactionZZ_ _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t e = 0; e < _res_constr.datalen; e++) { - uint32_t arr_conv_30 = _res_vals[e]; - LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1); - FREE((void*)arr_conv_30); - _res_constr.data[e] = arr_conv_30_conv; + uint32_t _res_conv_30 = _res_vals[e]; + LDKC2Tuple_usizeTransactionZ _res_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_30) & ~1); + FREE((void*)_res_conv_30); + _res_constr.data[e] = _res_conv_30_conv; } CVec_C2Tuple_usizeTransactionZZ_free(_res_constr); } @@ -6116,11 +6394,10 @@ void __attribute__((visibility("default"))) TS_CVec_MonitorEventZ_free(uint32_t _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t o = 0; o < _res_constr.datalen; o++) { - uint32_t arr_conv_14 = _res_vals[o]; - LDKMonitorEvent arr_conv_14_conv; - arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1)); - arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0); - _res_constr.data[o] = arr_conv_14_conv; + uint32_t _res_conv_14 = _res_vals[o]; + LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1); + FREE((void*)_res_conv_14); + _res_constr.data[o] = _res_conv_14_conv; } CVec_MonitorEventZ_free(_res_constr); } @@ -6134,10 +6411,10 @@ void __attribute__((visibility("default"))) TS_CVec_EventZ_free(uint32_tArray _ _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t h = 0; h < _res_constr.datalen; h++) { - uint32_t arr_conv_7 = _res_vals[h]; - LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1); - FREE((void*)arr_conv_7); - _res_constr.data[h] = arr_conv_7_conv; + uint32_t _res_conv_7 = _res_vals[h]; + LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1); + FREE((void*)_res_conv_7); + _res_constr.data[h] = _res_conv_7_conv; } CVec_EventZ_free(_res_constr); } @@ -6311,13 +6588,13 @@ void __attribute__((visibility("default"))) TS_CVec_TransactionZ_free(ptrArray _res_constr.data = NULL; int8_tArray* _res_vals = (int8_tArray*)(_res + 4); for (size_t m = 0; m < _res_constr.datalen; m++) { - int8_tArray arr_conv_12 = _res_vals[m]; - LDKTransaction arr_conv_12_ref; - arr_conv_12_ref.datalen = *((uint32_t*)arr_conv_12); - arr_conv_12_ref.data = MALLOC(arr_conv_12_ref.datalen, "LDKTransaction Bytes"); - memcpy(arr_conv_12_ref.data, (uint8_t*)(arr_conv_12 + 4), arr_conv_12_ref.datalen); - arr_conv_12_ref.data_is_owned = true; - _res_constr.data[m] = arr_conv_12_ref; + int8_tArray _res_conv_12 = _res_vals[m]; + LDKTransaction _res_conv_12_ref; + _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12); + _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKTransaction Bytes"); + memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen); + _res_conv_12_ref.data_is_owned = true; + _res_constr.data[m] = _res_conv_12_ref; } CVec_TransactionZ_free(_res_constr); } @@ -6353,10 +6630,10 @@ void __attribute__((visibility("default"))) TS_CVec_C2Tuple_u32TxOutZZ_free(uin _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t z = 0; z < _res_constr.datalen; z++) { - uint32_t arr_conv_25 = _res_vals[z]; - LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_25) & ~1); - FREE((void*)arr_conv_25); - _res_constr.data[z] = arr_conv_25_conv; + uint32_t _res_conv_25 = _res_vals[z]; + LDKC2Tuple_u32TxOutZ _res_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_25) & ~1); + FREE((void*)_res_conv_25); + _res_constr.data[z] = _res_conv_25_conv; } CVec_C2Tuple_u32TxOutZZ_free(_res_constr); } @@ -6373,10 +6650,10 @@ uint32_t __attribute__((visibility("default"))) TS_C2Tuple_TxidCVec_C2Tuple_u32 b_constr.data = NULL; uint32_t* b_vals = (uint32_t*)(b + 4); for (size_t z = 0; z < b_constr.datalen; z++) { - uint32_t arr_conv_25 = b_vals[z]; - LDKC2Tuple_u32TxOutZ arr_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_25) & ~1); - FREE((void*)arr_conv_25); - b_constr.data[z] = arr_conv_25_conv; + uint32_t b_conv_25 = b_vals[z]; + LDKC2Tuple_u32TxOutZ b_conv_25_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_25) & ~1); + FREE((void*)b_conv_25); + b_constr.data[z] = b_conv_25_conv; } LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr); @@ -6399,10 +6676,10 @@ void __attribute__((visibility("default"))) TS_CVec_C2Tuple_TxidCVec_C2Tuple_u3 _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t x = 0; x < _res_constr.datalen; x++) { - uint32_t arr_conv_49 = _res_vals[x]; - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_conv_49) & ~1); - FREE((void*)arr_conv_49); - _res_constr.data[x] = arr_conv_49_conv; + uint32_t _res_conv_49 = _res_vals[x]; + LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_49_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_49) & ~1); + FREE((void*)_res_conv_49); + _res_constr.data[x] = _res_conv_49_conv; } CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr); } @@ -6461,10 +6738,10 @@ void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_ _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t b = 0; b < _res_constr.datalen; b++) { - uint32_t arr_conv_27 = _res_vals[b]; - LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_conv_27) & ~1); - FREE((void*)arr_conv_27); - _res_constr.data[b] = arr_conv_27_conv; + uint32_t _res_conv_27 = _res_vals[b]; + LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1); + FREE((void*)_res_conv_27); + _res_constr.data[b] = _res_conv_27_conv; } CVec_SpendableOutputDescriptorZ_free(_res_constr); } @@ -6526,6 +6803,40 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_clone( return (long)ret_conv; } +void __attribute__((visibility("default"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint32_tArray _res) { + LDKCVec_CResult_NoneAPIErrorZZ _res_constr; + _res_constr.datalen = *((uint32_t*)_res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + _res_constr.data = NULL; + uint32_t* _res_vals = (uint32_t*)(_res + 4); + for (size_t w = 0; w < _res_constr.datalen; w++) { + uint32_t _res_conv_22 = _res_vals[w]; + LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1); + FREE((void*)_res_conv_22); + _res_constr.data[w] = _res_conv_22_conv; + } + CVec_CResult_NoneAPIErrorZZ_free(_res_constr); +} + +void __attribute__((visibility("default"))) TS_CVec_APIErrorZ_free(uint32_tArray _res) { + LDKCVec_APIErrorZ _res_constr; + _res_constr.datalen = *((uint32_t*)_res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ 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]; + LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1); + FREE((void*)_res_conv_10); + _res_constr.data[k] = _res_conv_10_conv; + } + CVec_APIErrorZ_free(_res_constr); +} + void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32_tArray _res) { LDKCVec_ChannelDetailsZ _res_constr; _res_constr.datalen = *((uint32_t*)_res); @@ -6535,11 +6846,11 @@ void __attribute__((visibility("default"))) TS_CVec_ChannelDetailsZ_free(uint32 _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t q = 0; q < _res_constr.datalen; q++) { - uint32_t arr_conv_16 = _res_vals[q]; - LDKChannelDetails arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - _res_constr.data[q] = arr_conv_16_conv; + uint32_t _res_conv_16 = _res_vals[q]; + LDKChannelDetails _res_conv_16_conv; + _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); + _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); + _res_constr.data[q] = _res_conv_16_conv; } CVec_ChannelDetailsZ_free(_res_constr); } @@ -6551,10 +6862,8 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailu } uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) { - LDKPaymentSendFailure e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - e_conv = PaymentSendFailure_clone(&e_conv); + LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1); + FREE((void*)e); LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv); return (long)ret_conv; @@ -6583,11 +6892,11 @@ void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32 _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t q = 0; q < _res_constr.datalen; q++) { - uint32_t arr_conv_16 = _res_vals[q]; - LDKChannelMonitor arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - _res_constr.data[q] = arr_conv_16_conv; + uint32_t _res_conv_16 = _res_vals[q]; + LDKChannelMonitor _res_conv_16_conv; + _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); + _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); + _res_constr.data[q] = _res_conv_16_conv; } CVec_ChannelMonitorZ_free(_res_constr); } @@ -6637,26 +6946,6 @@ void __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannel CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u64u64Z_clone(uint32_t orig) { - LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1); - LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - *ret_ref = C2Tuple_u64u64Z_clone(orig_conv); - return (long)ret_ref; -} - -uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u64u64Z_new(int64_t a, int64_t b) { - LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z"); - *ret_ref = C2Tuple_u64u64Z_new(a, b); - return (long)ret_ref; -} - -void __attribute__((visibility("default"))) TS_C2Tuple_u64u64Z_free(uint32_t _res) { - if ((_res & 1) != 0) return; - LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)_res) & ~1); - FREE((void*)_res); - C2Tuple_u64u64Z_free(_res_conv); -} - uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) { LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1); FREE((void*)o); @@ -6708,11 +6997,11 @@ uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_Signat b_constr.data = NULL; int8_tArray* b_vals = (int8_tArray*)(b + 4); for (size_t m = 0; m < b_constr.datalen; m++) { - int8_tArray arr_conv_12 = b_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - b_constr.data[m] = arr_conv_12_ref; + int8_tArray b_conv_12 = b_vals[m]; + LDKSignature b_conv_12_ref; + CHECK(*((uint32_t*)b_conv_12) == 64); + memcpy(b_conv_12_ref.compact_form, (uint8_t*)(b_conv_12 + 4), 64); + b_constr.data[m] = b_conv_12_ref; } LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ"); *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr); @@ -6783,71 +7072,172 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_SignatureNoneZ_clone return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_ok(uint32_t o) { - LDKChannelKeys o_conv = *(LDKChannelKeys*)(((uint64_t)o) & ~1); - LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); - *ret_conv = CResult_ChannelKeysDecodeErrorZ_ok(o_conv); +uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_ok(uint32_t o) { + LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv); return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_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_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); - *ret_conv = CResult_ChannelKeysDecodeErrorZ_err(e_conv); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + *ret_conv = CResult_SignDecodeErrorZ_err(e_conv); + return (long)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_SignDecodeErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_SignDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1); + LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv); + return (long)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CVec_CVec_u8ZZ_free(ptrArray _res) { + LDKCVec_CVec_u8ZZ _res_constr; + _res_constr.datalen = *((uint32_t*)_res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements"); + else + _res_constr.data = NULL; + int8_tArray* _res_vals = (int8_tArray*)(_res + 4); + for (size_t m = 0; m < _res_constr.datalen; m++) { + int8_tArray _res_conv_12 = _res_vals[m]; + LDKCVec_u8Z _res_conv_12_ref; + _res_conv_12_ref.datalen = *((uint32_t*)_res_conv_12); + _res_conv_12_ref.data = MALLOC(_res_conv_12_ref.datalen, "LDKCVec_u8Z Bytes"); + memcpy(_res_conv_12_ref.data, (uint8_t*)(_res_conv_12 + 4), _res_conv_12_ref.datalen); + _res_constr.data[m] = _res_conv_12_ref; + } + CVec_CVec_u8ZZ_free(_res_constr); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_ok(ptrArray o) { + LDKCVec_CVec_u8ZZ o_constr; + o_constr.datalen = *((uint32_t*)o); + if (o_constr.datalen > 0) + o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements"); + else + o_constr.data = NULL; + int8_tArray* o_vals = (int8_tArray*)(o + 4); + for (size_t m = 0; m < o_constr.datalen; m++) { + int8_tArray o_conv_12 = o_vals[m]; + LDKCVec_u8Z o_conv_12_ref; + o_conv_12_ref.datalen = *((uint32_t*)o_conv_12); + o_conv_12_ref.data = MALLOC(o_conv_12_ref.datalen, "LDKCVec_u8Z Bytes"); + memcpy(o_conv_12_ref.data, (uint8_t*)(o_conv_12 + 4), o_conv_12_ref.datalen); + o_constr.data[m] = o_conv_12_ref; + } + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr); + return (long)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_err() { + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err(); return (long)ret_conv; } -void __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_free(uint32_t _res) { if ((_res & 1) != 0) return; - LDKCResult_ChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1); + LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_ChannelKeysDecodeErrorZ_free(_res_conv); + CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelKeysDecodeErrorZ_clone(uint32_t orig) { - LDKCResult_ChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelKeysDecodeErrorZ*)(orig & ~1); - LDKCResult_ChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelKeysDecodeErrorZ), "LDKCResult_ChannelKeysDecodeErrorZ"); - *ret_conv = CResult_ChannelKeysDecodeErrorZ_clone(orig_conv); +uint32_t __attribute__((visibility("default"))) TS_CResult_CVec_CVec_u8ZZNoneZ_clone(uint32_t orig) { + LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1); + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv); return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_ok(uint32_t o) { - LDKInMemoryChannelKeys o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_ok(uint32_t o) { + LDKInMemorySigner o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); - o_conv = InMemoryChannelKeys_clone(&o_conv); - LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv); + o_conv = InMemorySigner_clone(&o_conv); + LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv); return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_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_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv); + LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv); return (long)ret_conv; } -void __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; - LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1); + LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1); FREE((void*)_res); - CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv); + CResult_InMemorySignerDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_InMemoryChannelKeysDecodeErrorZ_clone(uint32_t orig) { - LDKCResult_InMemoryChannelKeysDecodeErrorZ* orig_conv = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(orig & ~1); - LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig_conv); +uint32_t __attribute__((visibility("default"))) TS_CResult_InMemorySignerDecodeErrorZ_clone(uint32_t orig) { + LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1); + LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv); return (long)ret_conv; } +void __attribute__((visibility("default"))) TS_CVec_TxOutZ_free(uint32_tArray _res) { + LDKCVec_TxOutZ _res_constr; + _res_constr.datalen = *((uint32_t*)_res); + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements"); + else + _res_constr.data = NULL; + uint32_t* _res_vals = (uint32_t*)(_res + 4); + for (size_t h = 0; h < _res_constr.datalen; h++) { + uint32_t _res_conv_7 = _res_vals[h]; + LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1); + FREE((void*)_res_conv_7); + _res_constr.data[h] = _res_conv_7_conv; + } + CVec_TxOutZ_free(_res_constr); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_ok(int8_tArray o) { + LDKTransaction o_ref; + o_ref.datalen = *((uint32_t*)o); + o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes"); + memcpy(o_ref.data, (uint8_t*)(o + 4), o_ref.datalen); + o_ref.data_is_owned = true; + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = CResult_TransactionNoneZ_ok(o_ref); + return (long)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_err() { + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = CResult_TransactionNoneZ_err(); + return (long)ret_conv; +} + +void __attribute__((visibility("default"))) TS_CResult_TransactionNoneZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1); + FREE((void*)_res); + CResult_TransactionNoneZ_free(_res_conv); +} + void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArray _res) { LDKCVec_RouteHopZ _res_constr; _res_constr.datalen = *((uint32_t*)_res); @@ -6857,11 +7247,11 @@ void __attribute__((visibility("default"))) TS_CVec_RouteHopZ_free(uint32_tArra _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t k = 0; k < _res_constr.datalen; k++) { - uint32_t arr_conv_10 = _res_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - _res_constr.data[k] = arr_conv_10_conv; + uint32_t _res_conv_10 = _res_vals[k]; + LDKRouteHop _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_RouteHopZ_free(_res_constr); } @@ -6875,22 +7265,22 @@ void __attribute__((visibility("default"))) TS_CVec_CVec_RouteHopZZ_free(ptrArr _res_constr.data = NULL; uint32_tArray* _res_vals = (uint32_tArray*)(_res + 4); for (size_t m = 0; m < _res_constr.datalen; m++) { - uint32_tArray arr_conv_12 = _res_vals[m]; - LDKCVec_RouteHopZ arr_conv_12_constr; - arr_conv_12_constr.datalen = *((uint32_t*)arr_conv_12); - if (arr_conv_12_constr.datalen > 0) - arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + uint32_tArray _res_conv_12 = _res_vals[m]; + LDKCVec_RouteHopZ _res_conv_12_constr; + _res_conv_12_constr.datalen = *((uint32_t*)_res_conv_12); + if (_res_conv_12_constr.datalen > 0) + _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); else - arr_conv_12_constr.data = NULL; - uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12 + 4); - for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) { - uint32_t arr_conv_10 = arr_conv_12_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - arr_conv_12_constr.data[k] = arr_conv_10_conv; + _res_conv_12_constr.data = NULL; + uint32_t* _res_conv_12_vals = (uint32_t*)(_res_conv_12 + 4); + for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) { + uint32_t _res_conv_12_conv_10 = _res_conv_12_vals[k]; + LDKRouteHop _res_conv_12_conv_10_conv; + _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1)); + _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0); + _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv; } - _res_constr.data[m] = arr_conv_12_constr; + _res_constr.data[m] = _res_conv_12_constr; } CVec_CVec_RouteHopZZ_free(_res_constr); } @@ -6938,11 +7328,11 @@ void __attribute__((visibility("default"))) TS_CVec_RouteHintZ_free(uint32_tArr _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t l = 0; l < _res_constr.datalen; l++) { - uint32_t arr_conv_11 = _res_vals[l]; - LDKRouteHint arr_conv_11_conv; - arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1)); - arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0); - _res_constr.data[l] = arr_conv_11_conv; + uint32_t _res_conv_11 = _res_vals[l]; + LDKRouteHint _res_conv_11_conv; + _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1)); + _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0); + _res_constr.data[l] = _res_conv_11_conv; } CVec_RouteHintZ_free(_res_constr); } @@ -7050,11 +7440,11 @@ void __attribute__((visibility("default"))) TS_CVec_UpdateAddHTLCZ_free(uint32_ _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t p = 0; p < _res_constr.datalen; p++) { - uint32_t arr_conv_15 = _res_vals[p]; - LDKUpdateAddHTLC arr_conv_15_conv; - arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1)); - arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0); - _res_constr.data[p] = arr_conv_15_conv; + uint32_t _res_conv_15 = _res_vals[p]; + LDKUpdateAddHTLC _res_conv_15_conv; + _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1)); + _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0); + _res_constr.data[p] = _res_conv_15_conv; } CVec_UpdateAddHTLCZ_free(_res_constr); } @@ -7068,11 +7458,11 @@ void __attribute__((visibility("default"))) TS_CVec_UpdateFulfillHTLCZ_free(uin _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t t = 0; t < _res_constr.datalen; t++) { - uint32_t arr_conv_19 = _res_vals[t]; - LDKUpdateFulfillHTLC arr_conv_19_conv; - arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1)); - arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0); - _res_constr.data[t] = arr_conv_19_conv; + uint32_t _res_conv_19 = _res_vals[t]; + LDKUpdateFulfillHTLC _res_conv_19_conv; + _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1)); + _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0); + _res_constr.data[t] = _res_conv_19_conv; } CVec_UpdateFulfillHTLCZ_free(_res_constr); } @@ -7086,11 +7476,11 @@ void __attribute__((visibility("default"))) TS_CVec_UpdateFailHTLCZ_free(uint32 _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t q = 0; q < _res_constr.datalen; q++) { - uint32_t arr_conv_16 = _res_vals[q]; - LDKUpdateFailHTLC arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - _res_constr.data[q] = arr_conv_16_conv; + uint32_t _res_conv_16 = _res_vals[q]; + LDKUpdateFailHTLC _res_conv_16_conv; + _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1)); + _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0); + _res_constr.data[q] = _res_conv_16_conv; } CVec_UpdateFailHTLCZ_free(_res_constr); } @@ -7104,11 +7494,11 @@ void __attribute__((visibility("default"))) TS_CVec_UpdateFailMalformedHTLCZ_fr _res_constr.data = NULL; uint32_t* _res_vals = (uint32_t*)(_res + 4); for (size_t z = 0; z < _res_constr.datalen; z++) { - uint32_t arr_conv_25 = _res_vals[z]; - LDKUpdateFailMalformedHTLC arr_conv_25_conv; - arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1)); - arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0); - _res_constr.data[z] = arr_conv_25_conv; + uint32_t _res_conv_25 = _res_vals[z]; + LDKUpdateFailMalformedHTLC _res_conv_25_conv; + _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1)); + _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0); + _res_constr.data[z] = _res_conv_25_conv; } CVec_UpdateFailMalformedHTLCZ_free(_res_constr); } @@ -8184,11 +8574,11 @@ uint32_t __attribute__((visibility("default"))) TS_Event_clone(uint32_t orig) { int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; - LDKCVec_u8Z arg_var = Event_write(obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Event_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; } void __attribute__((visibility("default"))) TS_MessageSendEvent_free(uint32_t this_ptr) { @@ -8626,11 +9016,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelConfig_write(uint3 LDKChannelConfig obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelConfig_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_ChannelConfig_read(int8_tArray ser) { @@ -8785,6 +9175,13 @@ void __attribute__((visibility("default"))) TS_Access_free(uint32_t this_ptr) { Access_free(this_ptr_conv); } +void __attribute__((visibility("default"))) TS_Listen_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); + Listen_free(this_ptr_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); @@ -8842,10 +9239,10 @@ void __attribute__((visibility("default"))) TS_ChainMonitor_block_connected(uin txdata_constr.data = NULL; uint32_t* txdata_vals = (uint32_t*)(txdata + 4); for (size_t e = 0; e < txdata_constr.datalen; e++) { - uint32_t arr_conv_30 = txdata_vals[e]; - LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1); - FREE((void*)arr_conv_30); - txdata_constr.data[e] = arr_conv_30_conv; + uint32_t txdata_conv_30 = txdata_vals[e]; + LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1); + FREE((void*)txdata_conv_30); + txdata_constr.data[e] = txdata_conv_30_conv; } ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height); } @@ -8935,11 +9332,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_writ LDKChannelMonitorUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelMonitorUpdate_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_ChannelMonitorUpdate_read(int8_tArray ser) { @@ -8979,23 +9376,17 @@ uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uin } void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) { - LDKMonitorEvent this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + if ((this_ptr & 1) != 0) return; + LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); MonitorEvent_free(this_ptr_conv); } uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_clone(uint32_t orig) { - LDKMonitorEvent orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv); - CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long ret_ref = (long)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig; + LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_copy = MonitorEvent_clone(orig_conv); + long ret_ref = (long)ret_copy; return ret_ref; } @@ -9024,11 +9415,11 @@ int8_tArray __attribute__((visibility("default"))) TS_HTLCUpdate_write(uint32_t LDKHTLCUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = HTLCUpdate_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_HTLCUpdate_read(int8_tArray ser) { @@ -9065,11 +9456,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_write(uint LDKChannelMonitor obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelMonitor_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_ChannelMonitor_update_monitor(uint32_t this_arg, uint32_t updates, uint32_t broadcaster, uint32_t fee_estimator, uint32_t logger) { @@ -9112,14 +9503,10 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_ 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 o = 0; o < ret_var.datalen; o++) { - LDKMonitorEvent arr_conv_14_var = ret_var.data[o]; - CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_14_ref = (long)arr_conv_14_var.inner; - if (arr_conv_14_var.is_owned) { - arr_conv_14_ref |= 1; - } - ret_arr_ptr[o] = arr_conv_14_ref; + LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent"); + *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]); + long ret_conv_14_ref = (long)ret_conv_14_copy; + ret_arr_ptr[o] = ret_conv_14_ref; } FREE(ret_var.data); return ret_arr; @@ -9133,10 +9520,10 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_and_ 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 h = 0; h < ret_var.datalen; h++) { - LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *arr_conv_7_copy = Event_clone(&ret_var.data[h]); - long arr_conv_7_ref = (long)arr_conv_7_copy; - ret_arr_ptr[h] = arr_conv_7_ref; + LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_conv_7_copy = Event_clone(&ret_var.data[h]); + long ret_conv_7_ref = (long)ret_conv_7_copy; + ret_arr_ptr[h] = ret_conv_7_ref; } FREE(ret_var.data); return ret_arr; @@ -9151,11 +9538,11 @@ ptrArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_latest_ho ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4); for (size_t m = 0; m < ret_var.datalen; m++) { - LDKTransaction arr_conv_12_var = ret_var.data[m]; - int8_tArray arr_conv_12_arr = init_arr(arr_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arr_conv_12_arr + 4), arr_conv_12_var.data, arr_conv_12_var.datalen); - Transaction_free(arr_conv_12_var); - ret_arr_ptr[m] = arr_conv_12_arr; + LDKTransaction ret_conv_12_var = ret_var.data[m]; + int8_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_conv_12_var.data, ret_conv_12_var.datalen); + Transaction_free(ret_conv_12_var); + ret_arr_ptr[m] = ret_conv_12_arr; } FREE(ret_var.data); return ret_arr; @@ -9177,10 +9564,10 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_block_co txdata_constr.data = NULL; uint32_t* txdata_vals = (uint32_t*)(txdata + 4); for (size_t e = 0; e < txdata_constr.datalen; e++) { - uint32_t arr_conv_30 = txdata_vals[e]; - LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1); - FREE((void*)arr_conv_30); - txdata_constr.data[e] = arr_conv_30_conv; + uint32_t txdata_conv_30 = txdata_vals[e]; + LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1); + FREE((void*)txdata_conv_30); + txdata_constr.data[e] = txdata_conv_30_conv; } LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1); LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1); @@ -9189,9 +9576,9 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_block_co 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 x = 0; x < ret_var.datalen; x++) { - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); - *arr_conv_49_ref = ret_var.data[x]; - ret_arr_ptr[x] = (long)arr_conv_49_ref; + LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_49_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ"); + *ret_conv_49_ref = ret_var.data[x]; + ret_arr_ptr[x] = (long)ret_conv_49_ref; } FREE(ret_var.data); return ret_arr; @@ -9235,45 +9622,351 @@ void __attribute__((visibility("default"))) TS_OutPoint_free(uint32_t this_ptr) OutPoint_free(this_ptr_conv); } -int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) { - LDKOutPoint this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_OutPoint_get_txid(uint32_t this_ptr) { + LDKOutPoint 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), *OutPoint_get_txid(&this_ptr_conv), 32); + return ret_arr; +} + +void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) { + LDKOutPoint 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); + OutPoint_set_txid(&this_ptr_conv, val_ref); +} + +int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) { + LDKOutPoint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = OutPoint_get_index(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) { + LDKOutPoint this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + OutPoint_set_index(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) { + LDKThirtyTwoBytes txid_arg_ref; + CHECK(*((uint32_t*)txid_arg) == 32); + memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32); + LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) { + LDKOutPoint orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKOutPoint ret_var = OutPoint_clone(&orig_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) { + LDKOutPoint this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32); + return ret_arr; +} + +int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) { + LDKOutPoint obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = OutPoint_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_OutPoint_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ"); + *ret_conv = OutPoint_read(ser_ref); + return (long)ret_conv; +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_free(uint32_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + DelayedPaymentOutputDescriptor_free(this_ptr_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = OutPoint_clone(&val_conv); + DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv); +} + +int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_per_commitment_point(uint32_t this_ptr) { + LDKDelayedPaymentOutputDescriptor 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), DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) { + LDKDelayedPaymentOutputDescriptor 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); + DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref); +} + +int16_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_to_self_delay(uint32_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_to_self_delay(uint32_t this_ptr, int16_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val); +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1); + FREE((void*)val); + DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv); +} + +int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_revocation_pubkey(uint32_t this_ptr) { + LDKDelayedPaymentOutputDescriptor 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), DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form, 33); + return ret_arr; +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_revocation_pubkey(uint32_t this_ptr, int8_tArray val) { + LDKDelayedPaymentOutputDescriptor 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); + DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref); +} + +int8_tArray __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) { + LDKDelayedPaymentOutputDescriptor 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), *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32); + return ret_arr; +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) { + LDKDelayedPaymentOutputDescriptor 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); + DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref); +} + +int64_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) { + LDKDelayedPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_new(uint32_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, uint32_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) { + LDKOutPoint outpoint_arg_conv; + outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1)); + outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0); + outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv); + LDKPublicKey per_commitment_point_arg_ref; + CHECK(*((uint32_t*)per_commitment_point_arg) == 33); + memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33); + LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1); + FREE((void*)output_arg); + LDKPublicKey revocation_pubkey_arg_ref; + CHECK(*((uint32_t*)revocation_pubkey_arg) == 33); + memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33); + LDKThirtyTwoBytes channel_keys_id_arg_ref; + CHECK(*((uint32_t*)channel_keys_id_arg) == 32); + memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32); + LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +uint32_t __attribute__((visibility("default"))) TS_DelayedPaymentOutputDescriptor_clone(uint32_t orig) { + LDKDelayedPaymentOutputDescriptor orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_free(uint32_t this_ptr) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + StaticPaymentOutputDescriptor_free(this_ptr_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_outpoint(uint32_t this_ptr) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_outpoint(uint32_t this_ptr, uint32_t val) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKOutPoint val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = OutPoint_clone(&val_conv); + StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv); +} + +void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_output(uint32_t this_ptr, uint32_t val) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1); + FREE((void*)val); + StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv); +} + +int8_tArray __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_keys_id(uint32_t this_ptr) { + LDKStaticPaymentOutputDescriptor 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), *OutPoint_get_txid(&this_ptr_conv), 32); + memcpy((uint8_t*)(ret_arr + 4), *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv), 32); return ret_arr; } -void __attribute__((visibility("default"))) TS_OutPoint_set_txid(uint32_t this_ptr, int8_tArray val) { - LDKOutPoint this_ptr_conv; +void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_keys_id(uint32_t this_ptr, int8_tArray val) { + LDKStaticPaymentOutputDescriptor 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); - OutPoint_set_txid(&this_ptr_conv, val_ref); + StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref); } -int16_t __attribute__((visibility("default"))) TS_OutPoint_get_index(uint32_t this_ptr) { - LDKOutPoint this_ptr_conv; +int64_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_get_channel_value_satoshis(uint32_t this_ptr) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int16_t ret_val = OutPoint_get_index(&this_ptr_conv); + int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_OutPoint_set_index(uint32_t this_ptr, int16_t val) { - LDKOutPoint this_ptr_conv; +void __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_set_channel_value_satoshis(uint32_t this_ptr, int64_t val) { + LDKStaticPaymentOutputDescriptor this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - OutPoint_set_index(&this_ptr_conv, val); + StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txid_arg, int16_t index_arg) { - LDKThirtyTwoBytes txid_arg_ref; - CHECK(*((uint32_t*)txid_arg) == 32); - memcpy(txid_arg_ref.data, (uint8_t*)(txid_arg + 4), 32); - LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg); +uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_new(uint32_t outpoint_arg, uint32_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) { + LDKOutPoint outpoint_arg_conv; + outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1)); + outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0); + outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv); + LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1); + FREE((void*)output_arg); + LDKThirtyTwoBytes channel_keys_id_arg_ref; + CHECK(*((uint32_t*)channel_keys_id_arg) == 32); + memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32); + LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9283,11 +9976,11 @@ uint32_t __attribute__((visibility("default"))) TS_OutPoint_new(int8_tArray txi return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig) { - LDKOutPoint orig_conv; +uint32_t __attribute__((visibility("default"))) TS_StaticPaymentOutputDescriptor_clone(uint32_t orig) { + LDKStaticPaymentOutputDescriptor orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKOutPoint ret_var = OutPoint_clone(&orig_conv); + LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9297,35 +9990,6 @@ uint32_t __attribute__((visibility("default"))) TS_OutPoint_clone(uint32_t orig return ret_ref; } -int8_tArray __attribute__((visibility("default"))) TS_OutPoint_to_channel_id(uint32_t this_arg) { - LDKOutPoint this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), OutPoint_to_channel_id(&this_arg_conv).data, 32); - return arg_arr; -} - -int8_tArray __attribute__((visibility("default"))) TS_OutPoint_write(uint32_t obj) { - LDKOutPoint obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; -} - -uint32_t __attribute__((visibility("default"))) TS_OutPoint_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ"); - *ret_conv = OutPoint_read(ser_ref); - return (long)ret_conv; -} - void __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_free(uint32_t this_ptr) { if ((this_ptr & 1) != 0) return; LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1); @@ -9343,11 +10007,11 @@ uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_cl int8_tArray __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_write(uint32_t obj) { LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj; - LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = SpendableOutputDescriptor_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_SpendableOutputDescriptor_read(int8_tArray ser) { @@ -9359,18 +10023,18 @@ uint32_t __attribute__((visibility("default"))) TS_SpendableOutputDescriptor_re return (long)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelKeys_clone(uint32_t orig) { - LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig; - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = ChannelKeys_clone(orig_conv); +uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) { + LDKSign* orig_conv = (LDKSign*)orig; + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = Sign_clone(orig_conv); return (long)ret; } -void __attribute__((visibility("default"))) TS_ChannelKeys_free(uint32_t this_ptr) { +void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) { if ((this_ptr & 1) != 0) return; - LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)(((uint64_t)this_ptr) & ~1); + LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1); FREE((void*)this_ptr); - ChannelKeys_free(this_ptr_conv); + Sign_free(this_ptr_conv); } void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this_ptr) { @@ -9380,132 +10044,132 @@ void __attribute__((visibility("default"))) TS_KeysInterface_free(uint32_t this KeysInterface_free(this_ptr_conv); } -void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_free(uint32_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +void __attribute__((visibility("default"))) TS_InMemorySigner_free(uint32_t this_ptr) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); - InMemoryChannelKeys_free(this_ptr_conv); + InMemorySigner_free(this_ptr_conv); } -int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_funding_key(uint32_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_funding_key(uint32_t this_ptr) { + LDKInMemorySigner 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), *InMemoryChannelKeys_get_funding_key(&this_ptr_conv), 32); + memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_funding_key(&this_ptr_conv), 32); return ret_arr; } -void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_funding_key(uint32_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +void __attribute__((visibility("default"))) TS_InMemorySigner_set_funding_key(uint32_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK(*((uint32_t*)val) == 32); memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32); - InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref); + InMemorySigner_set_funding_key(&this_ptr_conv, val_ref); } -int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_revocation_base_key(uint32_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_revocation_base_key(uint32_t this_ptr) { + LDKInMemorySigner 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), *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv), 32); + memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_revocation_base_key(&this_ptr_conv), 32); return ret_arr; } -void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +void __attribute__((visibility("default"))) TS_InMemorySigner_set_revocation_base_key(uint32_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK(*((uint32_t*)val) == 32); memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32); - InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref); + InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref); } -int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_payment_key(uint32_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_payment_key(uint32_t this_ptr) { + LDKInMemorySigner 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), *InMemoryChannelKeys_get_payment_key(&this_ptr_conv), 32); + memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_payment_key(&this_ptr_conv), 32); return ret_arr; } -void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_payment_key(uint32_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +void __attribute__((visibility("default"))) TS_InMemorySigner_set_payment_key(uint32_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK(*((uint32_t*)val) == 32); memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32); - InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref); + InMemorySigner_set_payment_key(&this_ptr_conv, val_ref); } -int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_delayed_payment_base_key(uint32_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_delayed_payment_base_key(uint32_t this_ptr) { + LDKInMemorySigner 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), *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv), 32); + memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv), 32); return ret_arr; } -void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +void __attribute__((visibility("default"))) TS_InMemorySigner_set_delayed_payment_base_key(uint32_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK(*((uint32_t*)val) == 32); memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32); - InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref); + InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref); } -int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_htlc_base_key(uint32_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_htlc_base_key(uint32_t this_ptr) { + LDKInMemorySigner 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), *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv), 32); + memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_htlc_base_key(&this_ptr_conv), 32); return ret_arr; } -void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +void __attribute__((visibility("default"))) TS_InMemorySigner_set_htlc_base_key(uint32_t this_ptr, int8_tArray val) { + LDKInMemorySigner this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; LDKSecretKey val_ref; CHECK(*((uint32_t*)val) == 32); memcpy(val_ref.bytes, (uint8_t*)(val + 4), 32); - InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref); + InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref); } -int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_commitment_seed(uint32_t this_ptr) { - LDKInMemoryChannelKeys this_ptr_conv; +int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_get_commitment_seed(uint32_t this_ptr) { + LDKInMemorySigner 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), *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv), 32); + memcpy((uint8_t*)(ret_arr + 4), *InMemorySigner_get_commitment_seed(&this_ptr_conv), 32); return ret_arr; } -void __attribute__((visibility("default"))) TS_InMemoryChannelKeys_set_commitment_seed(uint32_t this_ptr, int8_tArray val) { - LDKInMemoryChannelKeys this_ptr_conv; +void __attribute__((visibility("default"))) TS_InMemorySigner_set_commitment_seed(uint32_t this_ptr, int8_tArray val) { + LDKInMemorySigner 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); - InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref); + InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref); } -uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_clone(uint32_t orig) { - LDKInMemoryChannelKeys orig_conv; +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_clone(uint32_t orig) { + LDKInMemorySigner orig_conv; orig_conv.inner = (void*)(orig & (~1)); orig_conv.is_owned = false; - LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv); + LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9515,7 +10179,7 @@ uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_clone(ui return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_new(int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, uint32_t key_derivation_params) { +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_new(int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { LDKSecretKey funding_key_ref; CHECK(*((uint32_t*)funding_key) == 32); memcpy(funding_key_ref.bytes, (uint8_t*)(funding_key + 4), 32); @@ -9534,9 +10198,10 @@ uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_new(int8 LDKThirtyTwoBytes commitment_seed_ref; CHECK(*((uint32_t*)commitment_seed) == 32); memcpy(commitment_seed_ref.data, (uint8_t*)(commitment_seed + 4), 32); - LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)key_derivation_params) & ~1); - FREE((void*)key_derivation_params); - LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv); + LDKThirtyTwoBytes channel_keys_id_ref; + CHECK(*((uint32_t*)channel_keys_id) == 32); + memcpy(channel_keys_id_ref.data, (uint8_t*)(channel_keys_id + 4), 32); + LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9546,11 +10211,11 @@ uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_new(int8 return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_counterparty_pubkeys(uint32_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_pubkeys(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv); + LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9560,35 +10225,35 @@ uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_counterp return ret_ref; } -int16_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_counterparty_selected_contest_delay(uint32_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +int16_t __attribute__((visibility("default"))) TS_InMemorySigner_counterparty_selected_contest_delay(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv); + int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv); return ret_val; } -int16_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_holder_selected_contest_delay(uint32_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +int16_t __attribute__((visibility("default"))) TS_InMemorySigner_holder_selected_contest_delay(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv); + int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv); return ret_val; } -jboolean __attribute__((visibility("default"))) TS_InMemoryChannelKeys_is_outbound(uint32_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +jboolean __attribute__((visibility("default"))) TS_InMemorySigner_is_outbound(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv); + jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv); return ret_val; } -uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_funding_outpoint(uint32_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_funding_outpoint(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv); + LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9598,11 +10263,11 @@ uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_funding_ return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_channel_parameters(uint32_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_parameters(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv); + LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9612,32 +10277,66 @@ uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_get_chan return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_InMemoryChannelKeys_as_ChannelKeys(uint32_t this_arg) { - LDKInMemoryChannelKeys this_arg_conv; +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKTransaction spend_tx_ref; + spend_tx_ref.datalen = *((uint32_t*)spend_tx); + spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes"); + memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen); + spend_tx_ref.data_is_owned = true; + LDKStaticPaymentOutputDescriptor descriptor_conv; + descriptor_conv.inner = (void*)(descriptor & (~1)); + descriptor_conv.is_owned = false; + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv); + return (long)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_dynamic_p2wsh_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKTransaction spend_tx_ref; + spend_tx_ref.datalen = *((uint32_t*)spend_tx); + spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes"); + memcpy(spend_tx_ref.data, (uint8_t*)(spend_tx + 4), spend_tx_ref.datalen); + spend_tx_ref.data_is_owned = true; + LDKDelayedPaymentOutputDescriptor descriptor_conv; + descriptor_conv.inner = (void*)(descriptor & (~1)); + descriptor_conv.is_owned = false; + LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ"); + *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv); + return (long)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys"); - *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv); + LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign"); + *ret = InMemorySigner_as_Sign(&this_arg_conv); return (long)ret; } -int8_tArray __attribute__((visibility("default"))) TS_InMemoryChannelKeys_write(uint32_t obj) { - LDKInMemoryChannelKeys obj_conv; +int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) { + LDKInMemorySigner obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = InMemorySigner_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_InMemoryChannelKeys_read(int8_tArray ser) { +uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ"); - *ret_conv = InMemoryChannelKeys_read(ser_ref); + LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); + *ret_conv = InMemorySigner_read(ser_ref); return (long)ret_conv; } @@ -9648,13 +10347,12 @@ void __attribute__((visibility("default"))) TS_KeysManager_free(uint32_t this_p KeysManager_free(this_ptr_conv); } -uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, uint32_t network, int64_t starting_time_secs, int32_t starting_time_nanos) { +uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) { unsigned char seed_arr[32]; CHECK(*((uint32_t*)seed) == 32); memcpy(seed_arr, (uint8_t*)(seed + 4), 32); unsigned char (*seed_ref)[32] = &seed_arr; - LDKNetwork network_conv = LDKNetwork_from_js(network); - LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos); + LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9664,11 +10362,15 @@ uint32_t __attribute__((visibility("default"))) TS_KeysManager_new(int8_tArray return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int64_t params_1, int64_t params_2) { +uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_keys(uint32_t this_arg, int64_t channel_value_satoshis, int8_tArray params) { LDKKeysManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2); + unsigned char params_arr[32]; + CHECK(*((uint32_t*)params) == 32); + memcpy(params_arr, (uint8_t*)(params + 4), 32); + unsigned char (*params_ref)[32] = ¶ms_arr; + LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. long ret_ref = (long)ret_var.inner; @@ -9678,6 +10380,45 @@ uint32_t __attribute__((visibility("default"))) TS_KeysManager_derive_channel_k return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_KeysManager_spend_spendable_outputs(uint32_t this_arg, uint32_tArray descriptors, uint32_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) { + LDKKeysManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKCVec_SpendableOutputDescriptorZ descriptors_constr; + descriptors_constr.datalen = *((uint32_t*)descriptors); + if (descriptors_constr.datalen > 0) + descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements"); + else + descriptors_constr.data = NULL; + uint32_t* descriptors_vals = (uint32_t*)(descriptors + 4); + for (size_t b = 0; b < descriptors_constr.datalen; b++) { + uint32_t descriptors_conv_27 = descriptors_vals[b]; + LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1); + FREE((void*)descriptors_conv_27); + descriptors_constr.data[b] = descriptors_conv_27_conv; + } + LDKCVec_TxOutZ outputs_constr; + outputs_constr.datalen = *((uint32_t*)outputs); + if (outputs_constr.datalen > 0) + outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements"); + else + outputs_constr.data = NULL; + uint32_t* outputs_vals = (uint32_t*)(outputs + 4); + for (size_t h = 0; h < outputs_constr.datalen; h++) { + uint32_t outputs_conv_7 = outputs_vals[h]; + LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1); + FREE((void*)outputs_conv_7); + outputs_constr.data[h] = outputs_conv_7_conv; + } + LDKCVec_u8Z change_destination_script_ref; + change_destination_script_ref.datalen = *((uint32_t*)change_destination_script); + change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes"); + memcpy(change_destination_script_ref.data, (uint8_t*)(change_destination_script + 4), change_destination_script_ref.datalen); + LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ"); + *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight); + return (long)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_KeysManager_as_KeysInterface(uint32_t this_arg) { LDKKeysManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -9724,9 +10465,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelDetails_get_remote LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelDetails_set_remote_network_id(uint32_t this_ptr, int8_tArray val) { @@ -9854,23 +10595,17 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_clone(uint32_ } void __attribute__((visibility("default"))) TS_PaymentSendFailure_free(uint32_t this_ptr) { - LDKPaymentSendFailure this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0); + if ((this_ptr & 1) != 0) return; + LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1); + FREE((void*)this_ptr); PaymentSendFailure_free(this_ptr_conv); } uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_clone(uint32_t orig) { - LDKPaymentSendFailure orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - LDKPaymentSendFailure ret_var = PaymentSendFailure_clone(&orig_conv); - CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long ret_ref = (long)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } + LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig; + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(orig_conv); + long ret_ref = (long)ret_copy; return ret_ref; } @@ -9919,14 +10654,14 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_cha 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 q = 0; q < ret_var.datalen; q++) { - LDKChannelDetails arr_conv_16_var = ret_var.data[q]; - CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_16_ref = (long)arr_conv_16_var.inner; - if (arr_conv_16_var.is_owned) { - arr_conv_16_ref |= 1; + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_conv_16_ref = (long)ret_conv_16_var.inner; + if (ret_conv_16_var.is_owned) { + ret_conv_16_ref |= 1; } - ret_arr_ptr[q] = arr_conv_16_ref; + ret_arr_ptr[q] = ret_conv_16_ref; } FREE(ret_var.data); return ret_arr; @@ -9940,14 +10675,14 @@ uint32_tArray __attribute__((visibility("default"))) TS_ChannelManager_list_usa 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 q = 0; q < ret_var.datalen; q++) { - LDKChannelDetails arr_conv_16_var = ret_var.data[q]; - CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - long arr_conv_16_ref = (long)arr_conv_16_var.inner; - if (arr_conv_16_var.is_owned) { - arr_conv_16_ref |= 1; + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + CHECK((((long)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_conv_16_ref = (long)ret_conv_16_var.inner; + if (ret_conv_16_var.is_owned) { + ret_conv_16_ref |= 1; } - ret_arr_ptr[q] = arr_conv_16_ref; + ret_arr_ptr[q] = ret_conv_16_ref; } FREE(ret_var.data); return ret_arr; @@ -10037,10 +10772,10 @@ void __attribute__((visibility("default"))) TS_ChannelManager_broadcast_node_an addresses_constr.data = NULL; uint32_t* addresses_vals = (uint32_t*)(addresses + 4); for (size_t m = 0; m < addresses_constr.datalen; m++) { - uint32_t arr_conv_12 = addresses_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - addresses_constr.data[m] = arr_conv_12_conv; + uint32_t addresses_conv_12 = addresses_vals[m]; + LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1); + FREE((void*)addresses_conv_12); + addresses_constr.data[m] = addresses_conv_12_conv; } ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr); } @@ -10092,9 +10827,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_no LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelManager_get_our_node_id(&this_arg_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelManager_channel_monitor_updated(uint32_t this_arg, uint32_t funding_txo, int64_t highest_applied_update_id) { @@ -10125,6 +10860,15 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProv return (long)ret; } +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen"); + *ret = ChannelManager_as_Listen(&this_arg_conv); + return (long)ret; +} + void __attribute__((visibility("default"))) TS_ChannelManager_block_connected(uint32_t this_arg, int8_tArray header, uint32_tArray txdata, int32_t height) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -10141,10 +10885,10 @@ void __attribute__((visibility("default"))) TS_ChannelManager_block_connected(u txdata_constr.data = NULL; uint32_t* txdata_vals = (uint32_t*)(txdata + 4); for (size_t e = 0; e < txdata_constr.datalen; e++) { - uint32_t arr_conv_30 = txdata_vals[e]; - LDKC2Tuple_usizeTransactionZ arr_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_30) & ~1); - FREE((void*)arr_conv_30); - txdata_constr.data[e] = arr_conv_30_conv; + uint32_t txdata_conv_30 = txdata_vals[e]; + LDKC2Tuple_usizeTransactionZ txdata_conv_30_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_30) & ~1); + FREE((void*)txdata_conv_30); + txdata_constr.data[e] = txdata_conv_30_conv; } ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height); } @@ -10160,6 +10904,13 @@ void __attribute__((visibility("default"))) TS_ChannelManager_block_disconnecte ChannelManager_block_disconnected(&this_arg_conv, header_ref); } +void __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update(uint32_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + ChannelManager_await_persistable_update(&this_arg_conv); +} + uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_ChannelMessageHandler(uint32_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -10173,11 +10924,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint LDKChannelManager obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelManager_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; } void __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_free(uint32_t this_ptr) { @@ -10310,11 +11061,11 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManagerReadArgs_new(u channel_monitors_constr.data = NULL; uint32_t* channel_monitors_vals = (uint32_t*)(channel_monitors + 4); for (size_t q = 0; q < channel_monitors_constr.datalen; q++) { - uint32_t arr_conv_16 = channel_monitors_vals[q]; - LDKChannelMonitor arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - channel_monitors_constr.data[q] = arr_conv_16_conv; + uint32_t channel_monitors_conv_16 = channel_monitors_vals[q]; + LDKChannelMonitor channel_monitors_conv_16_conv; + channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1)); + channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0); + channel_monitors_constr.data[q] = channel_monitors_conv_16_conv; } LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -10367,6 +11118,46 @@ void __attribute__((visibility("default"))) TS_Init_free(uint32_t this_ptr) { Init_free(this_ptr_conv); } +uint32_t __attribute__((visibility("default"))) TS_Init_get_features(uint32_t this_ptr) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_Init_set_features(uint32_t this_ptr, uint32_t val) { + LDKInit this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + LDKInitFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + val_conv = InitFeatures_clone(&val_conv); + Init_set_features(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_Init_new(uint32_t features_arg) { + LDKInitFeatures 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 = InitFeatures_clone(&features_arg_conv); + LDKInit ret_var = Init_new(features_arg_conv); + CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_Init_clone(uint32_t orig) { LDKInit orig_conv; orig_conv.inner = (void*)(orig & (~1)); @@ -10752,9 +11543,9 @@ int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_funding_p LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_OpenChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) { @@ -10771,9 +11562,9 @@ int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_revocatio LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_OpenChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -10790,9 +11581,9 @@ int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_payment_p LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_payment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_OpenChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) { @@ -10809,9 +11600,9 @@ int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_delayed_p LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_OpenChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -10828,9 +11619,9 @@ int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_htlc_base LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_OpenChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -10847,9 +11638,9 @@ int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_get_first_per LDKOpenChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_OpenChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) { @@ -11026,9 +11817,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_funding LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_AcceptChannel_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) { @@ -11045,9 +11836,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_revocat LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_AcceptChannel_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -11064,9 +11855,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_payment LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_AcceptChannel_set_payment_point(uint32_t this_ptr, int8_tArray val) { @@ -11083,9 +11874,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_delayed LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_AcceptChannel_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -11102,9 +11893,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_htlc_ba LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_AcceptChannel_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -11121,9 +11912,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_get_first_p LDKAcceptChannel this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_AcceptChannel_set_first_per_commitment_point(uint32_t this_ptr, int8_tArray val) { @@ -11214,9 +12005,9 @@ int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_get_signat LDKFundingCreated this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), FundingCreated_get_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_FundingCreated_set_signature(uint32_t this_ptr, int8_tArray val) { @@ -11293,9 +12084,9 @@ int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_get_signatu LDKFundingSigned this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), FundingSigned_get_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_FundingSigned_set_signature(uint32_t this_ptr, int8_tArray val) { @@ -11369,9 +12160,9 @@ int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_get_next_pe LDKFundingLocked this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_FundingLocked_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) { @@ -11445,10 +12236,10 @@ int8_tArray __attribute__((visibility("default"))) TS_Shutdown_get_scriptpubkey LDKShutdown this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - return arg_arr; + LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_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; } void __attribute__((visibility("default"))) TS_Shutdown_set_scriptpubkey(uint32_t this_ptr, int8_tArray val) { @@ -11539,9 +12330,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_get_signatu LDKClosingSigned this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ClosingSigned_get_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint32_t this_ptr, int8_tArray val) { @@ -11935,9 +12726,9 @@ int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_get_sign LDKCommitmentSigned this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), CommitmentSigned_get_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_CommitmentSigned_set_signature(uint32_t this_ptr, int8_tArray val) { @@ -11962,11 +12753,11 @@ void __attribute__((visibility("default"))) TS_CommitmentSigned_set_htlc_signat val_constr.data = NULL; int8_tArray* val_vals = (int8_tArray*)(val + 4); for (size_t m = 0; m < val_constr.datalen; m++) { - int8_tArray arr_conv_12 = val_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - val_constr.data[m] = arr_conv_12_ref; + int8_tArray val_conv_12 = val_vals[m]; + LDKSignature val_conv_12_ref; + CHECK(*((uint32_t*)val_conv_12) == 64); + memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64); + val_constr.data[m] = val_conv_12_ref; } CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr); } @@ -11986,11 +12777,11 @@ uint32_t __attribute__((visibility("default"))) TS_CommitmentSigned_new(int8_tA htlc_signatures_arg_constr.data = NULL; int8_tArray* htlc_signatures_arg_vals = (int8_tArray*)(htlc_signatures_arg + 4); for (size_t m = 0; m < htlc_signatures_arg_constr.datalen; m++) { - int8_tArray arr_conv_12 = htlc_signatures_arg_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - htlc_signatures_arg_constr.data[m] = arr_conv_12_ref; + int8_tArray htlc_signatures_arg_conv_12 = htlc_signatures_arg_vals[m]; + LDKSignature htlc_signatures_arg_conv_12_ref; + CHECK(*((uint32_t*)htlc_signatures_arg_conv_12) == 64); + memcpy(htlc_signatures_arg_conv_12_ref.compact_form, (uint8_t*)(htlc_signatures_arg_conv_12 + 4), 64); + htlc_signatures_arg_constr.data[m] = htlc_signatures_arg_conv_12_ref; } LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -12065,9 +12856,9 @@ int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_get_next_per LDKRevokeAndACK this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_RevokeAndACK_set_next_per_commitment_point(uint32_t this_ptr, int8_tArray val) { @@ -12213,9 +13004,9 @@ int8_tArray __attribute__((visibility("default"))) TS_DataLossProtect_get_my_cu LDKDataLossProtect this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_DataLossProtect_set_my_current_per_commitment_point(uint32_t this_ptr, int8_tArray val) { @@ -12374,9 +13165,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_ge LDKAnnouncementSignatures this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_node_signature(uint32_t this_ptr, int8_tArray val) { @@ -12393,9 +13184,9 @@ int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_ge LDKAnnouncementSignatures this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_AnnouncementSignatures_set_bitcoin_signature(uint32_t this_ptr, int8_tArray val) { @@ -12459,11 +13250,11 @@ uint32_t __attribute__((visibility("default"))) TS_NetAddress_clone(uint32_t or int8_tArray __attribute__((visibility("default"))) TS_NetAddress_write(uint32_t obj) { LDKNetAddress* obj_conv = (LDKNetAddress*)obj; - LDKCVec_u8Z arg_var = NetAddress_write(obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NetAddress_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_Result_read(int8_tArray ser) { @@ -12526,9 +13317,9 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_ LDKUnsignedNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_node_id(uint32_t this_ptr, int8_tArray val) { @@ -12591,10 +13382,10 @@ void __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_set_add val_constr.data = NULL; uint32_t* val_vals = (uint32_t*)(val + 4); for (size_t m = 0; m < val_constr.datalen; m++) { - uint32_t arr_conv_12 = val_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - val_constr.data[m] = arr_conv_12_conv; + uint32_t val_conv_12 = val_vals[m]; + LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); + FREE((void*)val_conv_12); + val_constr.data[m] = val_conv_12_conv; } UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr); } @@ -12624,9 +13415,9 @@ int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_get_sign LDKNodeAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), NodeAnnouncement_get_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_NodeAnnouncement_set_signature(uint32_t this_ptr, int8_tArray val) { @@ -12766,9 +13557,9 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnounceme LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint32_t this_ptr, int8_tArray val) { @@ -12785,9 +13576,9 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnounceme LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint32_t this_ptr, int8_tArray val) { @@ -12804,9 +13595,9 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnounceme LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint32_t this_ptr, int8_tArray val) { @@ -12823,9 +13614,9 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnounceme LDKUnsignedChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint32_t this_ptr, int8_tArray val) { @@ -12863,9 +13654,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_n LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_1(uint32_t this_ptr, int8_tArray val) { @@ -12882,9 +13673,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_n LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_node_signature_2(uint32_t this_ptr, int8_tArray val) { @@ -12901,9 +13692,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_b LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_1(uint32_t this_ptr, int8_tArray val) { @@ -12920,9 +13711,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_get_b LDKChannelAnnouncement this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelAnnouncement_set_bitcoin_signature_2(uint32_t this_ptr, int8_tArray val) { @@ -13157,9 +13948,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_get_signatu LDKChannelUpdate this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelUpdate_get_signature(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelUpdate_set_signature(uint32_t this_ptr, int8_tArray val) { @@ -13396,8 +14187,8 @@ void __attribute__((visibility("default"))) TS_ReplyChannelRange_set_short_chan val_constr.data = NULL; int64_t* val_vals = (int64_t*)(val + 4); for (size_t i = 0; i < val_constr.datalen; i++) { - int64_t arr_conv_8 = val_vals[i]; - val_constr.data[i] = arr_conv_8; + int64_t val_conv_8 = val_vals[i]; + val_constr.data[i] = val_conv_8; } ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr); } @@ -13414,8 +14205,8 @@ uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_new(int8_t short_channel_ids_arg_constr.data = NULL; int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4); for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) { - int64_t arr_conv_8 = short_channel_ids_arg_vals[i]; - short_channel_ids_arg_constr.data[i] = arr_conv_8; + int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i]; + short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8; } LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -13479,8 +14270,8 @@ void __attribute__((visibility("default"))) TS_QueryShortChannelIds_set_short_c val_constr.data = NULL; int64_t* val_vals = (int64_t*)(val + 4); for (size_t i = 0; i < val_constr.datalen; i++) { - int64_t arr_conv_8 = val_vals[i]; - val_constr.data[i] = arr_conv_8; + int64_t val_conv_8 = val_vals[i]; + val_constr.data[i] = val_conv_8; } QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr); } @@ -13497,8 +14288,8 @@ uint32_t __attribute__((visibility("default"))) TS_QueryShortChannelIds_new(int short_channel_ids_arg_constr.data = NULL; int64_t* short_channel_ids_arg_vals = (int64_t*)(short_channel_ids_arg + 4); for (size_t i = 0; i < short_channel_ids_arg_constr.datalen; i++) { - int64_t arr_conv_8 = short_channel_ids_arg_vals[i]; - short_channel_ids_arg_constr.data[i] = arr_conv_8; + int64_t short_channel_ids_arg_conv_8 = short_channel_ids_arg_vals[i]; + short_channel_ids_arg_constr.data[i] = short_channel_ids_arg_conv_8; } LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -13788,12 +14579,12 @@ void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_ val_constr.data = NULL; uint32_t* val_vals = (uint32_t*)(val + 4); for (size_t p = 0; p < val_constr.datalen; p++) { - uint32_t arr_conv_15 = val_vals[p]; - LDKUpdateAddHTLC arr_conv_15_conv; - arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1)); - arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0); - arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv); - val_constr.data[p] = arr_conv_15_conv; + uint32_t val_conv_15 = val_vals[p]; + LDKUpdateAddHTLC val_conv_15_conv; + val_conv_15_conv.inner = (void*)(val_conv_15 & (~1)); + val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0); + val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv); + val_constr.data[p] = val_conv_15_conv; } CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr); } @@ -13810,12 +14601,12 @@ void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulf val_constr.data = NULL; uint32_t* val_vals = (uint32_t*)(val + 4); for (size_t t = 0; t < val_constr.datalen; t++) { - uint32_t arr_conv_19 = val_vals[t]; - LDKUpdateFulfillHTLC arr_conv_19_conv; - arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1)); - arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0); - arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv); - val_constr.data[t] = arr_conv_19_conv; + uint32_t val_conv_19 = val_vals[t]; + LDKUpdateFulfillHTLC val_conv_19_conv; + val_conv_19_conv.inner = (void*)(val_conv_19 & (~1)); + val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0); + val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv); + val_constr.data[t] = val_conv_19_conv; } CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr); } @@ -13832,12 +14623,12 @@ void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail val_constr.data = NULL; uint32_t* val_vals = (uint32_t*)(val + 4); for (size_t q = 0; q < val_constr.datalen; q++) { - uint32_t arr_conv_16 = val_vals[q]; - LDKUpdateFailHTLC arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv); - val_constr.data[q] = arr_conv_16_conv; + uint32_t val_conv_16 = val_vals[q]; + LDKUpdateFailHTLC val_conv_16_conv; + val_conv_16_conv.inner = (void*)(val_conv_16 & (~1)); + val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0); + val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv); + val_constr.data[q] = val_conv_16_conv; } CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr); } @@ -13854,12 +14645,12 @@ void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail val_constr.data = NULL; uint32_t* val_vals = (uint32_t*)(val + 4); for (size_t z = 0; z < val_constr.datalen; z++) { - uint32_t arr_conv_25 = val_vals[z]; - LDKUpdateFailMalformedHTLC arr_conv_25_conv; - arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1)); - arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0); - arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv); - val_constr.data[z] = arr_conv_25_conv; + uint32_t val_conv_25 = val_vals[z]; + LDKUpdateFailMalformedHTLC val_conv_25_conv; + val_conv_25_conv.inner = (void*)(val_conv_25 & (~1)); + val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0); + val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv); + val_constr.data[z] = val_conv_25_conv; } CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr); } @@ -13923,12 +14714,12 @@ uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_new(uint32_ update_add_htlcs_arg_constr.data = NULL; uint32_t* update_add_htlcs_arg_vals = (uint32_t*)(update_add_htlcs_arg + 4); for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) { - uint32_t arr_conv_15 = update_add_htlcs_arg_vals[p]; - LDKUpdateAddHTLC arr_conv_15_conv; - arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1)); - arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0); - arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv); - update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv; + uint32_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p]; + LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv; + update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1)); + update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0); + update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv); + update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv; } LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr; update_fulfill_htlcs_arg_constr.datalen = *((uint32_t*)update_fulfill_htlcs_arg); @@ -13938,12 +14729,12 @@ uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_new(uint32_ update_fulfill_htlcs_arg_constr.data = NULL; uint32_t* update_fulfill_htlcs_arg_vals = (uint32_t*)(update_fulfill_htlcs_arg + 4); for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) { - uint32_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t]; - LDKUpdateFulfillHTLC arr_conv_19_conv; - arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1)); - arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0); - arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv); - update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv; + uint32_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t]; + LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv; + update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1)); + update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0); + update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv); + update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv; } LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr; update_fail_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_htlcs_arg); @@ -13953,12 +14744,12 @@ uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_new(uint32_ update_fail_htlcs_arg_constr.data = NULL; uint32_t* update_fail_htlcs_arg_vals = (uint32_t*)(update_fail_htlcs_arg + 4); for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) { - uint32_t arr_conv_16 = update_fail_htlcs_arg_vals[q]; - LDKUpdateFailHTLC arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv); - update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv; + uint32_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q]; + LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv; + update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1)); + update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0); + update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv); + update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv; } LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr; update_fail_malformed_htlcs_arg_constr.datalen = *((uint32_t*)update_fail_malformed_htlcs_arg); @@ -13968,12 +14759,12 @@ uint32_t __attribute__((visibility("default"))) TS_CommitmentUpdate_new(uint32_ update_fail_malformed_htlcs_arg_constr.data = NULL; uint32_t* update_fail_malformed_htlcs_arg_vals = (uint32_t*)(update_fail_malformed_htlcs_arg + 4); for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) { - uint32_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z]; - LDKUpdateFailMalformedHTLC arr_conv_25_conv; - arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1)); - arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0); - arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv); - update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv; + uint32_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z]; + LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv; + update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1)); + update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0); + update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv); + update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv; } LDKUpdateFee update_fee_arg_conv; update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1)); @@ -14040,11 +14831,11 @@ int8_tArray __attribute__((visibility("default"))) TS_AcceptChannel_write(uint3 LDKAcceptChannel obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = AcceptChannel_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_AcceptChannel_read(int8_tArray ser) { @@ -14060,11 +14851,11 @@ int8_tArray __attribute__((visibility("default"))) TS_AnnouncementSignatures_wr LDKAnnouncementSignatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = AnnouncementSignatures_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_AnnouncementSignatures_read(int8_tArray ser) { @@ -14080,11 +14871,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelReestablish_write( LDKChannelReestablish obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelReestablish_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_ChannelReestablish_read(int8_tArray ser) { @@ -14100,11 +14891,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ClosingSigned_write(uint3 LDKClosingSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ClosingSigned_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_ClosingSigned_read(int8_tArray ser) { @@ -14120,11 +14911,11 @@ int8_tArray __attribute__((visibility("default"))) TS_CommitmentSigned_write(ui LDKCommitmentSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = CommitmentSigned_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_CommitmentSigned_read(int8_tArray ser) { @@ -14140,11 +14931,11 @@ int8_tArray __attribute__((visibility("default"))) TS_FundingCreated_write(uint LDKFundingCreated obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = FundingCreated_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_FundingCreated_read(int8_tArray ser) { @@ -14160,11 +14951,11 @@ int8_tArray __attribute__((visibility("default"))) TS_FundingSigned_write(uint3 LDKFundingSigned obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = FundingSigned_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_FundingSigned_read(int8_tArray ser) { @@ -14180,11 +14971,11 @@ int8_tArray __attribute__((visibility("default"))) TS_FundingLocked_write(uint3 LDKFundingLocked obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = FundingLocked_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_FundingLocked_read(int8_tArray ser) { @@ -14200,11 +14991,11 @@ int8_tArray __attribute__((visibility("default"))) TS_Init_write(uint32_t obj) LDKInit obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Init_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Init_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_Init_read(int8_tArray ser) { @@ -14220,11 +15011,11 @@ int8_tArray __attribute__((visibility("default"))) TS_OpenChannel_write(uint32_ LDKOpenChannel obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = OpenChannel_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_OpenChannel_read(int8_tArray ser) { @@ -14240,11 +15031,11 @@ int8_tArray __attribute__((visibility("default"))) TS_RevokeAndACK_write(uint32 LDKRevokeAndACK obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = RevokeAndACK_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_RevokeAndACK_read(int8_tArray ser) { @@ -14260,11 +15051,11 @@ int8_tArray __attribute__((visibility("default"))) TS_Shutdown_write(uint32_t o LDKShutdown obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Shutdown_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_Shutdown_read(int8_tArray ser) { @@ -14280,11 +15071,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UpdateFailHTLC_write(uint LDKUpdateFailHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFailHTLC_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_UpdateFailHTLC_read(int8_tArray ser) { @@ -14300,11 +15091,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UpdateFailMalformedHTLC_w LDKUpdateFailMalformedHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_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_UpdateFailMalformedHTLC_read(int8_tArray ser) { @@ -14320,11 +15111,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UpdateFee_write(uint32_t LDKUpdateFee obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFee_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_UpdateFee_read(int8_tArray ser) { @@ -14340,11 +15131,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UpdateFulfillHTLC_write(u LDKUpdateFulfillHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateFulfillHTLC_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_UpdateFulfillHTLC_read(int8_tArray ser) { @@ -14360,11 +15151,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UpdateAddHTLC_write(uint3 LDKUpdateAddHTLC obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UpdateAddHTLC_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_UpdateAddHTLC_read(int8_tArray ser) { @@ -14380,11 +15171,11 @@ int8_tArray __attribute__((visibility("default"))) TS_Ping_write(uint32_t obj) LDKPing obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Ping_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Ping_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_Ping_read(int8_tArray ser) { @@ -14400,11 +15191,11 @@ int8_tArray __attribute__((visibility("default"))) TS_Pong_write(uint32_t obj) LDKPong obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = Pong_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = Pong_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_Pong_read(int8_tArray ser) { @@ -14420,11 +15211,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelAnnounceme LDKUnsignedChannelAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_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_UnsignedChannelAnnouncement_read(int8_tArray ser) { @@ -14440,11 +15231,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelAnnouncement_write LDKChannelAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelAnnouncement_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_ChannelAnnouncement_read(int8_tArray ser) { @@ -14460,11 +15251,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedChannelUpdate_wri LDKUnsignedChannelUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UnsignedChannelUpdate_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_UnsignedChannelUpdate_read(int8_tArray ser) { @@ -14480,11 +15271,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelUpdate_write(uint3 LDKChannelUpdate obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelUpdate_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_ChannelUpdate_read(int8_tArray ser) { @@ -14500,11 +15291,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ErrorMessage_write(uint32 LDKErrorMessage obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ErrorMessage_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_ErrorMessage_read(int8_tArray ser) { @@ -14520,11 +15311,11 @@ int8_tArray __attribute__((visibility("default"))) TS_UnsignedNodeAnnouncement_ LDKUnsignedNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_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_UnsignedNodeAnnouncement_read(int8_tArray ser) { @@ -14540,11 +15331,11 @@ int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncement_write(ui LDKNodeAnnouncement obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NodeAnnouncement_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_NodeAnnouncement_read(int8_tArray ser) { @@ -14569,11 +15360,11 @@ int8_tArray __attribute__((visibility("default"))) TS_QueryShortChannelIds_writ LDKQueryShortChannelIds obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = QueryShortChannelIds_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_ReplyShortChannelIdsEnd_read(int8_tArray ser) { @@ -14589,11 +15380,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_w LDKReplyShortChannelIdsEnd obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_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_QueryChannelRange_read(int8_tArray ser) { @@ -14609,11 +15400,11 @@ int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(u LDKQueryChannelRange obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = QueryChannelRange_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_ReplyChannelRange_read(int8_tArray ser) { @@ -14629,11 +15420,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ReplyChannelRange_write(u LDKReplyChannelRange obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ReplyChannelRange_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_GossipTimestampFilter_read(int8_tArray ser) { @@ -14649,11 +15440,11 @@ int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_wri LDKGossipTimestampFilter obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = GossipTimestampFilter_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; } void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_ptr) { @@ -14807,9 +15598,9 @@ ptrArray __attribute__((visibility("default"))) TS_PeerManager_get_peer_node_id ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes"); int8_tArray *ret_arr_ptr = (int8_tArray*)(ret_arr + 4); for (size_t m = 0; m < ret_var.datalen; m++) { - int8_tArray arr_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arr_conv_12_arr + 4), ret_var.data[m].compressed_form, 33); - ret_arr_ptr[m] = arr_conv_12_arr; + int8_tArray ret_conv_12_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_conv_12_arr + 4), ret_var.data[m].compressed_form, 33); + ret_arr_ptr[m] = ret_conv_12_arr; } FREE(ret_var.data); return ret_arr; @@ -14898,9 +15689,9 @@ int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(i CHECK(*((uint32_t*)commitment_seed) == 32); memcpy(commitment_seed_arr, (uint8_t*)(commitment_seed + 4), 32); unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr; - int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32); - return arg_arr; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), build_commitment_secret(commitment_seed_ref, idx).data, 32); + return ret_arr; } uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) { @@ -14965,9 +15756,9 @@ int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_per_co LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_TxCreationKeys_set_per_commitment_point(uint32_t this_ptr, int8_tArray val) { @@ -14984,9 +15775,9 @@ int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_revoca LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_TxCreationKeys_set_revocation_key(uint32_t this_ptr, int8_tArray val) { @@ -15003,9 +15794,9 @@ int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadc LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_htlc_key(uint32_t this_ptr, int8_tArray val) { @@ -15022,9 +15813,9 @@ int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_counte LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_TxCreationKeys_set_countersignatory_htlc_key(uint32_t this_ptr, int8_tArray val) { @@ -15041,9 +15832,9 @@ int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_get_broadc LDKTxCreationKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_TxCreationKeys_set_broadcaster_delayed_payment_key(uint32_t this_ptr, int8_tArray val) { @@ -15100,11 +15891,11 @@ int8_tArray __attribute__((visibility("default"))) TS_TxCreationKeys_write(uint LDKTxCreationKeys obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = TxCreationKeys_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_TxCreationKeys_read(int8_tArray ser) { @@ -15127,9 +15918,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_fun LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_funding_pubkey(uint32_t this_ptr, int8_tArray val) { @@ -15146,9 +15937,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_rev LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_revocation_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -15165,9 +15956,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_pay LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_payment_point(uint32_t this_ptr, int8_tArray val) { @@ -15184,9 +15975,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_del LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_delayed_payment_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -15203,9 +15994,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_get_htl LDKChannelPublicKeys this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelPublicKeys_set_htlc_basepoint(uint32_t this_ptr, int8_tArray val) { @@ -15262,11 +16053,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelPublicKeys_write(u LDKChannelPublicKeys obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelPublicKeys_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_ChannelPublicKeys_read(int8_tArray ser) { @@ -15321,11 +16112,11 @@ int8_tArray __attribute__((visibility("default"))) TS_get_revokeable_redeemscri LDKPublicKey broadcaster_delayed_payment_key_ref; CHECK(*((uint32_t*)broadcaster_delayed_payment_key) == 33); memcpy(broadcaster_delayed_payment_key_ref.compressed_form, (uint8_t*)(broadcaster_delayed_payment_key + 4), 33); - LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref); + 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; } void __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_free(uint32_t this_ptr) { @@ -15417,11 +16208,11 @@ int8_tArray __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_wr LDKHTLCOutputInCommitment obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = HTLCOutputInCommitment_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_HTLCOutputInCommitment_read(int8_tArray ser) { @@ -15440,11 +16231,11 @@ int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uin LDKTxCreationKeys keys_conv; keys_conv.inner = (void*)(keys & (~1)); keys_conv.is_owned = false; - LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_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; } int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript(int8_tArray broadcaster, int8_tArray countersignatory) { @@ -15454,11 +16245,11 @@ int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript LDKPublicKey countersignatory_ref; CHECK(*((uint32_t*)countersignatory) == 33); memcpy(countersignatory_ref.compressed_form, (uint8_t*)(countersignatory + 4), 33); - LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref); + 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; } int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { @@ -15475,11 +16266,11 @@ int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(in LDKPublicKey revocation_key_ref; CHECK(*((uint32_t*)revocation_key) == 33); memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33); - LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - Transaction_free(arg_var); - return arg_arr; + LDKTransaction ret_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); + 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); + Transaction_free(ret_var); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_ptr) { @@ -15747,11 +16538,11 @@ int8_tArray __attribute__((visibility("default"))) TS_CounterpartyChannelTransa LDKCounterpartyChannelTransactionParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_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_CounterpartyChannelTransactionParameters_read(int8_tArray ser) { @@ -15767,11 +16558,11 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelTransactionParamet LDKChannelTransactionParameters obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelTransactionParameters_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_ChannelTransactionParameters_read(int8_tArray ser) { @@ -15859,9 +16650,9 @@ int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransacti LDKHolderCommitmentTransaction this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_counterparty_sig(uint32_t this_ptr, int8_tArray val) { @@ -15886,11 +16677,11 @@ void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_set_ val_constr.data = NULL; int8_tArray* val_vals = (int8_tArray*)(val + 4); for (size_t m = 0; m < val_constr.datalen; m++) { - int8_tArray arr_conv_12 = val_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - val_constr.data[m] = arr_conv_12_ref; + int8_tArray val_conv_12 = val_vals[m]; + LDKSignature val_conv_12_ref; + CHECK(*((uint32_t*)val_conv_12) == 64); + memcpy(val_conv_12_ref.compact_form, (uint8_t*)(val_conv_12 + 4), 64); + val_constr.data[m] = val_conv_12_ref; } HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr); } @@ -15913,11 +16704,11 @@ int8_tArray __attribute__((visibility("default"))) TS_HolderCommitmentTransacti LDKHolderCommitmentTransaction obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = HolderCommitmentTransaction_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_HolderCommitmentTransaction_read(int8_tArray ser) { @@ -15945,11 +16736,11 @@ uint32_t __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_ counterparty_htlc_sigs_constr.data = NULL; int8_tArray* counterparty_htlc_sigs_vals = (int8_tArray*)(counterparty_htlc_sigs + 4); for (size_t m = 0; m < counterparty_htlc_sigs_constr.datalen; m++) { - int8_tArray arr_conv_12 = counterparty_htlc_sigs_vals[m]; - LDKSignature arr_conv_12_ref; - CHECK(*((uint32_t*)arr_conv_12) == 64); - memcpy(arr_conv_12_ref.compact_form, (uint8_t*)(arr_conv_12 + 4), 64); - counterparty_htlc_sigs_constr.data[m] = arr_conv_12_ref; + int8_tArray counterparty_htlc_sigs_conv_12 = counterparty_htlc_sigs_vals[m]; + LDKSignature counterparty_htlc_sigs_conv_12_ref; + CHECK(*((uint32_t*)counterparty_htlc_sigs_conv_12) == 64); + memcpy(counterparty_htlc_sigs_conv_12_ref.compact_form, (uint8_t*)(counterparty_htlc_sigs_conv_12 + 4), 64); + counterparty_htlc_sigs_constr.data[m] = counterparty_htlc_sigs_conv_12_ref; } LDKPublicKey holder_funding_key_ref; CHECK(*((uint32_t*)holder_funding_key) == 33); @@ -15978,11 +16769,11 @@ int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransactio LDKBuiltCommitmentTransaction this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - Transaction_free(arg_var); - return arg_arr; + LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_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); + Transaction_free(ret_var); + return ret_arr; } void __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_set_transaction(uint32_t this_ptr, int8_tArray val) { @@ -16053,11 +16844,11 @@ int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransactio LDKBuiltCommitmentTransaction obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_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_BuiltCommitmentTransaction_read(int8_tArray ser) { @@ -16076,9 +16867,9 @@ int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransactio LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript); funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4); - int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32); - return arg_arr; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32); + return ret_arr; } int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) { @@ -16092,9 +16883,9 @@ int8_tArray __attribute__((visibility("default"))) TS_BuiltCommitmentTransactio LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript); funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4); - int8_tArray arg_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64); - return arg_arr; + int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64); + return ret_arr; } void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_ptr) { @@ -16122,11 +16913,11 @@ int8_tArray __attribute__((visibility("default"))) TS_CommitmentTransaction_wri LDKCommitmentTransaction obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = CommitmentTransaction_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_CommitmentTransaction_read(int8_tArray ser) { @@ -16213,9 +17004,9 @@ int8_tArray __attribute__((visibility("default"))) TS_TrustedCommitmentTransact LDKTrustedCommitmentTransaction this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; - int8_tArray arg_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32); - return arg_arr; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), TrustedCommitmentTransaction_txid(&this_arg_conv).data, 32); + return ret_arr; } uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_built_transaction(uint32_t this_arg) { @@ -16406,33 +17197,33 @@ int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32 LDKInitFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = InitFeatures_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = InitFeatures_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; } int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) { LDKNodeFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeFeatures_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = NodeFeatures_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; } int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) { LDKChannelFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = ChannelFeatures_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + LDKCVec_u8Z ret_var = ChannelFeatures_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_InitFeatures_read(int8_tArray ser) { @@ -16473,9 +17264,9 @@ int8_tArray __attribute__((visibility("default"))) TS_RouteHop_get_pubkey(uint3 LDKRouteHop this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), RouteHop_get_pubkey(&this_ptr_conv).compressed_form, 33); - return arg_arr; + 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_RouteHop_set_pubkey(uint32_t this_ptr, int8_tArray val) { @@ -16638,23 +17429,23 @@ void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_pt val_constr.data = NULL; uint32_tArray* val_vals = (uint32_tArray*)(val + 4); for (size_t m = 0; m < val_constr.datalen; m++) { - uint32_tArray arr_conv_12 = val_vals[m]; - LDKCVec_RouteHopZ arr_conv_12_constr; - arr_conv_12_constr.datalen = *((uint32_t*)arr_conv_12); - if (arr_conv_12_constr.datalen > 0) - arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + 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 - arr_conv_12_constr.data = NULL; - uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12 + 4); - for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) { - uint32_t arr_conv_10 = arr_conv_12_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv); - arr_conv_12_constr.data[k] = arr_conv_10_conv; + 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] = arr_conv_12_constr; + val_constr.data[m] = val_conv_12_constr; } Route_set_paths(&this_ptr_conv, val_constr); } @@ -16668,23 +17459,23 @@ uint32_t __attribute__((visibility("default"))) TS_Route_new(ptrArray paths_arg 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 arr_conv_12 = paths_arg_vals[m]; - LDKCVec_RouteHopZ arr_conv_12_constr; - arr_conv_12_constr.datalen = *((uint32_t*)arr_conv_12); - if (arr_conv_12_constr.datalen > 0) - arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + 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 - arr_conv_12_constr.data = NULL; - uint32_t* arr_conv_12_vals = (uint32_t*)(arr_conv_12 + 4); - for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) { - uint32_t arr_conv_10 = arr_conv_12_vals[k]; - LDKRouteHop arr_conv_10_conv; - arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1)); - arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0); - arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv); - arr_conv_12_constr.data[k] = arr_conv_10_conv; + 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] = arr_conv_12_constr; + paths_arg_constr.data[m] = paths_arg_conv_12_constr; } LDKRoute ret_var = Route_new(paths_arg_constr); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. @@ -16714,11 +17505,11 @@ 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 arg_var = Route_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + 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) { @@ -16741,9 +17532,9 @@ int8_tArray __attribute__((visibility("default"))) TS_RouteHint_get_src_node_id LDKRouteHint this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33); - return arg_arr; + int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), RouteHint_get_src_node_id(&this_ptr_conv).compressed_form, 33); + return ret_arr; } void __attribute__((visibility("default"))) TS_RouteHint_set_src_node_id(uint32_t this_ptr, int8_tArray val) { @@ -16876,11 +17667,11 @@ uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_no 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 arr_conv_16 = first_hops_vals[q]; - LDKChannelDetails arr_conv_16_conv; - arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1)); - arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0); - first_hops_constr.data[q] = arr_conv_16_conv; + 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; } LDKCVec_RouteHintZ last_hops_constr; last_hops_constr.datalen = *((uint32_t*)last_hops); @@ -16890,12 +17681,12 @@ uint32_t __attribute__((visibility("default"))) TS_get_route(int8_tArray our_no 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 arr_conv_11 = last_hops_vals[l]; - LDKRouteHint arr_conv_11_conv; - arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1)); - arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0); - arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv); - last_hops_constr.data[l] = arr_conv_11_conv; + 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"); @@ -16911,6 +17702,20 @@ void __attribute__((visibility("default"))) TS_NetworkGraph_free(uint32_t this_ NetworkGraph_free(this_ptr_conv); } +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((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_ptr) { LDKLockedNetworkGraph this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -16947,7 +17752,7 @@ uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_ LDKNetworkGraph network_graph_conv; network_graph_conv.inner = (void*)(network_graph & (~1)); network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0); - // Warning: we need a move here but no clone is available for LDKNetworkGraph + network_graph_conv = NetworkGraph_clone(&network_graph_conv); LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv); CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -17139,11 +17944,11 @@ int8_tArray __attribute__((visibility("default"))) TS_DirectionalChannelInfo_wr LDKDirectionalChannelInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + 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) { @@ -17191,9 +17996,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_one( LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelInfo_get_node_one(&this_ptr_conv).compressed_form, 33); - return arg_arr; + 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; } void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_one(uint32_t this_ptr, int8_tArray val) { @@ -17235,9 +18040,9 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelInfo_get_node_two( LDKChannelInfo this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); this_ptr_conv.is_owned = false; - int8_tArray arg_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), ChannelInfo_get_node_two(&this_ptr_conv).compressed_form, 33); - return arg_arr; + 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); + return ret_arr; } void __attribute__((visibility("default"))) TS_ChannelInfo_set_node_two(uint32_t this_ptr, int8_tArray val) { @@ -17300,15 +18105,29 @@ void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_mes ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } +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((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + long ret_ref = (long)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 arg_var = ChannelInfo_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + 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) { @@ -17395,11 +18214,11 @@ int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_ LDKRoutingFees obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + 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; } void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_free(uint32_t this_ptr) { @@ -17499,10 +18318,10 @@ void __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_set_address val_constr.data = NULL; uint32_t* val_vals = (uint32_t*)(val + 4); for (size_t m = 0; m < val_constr.datalen; m++) { - uint32_t arr_conv_12 = val_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - val_constr.data[m] = arr_conv_12_conv; + uint32_t val_conv_12 = val_vals[m]; + LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1); + FREE((void*)val_conv_12); + val_constr.data[m] = val_conv_12_conv; } NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr); } @@ -17551,10 +18370,10 @@ uint32_t __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_new(uin 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 arr_conv_12 = addresses_arg_vals[m]; - LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1); - FREE((void*)arr_conv_12); - addresses_arg_constr.data[m] = arr_conv_12_conv; + uint32_t addresses_arg_conv_12 = addresses_arg_vals[m]; + LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1); + FREE((void*)addresses_arg_conv_12); + 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)); @@ -17588,11 +18407,11 @@ int8_tArray __attribute__((visibility("default"))) TS_NodeAnnouncementInfo_writ LDKNodeAnnouncementInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + 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_NodeAnnouncementInfo_read(int8_tArray ser) { @@ -17623,8 +18442,8 @@ void __attribute__((visibility("default"))) TS_NodeInfo_set_channels(uint32_t t val_constr.data = NULL; int64_t* val_vals = (int64_t*)(val + 4); for (size_t i = 0; i < val_constr.datalen; i++) { - int64_t arr_conv_8 = val_vals[i]; - val_constr.data[i] = arr_conv_8; + int64_t val_conv_8 = val_vals[i]; + val_constr.data[i] = val_conv_8; } NodeInfo_set_channels(&this_ptr_conv, val_constr); } @@ -17688,8 +18507,8 @@ uint32_t __attribute__((visibility("default"))) TS_NodeInfo_new(int64_tArray ch 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 arr_conv_8 = channels_arg_vals[i]; - channels_arg_constr.data[i] = arr_conv_8; + 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)); @@ -17727,11 +18546,11 @@ int8_tArray __attribute__((visibility("default"))) TS_NodeInfo_write(uint32_t o LDKNodeInfo obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + 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_NodeInfo_read(int8_tArray ser) { @@ -17747,11 +18566,11 @@ int8_tArray __attribute__((visibility("default"))) TS_NetworkGraph_write(uint32 LDKNetworkGraph obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; - LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv); - int8_tArray arg_arr = init_arr(arg_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(arg_arr + 4), arg_var.data, arg_var.datalen); - CVec_u8Z_free(arg_var); - return arg_arr; + 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) { diff --git a/ts/bindings.ts b/ts/bindings.ts index 64cc2939..712fef7d 100644 --- a/ts/bindings.ts +++ b/ts/bindings.ts @@ -410,10 +410,19 @@ public static native long new_empty_slice_vec(); public static native boolean LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(long arg); public static native void LDKCResult_NoneChannelMonitorUpdateErrZ_get_ok(long arg); public static native LDKChannelMonitorUpdateErr LDKCResult_NoneChannelMonitorUpdateErrZ_get_err(long arg); + public static class LDKMonitorEvent { + private LDKMonitorEvent() {} + export class HTLCEvent extends LDKMonitorEvent { + HTLCEvent() { } + } + export class CommitmentTxBroadcasted extends LDKMonitorEvent { + CommitmentTxBroadcasted() { } + } + static native void init(); + } + static { LDKMonitorEvent.init(); } + public static native LDKMonitorEvent LDKMonitorEvent_ref_from_ptr(long ptr); public static native long LDKCVec_MonitorEventZ_new(number[] elems); - public static native long LDKC2Tuple_u64u64Z_new(number a, number b); - public static native number LDKC2Tuple_u64u64Z_get_a(long ptr); - public static native number LDKC2Tuple_u64u64Z_get_b(long ptr); public static class LDKSpendableOutputDescriptor { private LDKSpendableOutputDescriptor() {} export class StaticOutput extends LDKSpendableOutputDescriptor { @@ -421,20 +430,11 @@ public static native long new_empty_slice_vec(); public number output; StaticOutput(number outpoint, number output) { this.outpoint = outpoint; this.output = output; } } - export class DynamicOutputP2WSH extends LDKSpendableOutputDescriptor { - public number outpoint; - public Uint8Array per_commitment_point; - public number to_self_delay; - public number output; - public number key_derivation_params; - public Uint8Array revocation_pubkey; - DynamicOutputP2WSH(number outpoint, Uint8Array per_commitment_point, number to_self_delay, number output, number key_derivation_params, Uint8Array revocation_pubkey) { this.outpoint = outpoint; this.per_commitment_point = per_commitment_point; this.to_self_delay = to_self_delay; this.output = output; this.key_derivation_params = key_derivation_params; this.revocation_pubkey = revocation_pubkey; } + export class DelayedPaymentOutput extends LDKSpendableOutputDescriptor { + DelayedPaymentOutput() { } } - export class StaticOutputCounterpartyPayment extends LDKSpendableOutputDescriptor { - public number outpoint; - public number output; - public number key_derivation_params; - StaticOutputCounterpartyPayment(number outpoint, number output, number key_derivation_params) { this.outpoint = outpoint; this.output = output; this.key_derivation_params = key_derivation_params; } + export class StaticPaymentOutput extends LDKSpendableOutputDescriptor { + StaticPaymentOutput() { } } static native void init(); } @@ -520,10 +520,10 @@ public static native long new_empty_slice_vec(); // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START - export interface LDKChannelKeys { + export interface LDKSign { get_per_commitment_point (idx: number): Uint8Array; release_commitment_secret (idx: number): Uint8Array; - key_derivation_params (): number; + channel_keys_id (): Uint8Array; sign_counterparty_commitment (commitment_tx: number): number; sign_holder_commitment_and_htlcs (commitment_tx: number): number; sign_justice_transaction (justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: number): number; @@ -534,107 +534,107 @@ public static native long new_empty_slice_vec(); write (): Uint8Array; } - export function LDKChannelKeys_new(impl: LDKChannelKeys, pubkeys: number): number { + export function LDKSign_new(impl: LDKSign, pubkeys: number): number { throw new Error('unimplemented'); // TODO: bind to WASM } // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END - // LDKPublicKey ChannelKeys_get_per_commitment_point LDKChannelKeys* this_arg, uint64_t idx - export function ChannelKeys_get_per_commitment_point(this_arg: number, idx: number): Uint8Array { + // LDKPublicKey Sign_get_per_commitment_point LDKSign* this_arg, uint64_t idx + export function Sign_get_per_commitment_point(this_arg: number, idx: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_get_per_commitment_point(this_arg, idx); + const nativeResponseValue = wasm.Sign_get_per_commitment_point(this_arg, idx); return decodeArray(nativeResponseValue); } - // LDKThirtyTwoBytes ChannelKeys_release_commitment_secret LDKChannelKeys* this_arg, uint64_t idx - export function ChannelKeys_release_commitment_secret(this_arg: number, idx: number): Uint8Array { + // LDKThirtyTwoBytes Sign_release_commitment_secret LDKSign* this_arg, uint64_t idx + export function Sign_release_commitment_secret(this_arg: number, idx: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_release_commitment_secret(this_arg, idx); + const nativeResponseValue = wasm.Sign_release_commitment_secret(this_arg, idx); return decodeArray(nativeResponseValue); } - // LDKC2Tuple_u64u64Z ChannelKeys_key_derivation_params LDKChannelKeys* this_arg - export function ChannelKeys_key_derivation_params(this_arg: number): number { + // LDKThirtyTwoBytes Sign_channel_keys_id LDKSign* this_arg + export function Sign_channel_keys_id(this_arg: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_key_derivation_params(this_arg); - return nativeResponseValue; + const nativeResponseValue = wasm.Sign_channel_keys_id(this_arg); + return decodeArray(nativeResponseValue); } - // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ChannelKeys_sign_counterparty_commitment LDKChannelKeys* this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx - export function ChannelKeys_sign_counterparty_commitment(this_arg: number, commitment_tx: number): number { + // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ Sign_sign_counterparty_commitment LDKSign* this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx + export function Sign_sign_counterparty_commitment(this_arg: number, commitment_tx: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_sign_counterparty_commitment(this_arg, commitment_tx); + const nativeResponseValue = wasm.Sign_sign_counterparty_commitment(this_arg, commitment_tx); return nativeResponseValue; } - // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ChannelKeys_sign_holder_commitment_and_htlcs LDKChannelKeys* this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx - export function ChannelKeys_sign_holder_commitment_and_htlcs(this_arg: number, commitment_tx: number): number { + // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ Sign_sign_holder_commitment_and_htlcs LDKSign* this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx + export function Sign_sign_holder_commitment_and_htlcs(this_arg: number, commitment_tx: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_sign_holder_commitment_and_htlcs(this_arg, commitment_tx); + const nativeResponseValue = wasm.Sign_sign_holder_commitment_and_htlcs(this_arg, commitment_tx); return nativeResponseValue; } - // LDKCResult_SignatureNoneZ ChannelKeys_sign_justice_transaction LDKChannelKeys* this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc - export function ChannelKeys_sign_justice_transaction(this_arg: number, justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: number): number { + // LDKCResult_SignatureNoneZ Sign_sign_justice_transaction LDKSign* this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc + export function Sign_sign_justice_transaction(this_arg: number, justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_sign_justice_transaction(this_arg, encodeArray(justice_tx), input, amount, encodeArray(per_commitment_key), htlc); + const nativeResponseValue = wasm.Sign_sign_justice_transaction(this_arg, encodeArray(justice_tx), input, amount, encodeArray(per_commitment_key), htlc); return nativeResponseValue; } - // LDKCResult_SignatureNoneZ ChannelKeys_sign_counterparty_htlc_transaction LDKChannelKeys* this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc - export function ChannelKeys_sign_counterparty_htlc_transaction(this_arg: number, htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: number): number { + // LDKCResult_SignatureNoneZ Sign_sign_counterparty_htlc_transaction LDKSign* this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc + export function Sign_sign_counterparty_htlc_transaction(this_arg: number, htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_sign_counterparty_htlc_transaction(this_arg, encodeArray(htlc_tx), input, amount, encodeArray(per_commitment_point), htlc); + const nativeResponseValue = wasm.Sign_sign_counterparty_htlc_transaction(this_arg, encodeArray(htlc_tx), input, amount, encodeArray(per_commitment_point), htlc); return nativeResponseValue; } - // LDKCResult_SignatureNoneZ ChannelKeys_sign_closing_transaction LDKChannelKeys* this_arg, struct LDKTransaction closing_tx - export function ChannelKeys_sign_closing_transaction(this_arg: number, closing_tx: Uint8Array): number { + // LDKCResult_SignatureNoneZ Sign_sign_closing_transaction LDKSign* this_arg, struct LDKTransaction closing_tx + export function Sign_sign_closing_transaction(this_arg: number, closing_tx: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_sign_closing_transaction(this_arg, encodeArray(closing_tx)); + const nativeResponseValue = wasm.Sign_sign_closing_transaction(this_arg, encodeArray(closing_tx)); return nativeResponseValue; } - // LDKCResult_SignatureNoneZ ChannelKeys_sign_channel_announcement LDKChannelKeys* this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg - export function ChannelKeys_sign_channel_announcement(this_arg: number, msg: number): number { + // LDKCResult_SignatureNoneZ Sign_sign_channel_announcement LDKSign* this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg + export function Sign_sign_channel_announcement(this_arg: number, msg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_sign_channel_announcement(this_arg, msg); + const nativeResponseValue = wasm.Sign_sign_channel_announcement(this_arg, msg); return nativeResponseValue; } - // void ChannelKeys_ready_channel LDKChannelKeys* this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters - export function ChannelKeys_ready_channel(this_arg: number, channel_parameters: number): void { + // void Sign_ready_channel LDKSign* this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters + export function Sign_ready_channel(this_arg: number, channel_parameters: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_ready_channel(this_arg, channel_parameters); + const nativeResponseValue = wasm.Sign_ready_channel(this_arg, channel_parameters); // debug statements here } - // LDKCVec_u8Z ChannelKeys_write LDKChannelKeys* this_arg - export function ChannelKeys_write(this_arg: number): Uint8Array { + // LDKCVec_u8Z Sign_write LDKSign* this_arg + export function Sign_write(this_arg: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_write(this_arg); + const nativeResponseValue = wasm.Sign_write(this_arg); return decodeArray(nativeResponseValue); } - // LDKChannelPublicKeys ChannelKeys_get_pubkeys LDKChannelKeys* this_arg - export function ChannelKeys_get_pubkeys(this_arg: number): number { + // LDKChannelPublicKeys Sign_get_pubkeys LDKSign* this_arg + export function Sign_get_pubkeys(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_get_pubkeys(this_arg); + const nativeResponseValue = wasm.Sign_get_pubkeys(this_arg); return nativeResponseValue; } public static native long LDKC2Tuple_BlockHashChannelMonitorZ_new(Uint8Array a, number b); @@ -675,7 +675,27 @@ public static native long new_empty_slice_vec(); public static native boolean LDKCResult_NoneAPIErrorZ_result_ok(long arg); public static native void LDKCResult_NoneAPIErrorZ_get_ok(long arg); 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 long LDKCVec_ChannelDetailsZ_new(number[] elems); + public static class LDKPaymentSendFailure { + private LDKPaymentSendFailure() {} + export class ParameterError extends LDKPaymentSendFailure { + ParameterError() { } + } + export class PathParameterError extends LDKPaymentSendFailure { + PathParameterError() { } + } + export class AllFailedRetrySafe extends LDKPaymentSendFailure { + AllFailedRetrySafe() { } + } + export class PartialFailure extends LDKPaymentSendFailure { + PartialFailure() { } + } + static native void init(); + } + static { LDKPaymentSendFailure.init(); } + public static native LDKPaymentSendFailure LDKPaymentSendFailure_ref_from_ptr(long ptr); 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); @@ -746,9 +766,9 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.BroadcasterInterface_broadcast_transaction(this_arg, encodeArray(tx)); // debug statements here } - public static native boolean LDKCResult_ChannelKeysDecodeErrorZ_result_ok(long arg); - public static native number LDKCResult_ChannelKeysDecodeErrorZ_get_ok(long arg); - public static native number LDKCResult_ChannelKeysDecodeErrorZ_get_err(long arg); + public static native boolean LDKCResult_SignDecodeErrorZ_result_ok(long arg); + public static native number LDKCResult_SignDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_SignDecodeErrorZ_get_err(long arg); @@ -758,7 +778,7 @@ public static native long new_empty_slice_vec(); get_node_secret (): Uint8Array; get_destination_script (): Uint8Array; get_shutdown_pubkey (): Uint8Array; - get_channel_keys (inbound: boolean, channel_value_satoshis: number): number; + get_channel_signer (inbound: boolean, channel_value_satoshis: number): number; get_secure_random_bytes (): Uint8Array; read_chan_signer (reader: Uint8Array): number; } @@ -794,12 +814,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.KeysInterface_get_shutdown_pubkey(this_arg); return decodeArray(nativeResponseValue); } - // LDKChannelKeys KeysInterface_get_channel_keys LDKKeysInterface* this_arg, bool inbound, uint64_t channel_value_satoshis - export function KeysInterface_get_channel_keys(this_arg: number, inbound: boolean, channel_value_satoshis: number): number { + // LDKSign KeysInterface_get_channel_signer LDKKeysInterface* this_arg, bool inbound, uint64_t channel_value_satoshis + export function KeysInterface_get_channel_signer(this_arg: number, inbound: boolean, channel_value_satoshis: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.KeysInterface_get_channel_keys(this_arg, inbound, channel_value_satoshis); + const nativeResponseValue = wasm.KeysInterface_get_channel_signer(this_arg, inbound, channel_value_satoshis); return nativeResponseValue; } // LDKThirtyTwoBytes KeysInterface_get_secure_random_bytes LDKKeysInterface* this_arg @@ -810,7 +830,7 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.KeysInterface_get_secure_random_bytes(this_arg); return decodeArray(nativeResponseValue); } - // LDKCResult_ChannelKeysDecodeErrorZ KeysInterface_read_chan_signer LDKKeysInterface* this_arg, struct LDKu8slice reader + // LDKCResult_SignDecodeErrorZ KeysInterface_read_chan_signer LDKKeysInterface* this_arg, struct LDKu8slice reader export function KeysInterface_read_chan_signer(this_arg: number, reader: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); @@ -867,9 +887,16 @@ public static native long new_empty_slice_vec(); public static native boolean LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(long arg); public static native number LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(long arg); public static native number LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(long arg); - public static native boolean LDKCResult_InMemoryChannelKeysDecodeErrorZ_result_ok(long arg); - public static native number LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_ok(long arg); - public static native number LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_err(long arg); + public static native boolean LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(long arg); + public static native Uint8Array[] LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(long arg); + public static native void LDKCResult_CVec_CVec_u8ZZNoneZ_get_err(long arg); + public static native boolean LDKCResult_InMemorySignerDecodeErrorZ_result_ok(long arg); + public static native number LDKCResult_InMemorySignerDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_InMemorySignerDecodeErrorZ_get_err(long arg); + public static native long LDKCVec_TxOutZ_new(number[] elems); + public static native boolean LDKCResult_TransactionNoneZ_result_ok(long arg); + public static native Uint8Array LDKCResult_TransactionNoneZ_get_ok(long arg); + public static native void LDKCResult_TransactionNoneZ_get_err(long arg); public static native long LDKCVec_RouteHopZ_new(number[] elems); public static native boolean LDKCResult_RouteDecodeErrorZ_result_ok(long arg); public static native number LDKCResult_RouteDecodeErrorZ_get_ok(long arg); @@ -1056,6 +1083,39 @@ public static native long new_empty_slice_vec(); +// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START + + export interface LDKListen { + block_connected (block: Uint8Array, height: number): void; + block_disconnected (header: Uint8Array, height: number): void; + } + + export function LDKListen_new(impl: LDKListen): number { + throw new Error('unimplemented'); // TODO: bind to WASM + } + +// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END + + + // void Listen_block_connected LDKListen* this_arg, struct LDKu8slice block, uint32_t height + export function Listen_block_connected(this_arg: number, block: Uint8Array, height: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Listen_block_connected(this_arg, encodeArray(block), height); + // debug statements here + } + // void Listen_block_disconnected LDKListen* this_arg, const uint8_t (*header)[80], uint32_t height + export function Listen_block_disconnected(this_arg: number, header: Uint8Array, height: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Listen_block_disconnected(this_arg, encodeArray(header), height); + // debug statements here + } + + + // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START export interface LDKFilter { @@ -1130,7 +1190,7 @@ public static native long new_empty_slice_vec(); handle_funding_created (their_node_id: Uint8Array, msg: number): void; handle_funding_signed (their_node_id: Uint8Array, msg: number): void; handle_funding_locked (their_node_id: Uint8Array, msg: number): void; - handle_shutdown (their_node_id: Uint8Array, msg: number): void; + handle_shutdown (their_node_id: Uint8Array, their_features: number, msg: number): void; handle_closing_signed (their_node_id: Uint8Array, msg: number): void; handle_update_add_htlc (their_node_id: Uint8Array, msg: number): void; handle_update_fulfill_htlc (their_node_id: Uint8Array, msg: number): void; @@ -1193,12 +1253,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelMessageHandler_handle_funding_locked(this_arg, encodeArray(their_node_id), msg); // debug statements here } - // void ChannelMessageHandler_handle_shutdown LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg - export function ChannelMessageHandler_handle_shutdown(this_arg: number, their_node_id: Uint8Array, msg: number): void { + // void ChannelMessageHandler_handle_shutdown LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg + export function ChannelMessageHandler_handle_shutdown(this_arg: number, their_node_id: Uint8Array, their_features: number, msg: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelMessageHandler_handle_shutdown(this_arg, encodeArray(their_node_id), msg); + const nativeResponseValue = wasm.ChannelMessageHandler_handle_shutdown(this_arg, encodeArray(their_node_id), their_features, msg); // debug statements here } // void ChannelMessageHandler_handle_closing_signed LDKChannelMessageHandler* this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg @@ -2262,6 +2322,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_ChannelInfoDecodeErrorZ_free(_res); // debug statements here } + // struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); + export function CResult_ChannelInfoDecodeErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_ChannelInfoDecodeErrorZ_clone(orig); + return nativeResponseValue; + } // struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); export function CResult_RoutingFeesDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { @@ -2398,6 +2466,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_NetworkGraphDecodeErrorZ_free(_res); // debug statements here } + // struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); + export function CResult_NetworkGraphDecodeErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_NetworkGraphDecodeErrorZ_clone(orig); + return nativeResponseValue; + } // struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); export function C2Tuple_usizeTransactionZ_new(a: number, b: Uint8Array): number { if(!isWasmInitialized) { @@ -2798,6 +2874,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_NoneAPIErrorZ_clone(orig); return nativeResponseValue; } + // void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); + export function CVec_CResult_NoneAPIErrorZZ_free(_res: number[]): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CVec_CResult_NoneAPIErrorZZ_free(_res); + // debug statements here + } + // void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); + export function CVec_APIErrorZ_free(_res: number[]): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CVec_APIErrorZ_free(_res); + // debug statements here + } // void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); export function CVec_ChannelDetailsZ_free(_res: number[]): void { if(!isWasmInitialized) { @@ -2886,30 +2978,6 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res); // debug statements here } - // struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); - export function C2Tuple_u64u64Z_clone(orig: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.C2Tuple_u64u64Z_clone(orig); - return nativeResponseValue; - } - // struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); - export function C2Tuple_u64u64Z_new(a: number, b: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.C2Tuple_u64u64Z_new(a, b); - return nativeResponseValue; - } - // void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); - export function C2Tuple_u64u64Z_free(_res: number): void { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.C2Tuple_u64u64Z_free(_res); - // debug statements here - } // struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); export function CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { @@ -3030,70 +3098,142 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_SignatureNoneZ_clone(orig); return nativeResponseValue; } - // struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_ok(struct LDKChannelKeys o); - export function CResult_ChannelKeysDecodeErrorZ_ok(o: number): number { + // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); + export function CResult_SignDecodeErrorZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_SignDecodeErrorZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_SignDecodeErrorZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_SignDecodeErrorZ_err(e); + return nativeResponseValue; + } + // void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); + export function CResult_SignDecodeErrorZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_SignDecodeErrorZ_free(_res); + // debug statements here + } + // struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); + export function CResult_SignDecodeErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_SignDecodeErrorZ_clone(orig); + return nativeResponseValue; + } + // void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); + export function CVec_CVec_u8ZZ_free(_res: Uint8Array[]): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CVec_CVec_u8ZZ_free(_res); + // debug statements here + } + // struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); + export function CResult_CVec_CVec_u8ZZNoneZ_ok(o: Uint8Array[]): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ChannelKeysDecodeErrorZ_ok(o); + const nativeResponseValue = wasm.CResult_CVec_CVec_u8ZZNoneZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); - export function CResult_ChannelKeysDecodeErrorZ_err(e: number): number { + // struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); + export function CResult_CVec_CVec_u8ZZNoneZ_err(): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ChannelKeysDecodeErrorZ_err(e); + const nativeResponseValue = wasm.CResult_CVec_CVec_u8ZZNoneZ_err(); return nativeResponseValue; } - // void CResult_ChannelKeysDecodeErrorZ_free(struct LDKCResult_ChannelKeysDecodeErrorZ _res); - export function CResult_ChannelKeysDecodeErrorZ_free(_res: number): void { + // void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); + export function CResult_CVec_CVec_u8ZZNoneZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ChannelKeysDecodeErrorZ_free(_res); + const nativeResponseValue = wasm.CResult_CVec_CVec_u8ZZNoneZ_free(_res); // debug statements here } - // struct LDKCResult_ChannelKeysDecodeErrorZ CResult_ChannelKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelKeysDecodeErrorZ *NONNULL_PTR orig); - export function CResult_ChannelKeysDecodeErrorZ_clone(orig: number): number { + // struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); + export function CResult_CVec_CVec_u8ZZNoneZ_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ChannelKeysDecodeErrorZ_clone(orig); + const nativeResponseValue = wasm.CResult_CVec_CVec_u8ZZNoneZ_clone(orig); return nativeResponseValue; } - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_ok(struct LDKInMemoryChannelKeys o); - export function CResult_InMemoryChannelKeysDecodeErrorZ_ok(o: number): number { + // struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); + export function CResult_InMemorySignerDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InMemoryChannelKeysDecodeErrorZ_ok(o); + const nativeResponseValue = wasm.CResult_InMemorySignerDecodeErrorZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_err(struct LDKDecodeError e); - export function CResult_InMemoryChannelKeysDecodeErrorZ_err(e: number): number { + // struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_InMemorySignerDecodeErrorZ_err(e: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InMemoryChannelKeysDecodeErrorZ_err(e); + const nativeResponseValue = wasm.CResult_InMemorySignerDecodeErrorZ_err(e); return nativeResponseValue; } - // void CResult_InMemoryChannelKeysDecodeErrorZ_free(struct LDKCResult_InMemoryChannelKeysDecodeErrorZ _res); - export function CResult_InMemoryChannelKeysDecodeErrorZ_free(_res: number): void { + // void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); + export function CResult_InMemorySignerDecodeErrorZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InMemoryChannelKeysDecodeErrorZ_free(_res); + const nativeResponseValue = wasm.CResult_InMemorySignerDecodeErrorZ_free(_res); // debug statements here } - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ CResult_InMemoryChannelKeysDecodeErrorZ_clone(const struct LDKCResult_InMemoryChannelKeysDecodeErrorZ *NONNULL_PTR orig); - export function CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig: number): number { + // struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); + export function CResult_InMemorySignerDecodeErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_InMemorySignerDecodeErrorZ_clone(orig); + return nativeResponseValue; + } + // void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); + export function CVec_TxOutZ_free(_res: number[]): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CVec_TxOutZ_free(_res); + // debug statements here + } + // struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); + export function CResult_TransactionNoneZ_ok(o: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_TransactionNoneZ_ok(encodeArray(o)); + return nativeResponseValue; + } + // struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); + export function CResult_TransactionNoneZ_err(): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InMemoryChannelKeysDecodeErrorZ_clone(orig); + const nativeResponseValue = wasm.CResult_TransactionNoneZ_err(); return nativeResponseValue; } + // void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); + export function CResult_TransactionNoneZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_TransactionNoneZ_free(_res); + // debug statements here + } // void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); export function CVec_RouteHopZ_free(_res: number[]): void { if(!isWasmInitialized) { @@ -4830,6 +4970,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Access_free(this_ptr); // debug statements here } + // void Listen_free(struct LDKListen this_ptr); + export function Listen_free(this_ptr: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Listen_free(this_ptr); + // debug statements here + } // void Watch_free(struct LDKWatch this_ptr); export function Watch_free(this_ptr: number): void { if(!isWasmInitialized) { @@ -5222,6 +5370,214 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.OutPoint_read(encodeArray(ser)); return nativeResponseValue; } + // void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_ptr); + export function DelayedPaymentOutputDescriptor_free(this_ptr: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_free(this_ptr); + // debug statements here + } + // struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + export function DelayedPaymentOutputDescriptor_get_outpoint(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_get_outpoint(this_ptr); + return nativeResponseValue; + } + // void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + export function DelayedPaymentOutputDescriptor_set_outpoint(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_set_outpoint(this_ptr, val); + // debug statements here + } + // struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + export function DelayedPaymentOutputDescriptor_get_per_commitment_point(this_ptr: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_get_per_commitment_point(this_ptr); + return decodeArray(nativeResponseValue); + } + // void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + export function DelayedPaymentOutputDescriptor_set_per_commitment_point(this_ptr: number, val: Uint8Array): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_set_per_commitment_point(this_ptr, encodeArray(val)); + // debug statements here + } + // uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + export function DelayedPaymentOutputDescriptor_get_to_self_delay(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_get_to_self_delay(this_ptr); + return nativeResponseValue; + } + // void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); + export function DelayedPaymentOutputDescriptor_set_to_self_delay(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_set_to_self_delay(this_ptr, val); + // debug statements here + } + // void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + export function DelayedPaymentOutputDescriptor_set_output(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_set_output(this_ptr, val); + // debug statements here + } + // struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + export function DelayedPaymentOutputDescriptor_get_revocation_pubkey(this_ptr: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this_ptr); + return decodeArray(nativeResponseValue); + } + // void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + export function DelayedPaymentOutputDescriptor_set_revocation_pubkey(this_ptr: number, val: Uint8Array): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this_ptr, encodeArray(val)); + // debug statements here + } + // const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + export function DelayedPaymentOutputDescriptor_get_channel_keys_id(this_ptr: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_get_channel_keys_id(this_ptr); + return decodeArray(nativeResponseValue); + } + // void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + export function DelayedPaymentOutputDescriptor_set_channel_keys_id(this_ptr: number, val: Uint8Array): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_set_channel_keys_id(this_ptr, encodeArray(val)); + // debug statements here + } + // uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + export function DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr); + return nativeResponseValue; + } + // void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + export function DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this_ptr, val); + // debug statements here + } + // MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKPublicKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + export function DelayedPaymentOutputDescriptor_new(outpoint_arg: number, per_commitment_point_arg: Uint8Array, to_self_delay_arg: number, output_arg: number, revocation_pubkey_arg: Uint8Array, channel_keys_id_arg: Uint8Array, channel_value_satoshis_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_new(outpoint_arg, encodeArray(per_commitment_point_arg), to_self_delay_arg, output_arg, encodeArray(revocation_pubkey_arg), encodeArray(channel_keys_id_arg), channel_value_satoshis_arg); + return nativeResponseValue; + } + // struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); + export function DelayedPaymentOutputDescriptor_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DelayedPaymentOutputDescriptor_clone(orig); + return nativeResponseValue; + } + // void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_ptr); + export function StaticPaymentOutputDescriptor_free(this_ptr: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_free(this_ptr); + // debug statements here + } + // struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + export function StaticPaymentOutputDescriptor_get_outpoint(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_get_outpoint(this_ptr); + return nativeResponseValue; + } + // void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); + export function StaticPaymentOutputDescriptor_set_outpoint(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_set_outpoint(this_ptr, val); + // debug statements here + } + // void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); + export function StaticPaymentOutputDescriptor_set_output(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_set_output(this_ptr, val); + // debug statements here + } + // const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; + export function StaticPaymentOutputDescriptor_get_channel_keys_id(this_ptr: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_get_channel_keys_id(this_ptr); + return decodeArray(nativeResponseValue); + } + // void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + export function StaticPaymentOutputDescriptor_set_channel_keys_id(this_ptr: number, val: Uint8Array): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_set_channel_keys_id(this_ptr, encodeArray(val)); + // debug statements here + } + // uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + export function StaticPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr); + return nativeResponseValue; + } + // void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); + export function StaticPaymentOutputDescriptor_set_channel_value_satoshis(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this_ptr, val); + // debug statements here + } + // MUST_USE_RES struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg); + export function StaticPaymentOutputDescriptor_new(outpoint_arg: number, output_arg: number, channel_keys_id_arg: Uint8Array, channel_value_satoshis_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_new(outpoint_arg, output_arg, encodeArray(channel_keys_id_arg), channel_value_satoshis_arg); + return nativeResponseValue; + } + // struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); + export function StaticPaymentOutputDescriptor_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.StaticPaymentOutputDescriptor_clone(orig); + return nativeResponseValue; + } // void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); export function SpendableOutputDescriptor_free(this_ptr: number): void { if(!isWasmInitialized) { @@ -5254,20 +5610,20 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.SpendableOutputDescriptor_read(encodeArray(ser)); return nativeResponseValue; } - // struct LDKChannelKeys ChannelKeys_clone(const struct LDKChannelKeys *NONNULL_PTR orig); - export function ChannelKeys_clone(orig: number): number { + // struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); + export function Sign_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_clone(orig); + const nativeResponseValue = wasm.Sign_clone(orig); return nativeResponseValue; } - // void ChannelKeys_free(struct LDKChannelKeys this_ptr); - export function ChannelKeys_free(this_ptr: number): void { + // void Sign_free(struct LDKSign this_ptr); + export function Sign_free(this_ptr: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelKeys_free(this_ptr); + const nativeResponseValue = wasm.Sign_free(this_ptr); // debug statements here } // void KeysInterface_free(struct LDKKeysInterface this_ptr); @@ -5278,196 +5634,212 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.KeysInterface_free(this_ptr); // debug statements here } - // void InMemoryChannelKeys_free(struct LDKInMemoryChannelKeys this_ptr); - export function InMemoryChannelKeys_free(this_ptr: number): void { + // void InMemorySigner_free(struct LDKInMemorySigner this_ptr); + export function InMemorySigner_free(this_ptr: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_free(this_ptr); + const nativeResponseValue = wasm.InMemorySigner_free(this_ptr); // debug statements here } - // const uint8_t (*InMemoryChannelKeys_get_funding_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - export function InMemoryChannelKeys_get_funding_key(this_ptr: number): Uint8Array { + // const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + export function InMemorySigner_get_funding_key(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_get_funding_key(this_ptr); + const nativeResponseValue = wasm.InMemorySigner_get_funding_key(this_ptr); return decodeArray(nativeResponseValue); } - // void InMemoryChannelKeys_set_funding_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - export function InMemoryChannelKeys_set_funding_key(this_ptr: number, val: Uint8Array): void { + // void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + export function InMemorySigner_set_funding_key(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_set_funding_key(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.InMemorySigner_set_funding_key(this_ptr, encodeArray(val)); // debug statements here } - // const uint8_t (*InMemoryChannelKeys_get_revocation_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - export function InMemoryChannelKeys_get_revocation_base_key(this_ptr: number): Uint8Array { + // const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + export function InMemorySigner_get_revocation_base_key(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_get_revocation_base_key(this_ptr); + const nativeResponseValue = wasm.InMemorySigner_get_revocation_base_key(this_ptr); return decodeArray(nativeResponseValue); } - // void InMemoryChannelKeys_set_revocation_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - export function InMemoryChannelKeys_set_revocation_base_key(this_ptr: number, val: Uint8Array): void { + // void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + export function InMemorySigner_set_revocation_base_key(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_set_revocation_base_key(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.InMemorySigner_set_revocation_base_key(this_ptr, encodeArray(val)); // debug statements here } - // const uint8_t (*InMemoryChannelKeys_get_payment_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - export function InMemoryChannelKeys_get_payment_key(this_ptr: number): Uint8Array { + // const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + export function InMemorySigner_get_payment_key(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_get_payment_key(this_ptr); + const nativeResponseValue = wasm.InMemorySigner_get_payment_key(this_ptr); return decodeArray(nativeResponseValue); } - // void InMemoryChannelKeys_set_payment_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - export function InMemoryChannelKeys_set_payment_key(this_ptr: number, val: Uint8Array): void { + // void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + export function InMemorySigner_set_payment_key(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_set_payment_key(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.InMemorySigner_set_payment_key(this_ptr, encodeArray(val)); // debug statements here } - // const uint8_t (*InMemoryChannelKeys_get_delayed_payment_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - export function InMemoryChannelKeys_get_delayed_payment_base_key(this_ptr: number): Uint8Array { + // const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + export function InMemorySigner_get_delayed_payment_base_key(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_get_delayed_payment_base_key(this_ptr); + const nativeResponseValue = wasm.InMemorySigner_get_delayed_payment_base_key(this_ptr); return decodeArray(nativeResponseValue); } - // void InMemoryChannelKeys_set_delayed_payment_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - export function InMemoryChannelKeys_set_delayed_payment_base_key(this_ptr: number, val: Uint8Array): void { + // void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + export function InMemorySigner_set_delayed_payment_base_key(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_set_delayed_payment_base_key(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.InMemorySigner_set_delayed_payment_base_key(this_ptr, encodeArray(val)); // debug statements here } - // const uint8_t (*InMemoryChannelKeys_get_htlc_base_key(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - export function InMemoryChannelKeys_get_htlc_base_key(this_ptr: number): Uint8Array { + // const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + export function InMemorySigner_get_htlc_base_key(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_get_htlc_base_key(this_ptr); + const nativeResponseValue = wasm.InMemorySigner_get_htlc_base_key(this_ptr); return decodeArray(nativeResponseValue); } - // void InMemoryChannelKeys_set_htlc_base_key(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKSecretKey val); - export function InMemoryChannelKeys_set_htlc_base_key(this_ptr: number, val: Uint8Array): void { + // void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); + export function InMemorySigner_set_htlc_base_key(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_set_htlc_base_key(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.InMemorySigner_set_htlc_base_key(this_ptr, encodeArray(val)); // debug statements here } - // const uint8_t (*InMemoryChannelKeys_get_commitment_seed(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr))[32]; - export function InMemoryChannelKeys_get_commitment_seed(this_ptr: number): Uint8Array { + // const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; + export function InMemorySigner_get_commitment_seed(this_ptr: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_get_commitment_seed(this_ptr); + const nativeResponseValue = wasm.InMemorySigner_get_commitment_seed(this_ptr); return decodeArray(nativeResponseValue); } - // void InMemoryChannelKeys_set_commitment_seed(struct LDKInMemoryChannelKeys *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - export function InMemoryChannelKeys_set_commitment_seed(this_ptr: number, val: Uint8Array): void { + // void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + export function InMemorySigner_set_commitment_seed(this_ptr: number, val: Uint8Array): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_set_commitment_seed(this_ptr, encodeArray(val)); + const nativeResponseValue = wasm.InMemorySigner_set_commitment_seed(this_ptr, encodeArray(val)); // debug statements here } - // struct LDKInMemoryChannelKeys InMemoryChannelKeys_clone(const struct LDKInMemoryChannelKeys *NONNULL_PTR orig); - export function InMemoryChannelKeys_clone(orig: number): number { + // struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); + export function InMemorySigner_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_clone(orig); + const nativeResponseValue = wasm.InMemorySigner_clone(orig); return nativeResponseValue; } - // MUST_USE_RES struct LDKInMemoryChannelKeys InMemoryChannelKeys_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKC2Tuple_u64u64Z key_derivation_params); - export function InMemoryChannelKeys_new(funding_key: Uint8Array, revocation_base_key: Uint8Array, payment_key: Uint8Array, delayed_payment_base_key: Uint8Array, htlc_base_key: Uint8Array, commitment_seed: Uint8Array, channel_value_satoshis: number, key_derivation_params: number): number { + // MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + export function InMemorySigner_new(funding_key: Uint8Array, revocation_base_key: Uint8Array, payment_key: Uint8Array, delayed_payment_base_key: Uint8Array, htlc_base_key: Uint8Array, commitment_seed: Uint8Array, channel_value_satoshis: number, channel_keys_id: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_new(encodeArray(funding_key), encodeArray(revocation_base_key), encodeArray(payment_key), encodeArray(delayed_payment_base_key), encodeArray(htlc_base_key), encodeArray(commitment_seed), channel_value_satoshis, key_derivation_params); + const nativeResponseValue = wasm.InMemorySigner_new(encodeArray(funding_key), encodeArray(revocation_base_key), encodeArray(payment_key), encodeArray(delayed_payment_base_key), encodeArray(htlc_base_key), encodeArray(commitment_seed), channel_value_satoshis, encodeArray(channel_keys_id)); return nativeResponseValue; } - // MUST_USE_RES struct LDKChannelPublicKeys InMemoryChannelKeys_counterparty_pubkeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - export function InMemoryChannelKeys_counterparty_pubkeys(this_arg: number): number { + // MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_counterparty_pubkeys(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_counterparty_pubkeys(this_arg); + const nativeResponseValue = wasm.InMemorySigner_counterparty_pubkeys(this_arg); return nativeResponseValue; } - // MUST_USE_RES uint16_t InMemoryChannelKeys_counterparty_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - export function InMemoryChannelKeys_counterparty_selected_contest_delay(this_arg: number): number { + // MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_counterparty_selected_contest_delay(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_counterparty_selected_contest_delay(this_arg); + const nativeResponseValue = wasm.InMemorySigner_counterparty_selected_contest_delay(this_arg); return nativeResponseValue; } - // MUST_USE_RES uint16_t InMemoryChannelKeys_holder_selected_contest_delay(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - export function InMemoryChannelKeys_holder_selected_contest_delay(this_arg: number): number { + // MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_holder_selected_contest_delay(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_holder_selected_contest_delay(this_arg); + const nativeResponseValue = wasm.InMemorySigner_holder_selected_contest_delay(this_arg); return nativeResponseValue; } - // MUST_USE_RES bool InMemoryChannelKeys_is_outbound(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - export function InMemoryChannelKeys_is_outbound(this_arg: number): boolean { + // MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_is_outbound(this_arg: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_is_outbound(this_arg); + const nativeResponseValue = wasm.InMemorySigner_is_outbound(this_arg); return nativeResponseValue; } - // MUST_USE_RES struct LDKOutPoint InMemoryChannelKeys_funding_outpoint(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - export function InMemoryChannelKeys_funding_outpoint(this_arg: number): number { + // MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_funding_outpoint(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_funding_outpoint(this_arg); + const nativeResponseValue = wasm.InMemorySigner_funding_outpoint(this_arg); return nativeResponseValue; } - // MUST_USE_RES struct LDKChannelTransactionParameters InMemoryChannelKeys_get_channel_parameters(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - export function InMemoryChannelKeys_get_channel_parameters(this_arg: number): number { + // MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_get_channel_parameters(this_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_get_channel_parameters(this_arg); + const nativeResponseValue = wasm.InMemorySigner_get_channel_parameters(this_arg); return nativeResponseValue; } - // struct LDKChannelKeys InMemoryChannelKeys_as_ChannelKeys(const struct LDKInMemoryChannelKeys *NONNULL_PTR this_arg); - export function InMemoryChannelKeys_as_ChannelKeys(this_arg: number): number { + // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); + export function InMemorySigner_sign_counterparty_payment_input(this_arg: number, spend_tx: Uint8Array, input_idx: number, descriptor: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_as_ChannelKeys(this_arg); + const nativeResponseValue = wasm.InMemorySigner_sign_counterparty_payment_input(this_arg, encodeArray(spend_tx), input_idx, descriptor); return nativeResponseValue; } - // struct LDKCVec_u8Z InMemoryChannelKeys_write(const struct LDKInMemoryChannelKeys *NONNULL_PTR obj); - export function InMemoryChannelKeys_write(obj: number): Uint8Array { + // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); + export function InMemorySigner_sign_dynamic_p2wsh_input(this_arg: number, spend_tx: Uint8Array, input_idx: number, descriptor: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_write(obj); + const nativeResponseValue = wasm.InMemorySigner_sign_dynamic_p2wsh_input(this_arg, encodeArray(spend_tx), input_idx, descriptor); + return nativeResponseValue; + } + // struct LDKSign InMemorySigner_as_Sign(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_as_Sign(this_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.InMemorySigner_as_Sign(this_arg); + return nativeResponseValue; + } + // struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); + export function InMemorySigner_write(obj: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.InMemorySigner_write(obj); return decodeArray(nativeResponseValue); } - // struct LDKCResult_InMemoryChannelKeysDecodeErrorZ InMemoryChannelKeys_read(struct LDKu8slice ser); - export function InMemoryChannelKeys_read(ser: Uint8Array): number { + // struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser); + export function InMemorySigner_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InMemoryChannelKeys_read(encodeArray(ser)); + const nativeResponseValue = wasm.InMemorySigner_read(encodeArray(ser)); return nativeResponseValue; } // void KeysManager_free(struct LDKKeysManager this_ptr); @@ -5478,20 +5850,28 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.KeysManager_free(this_ptr); // debug statements here } - // MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], enum LDKNetwork network, uint64_t starting_time_secs, uint32_t starting_time_nanos); - export function KeysManager_new(seed: Uint8Array, network: LDKNetwork, starting_time_secs: number, starting_time_nanos: number): number { + // MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); + export function KeysManager_new(seed: Uint8Array, starting_time_secs: number, starting_time_nanos: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.KeysManager_new(encodeArray(seed), starting_time_secs, starting_time_nanos); + return nativeResponseValue; + } + // MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); + export function KeysManager_derive_channel_keys(this_arg: number, channel_value_satoshis: number, params: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.KeysManager_new(encodeArray(seed), network, starting_time_secs, starting_time_nanos); + const nativeResponseValue = wasm.KeysManager_derive_channel_keys(this_arg, channel_value_satoshis, encodeArray(params)); return nativeResponseValue; } - // MUST_USE_RES struct LDKInMemoryChannelKeys KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, uint64_t params_1, uint64_t params_2); - export function KeysManager_derive_channel_keys(this_arg: number, channel_value_satoshis: number, params_1: number, params_2: number): number { + // MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); + export function KeysManager_spend_spendable_outputs(this_arg: number, descriptors: number[], outputs: number[], change_destination_script: Uint8Array, feerate_sat_per_1000_weight: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.KeysManager_derive_channel_keys(this_arg, channel_value_satoshis, params_1, params_2); + const nativeResponseValue = wasm.KeysManager_spend_spendable_outputs(this_arg, descriptors, outputs, encodeArray(change_destination_script), feerate_sat_per_1000_weight); return nativeResponseValue; } // struct LDKKeysInterface KeysManager_as_KeysInterface(const struct LDKKeysManager *NONNULL_PTR this_arg); @@ -5814,6 +6194,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelManager_as_EventsProvider(this_arg); return nativeResponseValue; } + // struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); + export function ChannelManager_as_Listen(this_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelManager_as_Listen(this_arg); + return nativeResponseValue; + } // void ChannelManager_block_connected(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); export function ChannelManager_block_connected(this_arg: number, header: Uint8Array, txdata: number[], height: number): void { if(!isWasmInitialized) { @@ -5830,6 +6218,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelManager_block_disconnected(this_arg, encodeArray(header)); // debug statements here } + // void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg); + export function ChannelManager_await_persistable_update(this_arg: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelManager_await_persistable_update(this_arg); + // debug statements here + } // struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); export function ChannelManager_as_ChannelMessageHandler(this_arg: number): number { if(!isWasmInitialized) { @@ -5990,6 +6386,30 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Init_free(this_ptr); // debug statements here } + // struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); + export function Init_get_features(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Init_get_features(this_ptr); + return nativeResponseValue; + } + // void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); + export function Init_set_features(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Init_set_features(this_ptr, val); + // debug statements here + } + // MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg); + export function Init_new(features_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Init_new(features_arg); + return nativeResponseValue; + } // struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); export function Init_clone(orig: number): number { if(!isWasmInitialized) { @@ -10950,6 +11370,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.NetworkGraph_free(this_ptr); // debug statements here } + // 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.NetworkGraph_clone(orig); + return nativeResponseValue; + } // void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_ptr); export function LockedNetworkGraph_free(this_ptr: number): void { if(!isWasmInitialized) { @@ -11246,6 +11674,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelInfo_set_announcement_message(this_ptr, val); // debug statements here } + // 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.ChannelInfo_clone(orig); + return nativeResponseValue; + } // struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); export function ChannelInfo_write(obj: number): Uint8Array { if(!isWasmInitialized) { diff --git a/ts/enums/LDKSecp256k1Error.ts b/ts/enums/LDKSecp256k1Error.ts index 62670097..58410b8c 100644 --- a/ts/enums/LDKSecp256k1Error.ts +++ b/ts/enums/LDKSecp256k1Error.ts @@ -7,7 +7,7 @@ LDKSecp256k1Error_InvalidSecretKey, LDKSecp256k1Error_InvalidRecoveryId, LDKSecp256k1Error_InvalidTweak, + LDKSecp256k1Error_TweakCheckFailed, LDKSecp256k1Error_NotEnoughMemory, - LDKSecp256k1Error_CallbackPanicked, } diff --git a/ts/structs/ChainMonitor.ts b/ts/structs/ChainMonitor.ts index 24938804..5283bdd5 100644 --- a/ts/structs/ChainMonitor.ts +++ b/ts/structs/ChainMonitor.ts @@ -19,7 +19,7 @@ import * as bindings from '../bindings' // TODO: figure out location } } public void block_connected(Uint8Array header, TwoTuple[] txdata, number height) { - bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).map(arr_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_30.a, arr_conv_30.b)).toArray(number[]::new), height); + bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).map(txdata_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_30.a, txdata_conv_30.b)).toArray(number[]::new), height); /* TODO 2 TwoTuple */; } diff --git a/ts/structs/ChannelInfo.ts b/ts/structs/ChannelInfo.ts index 6ea880e4..ea7a292f 100644 --- a/ts/structs/ChannelInfo.ts +++ b/ts/structs/ChannelInfo.ts @@ -84,6 +84,13 @@ import * as bindings from '../bindings' // TODO: figure out location this.ptrs_to.add(val); } + public ChannelInfo clone() { + number ret = bindings.ChannelInfo_clone(this.ptr); + const ret_hu_conv: ChannelInfo = new ChannelInfo(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + public Uint8Array write() { Uint8Array ret = bindings.ChannelInfo_write(this.ptr); return ret; diff --git a/ts/structs/ChannelKeys.ts b/ts/structs/ChannelKeys.ts deleted file mode 100644 index 61daa256..00000000 --- a/ts/structs/ChannelKeys.ts +++ /dev/null @@ -1,212 +0,0 @@ - - -import CommonBase from './CommonBase'; -import * as bindings from '../bindings' // TODO: figure out location - - - - export class ChannelKeys extends CommonBase { - - bindings_instance?: bindings.LDKChannelKeys; - - constructor(ptr?: number, arg?: bindings.LDKChannelKeys, pubkeys?: ChannelPublicKeys) { - if (Number.isFinite(ptr)) { - super(ptr); - this.bindings_instance = null; - } else { - // TODO: private constructor instantiation - super(bindings.LDKChannelKeys_new(arg, pubkeys == null ? 0 : pubkeys.ptr & ~1)); - this.ptrs_to.push(arg); - this.ptrs_to.add(pubkeys); - - } - } - - protected finalize() { - if (this.ptr != 0) { - bindings.ChannelKeys_free(this.ptr); - } - super.finalize(); - } - - static new_impl(arg: ChannelKeysInterface, pubkeys: ChannelPublicKeys): ChannelKeys { - const impl_holder: LDKChannelKeysHolder = new LDKChannelKeysHolder(); - let structImplementation = { - // todo: in-line interface filling - get_per_commitment_point (idx: number): Uint8Array { - Uint8Array ret = arg.get_per_commitment_point(idx); - return ret; - }, - - release_commitment_secret (idx: number): Uint8Array { - Uint8Array ret = arg.release_commitment_secret(idx); - return ret; - }, - - key_derivation_params (): number { - TwoTuple ret = arg.key_derivation_params(); - result: number = bindings.C2Tuple_u64u64Z_new(ret.a, ret.b); - return result; - }, - - sign_counterparty_commitment (commitment_tx: number): number { - const commitment_tx_hu_conv: CommitmentTransaction = new CommitmentTransaction(null, commitment_tx); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv); - result: number = ret != null ? ret.ptr : 0; - return result; - }, - - sign_holder_commitment_and_htlcs (commitment_tx: number): number { - const commitment_tx_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, commitment_tx); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv); - result: number = ret != null ? ret.ptr : 0; - return result; - }, - - sign_justice_transaction (justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: number): number { - const htlc_hu_conv: HTLCOutputInCommitment = new HTLCOutputInCommitment(null, htlc); - Result_SignatureNoneZ ret = arg.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc_hu_conv); - result: number = ret != null ? ret.ptr : 0; - return result; - }, - - sign_counterparty_htlc_transaction (htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: number): number { - const htlc_hu_conv: HTLCOutputInCommitment = new HTLCOutputInCommitment(null, htlc); - Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv); - result: number = ret != null ? ret.ptr : 0; - return result; - }, - - sign_closing_transaction (closing_tx: Uint8Array): number { - Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx); - result: number = ret != null ? ret.ptr : 0; - return result; - }, - - sign_channel_announcement (msg: number): number { - const msg_hu_conv: UnsignedChannelAnnouncement = new UnsignedChannelAnnouncement(null, msg); - Result_SignatureNoneZ ret = arg.sign_channel_announcement(msg_hu_conv); - result: number = ret != null ? ret.ptr : 0; - return result; - }, - - ready_channel (channel_parameters: number): void { - const channel_parameters_hu_conv: ChannelTransactionParameters = new ChannelTransactionParameters(null, channel_parameters); - arg.ready_channel(channel_parameters_hu_conv); - }, - - write (): Uint8Array { - Uint8Array ret = arg.write(); - return ret; - }, - - - }; - impl_holder.held = new ChannelKeys (null, structImplementation, pubkeys); - } - } - - export interface ChannelKeysInterface { - get_per_commitment_point(idx: number): Uint8Array; - release_commitment_secret(idx: number): Uint8Array; - key_derivation_params(): TwoTuple; - sign_counterparty_commitment(commitment_tx: CommitmentTransaction): Result_C2Tuple_SignatureCVec_SignatureZZNoneZ; - sign_holder_commitment_and_htlcs(commitment_tx: HolderCommitmentTransaction): Result_C2Tuple_SignatureCVec_SignatureZZNoneZ; - sign_justice_transaction(justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: HTLCOutputInCommitment): Result_SignatureNoneZ; - sign_counterparty_htlc_transaction(htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: HTLCOutputInCommitment): Result_SignatureNoneZ; - sign_closing_transaction(closing_tx: Uint8Array): Result_SignatureNoneZ; - sign_channel_announcement(msg: UnsignedChannelAnnouncement): Result_SignatureNoneZ; - ready_channel(channel_parameters: ChannelTransactionParameters): void; - write(): Uint8Array; - - } - - class LDKChannelKeysHolder { - held: ChannelKeys; - } - public Uint8Array get_per_commitment_point(number idx) { - Uint8Array ret = bindings.ChannelKeys_get_per_commitment_point(this.ptr, idx); - return ret; - } - - public Uint8Array release_commitment_secret(number idx) { - Uint8Array ret = bindings.ChannelKeys_release_commitment_secret(this.ptr, idx); - return ret; - } - - public TwoTuple key_derivation_params() { - number ret = bindings.ChannelKeys_key_derivation_params(this.ptr); - number ret_a = bindings.LDKC2Tuple_u64u64Z_get_a(ret); - number ret_b = bindings.LDKC2Tuple_u64u64Z_get_b(ret); - TwoTuple ret_conv = new TwoTuple(ret_a, ret_b, () -> { - bindings.C2Tuple_u64u64Z_free(ret); - }); - return ret_conv; - } - - public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx) { - number ret = bindings.ChannelKeys_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(commitment_tx); - return ret_hu_conv; - } - - public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) { - number ret = bindings.ChannelKeys_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); - Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(commitment_tx); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_justice_transaction(Uint8Array justice_tx, number input, number amount, Uint8Array per_commitment_key, HTLCOutputInCommitment htlc) { - number ret = bindings.ChannelKeys_sign_justice_transaction(this.ptr, justice_tx, input, amount, per_commitment_key, htlc == null ? 0 : htlc.ptr & ~1); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(htlc); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_counterparty_htlc_transaction(Uint8Array htlc_tx, number input, number amount, Uint8Array per_commitment_point, HTLCOutputInCommitment htlc) { - number ret = bindings.ChannelKeys_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, per_commitment_point, htlc == null ? 0 : htlc.ptr & ~1); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(htlc); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_closing_transaction(Uint8Array closing_tx) { - number ret = bindings.ChannelKeys_sign_closing_transaction(this.ptr, closing_tx); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - public Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) { - number ret = bindings.ChannelKeys_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); - Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); - this.ptrs_to.add(msg); - return ret_hu_conv; - } - - public void ready_channel(ChannelTransactionParameters channel_parameters) { - bindings.ChannelKeys_ready_channel(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1); - this.ptrs_to.add(channel_parameters); - } - - public Uint8Array write() { - Uint8Array ret = bindings.ChannelKeys_write(this.ptr); - return ret; - } - - public ChannelPublicKeys get_pubkeys() { - number ret = bindings.ChannelKeys_get_pubkeys(this.ptr); - const ret_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public ChannelKeys clone() { - number ret = bindings.ChannelKeys_clone(this.ptr); - ChannelKeys ret_hu_conv = new ChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - -} diff --git a/ts/structs/ChannelManager.ts b/ts/structs/ChannelManager.ts index 3d50c586..10525ab8 100644 --- a/ts/structs/ChannelManager.ts +++ b/ts/structs/ChannelManager.ts @@ -40,26 +40,26 @@ import * as bindings from '../bindings' // TODO: figure out location public ChannelDetails[] list_channels() { number[] ret = bindings.ChannelManager_list_channels(this.ptr); - ChannelDetails[] arr_conv_16_arr = new ChannelDetails[ret.length]; + ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret.length]; for (int q = 0; q < ret.length; q++) { - number arr_conv_16 = ret[q]; - const arr_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, arr_conv_16); - arr_conv_16_hu_conv.ptrs_to.add(this); - arr_conv_16_arr[q] = arr_conv_16_hu_conv; + number ret_conv_16 = ret[q]; + const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16); + ret_conv_16_hu_conv.ptrs_to.add(this); + ret_conv_16_arr[q] = ret_conv_16_hu_conv; } - return arr_conv_16_arr; + return ret_conv_16_arr; } public ChannelDetails[] list_usable_channels() { number[] ret = bindings.ChannelManager_list_usable_channels(this.ptr); - ChannelDetails[] arr_conv_16_arr = new ChannelDetails[ret.length]; + ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret.length]; for (int q = 0; q < ret.length; q++) { - number arr_conv_16 = ret[q]; - const arr_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, arr_conv_16); - arr_conv_16_hu_conv.ptrs_to.add(this); - arr_conv_16_arr[q] = arr_conv_16_hu_conv; + number ret_conv_16 = ret[q]; + const ret_conv_16_hu_conv: ChannelDetails = new ChannelDetails(null, ret_conv_16); + ret_conv_16_hu_conv.ptrs_to.add(this); + ret_conv_16_arr[q] = ret_conv_16_hu_conv; } - return arr_conv_16_arr; + return ret_conv_16_arr; } public Result_NoneAPIErrorZ close_channel(Uint8Array channel_id) { @@ -91,7 +91,7 @@ import * as bindings from '../bindings' // TODO: figure out location } public void broadcast_node_announcement(Uint8Array rgb, Uint8Array alias, NetAddress[] addresses) { - bindings.ChannelManager_broadcast_node_announcement(this.ptr, rgb, alias, Arrays.stream(addresses).map(arr_conv_12 -> arr_conv_12.ptr).toArray(number[]::new)); + bindings.ChannelManager_broadcast_node_announcement(this.ptr, rgb, alias, Arrays.stream(addresses).map(addresses_conv_12 -> addresses_conv_12.ptr).toArray(number[]::new)); /* TODO 2 NetAddress */; } @@ -137,8 +137,15 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public Listen as_Listen() { + number ret = bindings.ChannelManager_as_Listen(this.ptr); + Listen ret_hu_conv = new Listen(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + public void block_connected(Uint8Array header, TwoTuple[] txdata, number height) { - bindings.ChannelManager_block_connected(this.ptr, header, Arrays.stream(txdata).map(arr_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_30.a, arr_conv_30.b)).toArray(number[]::new), height); + bindings.ChannelManager_block_connected(this.ptr, header, Arrays.stream(txdata).map(txdata_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_30.a, txdata_conv_30.b)).toArray(number[]::new), height); /* TODO 2 TwoTuple */; } @@ -146,6 +153,10 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelManager_block_disconnected(this.ptr, header); } + public void await_persistable_update() { + bindings.ChannelManager_await_persistable_update(this.ptr); + } + public ChannelMessageHandler as_ChannelMessageHandler() { number ret = bindings.ChannelManager_as_ChannelMessageHandler(this.ptr); ChannelMessageHandler ret_hu_conv = new ChannelMessageHandler(null, ret); diff --git a/ts/structs/ChannelManagerReadArgs.ts b/ts/structs/ChannelManagerReadArgs.ts index 7db1a875..596df3a8 100644 --- a/ts/structs/ChannelManagerReadArgs.ts +++ b/ts/structs/ChannelManagerReadArgs.ts @@ -91,7 +91,7 @@ import * as bindings from '../bindings' // TODO: figure out location } public static ChannelManagerReadArgs constructor_new(KeysInterface keys_manager, FeeEstimator fee_estimator, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Logger logger, UserConfig default_config, ChannelMonitor[] channel_monitors) { - number ret = bindings.ChannelManagerReadArgs_new(keys_manager == null ? 0 : keys_manager.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr & ~1, Arrays.stream(channel_monitors).map(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray(number[]::new)); + number ret = bindings.ChannelManagerReadArgs_new(keys_manager == null ? 0 : keys_manager.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr & ~1, Arrays.stream(channel_monitors).map(channel_monitors_conv_16 -> channel_monitors_conv_16 == null ? 0 : channel_monitors_conv_16.ptr & ~1).toArray(number[]::new)); const ret_hu_conv: ChannelManagerReadArgs = new ChannelManagerReadArgs(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(keys_manager); diff --git a/ts/structs/ChannelMessageHandler.ts b/ts/structs/ChannelMessageHandler.ts index 7b1654f5..a9ffbd7c 100644 --- a/ts/structs/ChannelMessageHandler.ts +++ b/ts/structs/ChannelMessageHandler.ts @@ -62,9 +62,10 @@ import * as bindings from '../bindings' // TODO: figure out location arg.handle_funding_locked(their_node_id, msg_hu_conv); }, - handle_shutdown (their_node_id: Uint8Array, msg: number): void { + handle_shutdown (their_node_id: Uint8Array, their_features: number, msg: number): void { + const their_features_hu_conv: InitFeatures = new InitFeatures(null, their_features); const msg_hu_conv: Shutdown = new Shutdown(null, msg); - arg.handle_shutdown(their_node_id, msg_hu_conv); + arg.handle_shutdown(their_node_id, their_features_hu_conv, msg_hu_conv); }, handle_closing_signed (their_node_id: Uint8Array, msg: number): void { @@ -143,7 +144,7 @@ import * as bindings from '../bindings' // TODO: figure out location handle_funding_created(their_node_id: Uint8Array, msg: FundingCreated): void; handle_funding_signed(their_node_id: Uint8Array, msg: FundingSigned): void; handle_funding_locked(their_node_id: Uint8Array, msg: FundingLocked): void; - handle_shutdown(their_node_id: Uint8Array, msg: Shutdown): void; + handle_shutdown(their_node_id: Uint8Array, their_features: InitFeatures, msg: Shutdown): void; handle_closing_signed(their_node_id: Uint8Array, msg: ClosingSigned): void; handle_update_add_htlc(their_node_id: Uint8Array, msg: UpdateAddHTLC): void; handle_update_fulfill_htlc(their_node_id: Uint8Array, msg: UpdateFulfillHTLC): void; @@ -190,8 +191,9 @@ import * as bindings from '../bindings' // TODO: figure out location this.ptrs_to.add(msg); } - public void handle_shutdown(Uint8Array their_node_id, Shutdown msg) { - bindings.ChannelMessageHandler_handle_shutdown(this.ptr, their_node_id, msg == null ? 0 : msg.ptr & ~1); + public void handle_shutdown(Uint8Array their_node_id, InitFeatures their_features, Shutdown msg) { + bindings.ChannelMessageHandler_handle_shutdown(this.ptr, their_node_id, their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1); + this.ptrs_to.add(their_features); this.ptrs_to.add(msg); } diff --git a/ts/structs/ChannelMonitor.ts b/ts/structs/ChannelMonitor.ts index 0d9ad396..a2f59137 100644 --- a/ts/structs/ChannelMonitor.ts +++ b/ts/structs/ChannelMonitor.ts @@ -60,26 +60,26 @@ import * as bindings from '../bindings' // TODO: figure out location public MonitorEvent[] get_and_clear_pending_monitor_events() { number[] ret = bindings.ChannelMonitor_get_and_clear_pending_monitor_events(this.ptr); - MonitorEvent[] arr_conv_14_arr = new MonitorEvent[ret.length]; + MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length]; for (int o = 0; o < ret.length; o++) { - number arr_conv_14 = ret[o]; - const arr_conv_14_hu_conv: MonitorEvent = new MonitorEvent(null, arr_conv_14); - arr_conv_14_hu_conv.ptrs_to.add(this); - arr_conv_14_arr[o] = arr_conv_14_hu_conv; + number ret_conv_14 = ret[o]; + MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14); + ret_conv_14_hu_conv.ptrs_to.add(this); + ret_conv_14_arr[o] = ret_conv_14_hu_conv; } - return arr_conv_14_arr; + return ret_conv_14_arr; } public Event[] get_and_clear_pending_events() { number[] ret = bindings.ChannelMonitor_get_and_clear_pending_events(this.ptr); - Event[] arr_conv_7_arr = new Event[ret.length]; + Event[] ret_conv_7_arr = new Event[ret.length]; for (int h = 0; h < ret.length; h++) { - number arr_conv_7 = ret[h]; - Event arr_conv_7_hu_conv = Event.constr_from_ptr(arr_conv_7); - arr_conv_7_hu_conv.ptrs_to.add(this); - arr_conv_7_arr[h] = arr_conv_7_hu_conv; + number ret_conv_7 = ret[h]; + Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7); + ret_conv_7_hu_conv.ptrs_to.add(this); + ret_conv_7_arr[h] = ret_conv_7_hu_conv; } - return arr_conv_7_arr; + return ret_conv_7_arr; } public Uint8Array[] get_latest_holder_commitment_txn(Logger logger) { @@ -89,33 +89,33 @@ import * as bindings from '../bindings' // TODO: figure out location } public TwoTuple[]>[] block_connected(Uint8Array header, TwoTuple[] txdata, number height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { - number[] ret = bindings.ChannelMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).map(arr_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_30.a, arr_conv_30.b)).toArray(number[]::new), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); - TwoTuple[]>[] arr_conv_49_arr = new TwoTuple[ret.length]; + number[] ret = bindings.ChannelMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).map(txdata_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_30.a, txdata_conv_30.b)).toArray(number[]::new), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + TwoTuple[]>[] ret_conv_49_arr = new TwoTuple[ret.length]; for (int x = 0; x < ret.length; x++) { - number arr_conv_49 = ret[x]; - Uint8Array arr_conv_49_a = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(arr_conv_49); - number[] arr_conv_49_b = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(arr_conv_49); - TwoTuple[] arr_conv_25_arr = new TwoTuple[arr_conv_49_b.length]; - for (int z = 0; z < arr_conv_49_b.length; z++) { - number arr_conv_25 = arr_conv_49_b[z]; - number arr_conv_25_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(arr_conv_25); - number arr_conv_25_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(arr_conv_25)); - TxOut arr_conv_25_b_conv = new TxOut(null, arr_conv_25_b);; - TwoTuple arr_conv_25_conv = new TwoTuple(arr_conv_25_a, arr_conv_25_b_conv, () -> { - bindings.C2Tuple_u32TxOutZ_free(arr_conv_25); + number ret_conv_49 = ret[x]; + Uint8Array ret_conv_49_a = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(ret_conv_49); + number[] ret_conv_49_b = bindings.LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(ret_conv_49); + TwoTuple[] ret_conv_49_b_conv_25_arr = new TwoTuple[ret_conv_49_b.length]; + for (int z = 0; z < ret_conv_49_b.length; z++) { + number ret_conv_49_b_conv_25 = ret_conv_49_b[z]; + number ret_conv_49_b_conv_25_a = bindings.LDKC2Tuple_u32TxOutZ_get_a(ret_conv_49_b_conv_25); + number ret_conv_49_b_conv_25_b = bindings.TxOut_clone(bindings.LDKC2Tuple_u32TxOutZ_get_b(ret_conv_49_b_conv_25)); + TxOut ret_conv_49_b_conv_25_b_conv = new TxOut(null, ret_conv_49_b_conv_25_b);; + TwoTuple ret_conv_49_b_conv_25_conv = new TwoTuple(ret_conv_49_b_conv_25_a, ret_conv_49_b_conv_25_b_conv, () -> { + bindings.C2Tuple_u32TxOutZ_free(ret_conv_49_b_conv_25); }); - arr_conv_25_b_conv.ptrs_to.add(arr_conv_25_conv); - arr_conv_25_arr[z] = arr_conv_25_conv; + ret_conv_49_b_conv_25_b_conv.ptrs_to.add(ret_conv_49_b_conv_25_conv); + ret_conv_49_b_conv_25_arr[z] = ret_conv_49_b_conv_25_conv; }; - TwoTuple[]> arr_conv_49_conv = new TwoTuple[]>(arr_conv_49_a, arr_conv_25_arr); + TwoTuple[]> ret_conv_49_conv = new TwoTuple[]>(ret_conv_49_a, ret_conv_49_b_conv_25_arr); // Warning: We may not free the C tuple object! - arr_conv_49_arr[x] = arr_conv_49_conv; + ret_conv_49_arr[x] = ret_conv_49_conv; } /* TODO 2 TwoTuple */; this.ptrs_to.add(broadcaster); this.ptrs_to.add(fee_estimator); this.ptrs_to.add(logger); - return arr_conv_49_arr; + return ret_conv_49_arr; } public void block_disconnected(Uint8Array header, number height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { diff --git a/ts/structs/CommitmentUpdate.ts b/ts/structs/CommitmentUpdate.ts index 685dee86..39aed69e 100644 --- a/ts/structs/CommitmentUpdate.ts +++ b/ts/structs/CommitmentUpdate.ts @@ -19,22 +19,22 @@ import * as bindings from '../bindings' // TODO: figure out location } } public void set_update_add_htlcs(UpdateAddHTLC[] val) { - bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, Arrays.stream(val).map(arr_conv_15 -> arr_conv_15 == null ? 0 : arr_conv_15.ptr & ~1).toArray(number[]::new)); + bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, Arrays.stream(val).map(val_conv_15 -> val_conv_15 == null ? 0 : val_conv_15.ptr & ~1).toArray(number[]::new)); /* TODO 2 UpdateAddHTLC */; } public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) { - bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, Arrays.stream(val).map(arr_conv_19 -> arr_conv_19 == null ? 0 : arr_conv_19.ptr & ~1).toArray(number[]::new)); + bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, Arrays.stream(val).map(val_conv_19 -> val_conv_19 == null ? 0 : val_conv_19.ptr & ~1).toArray(number[]::new)); /* TODO 2 UpdateFulfillHTLC */; } public void set_update_fail_htlcs(UpdateFailHTLC[] val) { - bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, Arrays.stream(val).map(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray(number[]::new)); + bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, Arrays.stream(val).map(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr & ~1).toArray(number[]::new)); /* TODO 2 UpdateFailHTLC */; } public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) { - bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, Arrays.stream(val).map(arr_conv_25 -> arr_conv_25 == null ? 0 : arr_conv_25.ptr & ~1).toArray(number[]::new)); + bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, Arrays.stream(val).map(val_conv_25 -> val_conv_25 == null ? 0 : val_conv_25.ptr & ~1).toArray(number[]::new)); /* TODO 2 UpdateFailMalformedHTLC */; } @@ -63,7 +63,7 @@ import * as bindings from '../bindings' // TODO: figure out location } public static CommitmentUpdate constructor_new(UpdateAddHTLC[] update_add_htlcs_arg, UpdateFulfillHTLC[] update_fulfill_htlcs_arg, UpdateFailHTLC[] update_fail_htlcs_arg, UpdateFailMalformedHTLC[] update_fail_malformed_htlcs_arg, UpdateFee update_fee_arg, CommitmentSigned commitment_signed_arg) { - number ret = bindings.CommitmentUpdate_new(Arrays.stream(update_add_htlcs_arg).map(arr_conv_15 -> arr_conv_15 == null ? 0 : arr_conv_15.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fulfill_htlcs_arg).map(arr_conv_19 -> arr_conv_19 == null ? 0 : arr_conv_19.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fail_htlcs_arg).map(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fail_malformed_htlcs_arg).map(arr_conv_25 -> arr_conv_25 == null ? 0 : arr_conv_25.ptr & ~1).toArray(number[]::new), update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1); + number ret = bindings.CommitmentUpdate_new(Arrays.stream(update_add_htlcs_arg).map(update_add_htlcs_arg_conv_15 -> update_add_htlcs_arg_conv_15 == null ? 0 : update_add_htlcs_arg_conv_15.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fulfill_htlcs_arg).map(update_fulfill_htlcs_arg_conv_19 -> update_fulfill_htlcs_arg_conv_19 == null ? 0 : update_fulfill_htlcs_arg_conv_19.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fail_htlcs_arg).map(update_fail_htlcs_arg_conv_16 -> update_fail_htlcs_arg_conv_16 == null ? 0 : update_fail_htlcs_arg_conv_16.ptr & ~1).toArray(number[]::new), Arrays.stream(update_fail_malformed_htlcs_arg).map(update_fail_malformed_htlcs_arg_conv_25 -> update_fail_malformed_htlcs_arg_conv_25 == null ? 0 : update_fail_malformed_htlcs_arg_conv_25.ptr & ~1).toArray(number[]::new), update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1); const ret_hu_conv: CommitmentUpdate = new CommitmentUpdate(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); /* TODO 2 UpdateAddHTLC */; diff --git a/ts/structs/DelayedPaymentOutputDescriptor.ts b/ts/structs/DelayedPaymentOutputDescriptor.ts new file mode 100644 index 00000000..f6cdf765 --- /dev/null +++ b/ts/structs/DelayedPaymentOutputDescriptor.ts @@ -0,0 +1,97 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class DelayedPaymentOutputDescriptor extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.DelayedPaymentOutputDescriptor_free(this.ptr); + } + } + public OutPoint get_outpoint() { + number ret = bindings.DelayedPaymentOutputDescriptor_get_outpoint(this.ptr); + const ret_hu_conv: OutPoint = new OutPoint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public void set_outpoint(OutPoint val) { + bindings.DelayedPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + public Uint8Array get_per_commitment_point() { + Uint8Array ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr); + return ret; + } + + public void set_per_commitment_point(Uint8Array val) { + bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, val); + } + + public number get_to_self_delay() { + number ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr); + return ret; + } + + public void set_to_self_delay(number val) { + bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val); + } + + public void set_output(TxOut val) { + bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr); + } + + public Uint8Array get_revocation_pubkey() { + Uint8Array ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr); + return ret; + } + + public void set_revocation_pubkey(Uint8Array val) { + bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, val); + } + + public Uint8Array get_channel_keys_id() { + Uint8Array ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr); + return ret; + } + + public void set_channel_keys_id(Uint8Array val) { + bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, val); + } + + public number get_channel_value_satoshis() { + number ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr); + return ret; + } + + public void set_channel_value_satoshis(number val) { + bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val); + } + + public static DelayedPaymentOutputDescriptor constructor_new(OutPoint outpoint_arg, Uint8Array per_commitment_point_arg, number to_self_delay_arg, TxOut output_arg, Uint8Array revocation_pubkey_arg, Uint8Array channel_keys_id_arg, number channel_value_satoshis_arg) { + number ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, per_commitment_point_arg, to_self_delay_arg, output_arg.ptr, revocation_pubkey_arg, channel_keys_id_arg, channel_value_satoshis_arg); + const ret_hu_conv: DelayedPaymentOutputDescriptor = new DelayedPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(outpoint_arg); + return ret_hu_conv; + } + + public DelayedPaymentOutputDescriptor clone() { + number ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr); + const ret_hu_conv: DelayedPaymentOutputDescriptor = new DelayedPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Event.ts b/ts/structs/Event.ts index 110456b0..e24c66e2 100644 --- a/ts/structs/Event.ts +++ b/ts/structs/Event.ts @@ -99,13 +99,13 @@ export class SpendableOutputs extends Event { private constructor(ptr: number, obj: bindings.LDKEvent.SpendableOutputs) { super(null, ptr); const outputs: number[] = obj.outputs; - SpendableOutputDescriptor[] arr_conv_27_arr = new SpendableOutputDescriptor[outputs.length]; + SpendableOutputDescriptor[] outputs_conv_27_arr = new SpendableOutputDescriptor[outputs.length]; for (int b = 0; b < outputs.length; b++) { - number arr_conv_27 = outputs[b]; - SpendableOutputDescriptor arr_conv_27_hu_conv = SpendableOutputDescriptor.constr_from_ptr(arr_conv_27); - arr_conv_27_hu_conv.ptrs_to.add(this); - arr_conv_27_arr[b] = arr_conv_27_hu_conv; + number outputs_conv_27 = outputs[b]; + SpendableOutputDescriptor outputs_conv_27_hu_conv = SpendableOutputDescriptor.constr_from_ptr(outputs_conv_27); + outputs_conv_27_hu_conv.ptrs_to.add(this); + outputs_conv_27_arr[b] = outputs_conv_27_hu_conv; } - this.outputs = arr_conv_27_arr; + this.outputs = outputs_conv_27_arr; } } diff --git a/ts/structs/EventsProvider.ts b/ts/structs/EventsProvider.ts index d33cf1ed..5cec1ec3 100644 --- a/ts/structs/EventsProvider.ts +++ b/ts/structs/EventsProvider.ts @@ -34,7 +34,7 @@ import * as bindings from '../bindings' // TODO: figure out location // todo: in-line interface filling get_and_clear_pending_events (): number[] { Event[] ret = arg.get_and_clear_pending_events(); - result: number[] = Arrays.stream(ret).map(arr_conv_7 -> arr_conv_7.ptr).toArray(number[]::new); + result: number[] = Arrays.stream(ret).map(ret_conv_7 -> ret_conv_7.ptr).toArray(number[]::new); /* TODO 2 Event */; return result; }, @@ -55,14 +55,14 @@ import * as bindings from '../bindings' // TODO: figure out location } public Event[] get_and_clear_pending_events() { number[] ret = bindings.EventsProvider_get_and_clear_pending_events(this.ptr); - Event[] arr_conv_7_arr = new Event[ret.length]; + Event[] ret_conv_7_arr = new Event[ret.length]; for (int h = 0; h < ret.length; h++) { - number arr_conv_7 = ret[h]; - Event arr_conv_7_hu_conv = Event.constr_from_ptr(arr_conv_7); - arr_conv_7_hu_conv.ptrs_to.add(this); - arr_conv_7_arr[h] = arr_conv_7_hu_conv; + number ret_conv_7 = ret[h]; + Event ret_conv_7_hu_conv = Event.constr_from_ptr(ret_conv_7); + ret_conv_7_hu_conv.ptrs_to.add(this); + ret_conv_7_arr[h] = ret_conv_7_hu_conv; } - return arr_conv_7_arr; + return ret_conv_7_arr; } } diff --git a/ts/structs/InMemoryChannelKeys.ts b/ts/structs/InMemoryChannelKeys.ts deleted file mode 100644 index 4fc7fcdc..00000000 --- a/ts/structs/InMemoryChannelKeys.ts +++ /dev/null @@ -1,143 +0,0 @@ - - -import CommonBase from './CommonBase'; -import * as bindings from '../bindings' // TODO: figure out location - - - - export default class InMemoryChannelKeys extends CommonBase { - constructor(_dummy: object, ptr: number) { - super(ptr); - } - - - protected finalize() { - super.finalize(); - - if (this.ptr != 0) { - bindings.InMemoryChannelKeys_free(this.ptr); - } - } - public Uint8Array get_funding_key() { - Uint8Array ret = bindings.InMemoryChannelKeys_get_funding_key(this.ptr); - return ret; - } - - public void set_funding_key(Uint8Array val) { - bindings.InMemoryChannelKeys_set_funding_key(this.ptr, val); - } - - public Uint8Array get_revocation_base_key() { - Uint8Array ret = bindings.InMemoryChannelKeys_get_revocation_base_key(this.ptr); - return ret; - } - - public void set_revocation_base_key(Uint8Array val) { - bindings.InMemoryChannelKeys_set_revocation_base_key(this.ptr, val); - } - - public Uint8Array get_payment_key() { - Uint8Array ret = bindings.InMemoryChannelKeys_get_payment_key(this.ptr); - return ret; - } - - public void set_payment_key(Uint8Array val) { - bindings.InMemoryChannelKeys_set_payment_key(this.ptr, val); - } - - public Uint8Array get_delayed_payment_base_key() { - Uint8Array ret = bindings.InMemoryChannelKeys_get_delayed_payment_base_key(this.ptr); - return ret; - } - - public void set_delayed_payment_base_key(Uint8Array val) { - bindings.InMemoryChannelKeys_set_delayed_payment_base_key(this.ptr, val); - } - - public Uint8Array get_htlc_base_key() { - Uint8Array ret = bindings.InMemoryChannelKeys_get_htlc_base_key(this.ptr); - return ret; - } - - public void set_htlc_base_key(Uint8Array val) { - bindings.InMemoryChannelKeys_set_htlc_base_key(this.ptr, val); - } - - public Uint8Array get_commitment_seed() { - Uint8Array ret = bindings.InMemoryChannelKeys_get_commitment_seed(this.ptr); - return ret; - } - - public void set_commitment_seed(Uint8Array val) { - bindings.InMemoryChannelKeys_set_commitment_seed(this.ptr, val); - } - - public InMemoryChannelKeys clone() { - number ret = bindings.InMemoryChannelKeys_clone(this.ptr); - const ret_hu_conv: InMemoryChannelKeys = new InMemoryChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public static InMemoryChannelKeys constructor_new(Uint8Array funding_key, Uint8Array revocation_base_key, Uint8Array payment_key, Uint8Array delayed_payment_base_key, Uint8Array htlc_base_key, Uint8Array commitment_seed, number channel_value_satoshis, TwoTuple key_derivation_params) { - number ret = bindings.InMemoryChannelKeys_new(funding_key, revocation_base_key, payment_key, delayed_payment_base_key, htlc_base_key, commitment_seed, channel_value_satoshis, bindings.C2Tuple_u64u64Z_new(key_derivation_params.a, key_derivation_params.b)); - const ret_hu_conv: InMemoryChannelKeys = new InMemoryChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - public ChannelPublicKeys counterparty_pubkeys() { - number ret = bindings.InMemoryChannelKeys_counterparty_pubkeys(this.ptr); - const ret_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public number counterparty_selected_contest_delay() { - number ret = bindings.InMemoryChannelKeys_counterparty_selected_contest_delay(this.ptr); - return ret; - } - - public number holder_selected_contest_delay() { - number ret = bindings.InMemoryChannelKeys_holder_selected_contest_delay(this.ptr); - return ret; - } - - public boolean is_outbound() { - boolean ret = bindings.InMemoryChannelKeys_is_outbound(this.ptr); - return ret; - } - - public OutPoint funding_outpoint() { - number ret = bindings.InMemoryChannelKeys_funding_outpoint(this.ptr); - const ret_hu_conv: OutPoint = new OutPoint(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public ChannelTransactionParameters get_channel_parameters() { - number ret = bindings.InMemoryChannelKeys_get_channel_parameters(this.ptr); - const ret_hu_conv: ChannelTransactionParameters = new ChannelTransactionParameters(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public ChannelKeys as_ChannelKeys() { - number ret = bindings.InMemoryChannelKeys_as_ChannelKeys(this.ptr); - ChannelKeys ret_hu_conv = new ChannelKeys(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - - public Uint8Array write() { - Uint8Array ret = bindings.InMemoryChannelKeys_write(this.ptr); - return ret; - } - - public static Result_InMemoryChannelKeysDecodeErrorZ constructor_read(Uint8Array ser) { - number ret = bindings.InMemoryChannelKeys_read(ser); - Result_InMemoryChannelKeysDecodeErrorZ ret_hu_conv = Result_InMemoryChannelKeysDecodeErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/ts/structs/InMemorySigner.ts b/ts/structs/InMemorySigner.ts new file mode 100644 index 00000000..75b0f869 --- /dev/null +++ b/ts/structs/InMemorySigner.ts @@ -0,0 +1,157 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class InMemorySigner extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.InMemorySigner_free(this.ptr); + } + } + public Uint8Array get_funding_key() { + Uint8Array ret = bindings.InMemorySigner_get_funding_key(this.ptr); + return ret; + } + + public void set_funding_key(Uint8Array val) { + bindings.InMemorySigner_set_funding_key(this.ptr, val); + } + + public Uint8Array get_revocation_base_key() { + Uint8Array ret = bindings.InMemorySigner_get_revocation_base_key(this.ptr); + return ret; + } + + public void set_revocation_base_key(Uint8Array val) { + bindings.InMemorySigner_set_revocation_base_key(this.ptr, val); + } + + public Uint8Array get_payment_key() { + Uint8Array ret = bindings.InMemorySigner_get_payment_key(this.ptr); + return ret; + } + + public void set_payment_key(Uint8Array val) { + bindings.InMemorySigner_set_payment_key(this.ptr, val); + } + + public Uint8Array get_delayed_payment_base_key() { + Uint8Array ret = bindings.InMemorySigner_get_delayed_payment_base_key(this.ptr); + return ret; + } + + public void set_delayed_payment_base_key(Uint8Array val) { + bindings.InMemorySigner_set_delayed_payment_base_key(this.ptr, val); + } + + public Uint8Array get_htlc_base_key() { + Uint8Array ret = bindings.InMemorySigner_get_htlc_base_key(this.ptr); + return ret; + } + + public void set_htlc_base_key(Uint8Array val) { + bindings.InMemorySigner_set_htlc_base_key(this.ptr, val); + } + + public Uint8Array get_commitment_seed() { + Uint8Array ret = bindings.InMemorySigner_get_commitment_seed(this.ptr); + return ret; + } + + public void set_commitment_seed(Uint8Array val) { + bindings.InMemorySigner_set_commitment_seed(this.ptr, val); + } + + public InMemorySigner clone() { + number ret = bindings.InMemorySigner_clone(this.ptr); + const ret_hu_conv: InMemorySigner = new InMemorySigner(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public static InMemorySigner constructor_new(Uint8Array funding_key, Uint8Array revocation_base_key, Uint8Array payment_key, Uint8Array delayed_payment_base_key, Uint8Array htlc_base_key, Uint8Array commitment_seed, number channel_value_satoshis, Uint8Array channel_keys_id) { + number ret = bindings.InMemorySigner_new(funding_key, revocation_base_key, payment_key, delayed_payment_base_key, htlc_base_key, commitment_seed, channel_value_satoshis, channel_keys_id); + const ret_hu_conv: InMemorySigner = new InMemorySigner(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public ChannelPublicKeys counterparty_pubkeys() { + number ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr); + const ret_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public number counterparty_selected_contest_delay() { + number ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr); + return ret; + } + + public number holder_selected_contest_delay() { + number ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr); + return ret; + } + + public boolean is_outbound() { + boolean ret = bindings.InMemorySigner_is_outbound(this.ptr); + return ret; + } + + public OutPoint funding_outpoint() { + number ret = bindings.InMemorySigner_funding_outpoint(this.ptr); + const ret_hu_conv: OutPoint = new OutPoint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public ChannelTransactionParameters get_channel_parameters() { + number ret = bindings.InMemorySigner_get_channel_parameters(this.ptr); + const ret_hu_conv: ChannelTransactionParameters = new ChannelTransactionParameters(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(Uint8Array spend_tx, number input_idx, StaticPaymentOutputDescriptor descriptor) { + number ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); + Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(descriptor); + return ret_hu_conv; + } + + public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(Uint8Array spend_tx, number input_idx, DelayedPaymentOutputDescriptor descriptor) { + number ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); + Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(descriptor); + return ret_hu_conv; + } + + public Sign as_Sign() { + number ret = bindings.InMemorySigner_as_Sign(this.ptr); + Sign ret_hu_conv = new Sign(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public Uint8Array write() { + Uint8Array ret = bindings.InMemorySigner_write(this.ptr); + return ret; + } + + public static Result_InMemorySignerDecodeErrorZ constructor_read(Uint8Array ser) { + number ret = bindings.InMemorySigner_read(ser); + Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Init.ts b/ts/structs/Init.ts index f396b0bf..b8ca1522 100644 --- a/ts/structs/Init.ts +++ b/ts/structs/Init.ts @@ -18,6 +18,26 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.Init_free(this.ptr); } } + public InitFeatures get_features() { + number ret = bindings.Init_get_features(this.ptr); + const ret_hu_conv: InitFeatures = new InitFeatures(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public void set_features(InitFeatures val) { + bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + public static Init constructor_new(InitFeatures features_arg) { + number ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1); + const ret_hu_conv: Init = new Init(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(features_arg); + return ret_hu_conv; + } + public Init clone() { number ret = bindings.Init_clone(this.ptr); const ret_hu_conv: Init = new Init(null, ret); diff --git a/ts/structs/KeysInterface.ts b/ts/structs/KeysInterface.ts index e9a689be..a49aaf0b 100644 --- a/ts/structs/KeysInterface.ts +++ b/ts/structs/KeysInterface.ts @@ -47,8 +47,8 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; }, - get_channel_keys (inbound: boolean, channel_value_satoshis: number): number { - ChannelKeys ret = arg.get_channel_keys(inbound, channel_value_satoshis); + get_channel_signer (inbound: boolean, channel_value_satoshis: number): number { + Sign ret = arg.get_channel_signer(inbound, channel_value_satoshis); result: number = ret == null ? 0 : ret.ptr; impl_holder.held.ptrs_to.add(ret); return result; @@ -60,7 +60,7 @@ import * as bindings from '../bindings' // TODO: figure out location }, read_chan_signer (reader: Uint8Array): number { - Result_ChannelKeysDecodeErrorZ ret = arg.read_chan_signer(reader); + Result_SignDecodeErrorZ ret = arg.read_chan_signer(reader); result: number = ret != null ? ret.ptr : 0; return result; }, @@ -75,9 +75,9 @@ import * as bindings from '../bindings' // TODO: figure out location get_node_secret(): Uint8Array; get_destination_script(): Uint8Array; get_shutdown_pubkey(): Uint8Array; - get_channel_keys(inbound: boolean, channel_value_satoshis: number): ChannelKeys; + get_channel_signer(inbound: boolean, channel_value_satoshis: number): Sign; get_secure_random_bytes(): Uint8Array; - read_chan_signer(reader: Uint8Array): Result_ChannelKeysDecodeErrorZ; + read_chan_signer(reader: Uint8Array): Result_SignDecodeErrorZ; } @@ -99,9 +99,9 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public ChannelKeys get_channel_keys(boolean inbound, number channel_value_satoshis) { - number ret = bindings.KeysInterface_get_channel_keys(this.ptr, inbound, channel_value_satoshis); - ChannelKeys ret_hu_conv = new ChannelKeys(null, ret); + public Sign get_channel_signer(boolean inbound, number channel_value_satoshis) { + number ret = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis); + Sign ret_hu_conv = new Sign(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -111,9 +111,9 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public Result_ChannelKeysDecodeErrorZ read_chan_signer(Uint8Array reader) { + public Result_SignDecodeErrorZ read_chan_signer(Uint8Array reader) { number ret = bindings.KeysInterface_read_chan_signer(this.ptr, reader); - Result_ChannelKeysDecodeErrorZ ret_hu_conv = Result_ChannelKeysDecodeErrorZ.constr_from_ptr(ret); + Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } diff --git a/ts/structs/KeysManager.ts b/ts/structs/KeysManager.ts index 7627c0e3..c444e1f8 100644 --- a/ts/structs/KeysManager.ts +++ b/ts/structs/KeysManager.ts @@ -18,20 +18,28 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.KeysManager_free(this.ptr); } } - public static KeysManager constructor_new(Uint8Array seed, LDKNetwork network, number starting_time_secs, number starting_time_nanos) { - number ret = bindings.KeysManager_new(seed, network, starting_time_secs, starting_time_nanos); + public static KeysManager constructor_new(Uint8Array seed, number starting_time_secs, number starting_time_nanos) { + number ret = bindings.KeysManager_new(seed, starting_time_secs, starting_time_nanos); const ret_hu_conv: KeysManager = new KeysManager(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; } - public InMemoryChannelKeys derive_channel_keys(number channel_value_satoshis, number params_1, number params_2) { - number ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, params_1, params_2); - const ret_hu_conv: InMemoryChannelKeys = new InMemoryChannelKeys(null, ret); + public InMemorySigner derive_channel_keys(number channel_value_satoshis, Uint8Array params) { + number ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, params); + const ret_hu_conv: InMemorySigner = new InMemorySigner(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, Uint8Array change_destination_script, number feerate_sat_per_1000_weight) { + number ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, Arrays.stream(descriptors).map(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray(number[]::new), Arrays.stream(outputs).map(outputs_conv_7 -> outputs_conv_7.ptr).toArray(number[]::new), change_destination_script, feerate_sat_per_1000_weight); + Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); + /* TODO 2 SpendableOutputDescriptor */; + /* TODO 2 TxOut */; + return ret_hu_conv; + } + public KeysInterface as_KeysInterface() { number ret = bindings.KeysManager_as_KeysInterface(this.ptr); KeysInterface ret_hu_conv = new KeysInterface(null, ret); diff --git a/ts/structs/Listen.ts b/ts/structs/Listen.ts new file mode 100644 index 00000000..9e6ad6f9 --- /dev/null +++ b/ts/structs/Listen.ts @@ -0,0 +1,66 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export class Listen extends CommonBase { + + bindings_instance?: bindings.LDKListen; + + constructor(ptr?: number, arg?: bindings.LDKListen) { + if (Number.isFinite(ptr)) { + super(ptr); + this.bindings_instance = null; + } else { + // TODO: private constructor instantiation + super(bindings.LDKListen_new(arg)); + this.ptrs_to.push(arg); + + } + } + + protected finalize() { + if (this.ptr != 0) { + bindings.Listen_free(this.ptr); + } + super.finalize(); + } + + static new_impl(arg: ListenInterface): Listen { + const impl_holder: LDKListenHolder = new LDKListenHolder(); + let structImplementation = { + // todo: in-line interface filling + block_connected (block: Uint8Array, height: number): void { + arg.block_connected(block, height); + }, + + block_disconnected (header: Uint8Array, height: number): void { + arg.block_disconnected(header, height); + }, + + + }; + impl_holder.held = new Listen (null, structImplementation); + } + } + + export interface ListenInterface { + block_connected(block: Uint8Array, height: number): void; + block_disconnected(header: Uint8Array, height: number): void; + + } + + class LDKListenHolder { + held: Listen; + } + public void block_connected(Uint8Array block, number height) { + bindings.Listen_block_connected(this.ptr, block, height); + } + + public void block_disconnected(Uint8Array header, number height) { + bindings.Listen_block_disconnected(this.ptr, header, height); + } + +} diff --git a/ts/structs/MessageSendEventsProvider.ts b/ts/structs/MessageSendEventsProvider.ts index fdd165b8..6b218bb1 100644 --- a/ts/structs/MessageSendEventsProvider.ts +++ b/ts/structs/MessageSendEventsProvider.ts @@ -34,7 +34,7 @@ import * as bindings from '../bindings' // TODO: figure out location // todo: in-line interface filling get_and_clear_pending_msg_events (): number[] { MessageSendEvent[] ret = arg.get_and_clear_pending_msg_events(); - result: number[] = Arrays.stream(ret).map(arr_conv_18 -> arr_conv_18.ptr).toArray(number[]::new); + result: number[] = Arrays.stream(ret).map(ret_conv_18 -> ret_conv_18.ptr).toArray(number[]::new); /* TODO 2 MessageSendEvent */; return result; }, @@ -55,14 +55,14 @@ import * as bindings from '../bindings' // TODO: figure out location } public MessageSendEvent[] get_and_clear_pending_msg_events() { number[] ret = bindings.MessageSendEventsProvider_get_and_clear_pending_msg_events(this.ptr); - MessageSendEvent[] arr_conv_18_arr = new MessageSendEvent[ret.length]; + MessageSendEvent[] ret_conv_18_arr = new MessageSendEvent[ret.length]; for (int s = 0; s < ret.length; s++) { - number arr_conv_18 = ret[s]; - MessageSendEvent arr_conv_18_hu_conv = MessageSendEvent.constr_from_ptr(arr_conv_18); - arr_conv_18_hu_conv.ptrs_to.add(this); - arr_conv_18_arr[s] = arr_conv_18_hu_conv; + number ret_conv_18 = ret[s]; + MessageSendEvent ret_conv_18_hu_conv = MessageSendEvent.constr_from_ptr(ret_conv_18); + ret_conv_18_hu_conv.ptrs_to.add(this); + ret_conv_18_arr[s] = ret_conv_18_hu_conv; } - return arr_conv_18_arr; + return ret_conv_18_arr; } } diff --git a/ts/structs/MonitorEvent.ts b/ts/structs/MonitorEvent.ts index b24e6602..1a6c1637 100644 --- a/ts/structs/MonitorEvent.ts +++ b/ts/structs/MonitorEvent.ts @@ -1,28 +1,32 @@ - import CommonBase from './CommonBase'; import * as bindings from '../bindings' // TODO: figure out location - - - export default class MonitorEvent extends CommonBase { - constructor(_dummy: object, ptr: number) { - super(ptr); - } - - - protected finalize() { - super.finalize(); - - if (this.ptr != 0) { - bindings.MonitorEvent_free(this.ptr); - } - } - public MonitorEvent clone() { - number ret = bindings.MonitorEvent_clone(this.ptr); - const ret_hu_conv: MonitorEvent = new MonitorEvent(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; +export default class MonitorEvent extends CommonBase { + protected constructor(_dummy: object, ptr: number) { super(ptr); } + protected finalize() { + super.finalize(); + if (this.ptr != 0) { bindings.MonitorEvent_free(this.ptr); } + } + static constr_from_ptr(ptr: number): MonitorEvent { + const raw_val: bindings.LDKMonitorEvent = bindings.LDKMonitorEvent_ref_from_ptr(ptr); + if (raw_val instanceof bindings.LDKMonitorEvent.HTLCEvent) { + return new HTLCEvent(this.ptr, raw_val); + } + if (raw_val instanceof bindings.LDKMonitorEvent.CommitmentTxBroadcasted) { + return new CommitmentTxBroadcasted(this.ptr, raw_val); + } + throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } } +export class HTLCEvent extends MonitorEvent { + private constructor(ptr: number, obj: bindings.LDKMonitorEvent.HTLCEvent) { + super(null, ptr); + } +} +export class CommitmentTxBroadcasted extends MonitorEvent { + private constructor(ptr: number, obj: bindings.LDKMonitorEvent.CommitmentTxBroadcasted) { + super(null, ptr); + } +} diff --git a/ts/structs/NetGraphMsgHandler.ts b/ts/structs/NetGraphMsgHandler.ts index 5b7cbe89..841ae353 100644 --- a/ts/structs/NetGraphMsgHandler.ts +++ b/ts/structs/NetGraphMsgHandler.ts @@ -27,12 +27,13 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } - public static NetGraphMsgHandler constructor_from_net_graph(Access chain_access, Logger logger, Uint8Array network_graph_genesis_hash) { - number ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, bindings.NetworkGraph_new(network_graph_genesis_hash)); + public static NetGraphMsgHandler constructor_from_net_graph(Access chain_access, Logger logger, NetworkGraph network_graph) { + number ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, network_graph == null ? 0 : network_graph.ptr & ~1); const ret_hu_conv: NetGraphMsgHandler = new NetGraphMsgHandler(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(chain_access); ret_hu_conv.ptrs_to.add(logger); + ret_hu_conv.ptrs_to.add(network_graph); return ret_hu_conv; } diff --git a/ts/structs/NetworkGraph.ts b/ts/structs/NetworkGraph.ts index 7f590881..5d2deab2 100644 --- a/ts/structs/NetworkGraph.ts +++ b/ts/structs/NetworkGraph.ts @@ -18,6 +18,13 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.NetworkGraph_free(this.ptr); } } + public NetworkGraph clone() { + number ret = bindings.NetworkGraph_clone(this.ptr); + const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + public Uint8Array write() { Uint8Array ret = bindings.NetworkGraph_write(this.ptr); return ret; diff --git a/ts/structs/NodeAnnouncementInfo.ts b/ts/structs/NodeAnnouncementInfo.ts index 161b93b3..ff71ce14 100644 --- a/ts/structs/NodeAnnouncementInfo.ts +++ b/ts/structs/NodeAnnouncementInfo.ts @@ -58,7 +58,7 @@ import * as bindings from '../bindings' // TODO: figure out location } public void set_addresses(NetAddress[] val) { - bindings.NodeAnnouncementInfo_set_addresses(this.ptr, Arrays.stream(val).map(arr_conv_12 -> arr_conv_12.ptr).toArray(number[]::new)); + bindings.NodeAnnouncementInfo_set_addresses(this.ptr, Arrays.stream(val).map(val_conv_12 -> val_conv_12.ptr).toArray(number[]::new)); /* TODO 2 NetAddress */; } @@ -75,7 +75,7 @@ import * as bindings from '../bindings' // TODO: figure out location } public static NodeAnnouncementInfo constructor_new(NodeFeatures features_arg, number last_update_arg, Uint8Array rgb_arg, Uint8Array alias_arg, NetAddress[] addresses_arg, NodeAnnouncement announcement_message_arg) { - number ret = bindings.NodeAnnouncementInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, last_update_arg, rgb_arg, alias_arg, Arrays.stream(addresses_arg).map(arr_conv_12 -> arr_conv_12.ptr).toArray(number[]::new), announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); + number ret = bindings.NodeAnnouncementInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, last_update_arg, rgb_arg, alias_arg, Arrays.stream(addresses_arg).map(addresses_arg_conv_12 -> addresses_arg_conv_12.ptr).toArray(number[]::new), announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); const ret_hu_conv: NodeAnnouncementInfo = new NodeAnnouncementInfo(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); ret_hu_conv.ptrs_to.add(features_arg); diff --git a/ts/structs/PaymentSendFailure.ts b/ts/structs/PaymentSendFailure.ts index 32bef844..2310a2ee 100644 --- a/ts/structs/PaymentSendFailure.ts +++ b/ts/structs/PaymentSendFailure.ts @@ -1,28 +1,48 @@ - import CommonBase from './CommonBase'; import * as bindings from '../bindings' // TODO: figure out location - - - export default class PaymentSendFailure extends CommonBase { - constructor(_dummy: object, ptr: number) { - super(ptr); - } - - - protected finalize() { - super.finalize(); - - if (this.ptr != 0) { - bindings.PaymentSendFailure_free(this.ptr); - } - } - public PaymentSendFailure clone() { - number ret = bindings.PaymentSendFailure_clone(this.ptr); - const ret_hu_conv: PaymentSendFailure = new PaymentSendFailure(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; +export default class PaymentSendFailure extends CommonBase { + protected constructor(_dummy: object, ptr: number) { super(ptr); } + protected finalize() { + super.finalize(); + if (this.ptr != 0) { bindings.PaymentSendFailure_free(this.ptr); } + } + static constr_from_ptr(ptr: number): PaymentSendFailure { + const raw_val: bindings.LDKPaymentSendFailure = bindings.LDKPaymentSendFailure_ref_from_ptr(ptr); + if (raw_val instanceof bindings.LDKPaymentSendFailure.ParameterError) { + return new ParameterError(this.ptr, raw_val); + } + if (raw_val instanceof bindings.LDKPaymentSendFailure.PathParameterError) { + return new PathParameterError(this.ptr, raw_val); + } + if (raw_val instanceof bindings.LDKPaymentSendFailure.AllFailedRetrySafe) { + return new AllFailedRetrySafe(this.ptr, raw_val); + } + if (raw_val instanceof bindings.LDKPaymentSendFailure.PartialFailure) { + return new PartialFailure(this.ptr, raw_val); + } + throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } } +export class ParameterError extends PaymentSendFailure { + private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.ParameterError) { + super(null, ptr); + } +} +export class PathParameterError extends PaymentSendFailure { + private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.PathParameterError) { + super(null, ptr); + } +} +export class AllFailedRetrySafe extends PaymentSendFailure { + private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.AllFailedRetrySafe) { + super(null, ptr); + } +} +export class PartialFailure extends PaymentSendFailure { + private constructor(ptr: number, obj: bindings.LDKPaymentSendFailure.PartialFailure) { + super(null, ptr); + } +} diff --git a/ts/structs/Result_AcceptChannelDecodeErrorZ.ts b/ts/structs/Result_AcceptChannelDecodeErrorZ.ts new file mode 100644 index 00000000..ddc5ef5e --- /dev/null +++ b/ts/structs/Result_AcceptChannelDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_AcceptChannelDecodeErrorZ extends CommonBase { + private Result_AcceptChannelDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_AcceptChannelDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_AcceptChannelDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_AcceptChannelDecodeErrorZ_result_ok(ptr)) { + return new Result_AcceptChannelDecodeErrorZ_OK(null, ptr); + } else { + return new Result_AcceptChannelDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_AcceptChannelDecodeErrorZ_OK extends Result_AcceptChannelDecodeErrorZ { + public final AcceptChannel res; + private Result_AcceptChannelDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_AcceptChannelDecodeErrorZ_get_ok(ptr); + const res_hu_conv: AcceptChannel = new AcceptChannel(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_AcceptChannelDecodeErrorZ_OK(AcceptChannel res) { + this(null, bindings.CResult_AcceptChannelDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_AcceptChannelDecodeErrorZ_Err extends Result_AcceptChannelDecodeErrorZ { + public final DecodeError err; + private Result_AcceptChannelDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_AcceptChannelDecodeErrorZ_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 Result_AcceptChannelDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_AcceptChannelDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_AnnouncementSignaturesDecodeErrorZ.ts b/ts/structs/Result_AnnouncementSignaturesDecodeErrorZ.ts new file mode 100644 index 00000000..c2432445 --- /dev/null +++ b/ts/structs/Result_AnnouncementSignaturesDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { + private Result_AnnouncementSignaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_AnnouncementSignaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_AnnouncementSignaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_AnnouncementSignaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_AnnouncementSignaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_AnnouncementSignaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_AnnouncementSignaturesDecodeErrorZ_OK extends Result_AnnouncementSignaturesDecodeErrorZ { + public final AnnouncementSignatures res; + private Result_AnnouncementSignaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_AnnouncementSignaturesDecodeErrorZ_get_ok(ptr); + const res_hu_conv: AnnouncementSignatures = new AnnouncementSignatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_AnnouncementSignaturesDecodeErrorZ_OK(AnnouncementSignatures res) { + this(null, bindings.CResult_AnnouncementSignaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_AnnouncementSignaturesDecodeErrorZ_Err extends Result_AnnouncementSignaturesDecodeErrorZ { + public final DecodeError err; + private Result_AnnouncementSignaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_AnnouncementSignaturesDecodeErrorZ_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 Result_AnnouncementSignaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_AnnouncementSignaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.ts b/ts/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.ts new file mode 100644 index 00000000..9e4fdaa8 --- /dev/null +++ b/ts/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { + private Result_BuiltCommitmentTransactionDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_BuiltCommitmentTransactionDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(ptr)) { + return new Result_BuiltCommitmentTransactionDecodeErrorZ_OK(null, ptr); + } else { + return new Result_BuiltCommitmentTransactionDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_BuiltCommitmentTransactionDecodeErrorZ_OK extends Result_BuiltCommitmentTransactionDecodeErrorZ { + public final BuiltCommitmentTransaction res; + private Result_BuiltCommitmentTransactionDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(ptr); + const res_hu_conv: BuiltCommitmentTransaction = new BuiltCommitmentTransaction(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_BuiltCommitmentTransactionDecodeErrorZ_OK(BuiltCommitmentTransaction res) { + this(null, bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_BuiltCommitmentTransactionDecodeErrorZ_Err extends Result_BuiltCommitmentTransactionDecodeErrorZ { + public final DecodeError err; + private Result_BuiltCommitmentTransactionDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_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 Result_BuiltCommitmentTransactionDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_CVec_CVec_u8ZZNoneZ.ts b/ts/structs/Result_CVec_CVec_u8ZZNoneZ.ts new file mode 100644 index 00000000..58502517 --- /dev/null +++ b/ts/structs/Result_CVec_CVec_u8ZZNoneZ.ts @@ -0,0 +1,37 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_CVec_CVec_u8ZZNoneZ extends CommonBase { + private Result_CVec_CVec_u8ZZNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CVec_CVec_u8ZZNoneZ_free(ptr); } super.finalize(); + } + + static Result_CVec_CVec_u8ZZNoneZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CVec_CVec_u8ZZNoneZ_result_ok(ptr)) { + return new Result_CVec_CVec_u8ZZNoneZ_OK(null, ptr); + } else { + return new Result_CVec_CVec_u8ZZNoneZ_Err(null, ptr); + } + } + public static final class Result_CVec_CVec_u8ZZNoneZ_OK extends Result_CVec_CVec_u8ZZNoneZ { + public final Uint8Array[] res; + private Result_CVec_CVec_u8ZZNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_CVec_CVec_u8ZZNoneZ_get_ok(ptr); + } + public Result_CVec_CVec_u8ZZNoneZ_OK(Uint8Array[] res) { + this(null, bindings.CResult_CVec_CVec_u8ZZNoneZ_ok(res)); + } + } + + public static final class Result_CVec_CVec_u8ZZNoneZ_Err extends Result_CVec_CVec_u8ZZNoneZ { + private Result_CVec_CVec_u8ZZNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + public Result_CVec_CVec_u8ZZNoneZ_Err() { + this(null, bindings.CResult_CVec_CVec_u8ZZNoneZ_err()); + } + } +} diff --git a/ts/structs/Result_ChannelAnnouncementDecodeErrorZ.ts b/ts/structs/Result_ChannelAnnouncementDecodeErrorZ.ts new file mode 100644 index 00000000..5145f35c --- /dev/null +++ b/ts/structs/Result_ChannelAnnouncementDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { + private Result_ChannelAnnouncementDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelAnnouncementDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelAnnouncementDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelAnnouncementDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelAnnouncementDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelAnnouncementDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelAnnouncementDecodeErrorZ_OK extends Result_ChannelAnnouncementDecodeErrorZ { + public final ChannelAnnouncement res; + private Result_ChannelAnnouncementDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelAnnouncementDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelAnnouncementDecodeErrorZ_OK(ChannelAnnouncement res) { + this(null, bindings.CResult_ChannelAnnouncementDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelAnnouncementDecodeErrorZ_Err extends Result_ChannelAnnouncementDecodeErrorZ { + public final DecodeError err; + private Result_ChannelAnnouncementDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelAnnouncementDecodeErrorZ_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 Result_ChannelAnnouncementDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelAnnouncementDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_ChannelConfigDecodeErrorZ.ts b/ts/structs/Result_ChannelConfigDecodeErrorZ.ts new file mode 100644 index 00000000..ea264bbb --- /dev/null +++ b/ts/structs/Result_ChannelConfigDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelConfigDecodeErrorZ extends CommonBase { + private Result_ChannelConfigDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelConfigDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelConfigDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelConfigDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelConfigDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelConfigDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelConfigDecodeErrorZ_OK extends Result_ChannelConfigDecodeErrorZ { + public final ChannelConfig res; + private Result_ChannelConfigDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelConfigDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelConfig = new ChannelConfig(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelConfigDecodeErrorZ_OK(ChannelConfig res) { + this(null, bindings.CResult_ChannelConfigDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelConfigDecodeErrorZ_Err extends Result_ChannelConfigDecodeErrorZ { + public final DecodeError err; + private Result_ChannelConfigDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelConfigDecodeErrorZ_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 Result_ChannelConfigDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelConfigDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_ChannelFeaturesDecodeErrorZ.ts b/ts/structs/Result_ChannelFeaturesDecodeErrorZ.ts new file mode 100644 index 00000000..931540ce --- /dev/null +++ b/ts/structs/Result_ChannelFeaturesDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelFeaturesDecodeErrorZ extends CommonBase { + private Result_ChannelFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelFeaturesDecodeErrorZ_OK extends Result_ChannelFeaturesDecodeErrorZ { + public final ChannelFeatures res; + private Result_ChannelFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelFeatures = new ChannelFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelFeaturesDecodeErrorZ_OK(ChannelFeatures res) { + this(null, bindings.CResult_ChannelFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelFeaturesDecodeErrorZ_Err extends Result_ChannelFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_ChannelFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelFeaturesDecodeErrorZ_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 Result_ChannelFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_ChannelInfoDecodeErrorZ.ts b/ts/structs/Result_ChannelInfoDecodeErrorZ.ts new file mode 100644 index 00000000..3650d84f --- /dev/null +++ b/ts/structs/Result_ChannelInfoDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelInfoDecodeErrorZ extends CommonBase { + private Result_ChannelInfoDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelInfoDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelInfoDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelInfoDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelInfoDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelInfoDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelInfoDecodeErrorZ_OK extends Result_ChannelInfoDecodeErrorZ { + public final ChannelInfo res; + private Result_ChannelInfoDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelInfoDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelInfo = new ChannelInfo(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelInfoDecodeErrorZ_OK(ChannelInfo res) { + this(null, bindings.CResult_ChannelInfoDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelInfoDecodeErrorZ_Err extends Result_ChannelInfoDecodeErrorZ { + public final DecodeError err; + private Result_ChannelInfoDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelInfoDecodeErrorZ_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 Result_ChannelInfoDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelInfoDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_ChannelPublicKeysDecodeErrorZ.ts b/ts/structs/Result_ChannelPublicKeysDecodeErrorZ.ts new file mode 100644 index 00000000..c0febead --- /dev/null +++ b/ts/structs/Result_ChannelPublicKeysDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { + private Result_ChannelPublicKeysDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelPublicKeysDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelPublicKeysDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelPublicKeysDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelPublicKeysDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelPublicKeysDecodeErrorZ_OK extends Result_ChannelPublicKeysDecodeErrorZ { + public final ChannelPublicKeys res; + private Result_ChannelPublicKeysDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelPublicKeysDecodeErrorZ_OK(ChannelPublicKeys res) { + this(null, bindings.CResult_ChannelPublicKeysDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelPublicKeysDecodeErrorZ_Err extends Result_ChannelPublicKeysDecodeErrorZ { + public final DecodeError err; + private Result_ChannelPublicKeysDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelPublicKeysDecodeErrorZ_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 Result_ChannelPublicKeysDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelPublicKeysDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_ChannelTransactionParametersDecodeErrorZ.ts b/ts/structs/Result_ChannelTransactionParametersDecodeErrorZ.ts new file mode 100644 index 00000000..2353ce90 --- /dev/null +++ b/ts/structs/Result_ChannelTransactionParametersDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase { + private Result_ChannelTransactionParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelTransactionParametersDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelTransactionParametersDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelTransactionParametersDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelTransactionParametersDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelTransactionParametersDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelTransactionParametersDecodeErrorZ_OK extends Result_ChannelTransactionParametersDecodeErrorZ { + public final ChannelTransactionParameters res; + private Result_ChannelTransactionParametersDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelTransactionParametersDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelTransactionParameters = new ChannelTransactionParameters(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelTransactionParametersDecodeErrorZ_OK(ChannelTransactionParameters res) { + this(null, bindings.CResult_ChannelTransactionParametersDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelTransactionParametersDecodeErrorZ_Err extends Result_ChannelTransactionParametersDecodeErrorZ { + public final DecodeError err; + private Result_ChannelTransactionParametersDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelTransactionParametersDecodeErrorZ_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 Result_ChannelTransactionParametersDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelTransactionParametersDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_ChannelUpdateDecodeErrorZ.ts b/ts/structs/Result_ChannelUpdateDecodeErrorZ.ts new file mode 100644 index 00000000..f3f85e3a --- /dev/null +++ b/ts/structs/Result_ChannelUpdateDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { + private Result_ChannelUpdateDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelUpdateDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelUpdateDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ChannelUpdateDecodeErrorZ_result_ok(ptr)) { + return new Result_ChannelUpdateDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelUpdateDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelUpdateDecodeErrorZ_OK extends Result_ChannelUpdateDecodeErrorZ { + public final ChannelUpdate res; + private Result_ChannelUpdateDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelUpdateDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelUpdate = new ChannelUpdate(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ChannelUpdateDecodeErrorZ_OK(ChannelUpdate res) { + this(null, bindings.CResult_ChannelUpdateDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ChannelUpdateDecodeErrorZ_Err extends Result_ChannelUpdateDecodeErrorZ { + public final DecodeError err; + private Result_ChannelUpdateDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelUpdateDecodeErrorZ_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 Result_ChannelUpdateDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ChannelUpdateDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_ClosingSignedDecodeErrorZ.ts b/ts/structs/Result_ClosingSignedDecodeErrorZ.ts new file mode 100644 index 00000000..7163fff2 --- /dev/null +++ b/ts/structs/Result_ClosingSignedDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ClosingSignedDecodeErrorZ extends CommonBase { + private Result_ClosingSignedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ClosingSignedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ClosingSignedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ClosingSignedDecodeErrorZ_result_ok(ptr)) { + return new Result_ClosingSignedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ClosingSignedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ClosingSignedDecodeErrorZ_OK extends Result_ClosingSignedDecodeErrorZ { + public final ClosingSigned res; + private Result_ClosingSignedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ClosingSignedDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ClosingSigned = new ClosingSigned(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ClosingSignedDecodeErrorZ_OK(ClosingSigned res) { + this(null, bindings.CResult_ClosingSignedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ClosingSignedDecodeErrorZ_Err extends Result_ClosingSignedDecodeErrorZ { + public final DecodeError err; + private Result_ClosingSignedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ClosingSignedDecodeErrorZ_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 Result_ClosingSignedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ClosingSignedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_CommitmentSignedDecodeErrorZ.ts b/ts/structs/Result_CommitmentSignedDecodeErrorZ.ts new file mode 100644 index 00000000..3168c278 --- /dev/null +++ b/ts/structs/Result_CommitmentSignedDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { + private Result_CommitmentSignedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CommitmentSignedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CommitmentSignedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(ptr)) { + return new Result_CommitmentSignedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CommitmentSignedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CommitmentSignedDecodeErrorZ_OK extends Result_CommitmentSignedDecodeErrorZ { + public final CommitmentSigned res; + private Result_CommitmentSignedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(ptr); + const res_hu_conv: CommitmentSigned = new CommitmentSigned(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_CommitmentSignedDecodeErrorZ_OK(CommitmentSigned res) { + this(null, bindings.CResult_CommitmentSignedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_CommitmentSignedDecodeErrorZ_Err extends Result_CommitmentSignedDecodeErrorZ { + public final DecodeError err; + private Result_CommitmentSignedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_CommitmentSignedDecodeErrorZ_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 Result_CommitmentSignedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_CommitmentSignedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_CommitmentTransactionDecodeErrorZ.ts b/ts/structs/Result_CommitmentTransactionDecodeErrorZ.ts new file mode 100644 index 00000000..a555e9eb --- /dev/null +++ b/ts/structs/Result_CommitmentTransactionDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { + private Result_CommitmentTransactionDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CommitmentTransactionDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CommitmentTransactionDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(ptr)) { + return new Result_CommitmentTransactionDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CommitmentTransactionDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CommitmentTransactionDecodeErrorZ_OK extends Result_CommitmentTransactionDecodeErrorZ { + public final CommitmentTransaction res; + private Result_CommitmentTransactionDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(ptr); + const res_hu_conv: CommitmentTransaction = new CommitmentTransaction(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_CommitmentTransactionDecodeErrorZ_OK(CommitmentTransaction res) { + this(null, bindings.CResult_CommitmentTransactionDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_CommitmentTransactionDecodeErrorZ_Err extends Result_CommitmentTransactionDecodeErrorZ { + public final DecodeError err; + private Result_CommitmentTransactionDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_CommitmentTransactionDecodeErrorZ_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 Result_CommitmentTransactionDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_CommitmentTransactionDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.ts b/ts/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.ts new file mode 100644 index 00000000..68e67ff7 --- /dev/null +++ b/ts/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends CommonBase { + private Result_CounterpartyChannelTransactionParametersDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_CounterpartyChannelTransactionParametersDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_result_ok(ptr)) { + return new Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK(null, ptr); + } else { + return new Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK extends Result_CounterpartyChannelTransactionParametersDecodeErrorZ { + public final CounterpartyChannelTransactionParameters res; + private Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_get_ok(ptr); + const res_hu_conv: CounterpartyChannelTransactionParameters = new CounterpartyChannelTransactionParameters(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_CounterpartyChannelTransactionParametersDecodeErrorZ_OK(CounterpartyChannelTransactionParameters res) { + this(null, bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err extends Result_CounterpartyChannelTransactionParametersDecodeErrorZ { + public final DecodeError err; + private Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ_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 Result_CounterpartyChannelTransactionParametersDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_DirectionalChannelInfoDecodeErrorZ.ts b/ts/structs/Result_DirectionalChannelInfoDecodeErrorZ.ts new file mode 100644 index 00000000..972fc4ba --- /dev/null +++ b/ts/structs/Result_DirectionalChannelInfoDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { + private Result_DirectionalChannelInfoDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_DirectionalChannelInfoDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_DirectionalChannelInfoDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(ptr)) { + return new Result_DirectionalChannelInfoDecodeErrorZ_OK(null, ptr); + } else { + return new Result_DirectionalChannelInfoDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_DirectionalChannelInfoDecodeErrorZ_OK extends Result_DirectionalChannelInfoDecodeErrorZ { + public final DirectionalChannelInfo res; + private Result_DirectionalChannelInfoDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(ptr); + const res_hu_conv: DirectionalChannelInfo = new DirectionalChannelInfo(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_DirectionalChannelInfoDecodeErrorZ_OK(DirectionalChannelInfo res) { + this(null, bindings.CResult_DirectionalChannelInfoDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_DirectionalChannelInfoDecodeErrorZ_Err extends Result_DirectionalChannelInfoDecodeErrorZ { + public final DecodeError err; + private Result_DirectionalChannelInfoDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_DirectionalChannelInfoDecodeErrorZ_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 Result_DirectionalChannelInfoDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_DirectionalChannelInfoDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_FundingCreatedDecodeErrorZ.ts b/ts/structs/Result_FundingCreatedDecodeErrorZ.ts new file mode 100644 index 00000000..61050127 --- /dev/null +++ b/ts/structs/Result_FundingCreatedDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_FundingCreatedDecodeErrorZ extends CommonBase { + private Result_FundingCreatedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_FundingCreatedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_FundingCreatedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_FundingCreatedDecodeErrorZ_result_ok(ptr)) { + return new Result_FundingCreatedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_FundingCreatedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_FundingCreatedDecodeErrorZ_OK extends Result_FundingCreatedDecodeErrorZ { + public final FundingCreated res; + private Result_FundingCreatedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_FundingCreatedDecodeErrorZ_get_ok(ptr); + const res_hu_conv: FundingCreated = new FundingCreated(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_FundingCreatedDecodeErrorZ_OK(FundingCreated res) { + this(null, bindings.CResult_FundingCreatedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_FundingCreatedDecodeErrorZ_Err extends Result_FundingCreatedDecodeErrorZ { + public final DecodeError err; + private Result_FundingCreatedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_FundingCreatedDecodeErrorZ_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 Result_FundingCreatedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_FundingCreatedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_FundingLockedDecodeErrorZ.ts b/ts/structs/Result_FundingLockedDecodeErrorZ.ts new file mode 100644 index 00000000..c5bd2017 --- /dev/null +++ b/ts/structs/Result_FundingLockedDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_FundingLockedDecodeErrorZ extends CommonBase { + private Result_FundingLockedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_FundingLockedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_FundingLockedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_FundingLockedDecodeErrorZ_result_ok(ptr)) { + return new Result_FundingLockedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_FundingLockedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_FundingLockedDecodeErrorZ_OK extends Result_FundingLockedDecodeErrorZ { + public final FundingLocked res; + private Result_FundingLockedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_FundingLockedDecodeErrorZ_get_ok(ptr); + const res_hu_conv: FundingLocked = new FundingLocked(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_FundingLockedDecodeErrorZ_OK(FundingLocked res) { + this(null, bindings.CResult_FundingLockedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_FundingLockedDecodeErrorZ_Err extends Result_FundingLockedDecodeErrorZ { + public final DecodeError err; + private Result_FundingLockedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_FundingLockedDecodeErrorZ_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 Result_FundingLockedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_FundingLockedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_FundingSignedDecodeErrorZ.ts b/ts/structs/Result_FundingSignedDecodeErrorZ.ts new file mode 100644 index 00000000..37fbef2c --- /dev/null +++ b/ts/structs/Result_FundingSignedDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_FundingSignedDecodeErrorZ extends CommonBase { + private Result_FundingSignedDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_FundingSignedDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_FundingSignedDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_FundingSignedDecodeErrorZ_result_ok(ptr)) { + return new Result_FundingSignedDecodeErrorZ_OK(null, ptr); + } else { + return new Result_FundingSignedDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_FundingSignedDecodeErrorZ_OK extends Result_FundingSignedDecodeErrorZ { + public final FundingSigned res; + private Result_FundingSignedDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_FundingSignedDecodeErrorZ_get_ok(ptr); + const res_hu_conv: FundingSigned = new FundingSigned(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_FundingSignedDecodeErrorZ_OK(FundingSigned res) { + this(null, bindings.CResult_FundingSignedDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_FundingSignedDecodeErrorZ_Err extends Result_FundingSignedDecodeErrorZ { + public final DecodeError err; + private Result_FundingSignedDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_FundingSignedDecodeErrorZ_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 Result_FundingSignedDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_FundingSignedDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.ts b/ts/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.ts new file mode 100644 index 00000000..634405b4 --- /dev/null +++ b/ts/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { + private Result_HTLCOutputInCommitmentDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_HTLCOutputInCommitmentDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_result_ok(ptr)) { + return new Result_HTLCOutputInCommitmentDecodeErrorZ_OK(null, ptr); + } else { + return new Result_HTLCOutputInCommitmentDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_HTLCOutputInCommitmentDecodeErrorZ_OK extends Result_HTLCOutputInCommitmentDecodeErrorZ { + public final HTLCOutputInCommitment res; + private Result_HTLCOutputInCommitmentDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_get_ok(ptr); + const res_hu_conv: HTLCOutputInCommitment = new HTLCOutputInCommitment(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_HTLCOutputInCommitmentDecodeErrorZ_OK(HTLCOutputInCommitment res) { + this(null, bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_HTLCOutputInCommitmentDecodeErrorZ_Err extends Result_HTLCOutputInCommitmentDecodeErrorZ { + public final DecodeError err; + private Result_HTLCOutputInCommitmentDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_HTLCOutputInCommitmentDecodeErrorZ_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 Result_HTLCOutputInCommitmentDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_HTLCUpdateDecodeErrorZ.ts b/ts/structs/Result_HTLCUpdateDecodeErrorZ.ts new file mode 100644 index 00000000..3e6815f2 --- /dev/null +++ b/ts/structs/Result_HTLCUpdateDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { + private Result_HTLCUpdateDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_HTLCUpdateDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_HTLCUpdateDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_HTLCUpdateDecodeErrorZ_result_ok(ptr)) { + return new Result_HTLCUpdateDecodeErrorZ_OK(null, ptr); + } else { + return new Result_HTLCUpdateDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_HTLCUpdateDecodeErrorZ_OK extends Result_HTLCUpdateDecodeErrorZ { + public final HTLCUpdate res; + private Result_HTLCUpdateDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(ptr); + const res_hu_conv: HTLCUpdate = new HTLCUpdate(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_HTLCUpdateDecodeErrorZ_OK(HTLCUpdate res) { + this(null, bindings.CResult_HTLCUpdateDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_HTLCUpdateDecodeErrorZ_Err extends Result_HTLCUpdateDecodeErrorZ { + public final DecodeError err; + private Result_HTLCUpdateDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_HTLCUpdateDecodeErrorZ_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 Result_HTLCUpdateDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_HTLCUpdateDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_HolderCommitmentTransactionDecodeErrorZ.ts b/ts/structs/Result_HolderCommitmentTransactionDecodeErrorZ.ts new file mode 100644 index 00000000..613fcb9d --- /dev/null +++ b/ts/structs/Result_HolderCommitmentTransactionDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { + private Result_HolderCommitmentTransactionDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_HolderCommitmentTransactionDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_HolderCommitmentTransactionDecodeErrorZ_result_ok(ptr)) { + return new Result_HolderCommitmentTransactionDecodeErrorZ_OK(null, ptr); + } else { + return new Result_HolderCommitmentTransactionDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_HolderCommitmentTransactionDecodeErrorZ_OK extends Result_HolderCommitmentTransactionDecodeErrorZ { + public final HolderCommitmentTransaction res; + private Result_HolderCommitmentTransactionDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_HolderCommitmentTransactionDecodeErrorZ_get_ok(ptr); + const res_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_HolderCommitmentTransactionDecodeErrorZ_OK(HolderCommitmentTransaction res) { + this(null, bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_HolderCommitmentTransactionDecodeErrorZ_Err extends Result_HolderCommitmentTransactionDecodeErrorZ { + public final DecodeError err; + private Result_HolderCommitmentTransactionDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_HolderCommitmentTransactionDecodeErrorZ_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 Result_HolderCommitmentTransactionDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_InMemoryChannelKeysDecodeErrorZ.ts b/ts/structs/Result_InMemoryChannelKeysDecodeErrorZ.ts deleted file mode 100644 index 0d03fd66..00000000 --- a/ts/structs/Result_InMemoryChannelKeysDecodeErrorZ.ts +++ /dev/null @@ -1,47 +0,0 @@ - -import CommonBase from './CommonBase'; -import * as bindings from '../bindings' // TODO: figure out location - -public class Result_InMemoryChannelKeysDecodeErrorZ extends CommonBase { - private Result_InMemoryChannelKeysDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_InMemoryChannelKeysDecodeErrorZ_free(ptr); } super.finalize(); - } - - static Result_InMemoryChannelKeysDecodeErrorZ constr_from_ptr(long ptr) { - if (bindings.LDKCResult_InMemoryChannelKeysDecodeErrorZ_result_ok(ptr)) { - return new Result_InMemoryChannelKeysDecodeErrorZ_OK(null, ptr); - } else { - return new Result_InMemoryChannelKeysDecodeErrorZ_Err(null, ptr); - } - } - public static final class Result_InMemoryChannelKeysDecodeErrorZ_OK extends Result_InMemoryChannelKeysDecodeErrorZ { - public final InMemoryChannelKeys res; - private Result_InMemoryChannelKeysDecodeErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - number res = bindings.LDKCResult_InMemoryChannelKeysDecodeErrorZ_get_ok(ptr); - const res_hu_conv: InMemoryChannelKeys = new InMemoryChannelKeys(null, res); - res_hu_conv.ptrs_to.add(this); - this.res = res_hu_conv; - } - public Result_InMemoryChannelKeysDecodeErrorZ_OK(InMemoryChannelKeys res) { - this(null, bindings.CResult_InMemoryChannelKeysDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); - this.ptrs_to.add(res); - } - } - - public static final class Result_InMemoryChannelKeysDecodeErrorZ_Err extends Result_InMemoryChannelKeysDecodeErrorZ { - public final DecodeError err; - private Result_InMemoryChannelKeysDecodeErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - number err = bindings.LDKCResult_InMemoryChannelKeysDecodeErrorZ_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 Result_InMemoryChannelKeysDecodeErrorZ_Err(DecodeError err) { - this(null, bindings.CResult_InMemoryChannelKeysDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); - this.ptrs_to.add(err); - } - } -} diff --git a/ts/structs/Result_InMemorySignerDecodeErrorZ.ts b/ts/structs/Result_InMemorySignerDecodeErrorZ.ts new file mode 100644 index 00000000..89175a71 --- /dev/null +++ b/ts/structs/Result_InMemorySignerDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_InMemorySignerDecodeErrorZ extends CommonBase { + private Result_InMemorySignerDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_InMemorySignerDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_InMemorySignerDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_InMemorySignerDecodeErrorZ_result_ok(ptr)) { + return new Result_InMemorySignerDecodeErrorZ_OK(null, ptr); + } else { + return new Result_InMemorySignerDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_InMemorySignerDecodeErrorZ_OK extends Result_InMemorySignerDecodeErrorZ { + public final InMemorySigner res; + private Result_InMemorySignerDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_InMemorySignerDecodeErrorZ_get_ok(ptr); + const res_hu_conv: InMemorySigner = new InMemorySigner(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_InMemorySignerDecodeErrorZ_OK(InMemorySigner res) { + this(null, bindings.CResult_InMemorySignerDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_InMemorySignerDecodeErrorZ_Err extends Result_InMemorySignerDecodeErrorZ { + public final DecodeError err; + private Result_InMemorySignerDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_InMemorySignerDecodeErrorZ_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 Result_InMemorySignerDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_InMemorySignerDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_InitFeaturesDecodeErrorZ.ts b/ts/structs/Result_InitFeaturesDecodeErrorZ.ts new file mode 100644 index 00000000..2d959796 --- /dev/null +++ b/ts/structs/Result_InitFeaturesDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_InitFeaturesDecodeErrorZ extends CommonBase { + private Result_InitFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_InitFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_InitFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_InitFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_InitFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_InitFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_InitFeaturesDecodeErrorZ_OK extends Result_InitFeaturesDecodeErrorZ { + public final InitFeatures res; + private Result_InitFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_InitFeaturesDecodeErrorZ_get_ok(ptr); + const res_hu_conv: InitFeatures = new InitFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_InitFeaturesDecodeErrorZ_OK(InitFeatures res) { + this(null, bindings.CResult_InitFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_InitFeaturesDecodeErrorZ_Err extends Result_InitFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_InitFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_InitFeaturesDecodeErrorZ_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 Result_InitFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_InitFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_NetworkGraphDecodeErrorZ.ts b/ts/structs/Result_NetworkGraphDecodeErrorZ.ts index 38c3c298..78921d4e 100644 --- a/ts/structs/Result_NetworkGraphDecodeErrorZ.ts +++ b/ts/structs/Result_NetworkGraphDecodeErrorZ.ts @@ -27,14 +27,6 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { public Result_NetworkGraphDecodeErrorZ_OK(NetworkGraph res) { this(null, bindings.CResult_NetworkGraphDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); this.ptrs_to.add(res); - // 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 this 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 this call, res is reset to null and is now a dummy object. - res.ptr = 0; } } diff --git a/ts/structs/Result_NodeAnnouncementDecodeErrorZ.ts b/ts/structs/Result_NodeAnnouncementDecodeErrorZ.ts new file mode 100644 index 00000000..b382ff5d --- /dev/null +++ b/ts/structs/Result_NodeAnnouncementDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { + private Result_NodeAnnouncementDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NodeAnnouncementDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_NodeAnnouncementDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_NodeAnnouncementDecodeErrorZ_result_ok(ptr)) { + return new Result_NodeAnnouncementDecodeErrorZ_OK(null, ptr); + } else { + return new Result_NodeAnnouncementDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_NodeAnnouncementDecodeErrorZ_OK extends Result_NodeAnnouncementDecodeErrorZ { + public final NodeAnnouncement res; + private Result_NodeAnnouncementDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_NodeAnnouncementDecodeErrorZ_get_ok(ptr); + const res_hu_conv: NodeAnnouncement = new NodeAnnouncement(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_NodeAnnouncementDecodeErrorZ_OK(NodeAnnouncement res) { + this(null, bindings.CResult_NodeAnnouncementDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_NodeAnnouncementDecodeErrorZ_Err extends Result_NodeAnnouncementDecodeErrorZ { + public final DecodeError err; + private Result_NodeAnnouncementDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_NodeAnnouncementDecodeErrorZ_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 Result_NodeAnnouncementDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_NodeAnnouncementDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_NodeFeaturesDecodeErrorZ.ts b/ts/structs/Result_NodeFeaturesDecodeErrorZ.ts new file mode 100644 index 00000000..cd3d97da --- /dev/null +++ b/ts/structs/Result_NodeFeaturesDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_NodeFeaturesDecodeErrorZ extends CommonBase { + private Result_NodeFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_NodeFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_NodeFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_NodeFeaturesDecodeErrorZ_result_ok(ptr)) { + return new Result_NodeFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_NodeFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_NodeFeaturesDecodeErrorZ_OK extends Result_NodeFeaturesDecodeErrorZ { + public final NodeFeatures res; + private Result_NodeFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(ptr); + const res_hu_conv: NodeFeatures = new NodeFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_NodeFeaturesDecodeErrorZ_OK(NodeFeatures res) { + this(null, bindings.CResult_NodeFeaturesDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_NodeFeaturesDecodeErrorZ_Err extends Result_NodeFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_NodeFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_NodeFeaturesDecodeErrorZ_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 Result_NodeFeaturesDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_NodeFeaturesDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_NonePaymentSendFailureZ.ts b/ts/structs/Result_NonePaymentSendFailureZ.ts index e3b4f9fb..66ac0bed 100644 --- a/ts/structs/Result_NonePaymentSendFailureZ.ts +++ b/ts/structs/Result_NonePaymentSendFailureZ.ts @@ -29,13 +29,12 @@ public class Result_NonePaymentSendFailureZ extends CommonBase { private Result_NonePaymentSendFailureZ_Err(Object _dummy, long ptr) { super(_dummy, ptr); number err = bindings.LDKCResult_NonePaymentSendFailureZ_get_err(ptr); - const err_hu_conv: PaymentSendFailure = new PaymentSendFailure(null, err); + PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err); err_hu_conv.ptrs_to.add(this); this.err = err_hu_conv; } public Result_NonePaymentSendFailureZ_Err(PaymentSendFailure err) { - this(null, bindings.CResult_NonePaymentSendFailureZ_err(err == null ? 0 : err.ptr & ~1)); - this.ptrs_to.add(err); + this(null, bindings.CResult_NonePaymentSendFailureZ_err(err.ptr)); } } } diff --git a/ts/structs/Result_OpenChannelDecodeErrorZ.ts b/ts/structs/Result_OpenChannelDecodeErrorZ.ts new file mode 100644 index 00000000..0b9e5bf6 --- /dev/null +++ b/ts/structs/Result_OpenChannelDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_OpenChannelDecodeErrorZ extends CommonBase { + private Result_OpenChannelDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_OpenChannelDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_OpenChannelDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_OpenChannelDecodeErrorZ_result_ok(ptr)) { + return new Result_OpenChannelDecodeErrorZ_OK(null, ptr); + } else { + return new Result_OpenChannelDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_OpenChannelDecodeErrorZ_OK extends Result_OpenChannelDecodeErrorZ { + public final OpenChannel res; + private Result_OpenChannelDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_OpenChannelDecodeErrorZ_get_ok(ptr); + const res_hu_conv: OpenChannel = new OpenChannel(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_OpenChannelDecodeErrorZ_OK(OpenChannel res) { + this(null, bindings.CResult_OpenChannelDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_OpenChannelDecodeErrorZ_Err extends Result_OpenChannelDecodeErrorZ { + public final DecodeError err; + private Result_OpenChannelDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_OpenChannelDecodeErrorZ_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 Result_OpenChannelDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_OpenChannelDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_OutPointDecodeErrorZ.ts b/ts/structs/Result_OutPointDecodeErrorZ.ts new file mode 100644 index 00000000..7d46bc26 --- /dev/null +++ b/ts/structs/Result_OutPointDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_OutPointDecodeErrorZ extends CommonBase { + private Result_OutPointDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_OutPointDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_OutPointDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_OutPointDecodeErrorZ_result_ok(ptr)) { + return new Result_OutPointDecodeErrorZ_OK(null, ptr); + } else { + return new Result_OutPointDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_OutPointDecodeErrorZ_OK extends Result_OutPointDecodeErrorZ { + public final OutPoint res; + private Result_OutPointDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_OutPointDecodeErrorZ_get_ok(ptr); + const res_hu_conv: OutPoint = new OutPoint(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_OutPointDecodeErrorZ_OK(OutPoint res) { + this(null, bindings.CResult_OutPointDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_OutPointDecodeErrorZ_Err extends Result_OutPointDecodeErrorZ { + public final DecodeError err; + private Result_OutPointDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_OutPointDecodeErrorZ_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 Result_OutPointDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_OutPointDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_PublicKeyErrorZ.ts b/ts/structs/Result_PublicKeyErrorZ.ts new file mode 100644 index 00000000..2a790f14 --- /dev/null +++ b/ts/structs/Result_PublicKeyErrorZ.ts @@ -0,0 +1,39 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_PublicKeyErrorZ extends CommonBase { + private Result_PublicKeyErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PublicKeyErrorZ_free(ptr); } super.finalize(); + } + + static Result_PublicKeyErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_PublicKeyErrorZ_result_ok(ptr)) { + return new Result_PublicKeyErrorZ_OK(null, ptr); + } else { + return new Result_PublicKeyErrorZ_Err(null, ptr); + } + } + public static final class Result_PublicKeyErrorZ_OK extends Result_PublicKeyErrorZ { + public final Uint8Array res; + private Result_PublicKeyErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_PublicKeyErrorZ_get_ok(ptr); + } + public Result_PublicKeyErrorZ_OK(Uint8Array res) { + this(null, bindings.CResult_PublicKeyErrorZ_ok(res)); + } + } + + public static final class Result_PublicKeyErrorZ_Err extends Result_PublicKeyErrorZ { + public final LDKSecp256k1Error err; + private Result_PublicKeyErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_PublicKeyErrorZ_get_err(ptr); + } + public Result_PublicKeyErrorZ_Err(LDKSecp256k1Error err) { + this(null, bindings.CResult_PublicKeyErrorZ_err(err)); + } + } +} diff --git a/ts/structs/Result_RevokeAndACKDecodeErrorZ.ts b/ts/structs/Result_RevokeAndACKDecodeErrorZ.ts new file mode 100644 index 00000000..30426fd1 --- /dev/null +++ b/ts/structs/Result_RevokeAndACKDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { + private Result_RevokeAndACKDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_RevokeAndACKDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_RevokeAndACKDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_RevokeAndACKDecodeErrorZ_result_ok(ptr)) { + return new Result_RevokeAndACKDecodeErrorZ_OK(null, ptr); + } else { + return new Result_RevokeAndACKDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_RevokeAndACKDecodeErrorZ_OK extends Result_RevokeAndACKDecodeErrorZ { + public final RevokeAndACK res; + private Result_RevokeAndACKDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_RevokeAndACKDecodeErrorZ_get_ok(ptr); + const res_hu_conv: RevokeAndACK = new RevokeAndACK(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_RevokeAndACKDecodeErrorZ_OK(RevokeAndACK res) { + this(null, bindings.CResult_RevokeAndACKDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_RevokeAndACKDecodeErrorZ_Err extends Result_RevokeAndACKDecodeErrorZ { + public final DecodeError err; + private Result_RevokeAndACKDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_RevokeAndACKDecodeErrorZ_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 Result_RevokeAndACKDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_RevokeAndACKDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_SecretKeyErrorZ.ts b/ts/structs/Result_SecretKeyErrorZ.ts new file mode 100644 index 00000000..727c4b29 --- /dev/null +++ b/ts/structs/Result_SecretKeyErrorZ.ts @@ -0,0 +1,39 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_SecretKeyErrorZ extends CommonBase { + private Result_SecretKeyErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_SecretKeyErrorZ_free(ptr); } super.finalize(); + } + + static Result_SecretKeyErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_SecretKeyErrorZ_result_ok(ptr)) { + return new Result_SecretKeyErrorZ_OK(null, ptr); + } else { + return new Result_SecretKeyErrorZ_Err(null, ptr); + } + } + public static final class Result_SecretKeyErrorZ_OK extends Result_SecretKeyErrorZ { + public final Uint8Array res; + private Result_SecretKeyErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_SecretKeyErrorZ_get_ok(ptr); + } + public Result_SecretKeyErrorZ_OK(Uint8Array res) { + this(null, bindings.CResult_SecretKeyErrorZ_ok(res)); + } + } + + public static final class Result_SecretKeyErrorZ_Err extends Result_SecretKeyErrorZ { + public final LDKSecp256k1Error err; + private Result_SecretKeyErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_SecretKeyErrorZ_get_err(ptr); + } + public Result_SecretKeyErrorZ_Err(LDKSecp256k1Error err) { + this(null, bindings.CResult_SecretKeyErrorZ_err(err)); + } + } +} diff --git a/ts/structs/Result_ShutdownDecodeErrorZ.ts b/ts/structs/Result_ShutdownDecodeErrorZ.ts new file mode 100644 index 00000000..6b53c424 --- /dev/null +++ b/ts/structs/Result_ShutdownDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ShutdownDecodeErrorZ extends CommonBase { + private Result_ShutdownDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ShutdownDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ShutdownDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_ShutdownDecodeErrorZ_result_ok(ptr)) { + return new Result_ShutdownDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ShutdownDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ShutdownDecodeErrorZ_OK extends Result_ShutdownDecodeErrorZ { + public final Shutdown res; + private Result_ShutdownDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ShutdownDecodeErrorZ_get_ok(ptr); + const res_hu_conv: Shutdown = new Shutdown(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_ShutdownDecodeErrorZ_OK(Shutdown res) { + this(null, bindings.CResult_ShutdownDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_ShutdownDecodeErrorZ_Err extends Result_ShutdownDecodeErrorZ { + public final DecodeError err; + private Result_ShutdownDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ShutdownDecodeErrorZ_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 Result_ShutdownDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_ShutdownDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_SignDecodeErrorZ.ts b/ts/structs/Result_SignDecodeErrorZ.ts new file mode 100644 index 00000000..005c0a03 --- /dev/null +++ b/ts/structs/Result_SignDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_SignDecodeErrorZ extends CommonBase { + private Result_SignDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_SignDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_SignDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_SignDecodeErrorZ_result_ok(ptr)) { + return new Result_SignDecodeErrorZ_OK(null, ptr); + } else { + return new Result_SignDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_SignDecodeErrorZ_OK extends Result_SignDecodeErrorZ { + public final Sign res; + private Result_SignDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_SignDecodeErrorZ_get_ok(ptr); + Sign ret_hu_conv = new Sign(null, res); + ret_hu_conv.ptrs_to.add(this); + this.res = ret_hu_conv; + } + public Result_SignDecodeErrorZ_OK(Sign res) { + this(null, bindings.CResult_SignDecodeErrorZ_ok(res == null ? 0 : res.ptr)); + this.ptrs_to.add(res); + } + } + + public static final class Result_SignDecodeErrorZ_Err extends Result_SignDecodeErrorZ { + public final DecodeError err; + private Result_SignDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_SignDecodeErrorZ_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 Result_SignDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_SignDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_TransactionNoneZ.ts b/ts/structs/Result_TransactionNoneZ.ts new file mode 100644 index 00000000..b6abe503 --- /dev/null +++ b/ts/structs/Result_TransactionNoneZ.ts @@ -0,0 +1,37 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_TransactionNoneZ extends CommonBase { + private Result_TransactionNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_TransactionNoneZ_free(ptr); } super.finalize(); + } + + static Result_TransactionNoneZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_TransactionNoneZ_result_ok(ptr)) { + return new Result_TransactionNoneZ_OK(null, ptr); + } else { + return new Result_TransactionNoneZ_Err(null, ptr); + } + } + public static final class Result_TransactionNoneZ_OK extends Result_TransactionNoneZ { + public final Uint8Array res; + private Result_TransactionNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_TransactionNoneZ_get_ok(ptr); + } + public Result_TransactionNoneZ_OK(Uint8Array res) { + this(null, bindings.CResult_TransactionNoneZ_ok(res)); + } + } + + public static final class Result_TransactionNoneZ_Err extends Result_TransactionNoneZ { + private Result_TransactionNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + public Result_TransactionNoneZ_Err() { + this(null, bindings.CResult_TransactionNoneZ_err()); + } + } +} diff --git a/ts/structs/Result_TxCreationKeysDecodeErrorZ.ts b/ts/structs/Result_TxCreationKeysDecodeErrorZ.ts new file mode 100644 index 00000000..d58dcaf5 --- /dev/null +++ b/ts/structs/Result_TxCreationKeysDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { + private Result_TxCreationKeysDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_TxCreationKeysDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_TxCreationKeysDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_TxCreationKeysDecodeErrorZ_result_ok(ptr)) { + return new Result_TxCreationKeysDecodeErrorZ_OK(null, ptr); + } else { + return new Result_TxCreationKeysDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_TxCreationKeysDecodeErrorZ_OK extends Result_TxCreationKeysDecodeErrorZ { + public final TxCreationKeys res; + private Result_TxCreationKeysDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_TxCreationKeysDecodeErrorZ_get_ok(ptr); + const res_hu_conv: TxCreationKeys = new TxCreationKeys(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_TxCreationKeysDecodeErrorZ_OK(TxCreationKeys res) { + this(null, bindings.CResult_TxCreationKeysDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_TxCreationKeysDecodeErrorZ_Err extends Result_TxCreationKeysDecodeErrorZ { + public final DecodeError err; + private Result_TxCreationKeysDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_TxCreationKeysDecodeErrorZ_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 Result_TxCreationKeysDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_TxCreationKeysDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_TxCreationKeysErrorZ.ts b/ts/structs/Result_TxCreationKeysErrorZ.ts new file mode 100644 index 00000000..964be884 --- /dev/null +++ b/ts/structs/Result_TxCreationKeysErrorZ.ts @@ -0,0 +1,43 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_TxCreationKeysErrorZ extends CommonBase { + private Result_TxCreationKeysErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_TxCreationKeysErrorZ_free(ptr); } super.finalize(); + } + + static Result_TxCreationKeysErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_TxCreationKeysErrorZ_result_ok(ptr)) { + return new Result_TxCreationKeysErrorZ_OK(null, ptr); + } else { + return new Result_TxCreationKeysErrorZ_Err(null, ptr); + } + } + public static final class Result_TxCreationKeysErrorZ_OK extends Result_TxCreationKeysErrorZ { + public final TxCreationKeys res; + private Result_TxCreationKeysErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_TxCreationKeysErrorZ_get_ok(ptr); + const res_hu_conv: TxCreationKeys = new TxCreationKeys(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_TxCreationKeysErrorZ_OK(TxCreationKeys res) { + this(null, bindings.CResult_TxCreationKeysErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_TxCreationKeysErrorZ_Err extends Result_TxCreationKeysErrorZ { + public final LDKSecp256k1Error err; + private Result_TxCreationKeysErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + this.err = bindings.LDKCResult_TxCreationKeysErrorZ_get_err(ptr); + } + public Result_TxCreationKeysErrorZ_Err(LDKSecp256k1Error err) { + this(null, bindings.CResult_TxCreationKeysErrorZ_err(err)); + } + } +} diff --git a/ts/structs/Result_UpdateAddHTLCDecodeErrorZ.ts b/ts/structs/Result_UpdateAddHTLCDecodeErrorZ.ts new file mode 100644 index 00000000..5e1b94fa --- /dev/null +++ b/ts/structs/Result_UpdateAddHTLCDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateAddHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateAddHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateAddHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateAddHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateAddHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateAddHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateAddHTLCDecodeErrorZ_OK extends Result_UpdateAddHTLCDecodeErrorZ { + public final UpdateAddHTLC res; + private Result_UpdateAddHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_UpdateAddHTLCDecodeErrorZ_get_ok(ptr); + const res_hu_conv: UpdateAddHTLC = new UpdateAddHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateAddHTLCDecodeErrorZ_OK(UpdateAddHTLC res) { + this(null, bindings.CResult_UpdateAddHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateAddHTLCDecodeErrorZ_Err extends Result_UpdateAddHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateAddHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_UpdateAddHTLCDecodeErrorZ_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 Result_UpdateAddHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateAddHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_UpdateFailHTLCDecodeErrorZ.ts b/ts/structs/Result_UpdateFailHTLCDecodeErrorZ.ts new file mode 100644 index 00000000..f1b6b732 --- /dev/null +++ b/ts/structs/Result_UpdateFailHTLCDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateFailHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFailHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFailHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFailHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFailHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFailHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFailHTLCDecodeErrorZ_OK extends Result_UpdateFailHTLCDecodeErrorZ { + public final UpdateFailHTLC res; + private Result_UpdateFailHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_UpdateFailHTLCDecodeErrorZ_get_ok(ptr); + const res_hu_conv: UpdateFailHTLC = new UpdateFailHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFailHTLCDecodeErrorZ_OK(UpdateFailHTLC res) { + this(null, bindings.CResult_UpdateFailHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFailHTLCDecodeErrorZ_Err extends Result_UpdateFailHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFailHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_UpdateFailHTLCDecodeErrorZ_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 Result_UpdateFailHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFailHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.ts b/ts/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.ts new file mode 100644 index 00000000..8b05b5a2 --- /dev/null +++ b/ts/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateFailMalformedHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFailMalformedHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFailMalformedHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFailMalformedHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFailMalformedHTLCDecodeErrorZ_OK extends Result_UpdateFailMalformedHTLCDecodeErrorZ { + public final UpdateFailMalformedHTLC res; + private Result_UpdateFailMalformedHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_get_ok(ptr); + const res_hu_conv: UpdateFailMalformedHTLC = new UpdateFailMalformedHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFailMalformedHTLCDecodeErrorZ_OK(UpdateFailMalformedHTLC res) { + this(null, bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFailMalformedHTLCDecodeErrorZ_Err extends Result_UpdateFailMalformedHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFailMalformedHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ_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 Result_UpdateFailMalformedHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_UpdateFeeDecodeErrorZ.ts b/ts/structs/Result_UpdateFeeDecodeErrorZ.ts new file mode 100644 index 00000000..abb01dd7 --- /dev/null +++ b/ts/structs/Result_UpdateFeeDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_UpdateFeeDecodeErrorZ extends CommonBase { + private Result_UpdateFeeDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFeeDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFeeDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFeeDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFeeDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFeeDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFeeDecodeErrorZ_OK extends Result_UpdateFeeDecodeErrorZ { + public final UpdateFee res; + private Result_UpdateFeeDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_UpdateFeeDecodeErrorZ_get_ok(ptr); + const res_hu_conv: UpdateFee = new UpdateFee(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFeeDecodeErrorZ_OK(UpdateFee res) { + this(null, bindings.CResult_UpdateFeeDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFeeDecodeErrorZ_Err extends Result_UpdateFeeDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFeeDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_UpdateFeeDecodeErrorZ_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 Result_UpdateFeeDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFeeDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Result_UpdateFulfillHTLCDecodeErrorZ.ts b/ts/structs/Result_UpdateFulfillHTLCDecodeErrorZ.ts new file mode 100644 index 00000000..4899f6fc --- /dev/null +++ b/ts/structs/Result_UpdateFulfillHTLCDecodeErrorZ.ts @@ -0,0 +1,47 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { + private Result_UpdateFulfillHTLCDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_UpdateFulfillHTLCDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.LDKCResult_UpdateFulfillHTLCDecodeErrorZ_result_ok(ptr)) { + return new Result_UpdateFulfillHTLCDecodeErrorZ_OK(null, ptr); + } else { + return new Result_UpdateFulfillHTLCDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_UpdateFulfillHTLCDecodeErrorZ_OK extends Result_UpdateFulfillHTLCDecodeErrorZ { + public final UpdateFulfillHTLC res; + private Result_UpdateFulfillHTLCDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_UpdateFulfillHTLCDecodeErrorZ_get_ok(ptr); + const res_hu_conv: UpdateFulfillHTLC = new UpdateFulfillHTLC(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + public Result_UpdateFulfillHTLCDecodeErrorZ_OK(UpdateFulfillHTLC res) { + this(null, bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_ok(res == null ? 0 : res.ptr & ~1)); + this.ptrs_to.add(res); + } + } + + public static final class Result_UpdateFulfillHTLCDecodeErrorZ_Err extends Result_UpdateFulfillHTLCDecodeErrorZ { + public final DecodeError err; + private Result_UpdateFulfillHTLCDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_UpdateFulfillHTLCDecodeErrorZ_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 Result_UpdateFulfillHTLCDecodeErrorZ_Err(DecodeError err) { + this(null, bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1)); + this.ptrs_to.add(err); + } + } +} diff --git a/ts/structs/Route.ts b/ts/structs/Route.ts index f6d7e14a..737c9b01 100644 --- a/ts/structs/Route.ts +++ b/ts/structs/Route.ts @@ -19,12 +19,12 @@ import * as bindings from '../bindings' // TODO: figure out location } } public void set_paths(RouteHop[][] val) { - bindings.Route_set_paths(this.ptr, Arrays.stream(val).map(arr_conv_12 -> Arrays.stream(arr_conv_12).map(arr_conv_10 -> arr_conv_10 == null ? 0 : arr_conv_10.ptr & ~1).toArray(number[]::new)).toArray(number[][]::new)); + bindings.Route_set_paths(this.ptr, Arrays.stream(val).map(val_conv_12 -> Arrays.stream(val_conv_12).map(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray(number[]::new)).toArray(number[][]::new)); /* TODO 2 RouteHop[] */; } public static Route constructor_new(RouteHop[][] paths_arg) { - number ret = bindings.Route_new(Arrays.stream(paths_arg).map(arr_conv_12 -> Arrays.stream(arr_conv_12).map(arr_conv_10 -> arr_conv_10 == null ? 0 : arr_conv_10.ptr & ~1).toArray(number[]::new)).toArray(number[][]::new)); + number ret = bindings.Route_new(Arrays.stream(paths_arg).map(paths_arg_conv_12 -> Arrays.stream(paths_arg_conv_12).map(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray(number[]::new)).toArray(number[][]::new)); const ret_hu_conv: Route = new Route(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); /* TODO 2 RouteHop[] */; diff --git a/ts/structs/RoutingMessageHandler.ts b/ts/structs/RoutingMessageHandler.ts index 7d352482..04d3d5f5 100644 --- a/ts/structs/RoutingMessageHandler.ts +++ b/ts/structs/RoutingMessageHandler.ts @@ -61,14 +61,14 @@ import * as bindings from '../bindings' // TODO: figure out location get_next_channel_announcements (starting_point: number, batch_amount: number): number[] { ThreeTuple[] ret = arg.get_next_channel_announcements(starting_point, batch_amount); - result: number[] = Arrays.stream(ret).map(arr_conv_63 -> bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(arr_conv_63.a == null ? 0 : arr_conv_63.a.ptr & ~1, arr_conv_63.b == null ? 0 : arr_conv_63.b.ptr & ~1, arr_conv_63.c == null ? 0 : arr_conv_63.c.ptr & ~1)).toArray(number[]::new); + result: number[] = Arrays.stream(ret).map(ret_conv_63 -> bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(ret_conv_63.a == null ? 0 : ret_conv_63.a.ptr & ~1, ret_conv_63.b == null ? 0 : ret_conv_63.b.ptr & ~1, ret_conv_63.c == null ? 0 : ret_conv_63.c.ptr & ~1)).toArray(number[]::new); /* TODO 2 ThreeTuple */; return result; }, get_next_node_announcements (starting_point: Uint8Array, batch_amount: number): number[] { NodeAnnouncement[] ret = arg.get_next_node_announcements(starting_point, batch_amount); - result: number[] = Arrays.stream(ret).map(arr_conv_18 -> arr_conv_18 == null ? 0 : arr_conv_18.ptr & ~1).toArray(number[]::new); + result: number[] = Arrays.stream(ret).map(ret_conv_18 -> ret_conv_18 == null ? 0 : ret_conv_18.ptr & ~1).toArray(number[]::new); /* TODO 2 NodeAnnouncement */; return result; }, @@ -162,39 +162,39 @@ import * as bindings from '../bindings' // TODO: figure out location public ThreeTuple[] get_next_channel_announcements(number starting_point, number batch_amount) { number[] ret = bindings.RoutingMessageHandler_get_next_channel_announcements(this.ptr, starting_point, batch_amount); - ThreeTuple[] arr_conv_63_arr = new ThreeTuple[ret.length]; + ThreeTuple[] ret_conv_63_arr = new ThreeTuple[ret.length]; for (int l = 0; l < ret.length; l++) { - number arr_conv_63 = ret[l]; - number arr_conv_63_a = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(arr_conv_63); - const arr_conv_63_a_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, arr_conv_63_a); - arr_conv_63_a_hu_conv.ptrs_to.add(this);; - number arr_conv_63_b = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(arr_conv_63); - const arr_conv_63_b_hu_conv: ChannelUpdate = new ChannelUpdate(null, arr_conv_63_b); - arr_conv_63_b_hu_conv.ptrs_to.add(this);; - number arr_conv_63_c = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(arr_conv_63); - const arr_conv_63_c_hu_conv: ChannelUpdate = new ChannelUpdate(null, arr_conv_63_c); - arr_conv_63_c_hu_conv.ptrs_to.add(this);; - ThreeTuple arr_conv_63_conv = new ThreeTuple(arr_conv_63_a_hu_conv, arr_conv_63_b_hu_conv, arr_conv_63_c_hu_conv, () -> { - bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arr_conv_63); + number ret_conv_63 = ret[l]; + number ret_conv_63_a = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(ret_conv_63); + const ret_conv_63_a_hu_conv: ChannelAnnouncement = new ChannelAnnouncement(null, ret_conv_63_a); + ret_conv_63_a_hu_conv.ptrs_to.add(this);; + number ret_conv_63_b = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(ret_conv_63); + const ret_conv_63_b_hu_conv: ChannelUpdate = new ChannelUpdate(null, ret_conv_63_b); + ret_conv_63_b_hu_conv.ptrs_to.add(this);; + number ret_conv_63_c = bindings.LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(ret_conv_63); + const ret_conv_63_c_hu_conv: ChannelUpdate = new ChannelUpdate(null, ret_conv_63_c); + ret_conv_63_c_hu_conv.ptrs_to.add(this);; + ThreeTuple ret_conv_63_conv = new ThreeTuple(ret_conv_63_a_hu_conv, ret_conv_63_b_hu_conv, ret_conv_63_c_hu_conv, () -> { + bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(ret_conv_63); }); - arr_conv_63_a_hu_conv.ptrs_to.add(arr_conv_63_conv); - arr_conv_63_b_hu_conv.ptrs_to.add(arr_conv_63_conv); - arr_conv_63_c_hu_conv.ptrs_to.add(arr_conv_63_conv); - arr_conv_63_arr[l] = arr_conv_63_conv; + ret_conv_63_a_hu_conv.ptrs_to.add(ret_conv_63_conv); + ret_conv_63_b_hu_conv.ptrs_to.add(ret_conv_63_conv); + ret_conv_63_c_hu_conv.ptrs_to.add(ret_conv_63_conv); + ret_conv_63_arr[l] = ret_conv_63_conv; } - return arr_conv_63_arr; + return ret_conv_63_arr; } public NodeAnnouncement[] get_next_node_announcements(Uint8Array starting_point, number batch_amount) { number[] ret = bindings.RoutingMessageHandler_get_next_node_announcements(this.ptr, starting_point, batch_amount); - NodeAnnouncement[] arr_conv_18_arr = new NodeAnnouncement[ret.length]; + NodeAnnouncement[] ret_conv_18_arr = new NodeAnnouncement[ret.length]; for (int s = 0; s < ret.length; s++) { - number arr_conv_18 = ret[s]; - const arr_conv_18_hu_conv: NodeAnnouncement = new NodeAnnouncement(null, arr_conv_18); - arr_conv_18_hu_conv.ptrs_to.add(this); - arr_conv_18_arr[s] = arr_conv_18_hu_conv; + number ret_conv_18 = ret[s]; + const ret_conv_18_hu_conv: NodeAnnouncement = new NodeAnnouncement(null, ret_conv_18); + ret_conv_18_hu_conv.ptrs_to.add(this); + ret_conv_18_arr[s] = ret_conv_18_hu_conv; } - return arr_conv_18_arr; + return ret_conv_18_arr; } public void sync_routing_table(Uint8Array their_node_id, Init init) { diff --git a/ts/structs/Sign.ts b/ts/structs/Sign.ts new file mode 100644 index 00000000..641c324d --- /dev/null +++ b/ts/structs/Sign.ts @@ -0,0 +1,206 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export class Sign extends CommonBase { + + bindings_instance?: bindings.LDKSign; + + constructor(ptr?: number, arg?: bindings.LDKSign, pubkeys?: ChannelPublicKeys) { + if (Number.isFinite(ptr)) { + super(ptr); + this.bindings_instance = null; + } else { + // TODO: private constructor instantiation + super(bindings.LDKSign_new(arg, pubkeys == null ? 0 : pubkeys.ptr & ~1)); + this.ptrs_to.push(arg); + this.ptrs_to.add(pubkeys); + + } + } + + protected finalize() { + if (this.ptr != 0) { + bindings.Sign_free(this.ptr); + } + super.finalize(); + } + + static new_impl(arg: SignInterface, pubkeys: ChannelPublicKeys): Sign { + const impl_holder: LDKSignHolder = new LDKSignHolder(); + let structImplementation = { + // todo: in-line interface filling + get_per_commitment_point (idx: number): Uint8Array { + Uint8Array ret = arg.get_per_commitment_point(idx); + return ret; + }, + + release_commitment_secret (idx: number): Uint8Array { + Uint8Array ret = arg.release_commitment_secret(idx); + return ret; + }, + + channel_keys_id (): Uint8Array { + Uint8Array ret = arg.channel_keys_id(); + return ret; + }, + + sign_counterparty_commitment (commitment_tx: number): number { + const commitment_tx_hu_conv: CommitmentTransaction = new CommitmentTransaction(null, commitment_tx); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_counterparty_commitment(commitment_tx_hu_conv); + result: number = ret != null ? ret.ptr : 0; + return result; + }, + + sign_holder_commitment_and_htlcs (commitment_tx: number): number { + const commitment_tx_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, commitment_tx); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv); + result: number = ret != null ? ret.ptr : 0; + return result; + }, + + sign_justice_transaction (justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: number): number { + const htlc_hu_conv: HTLCOutputInCommitment = new HTLCOutputInCommitment(null, htlc); + Result_SignatureNoneZ ret = arg.sign_justice_transaction(justice_tx, input, amount, per_commitment_key, htlc_hu_conv); + result: number = ret != null ? ret.ptr : 0; + return result; + }, + + sign_counterparty_htlc_transaction (htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: number): number { + const htlc_hu_conv: HTLCOutputInCommitment = new HTLCOutputInCommitment(null, htlc); + Result_SignatureNoneZ ret = arg.sign_counterparty_htlc_transaction(htlc_tx, input, amount, per_commitment_point, htlc_hu_conv); + result: number = ret != null ? ret.ptr : 0; + return result; + }, + + sign_closing_transaction (closing_tx: Uint8Array): number { + Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx); + result: number = ret != null ? ret.ptr : 0; + return result; + }, + + sign_channel_announcement (msg: number): number { + const msg_hu_conv: UnsignedChannelAnnouncement = new UnsignedChannelAnnouncement(null, msg); + Result_SignatureNoneZ ret = arg.sign_channel_announcement(msg_hu_conv); + result: number = ret != null ? ret.ptr : 0; + return result; + }, + + ready_channel (channel_parameters: number): void { + const channel_parameters_hu_conv: ChannelTransactionParameters = new ChannelTransactionParameters(null, channel_parameters); + arg.ready_channel(channel_parameters_hu_conv); + }, + + write (): Uint8Array { + Uint8Array ret = arg.write(); + return ret; + }, + + + }; + impl_holder.held = new Sign (null, structImplementation, pubkeys); + } + } + + export interface SignInterface { + get_per_commitment_point(idx: number): Uint8Array; + release_commitment_secret(idx: number): Uint8Array; + channel_keys_id(): Uint8Array; + sign_counterparty_commitment(commitment_tx: CommitmentTransaction): Result_C2Tuple_SignatureCVec_SignatureZZNoneZ; + sign_holder_commitment_and_htlcs(commitment_tx: HolderCommitmentTransaction): Result_C2Tuple_SignatureCVec_SignatureZZNoneZ; + sign_justice_transaction(justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: HTLCOutputInCommitment): Result_SignatureNoneZ; + sign_counterparty_htlc_transaction(htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: HTLCOutputInCommitment): Result_SignatureNoneZ; + sign_closing_transaction(closing_tx: Uint8Array): Result_SignatureNoneZ; + sign_channel_announcement(msg: UnsignedChannelAnnouncement): Result_SignatureNoneZ; + ready_channel(channel_parameters: ChannelTransactionParameters): void; + write(): Uint8Array; + + } + + class LDKSignHolder { + held: Sign; + } + public Uint8Array get_per_commitment_point(number idx) { + Uint8Array ret = bindings.Sign_get_per_commitment_point(this.ptr, idx); + return ret; + } + + public Uint8Array release_commitment_secret(number idx) { + Uint8Array ret = bindings.Sign_release_commitment_secret(this.ptr, idx); + return ret; + } + + public Uint8Array channel_keys_id() { + Uint8Array ret = bindings.Sign_channel_keys_id(this.ptr); + return ret; + } + + public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx) { + number ret = bindings.Sign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(commitment_tx); + return ret_hu_conv; + } + + public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) { + number ret = bindings.Sign_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); + Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(commitment_tx); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_justice_transaction(Uint8Array justice_tx, number input, number amount, Uint8Array per_commitment_key, HTLCOutputInCommitment htlc) { + number ret = bindings.Sign_sign_justice_transaction(this.ptr, justice_tx, input, amount, per_commitment_key, htlc == null ? 0 : htlc.ptr & ~1); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(htlc); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_counterparty_htlc_transaction(Uint8Array htlc_tx, number input, number amount, Uint8Array per_commitment_point, HTLCOutputInCommitment htlc) { + number ret = bindings.Sign_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, per_commitment_point, htlc == null ? 0 : htlc.ptr & ~1); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(htlc); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_closing_transaction(Uint8Array closing_tx) { + number ret = bindings.Sign_sign_closing_transaction(this.ptr, closing_tx); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) { + number ret = bindings.Sign_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); + this.ptrs_to.add(msg); + return ret_hu_conv; + } + + public void ready_channel(ChannelTransactionParameters channel_parameters) { + bindings.Sign_ready_channel(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1); + this.ptrs_to.add(channel_parameters); + } + + public Uint8Array write() { + Uint8Array ret = bindings.Sign_write(this.ptr); + return ret; + } + + public ChannelPublicKeys get_pubkeys() { + number ret = bindings.Sign_get_pubkeys(this.ptr); + const ret_hu_conv: ChannelPublicKeys = new ChannelPublicKeys(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public Sign clone() { + number ret = bindings.Sign_clone(this.ptr); + Sign ret_hu_conv = new Sign(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/ts/structs/SpendableOutputDescriptor.ts b/ts/structs/SpendableOutputDescriptor.ts index 005b9741..b2481d75 100644 --- a/ts/structs/SpendableOutputDescriptor.ts +++ b/ts/structs/SpendableOutputDescriptor.ts @@ -13,11 +13,11 @@ export default class SpendableOutputDescriptor extends CommonBase { if (raw_val instanceof bindings.LDKSpendableOutputDescriptor.StaticOutput) { return new StaticOutput(this.ptr, raw_val); } - if (raw_val instanceof bindings.LDKSpendableOutputDescriptor.DynamicOutputP2WSH) { - return new DynamicOutputP2WSH(this.ptr, raw_val); + if (raw_val instanceof bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput) { + return new DelayedPaymentOutput(this.ptr, raw_val); } - if (raw_val instanceof bindings.LDKSpendableOutputDescriptor.StaticOutputCounterpartyPayment) { - return new StaticOutputCounterpartyPayment(this.ptr, raw_val); + if (raw_val instanceof bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput) { + return new StaticPaymentOutput(this.ptr, raw_val); } throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } @@ -37,53 +37,13 @@ export class StaticOutput extends SpendableOutputDescriptor { this.output = output_conv; } } -export class DynamicOutputP2WSH extends SpendableOutputDescriptor { - public outpoint: OutPoint; - public per_commitment_point: Uint8Array; - public to_self_delay: number; - public output: TxOut; - public key_derivation_params: TwoTuple; - public revocation_pubkey: Uint8Array; - private constructor(ptr: number, obj: bindings.LDKSpendableOutputDescriptor.DynamicOutputP2WSH) { +export class DelayedPaymentOutput extends SpendableOutputDescriptor { + private constructor(ptr: number, obj: bindings.LDKSpendableOutputDescriptor.DelayedPaymentOutput) { super(null, ptr); - const outpoint: number = obj.outpoint; - const outpoint_hu_conv: OutPoint = new OutPoint(null, outpoint); - outpoint_hu_conv.ptrs_to.add(this); - this.outpoint = outpoint_hu_conv; - this.per_commitment_point = obj.per_commitment_point; - this.to_self_delay = obj.to_self_delay; - const output: number = obj.output; - TxOut output_conv = new TxOut(null, output); - this.output = output_conv; - const key_derivation_params: number = obj.key_derivation_params; - number key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params); - number key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params); - TwoTuple key_derivation_params_conv = new TwoTuple(key_derivation_params_a, key_derivation_params_b, () -> { - bindings.C2Tuple_u64u64Z_free(key_derivation_params); - }); - this.key_derivation_params = key_derivation_params_conv; - this.revocation_pubkey = obj.revocation_pubkey; } } -export class StaticOutputCounterpartyPayment extends SpendableOutputDescriptor { - public outpoint: OutPoint; - public output: TxOut; - public key_derivation_params: TwoTuple; - private constructor(ptr: number, obj: bindings.LDKSpendableOutputDescriptor.StaticOutputCounterpartyPayment) { +export class StaticPaymentOutput extends SpendableOutputDescriptor { + private constructor(ptr: number, obj: bindings.LDKSpendableOutputDescriptor.StaticPaymentOutput) { super(null, ptr); - const outpoint: number = obj.outpoint; - const outpoint_hu_conv: OutPoint = new OutPoint(null, outpoint); - outpoint_hu_conv.ptrs_to.add(this); - this.outpoint = outpoint_hu_conv; - const output: number = obj.output; - TxOut output_conv = new TxOut(null, output); - this.output = output_conv; - const key_derivation_params: number = obj.key_derivation_params; - number key_derivation_params_a = bindings.LDKC2Tuple_u64u64Z_get_a(key_derivation_params); - number key_derivation_params_b = bindings.LDKC2Tuple_u64u64Z_get_b(key_derivation_params); - TwoTuple key_derivation_params_conv = new TwoTuple(key_derivation_params_a, key_derivation_params_b, () -> { - bindings.C2Tuple_u64u64Z_free(key_derivation_params); - }); - this.key_derivation_params = key_derivation_params_conv; } } diff --git a/ts/structs/StaticPaymentOutputDescriptor.ts b/ts/structs/StaticPaymentOutputDescriptor.ts new file mode 100644 index 00000000..f4585c83 --- /dev/null +++ b/ts/structs/StaticPaymentOutputDescriptor.ts @@ -0,0 +1,70 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class StaticPaymentOutputDescriptor extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.StaticPaymentOutputDescriptor_free(this.ptr); + } + } + public OutPoint get_outpoint() { + number ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr); + const ret_hu_conv: OutPoint = new OutPoint(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public void set_outpoint(OutPoint val) { + bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + public void set_output(TxOut val) { + bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr); + } + + public Uint8Array get_channel_keys_id() { + Uint8Array ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr); + return ret; + } + + public void set_channel_keys_id(Uint8Array val) { + bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, val); + } + + public number get_channel_value_satoshis() { + number ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr); + return ret; + } + + public void set_channel_value_satoshis(number val) { + bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val); + } + + public static StaticPaymentOutputDescriptor constructor_new(OutPoint outpoint_arg, TxOut output_arg, Uint8Array channel_keys_id_arg, number channel_value_satoshis_arg) { + number ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, output_arg.ptr, channel_keys_id_arg, channel_value_satoshis_arg); + const ret_hu_conv: StaticPaymentOutputDescriptor = new StaticPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(outpoint_arg); + return ret_hu_conv; + } + + public StaticPaymentOutputDescriptor clone() { + number ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr); + const ret_hu_conv: StaticPaymentOutputDescriptor = new StaticPaymentOutputDescriptor(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + +} diff --git a/ts/structs/UnsignedNodeAnnouncement.ts b/ts/structs/UnsignedNodeAnnouncement.ts index bffe475a..e7a35ed5 100644 --- a/ts/structs/UnsignedNodeAnnouncement.ts +++ b/ts/structs/UnsignedNodeAnnouncement.ts @@ -67,7 +67,7 @@ import * as bindings from '../bindings' // TODO: figure out location } public void set_addresses(NetAddress[] val) { - bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, Arrays.stream(val).map(arr_conv_12 -> arr_conv_12.ptr).toArray(number[]::new)); + bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, Arrays.stream(val).map(val_conv_12 -> val_conv_12.ptr).toArray(number[]::new)); /* TODO 2 NetAddress */; } diff --git a/ts/structs/UtilMethods.ts b/ts/structs/UtilMethods.ts index 58c79b04..e797b758 100644 --- a/ts/structs/UtilMethods.ts +++ b/ts/structs/UtilMethods.ts @@ -6,7 +6,7 @@ } public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ constructor_BlockHashChannelManagerZ_read(Uint8Array ser, KeysInterface arg_keys_manager, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) { - number ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr & ~1, Arrays.stream(arg_channel_monitors).map(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray(number[]::new))); + number ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr & ~1, Arrays.stream(arg_channel_monitors).map(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr & ~1).toArray(number[]::new))); Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(arg_keys_manager); ret_hu_conv.ptrs_to.add(arg_fee_estimator); diff --git a/ts/structs/Watch.ts b/ts/structs/Watch.ts index 34555536..b1a752e9 100644 --- a/ts/structs/Watch.ts +++ b/ts/structs/Watch.ts @@ -54,7 +54,7 @@ import * as bindings from '../bindings' // TODO: figure out location release_pending_monitor_events (): number[] { MonitorEvent[] ret = arg.release_pending_monitor_events(); - result: number[] = Arrays.stream(ret).map(arr_conv_14 -> arr_conv_14 == null ? 0 : arr_conv_14.ptr & ~1).toArray(number[]::new); + result: number[] = Arrays.stream(ret).map(ret_conv_14 -> ret_conv_14.ptr).toArray(number[]::new); /* TODO 2 MonitorEvent */; return result; }, @@ -93,14 +93,14 @@ import * as bindings from '../bindings' // TODO: figure out location public MonitorEvent[] release_pending_monitor_events() { number[] ret = bindings.Watch_release_pending_monitor_events(this.ptr); - MonitorEvent[] arr_conv_14_arr = new MonitorEvent[ret.length]; + MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length]; for (int o = 0; o < ret.length; o++) { - number arr_conv_14 = ret[o]; - const arr_conv_14_hu_conv: MonitorEvent = new MonitorEvent(null, arr_conv_14); - arr_conv_14_hu_conv.ptrs_to.add(this); - arr_conv_14_arr[o] = arr_conv_14_hu_conv; + number ret_conv_14 = ret[o]; + MonitorEvent ret_conv_14_hu_conv = MonitorEvent.constr_from_ptr(ret_conv_14); + ret_conv_14_hu_conv.ptrs_to.add(this); + ret_conv_14_arr[o] = ret_conv_14_hu_conv; } - return arr_conv_14_arr; + return ret_conv_14_arr; } }