Merge pull request #39 from TheBlueMatt/main
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Wed, 18 Aug 2021 04:50:17 +0000 (04:50 +0000)
committerGitHub <noreply@github.com>
Wed, 18 Aug 2021 04:50:17 +0000 (04:50 +0000)
v0.0.100.0

47 files changed:
.github/workflows/build.yml
gen_type_mapping.py
java_strings.py
src/main/java/org/ldk/impl/bindings.java
src/main/java/org/ldk/structs/APIError.java
src/main/java/org/ldk/structs/BackgroundProcessor.java
src/main/java/org/ldk/structs/ChannelConfig.java
src/main/java/org/ldk/structs/ChannelManager.java
src/main/java/org/ldk/structs/ClosingSigned.java
src/main/java/org/ldk/structs/ClosingSignedFeeRange.java [new file with mode: 0644]
src/main/java/org/ldk/structs/Event.java
src/main/java/org/ldk/structs/InvalidShutdownScript.java [new file with mode: 0644]
src/main/java/org/ldk/structs/KeysInterface.java
src/main/java/org/ldk/structs/PaymentPurpose.java [new file with mode: 0644]
src/main/java/org/ldk/structs/PeerManager.java
src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java [new file with mode: 0644]
src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java [new file with mode: 0644]
src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java [new file with mode: 0644]
src/main/java/org/ldk/structs/Result_ShutdownScriptInvalidShutdownScriptZ.java [new file with mode: 0644]
src/main/java/org/ldk/structs/ShutdownScript.java [new file with mode: 0644]
src/main/java/org/ldk/structs/UtilMethods.java
src/main/jni/bindings.c
src/main/jni/bindings.c.body
src/main/jni/org_ldk_impl_bindings.h
src/main/jni/org_ldk_impl_bindings_LDKPaymentPurpose.h [new file with mode: 0644]
src/test/java/org/ldk/HumanObjectPeerTest.java
src/test/java/org/ldk/PeerTest.java
ts/bindings.c
ts/bindings.c.body
ts/bindings.ts
ts/structs/APIError.ts
ts/structs/BackgroundProcessor.ts
ts/structs/ChannelConfig.ts
ts/structs/ChannelManager.ts
ts/structs/ClosingSigned.ts
ts/structs/ClosingSignedFeeRange.ts [new file with mode: 0644]
ts/structs/Event.ts
ts/structs/InvalidShutdownScript.ts [new file with mode: 0644]
ts/structs/KeysInterface.ts
ts/structs/PaymentPurpose.ts [new file with mode: 0644]
ts/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.ts [new file with mode: 0644]
ts/structs/Result_PaymentHashPaymentSendFailureZ.ts [new file with mode: 0644]
ts/structs/Result_ShutdownScriptDecodeErrorZ.ts [new file with mode: 0644]
ts/structs/Result_ShutdownScriptInvalidShutdownScriptZ.ts [new file with mode: 0644]
ts/structs/ShutdownScript.ts [new file with mode: 0644]
ts/structs/UtilMethods.ts
typescript_strings.py

index 94eab836a051ac0a5d44cb57a0698f9af41455ee..807a5fff987ef25cedf9d989c7e84f740a17726f 100644 (file)
@@ -35,7 +35,7 @@ jobs:
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.99
+          git checkout 0.0.100
       - name: Rebuild C bindings without STD for WASM
         run: |
           cd ldk-c-bindings
@@ -163,7 +163,7 @@ jobs:
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.99
+          git checkout 0.0.100
       - name: Detect current git version
         run: |
           # We assume the top commit is just a bindings update commit, so we
@@ -243,7 +243,7 @@ jobs:
           cd ..
           git clone https://github.com/lightningdevkit/ldk-c-bindings
           cd ldk-c-bindings
-          git checkout 0.0.99
+          git checkout 0.0.100
       - name: Rebuild C bindings with upstream clang, and check the sample app builds + links
         run: |
           cd ldk-c-bindings
index 6cf389aac46ff049e668154a9ba0bc96661fe1e2..ab95f9b68bcb67a80894ceceee1e43b65cd7d335 100644 (file)
@@ -297,7 +297,7 @@ class TypeMappingGenerator:
                     if not is_free:
                         needs_full_clone = not is_free and (not ty_info.is_ptr and not holds_ref or ty_info.requires_clone == True) and ty_info.requires_clone != False
                         if needs_full_clone and (ty_info.rust_obj.replace("LDK", "") + "_clone") in self.clone_fns:
-                            base_conv = base_conv + "\n" + ty_info.var_name + "_conv = " + ty_info.rust_obj.replace("LDK", "") + "_clone(" + ty_info.var_name + ");"
+                            base_conv = base_conv + "\n" + ty_info.var_name + "_conv = " + ty_info.rust_obj.replace("LDK", "") + "_clone(&" + ty_info.var_name + "_conv);"
                         else:
                             base_conv = base_conv + self.consts.trait_struct_inc_refcnt(ty_info)
                             if needs_full_clone:
index 3482dfb9b63b3e011957c581ce273325b31f69ee..2ddecab7539aed909fc8f544515f4ec3497e1a0a 100644 (file)
@@ -849,7 +849,7 @@ import javax.annotation.Nullable;
                 elif not fn_line.ret_ty_info.passed_as_ptr:
                     out_c += "\t" + fn_line.ret_ty_info.c_ty + " ret = (*env)->Call" + fn_line.ret_ty_info.java_ty.title() + "Method(env, obj, j_calls->" + fn_line.fn_name + "_meth"
                 else:
-                    out_c = out_c + "\t" + fn_line.ret_ty_info.rust_obj + "* ret = (" + fn_line.ret_ty_info.rust_obj + "*)(*env)->CallLongMethod(env, obj, j_calls->" + fn_line.fn_name + "_meth"
+                    out_c = out_c + "\tuint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->" + fn_line.fn_name + "_meth"
 
                 for idx, arg_info in enumerate(fn_line.args_ty):
                     if arg_info.ret_conv is not None:
index 01db9fe6be5e5c7691925355c397431be1c61572..ddfc55f2c37dc2df409f712566fb66f0727d0e8e 100644 (file)
@@ -48,7 +48,7 @@ public class bindings {
        static native String get_lib_version_string();
 
        public static String get_ldk_java_bindings_version() {
-               return "v0.0.99.2";
+               return "v0.0.100.0";
        }
        public static native String get_ldk_c_bindings_version();
        public static native String get_ldk_version();
@@ -133,6 +133,12 @@ public class bindings {
        public static native boolean LDKCResult_CVec_SignatureZNoneZ_result_ok(long arg);
        public static native byte[][] LDKCResult_CVec_SignatureZNoneZ_get_ok(long arg);
        public static native void LDKCResult_CVec_SignatureZNoneZ_get_err(long arg);
+       public static native boolean LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(long arg);
+       public static native long LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(long arg);
+       public static native long LDKCResult_ShutdownScriptDecodeErrorZ_get_err(long arg);
+       public static native boolean LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(long arg);
+       public static native long LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(long arg);
+       public static native long LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(long arg);
        public static native boolean LDKCResult_NoneErrorZ_result_ok(long arg);
        public static native void LDKCResult_NoneErrorZ_get_ok(long arg);
        public static native IOError LDKCResult_NoneErrorZ_get_err(long arg);
@@ -497,6 +503,10 @@ public class bindings {
                public final static class MonitorUpdateFailed extends LDKAPIError {
                        MonitorUpdateFailed() { }
                }
+               public final static class IncompatibleShutdownScript extends LDKAPIError {
+                       public long script;
+                       IncompatibleShutdownScript(long script) { this.script = script; }
+               }
                static native void init();
        }
        static { LDKAPIError.init(); }
@@ -531,6 +541,9 @@ public class bindings {
        public static native boolean LDKCResult_NonePaymentSendFailureZ_result_ok(long arg);
        public static native void LDKCResult_NonePaymentSendFailureZ_get_ok(long arg);
        public static native long LDKCResult_NonePaymentSendFailureZ_get_err(long arg);
+       public static native boolean LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(long arg);
+       public static native byte[] LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(long arg);
+       public static native long LDKCResult_PaymentHashPaymentSendFailureZ_get_err(long arg);
        public static class LDKNetAddress {
                private LDKNetAddress() {}
                public final static class IPv4 extends LDKNetAddress {
@@ -588,7 +601,7 @@ public class bindings {
        public interface LDKKeysInterface {
                 byte[] get_node_secret();
                 byte[] get_destination_script();
-                byte[] get_shutdown_pubkey();
+                long get_shutdown_scriptpubkey();
                 long get_channel_signer(boolean inbound, long channel_value_satoshis);
                 byte[] get_secure_random_bytes();
                 long read_chan_signer(byte[] reader);
@@ -599,8 +612,8 @@ public class bindings {
        public static native byte[] KeysInterface_get_node_secret(long this_arg);
        // LDKCVec_u8Z KeysInterface_get_destination_script LDKKeysInterface *NONNULL_PTR this_arg
        public static native byte[] KeysInterface_get_destination_script(long this_arg);
-       // LDKPublicKey KeysInterface_get_shutdown_pubkey LDKKeysInterface *NONNULL_PTR this_arg
-       public static native byte[] KeysInterface_get_shutdown_pubkey(long this_arg);
+       // LDKShutdownScript KeysInterface_get_shutdown_scriptpubkey LDKKeysInterface *NONNULL_PTR this_arg
+       public static native long KeysInterface_get_shutdown_scriptpubkey(long this_arg);
        // LDKSign KeysInterface_get_channel_signer LDKKeysInterface *NONNULL_PTR 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 *NONNULL_PTR this_arg
@@ -689,6 +702,22 @@ public class bindings {
        public static native byte[] LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(long ptr);
        public static native long[] LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(long ptr);
        public static native long LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(long[] elems);
+       public static class LDKPaymentPurpose {
+               private LDKPaymentPurpose() {}
+               public final static class InvoicePayment extends LDKPaymentPurpose {
+                       public byte[] payment_preimage;
+                       public byte[] payment_secret;
+                       public long user_payment_id;
+                       InvoicePayment(byte[] payment_preimage, byte[] payment_secret, long user_payment_id) { this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; this.user_payment_id = user_payment_id; }
+               }
+               public final static class SpontaneousPayment extends LDKPaymentPurpose {
+                       public byte[] spontaneous_payment;
+                       SpontaneousPayment(byte[] spontaneous_payment) { this.spontaneous_payment = spontaneous_payment; }
+               }
+               static native void init();
+       }
+       static { LDKPaymentPurpose.init(); }
+       public static native LDKPaymentPurpose LDKPaymentPurpose_ref_from_ptr(long ptr);
        public static class LDKEvent {
                private LDKEvent() {}
                public final static class FundingGenerationReady extends LDKEvent {
@@ -700,11 +729,9 @@ public class bindings {
                }
                public final static class PaymentReceived extends LDKEvent {
                        public byte[] payment_hash;
-                       public byte[] payment_preimage;
-                       public byte[] payment_secret;
                        public long amt;
-                       public long user_payment_id;
-                       PaymentReceived(byte[] payment_hash, byte[] payment_preimage, byte[] payment_secret, long amt, long user_payment_id) { this.payment_hash = payment_hash; this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; this.amt = amt; this.user_payment_id = user_payment_id; }
+                       public long purpose;
+                       PaymentReceived(byte[] payment_hash, long amt, long purpose) { this.payment_hash = payment_hash; this.amt = amt; this.purpose = purpose; }
                }
                public final static class PaymentSent extends LDKEvent {
                        public byte[] payment_preimage;
@@ -723,6 +750,11 @@ public class bindings {
                        public long[] outputs;
                        SpendableOutputs(long[] outputs) { this.outputs = outputs; }
                }
+               public final static class PaymentForwarded extends LDKEvent {
+                       public long fee_earned_msat;
+                       public boolean claim_from_onchain_tx;
+                       PaymentForwarded(long fee_earned_msat, boolean claim_from_onchain_tx) { this.fee_earned_msat = fee_earned_msat; this.claim_from_onchain_tx = claim_from_onchain_tx; }
+               }
                static native void init();
        }
        static { LDKEvent.init(); }
@@ -804,6 +836,9 @@ public class bindings {
        public static native boolean LDKCResult_ClosingSignedDecodeErrorZ_result_ok(long arg);
        public static native long LDKCResult_ClosingSignedDecodeErrorZ_get_ok(long arg);
        public static native long LDKCResult_ClosingSignedDecodeErrorZ_get_err(long arg);
+       public static native boolean LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(long arg);
+       public static native long LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(long arg);
+       public static native long LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(long arg);
        public static native boolean LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(long arg);
        public static native long LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(long arg);
        public static native long LDKCResult_CommitmentSignedDecodeErrorZ_get_err(long arg);
@@ -1230,6 +1265,20 @@ public class bindings {
        public static native void CResult_CVec_SignatureZNoneZ_free(long _res);
        // struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
        public static native long CResult_CVec_SignatureZNoneZ_clone(long orig);
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
+       public static native long CResult_ShutdownScriptDecodeErrorZ_ok(long o);
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
+       public static native long CResult_ShutdownScriptDecodeErrorZ_err(long e);
+       // void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
+       public static native void CResult_ShutdownScriptDecodeErrorZ_free(long _res);
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
+       public static native long CResult_ShutdownScriptDecodeErrorZ_clone(long orig);
+       // struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
+       public static native long CResult_ShutdownScriptInvalidShutdownScriptZ_ok(long o);
+       // struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
+       public static native long CResult_ShutdownScriptInvalidShutdownScriptZ_err(long e);
+       // void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
+       public static native void CResult_ShutdownScriptInvalidShutdownScriptZ_free(long _res);
        // struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
        public static native long CResult_NoneErrorZ_ok();
        // struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
@@ -1474,6 +1523,14 @@ public class bindings {
        public static native void CResult_NonePaymentSendFailureZ_free(long _res);
        // struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
        public static native long CResult_NonePaymentSendFailureZ_clone(long orig);
+       // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
+       public static native long CResult_PaymentHashPaymentSendFailureZ_ok(byte[] o);
+       // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+       public static native long CResult_PaymentHashPaymentSendFailureZ_err(long e);
+       // void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
+       public static native void CResult_PaymentHashPaymentSendFailureZ_free(long _res);
+       // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
+       public static native long CResult_PaymentHashPaymentSendFailureZ_clone(long orig);
        // void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
        public static native void CVec_NetAddressZ_free(long[] _res);
        // struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
@@ -1850,6 +1907,14 @@ public class bindings {
        public static native void CResult_ClosingSignedDecodeErrorZ_free(long _res);
        // struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
        public static native long CResult_ClosingSignedDecodeErrorZ_clone(long orig);
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
+       public static native long CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(long o);
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
+       public static native long CResult_ClosingSignedFeeRangeDecodeErrorZ_err(long e);
+       // void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
+       public static native void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(long _res);
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
+       public static native long CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(long orig);
        // struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
        public static native long CResult_CommitmentSignedDecodeErrorZ_ok(long o);
        // struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
@@ -2074,14 +2139,22 @@ public class bindings {
        public static native void CResult_InvoiceSignOrCreationErrorZ_free(long _res);
        // struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
        public static native long CResult_InvoiceSignOrCreationErrorZ_clone(long orig);
+       // void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
+       public static native void PaymentPurpose_free(long this_ptr);
+       // struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
+       public static native long PaymentPurpose_clone(long orig);
+       // struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
+       public static native long PaymentPurpose_invoice_payment(byte[] payment_preimage, byte[] payment_secret, long user_payment_id);
+       // struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
+       public static native long PaymentPurpose_spontaneous_payment(byte[] a);
        // void Event_free(struct LDKEvent this_ptr);
        public static native void Event_free(long this_ptr);
        // struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
        public static native long Event_clone(long orig);
        // struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
        public static native long Event_funding_generation_ready(byte[] temporary_channel_id, long channel_value_satoshis, byte[] output_script, long user_channel_id);
-       // struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t amt, uint64_t user_payment_id);
-       public static native long Event_payment_received(byte[] payment_hash, byte[] payment_preimage, byte[] payment_secret, long amt, long user_payment_id);
+       // struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
+       public static native long Event_payment_received(byte[] payment_hash, long amt, long purpose);
        // struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage);
        public static native long Event_payment_sent(byte[] payment_preimage);
        // struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest);
@@ -2090,6 +2163,8 @@ public class bindings {
        public static native long Event_pending_htlcs_forwardable(long time_forwardable);
        // struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
        public static native long Event_spendable_outputs(long[] outputs);
+       // struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
+       public static native long Event_payment_forwarded(long fee_earned_msat, boolean claim_from_onchain_tx);
        // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
        public static native byte[] Event_write(long obj);
        // void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
@@ -2156,6 +2231,8 @@ public class bindings {
        public static native long APIError_channel_unavailable(String err);
        // struct LDKAPIError APIError_monitor_update_failed(void);
        public static native long APIError_monitor_update_failed();
+       // struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
+       public static native long APIError_incompatible_shutdown_script(long script);
        // struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
        public static native long sign(byte[] msg, byte[] sk);
        // struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
@@ -2264,8 +2341,16 @@ public class bindings {
        public static native boolean ChannelConfig_get_commit_upfront_shutdown_pubkey(long this_ptr);
        // void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
        public static native void ChannelConfig_set_commit_upfront_shutdown_pubkey(long this_ptr, boolean val);
-       // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
-       public static native long ChannelConfig_new(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg);
+       // uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+       public static native long ChannelConfig_get_max_dust_htlc_exposure_msat(long this_ptr);
+       // void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
+       public static native void ChannelConfig_set_max_dust_htlc_exposure_msat(long this_ptr, long val);
+       // uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+       public static native long ChannelConfig_get_force_close_avoidance_max_fee_satoshis(long this_ptr);
+       // void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
+       public static native void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(long this_ptr, long val);
+       // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
+       public static native long ChannelConfig_new(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg, long max_dust_htlc_exposure_msat_arg, long force_close_avoidance_max_fee_satoshis_arg);
        // struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
        public static native long ChannelConfig_clone(long orig);
        // MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
@@ -2356,6 +2441,8 @@ public class bindings {
        public static native ConfirmationTarget ConfirmationTarget_normal();
        // enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
        public static native ConfirmationTarget ConfirmationTarget_high_priority();
+       // bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
+       public static native boolean ConfirmationTarget_eq(long a, long b);
        // void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
        public static native void FeeEstimator_free(long this_ptr);
        // void ChainMonitor_free(struct LDKChainMonitor this_obj);
@@ -2740,12 +2827,16 @@ public class bindings {
        public static native long[] ChannelManager_list_usable_channels(long this_arg);
        // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
        public static native long ChannelManager_close_channel(long this_arg, byte[] channel_id);
+       // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight);
+       public static native long ChannelManager_close_channel_with_target_feerate(long this_arg, byte[] channel_id, int target_feerate_sats_per_1000_weight);
        // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
        public static native long ChannelManager_force_close_channel(long this_arg, byte[] channel_id);
        // void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
        public static native void ChannelManager_force_close_all_channels(long this_arg);
        // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
        public static native long ChannelManager_send_payment(long this_arg, long route, byte[] payment_hash, byte[] payment_secret);
+       // MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
+       public static native long ChannelManager_send_spontaneous_payment(long this_arg, long route, byte[] payment_preimage);
        // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction);
        public static native long ChannelManager_funding_transaction_generated(long this_arg, byte[] temporary_channel_id, byte[] funding_transaction);
        // void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses);
@@ -3066,6 +3157,20 @@ public class bindings {
        public static native long Shutdown_new(byte[] channel_id_arg, byte[] scriptpubkey_arg);
        // struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig);
        public static native long Shutdown_clone(long orig);
+       // void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
+       public static native void ClosingSignedFeeRange_free(long this_obj);
+       // uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
+       public static native long ClosingSignedFeeRange_get_min_fee_satoshis(long this_ptr);
+       // void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
+       public static native void ClosingSignedFeeRange_set_min_fee_satoshis(long this_ptr, long val);
+       // uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
+       public static native long ClosingSignedFeeRange_get_max_fee_satoshis(long this_ptr);
+       // void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
+       public static native void ClosingSignedFeeRange_set_max_fee_satoshis(long this_ptr, long val);
+       // MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
+       public static native long ClosingSignedFeeRange_new(long min_fee_satoshis_arg, long max_fee_satoshis_arg);
+       // struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
+       public static native long ClosingSignedFeeRange_clone(long orig);
        // void ClosingSigned_free(struct LDKClosingSigned this_obj);
        public static native void ClosingSigned_free(long this_obj);
        // const uint8_t (*ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr))[32];
@@ -3080,8 +3185,12 @@ public class bindings {
        public static native byte[] ClosingSigned_get_signature(long this_ptr);
        // void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKSignature val);
        public static native void ClosingSigned_set_signature(long this_ptr, byte[] val);
-       // MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
-       public static native long ClosingSigned_new(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg);
+       // struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
+       public static native long ClosingSigned_get_fee_range(long this_ptr);
+       // void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
+       public static native void ClosingSigned_set_fee_range(long this_ptr, long val);
+       // MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg);
+       public static native long ClosingSigned_new(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg, long fee_range_arg);
        // struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
        public static native long ClosingSigned_clone(long orig);
        // void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj);
@@ -3584,6 +3693,10 @@ public class bindings {
        public static native byte[] ClosingSigned_write(long obj);
        // struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser);
        public static native long ClosingSigned_read(byte[] ser);
+       // struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
+       public static native byte[] ClosingSignedFeeRange_write(long obj);
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
+       public static native long ClosingSignedFeeRange_read(byte[] ser);
        // struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
        public static native byte[] CommitmentSigned_write(long obj);
        // struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser);
@@ -4068,6 +4181,38 @@ public class bindings {
        public static native long ChannelFeatures_read(byte[] ser);
        // struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser);
        public static native long InvoiceFeatures_read(byte[] ser);
+       // void ShutdownScript_free(struct LDKShutdownScript this_obj);
+       public static native void ShutdownScript_free(long this_obj);
+       // struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
+       public static native long ShutdownScript_clone(long orig);
+       // void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
+       public static native void InvalidShutdownScript_free(long this_obj);
+       // struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
+       public static native byte[] InvalidShutdownScript_get_script(long this_ptr);
+       // void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
+       public static native void InvalidShutdownScript_set_script(long this_ptr, byte[] val);
+       // MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
+       public static native long InvalidShutdownScript_new(byte[] script_arg);
+       // struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
+       public static native byte[] ShutdownScript_write(long obj);
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
+       public static native long ShutdownScript_read(byte[] ser);
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]);
+       public static native long ShutdownScript_new_p2pkh(byte[] pubkey_hash);
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]);
+       public static native long ShutdownScript_new_p2sh(byte[] script_hash);
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
+       public static native long ShutdownScript_new_p2wpkh(byte[] pubkey_hash);
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
+       public static native long ShutdownScript_new_p2wsh(byte[] script_hash);
+       // MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
+       public static native long ShutdownScript_new_witness_program(byte version, byte[] program);
+       // MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
+       public static native byte[] ShutdownScript_into_inner(long this_arg);
+       // MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
+       public static native byte[] ShutdownScript_as_legacy_pubkey(long this_arg);
+       // MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
+       public static native boolean ShutdownScript_is_compatible(long this_arg, long features);
        // void RouteHop_free(struct LDKRouteHop this_obj);
        public static native void RouteHop_free(long this_obj);
        // struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
@@ -4152,6 +4297,8 @@ public class bindings {
        public static native boolean RouteHintHop_eq(long a, long b);
        // struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
        public static native long RouteHintHop_clone(long orig);
+       // struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
+       public static native long get_keysend_route(byte[] our_node_id, long network, byte[] payee, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger);
        // struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
        public static native long get_route(byte[] our_node_id, long network, byte[] payee, long payee_features, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger);
        // void NetworkGraph_free(struct LDKNetworkGraph this_obj);
@@ -4362,6 +4509,8 @@ public class bindings {
        public static native void ChannelManagerPersister_free(long this_ptr);
        // MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
        public static native long BackgroundProcessor_start(long persister, long event_handler, long chain_monitor, long channel_manager, long peer_manager, long logger);
+       // MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
+       public static native long BackgroundProcessor_join(long this_arg);
        // MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
        public static native long BackgroundProcessor_stop(long this_arg);
        // void check_platform(void);
index 96e81b8ce843e8b54f159efb258ed81050639a8d..48152a61b9312c492ca6a168f29ad893ebb55436 100644 (file)
@@ -36,6 +36,9 @@ public class APIError extends CommonBase {
                if (raw_val.getClass() == bindings.LDKAPIError.MonitorUpdateFailed.class) {
                        return new MonitorUpdateFailed(ptr, (bindings.LDKAPIError.MonitorUpdateFailed)raw_val);
                }
+               if (raw_val.getClass() == bindings.LDKAPIError.IncompatibleShutdownScript.class) {
+                       return new IncompatibleShutdownScript(ptr, (bindings.LDKAPIError.IncompatibleShutdownScript)raw_val);
+               }
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
@@ -89,6 +92,19 @@ public class APIError extends CommonBase {
                        super(null, ptr);
                }
        }
+       public final static class IncompatibleShutdownScript extends APIError {
+               /**
+                * The incompatible shutdown script.
+               */
+               public final ShutdownScript script;
+               private IncompatibleShutdownScript(long ptr, bindings.LDKAPIError.IncompatibleShutdownScript obj) {
+                       super(null, ptr);
+                       long script = obj.script;
+                       ShutdownScript script_hu_conv = new ShutdownScript(null, script);
+                       script_hu_conv.ptrs_to.add(this);
+                       this.script = script_hu_conv;
+               }
+       }
        /**
         * Creates a copy of the APIError
         */
@@ -155,4 +171,16 @@ public class APIError extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
+        */
+       public static APIError incompatible_shutdown_script(ShutdownScript script) {
+               long ret = bindings.APIError_incompatible_shutdown_script(script == null ? 0 : script.ptr & ~1);
+               if (ret < 1024) { return null; }
+               APIError ret_hu_conv = APIError.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               ret_hu_conv.ptrs_to.add(script);
+               return ret_hu_conv;
+       }
+
 }
index 9858c5d5ec82cab87e18da9bcac8c9318796525b..e6ff4511ac3c59ec3955d891dfe45f09cbd31f34 100644 (file)
@@ -22,6 +22,7 @@ import javax.annotation.Nullable;
  * then there is a risk of channels force-closing on startup when the manager realizes it's
  * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
  * for unilateral chain closure fees are at risk.
+ * BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
  */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class BackgroundProcessor extends CommonBase {
@@ -33,21 +34,25 @@ public class BackgroundProcessor extends CommonBase {
        }
 
        /**
-        * Start a background thread that takes care of responsibilities enumerated in the top-level
-        * documentation.
+        * Start a background thread that takes care of responsibilities enumerated in the [top-level
+        * documentation].
         * 
-        * If `persist_manager` returns an error, then this thread will return said error (and
-        * `start()` will need to be called again to restart the `BackgroundProcessor`). Users should
-        * wait on [`thread_handle`]'s `join()` method to be able to tell if and when an error is
-        * returned, or implement `persist_manager` such that an error is never returned to the
-        * `BackgroundProcessor`
+        * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
+        * `persist_manager` returns an error. In case of an error, the error is retrieved by calling
+        * either [`join`] or [`stop`].
+        * 
+        * Typically, users should either implement [`ChannelManagerPersister`] to never return an
+        * error or call [`join`] and handle any error that may arise. For the latter case, the
+        * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
         * 
         * `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
         * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
         * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
         * provided implementation.
         * 
-        * [`thread_handle`]: BackgroundProcessor::thread_handle
+        * [top-level documentation]: Self
+        * [`join`]: Self::join
+        * [`stop`]: Self::stop
         * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
         * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
         * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
@@ -67,7 +72,42 @@ public class BackgroundProcessor extends CommonBase {
        }
 
        /**
-        * Stop `BackgroundProcessor`'s thread.
+        * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
+        * [`ChannelManager`].
+        * 
+        * # Panics
+        * 
+        * This function panics if the background thread has panicked such as while persisting or
+        * handling events.
+        * 
+        * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
+        */
+       public Result_NoneErrorZ join() {
+               long ret = bindings.BackgroundProcessor_join(this.ptr);
+               if (ret < 1024) { return null; }
+               Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
+               this.ptrs_to.add(this);
+               // 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, this is reset to null and is now a dummy object.
+               this.ptr = 0;
+               return ret_hu_conv;
+       }
+
+       /**
+        * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting
+        * [`ChannelManager`].
+        * 
+        * # Panics
+        * 
+        * This function panics if the background thread has panicked such as while persisting or
+        * handling events.
+        * 
+        * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
         */
        public Result_NoneErrorZ stop() {
                long ret = bindings.BackgroundProcessor_stop(this.ptr);
index 51680d6a39fbeb3778cd2a9ecf571d326ea11865..26bcff3daf654ddf507c8ef8b124b630c9cf4dbb 100644 (file)
@@ -203,11 +203,111 @@ public class ChannelConfig extends CommonBase {
                bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val);
        }
 
+       /**
+        * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
+        * small to claim on-chain.
+        * 
+        * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
+        * not be claimable on-chain, instead being turned into additional miner fees if either
+        * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
+        * to such payments may be sustantial if there are many dust HTLCs present when the
+        * channel is force-closed.
+        * 
+        * This limit is applied for sent, forwarded, and received HTLCs and limits the total
+        * exposure across all three types per-channel. Setting this too low may prevent the
+        * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
+        * important to prevent stealing of dust HTLCs by miners.
+        * 
+        * Default value: 5_000_000 msat.
+        */
+       public long get_max_dust_htlc_exposure_msat() {
+               long ret = bindings.ChannelConfig_get_max_dust_htlc_exposure_msat(this.ptr);
+               return ret;
+       }
+
+       /**
+        * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
+        * small to claim on-chain.
+        * 
+        * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
+        * not be claimable on-chain, instead being turned into additional miner fees if either
+        * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
+        * to such payments may be sustantial if there are many dust HTLCs present when the
+        * channel is force-closed.
+        * 
+        * This limit is applied for sent, forwarded, and received HTLCs and limits the total
+        * exposure across all three types per-channel. Setting this too low may prevent the
+        * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
+        * important to prevent stealing of dust HTLCs by miners.
+        * 
+        * Default value: 5_000_000 msat.
+        */
+       public void set_max_dust_htlc_exposure_msat(long val) {
+               bindings.ChannelConfig_set_max_dust_htlc_exposure_msat(this.ptr, val);
+       }
+
+       /**
+        * The additional fee we're willing to pay to avoid waiting for the counterparty's
+        * `to_self_delay` to reclaim funds.
+        * 
+        * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
+        * closing transaction which both sides find acceptable, ultimately paid by the channel
+        * funder/initiator.
+        * 
+        * When we are the funder, because we have to pay the channel closing fee, we bound the
+        * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+        * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
+        * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+        * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
+        * funds.
+        * 
+        * When we are not the funder, we require the closing transaction fee pay at least our
+        * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+        * Thus, this value is ignored when we are not the funder.
+        * 
+        * Default value: 1000 satoshis.
+        * 
+        * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+        * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+        */
+       public long get_force_close_avoidance_max_fee_satoshis() {
+               long ret = bindings.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this.ptr);
+               return ret;
+       }
+
+       /**
+        * The additional fee we're willing to pay to avoid waiting for the counterparty's
+        * `to_self_delay` to reclaim funds.
+        * 
+        * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
+        * closing transaction which both sides find acceptable, ultimately paid by the channel
+        * funder/initiator.
+        * 
+        * When we are the funder, because we have to pay the channel closing fee, we bound the
+        * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+        * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
+        * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+        * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
+        * funds.
+        * 
+        * When we are not the funder, we require the closing transaction fee pay at least our
+        * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+        * Thus, this value is ignored when we are not the funder.
+        * 
+        * Default value: 1000 satoshis.
+        * 
+        * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+        * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+        */
+       public void set_force_close_avoidance_max_fee_satoshis(long val) {
+               bindings.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this.ptr, val);
+       }
+
        /**
         * Constructs a new ChannelConfig given each field
         */
-       public static ChannelConfig of(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) {
-               long ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+       public static ChannelConfig of(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg, long max_dust_htlc_exposure_msat_arg, long force_close_avoidance_max_fee_satoshis_arg) {
+               long ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
                if (ret < 1024) { return null; }
                ChannelConfig ret_hu_conv = new ChannelConfig(null, ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
index 923f5b305b621b945db2baf8901f83519f9ec7af..d8c9065a713c2f2e0423ecb2da222cddf82733fa 100644 (file)
@@ -164,7 +164,19 @@ public class ChannelManager extends CommonBase {
         * will be accepted on the given channel, and after additional timeout/the closing of all
         * pending HTLCs, the channel will be closed on chain.
         * 
+        * If we are the channel initiator, we will pay between our [`Background`] and
+        * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
+        * estimate.
+        * If our counterparty is the channel initiator, we will require a channel closing
+        * transaction feerate of at least our [`Background`] feerate or the feerate which
+        * would appear on a force-closure transaction, whichever is lower. We will allow our
+        * counterparty to pay as much fee as they'd like, however.
+        * 
         * May generate a SendShutdown message event on success, which should be relayed.
+        * 
+        * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
+        * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+        * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
         */
        public Result_NoneAPIErrorZ close_channel(byte[] channel_id) {
                long ret = bindings.ChannelManager_close_channel(this.ptr, channel_id);
@@ -173,6 +185,34 @@ public class ChannelManager extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs
+        * will be accepted on the given channel, and after additional timeout/the closing of all
+        * pending HTLCs, the channel will be closed on chain.
+        * 
+        * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated
+        * the channel being closed or not:
+        * If we are the channel initiator, we will pay at least this feerate on the closing
+        * transaction. The upper-bound is set by
+        * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`Normal`] fee
+        * estimate (or `target_feerate_sat_per_1000_weight`, if it is greater).
+        * If our counterparty is the channel initiator, we will refuse to accept a channel closure
+        * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
+        * will appear on a force-closure transaction, whichever is lower).
+        * 
+        * May generate a SendShutdown message event on success, which should be relayed.
+        * 
+        * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
+        * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+        * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+        */
+       public Result_NoneAPIErrorZ close_channel_with_target_feerate(byte[] channel_id, int target_feerate_sats_per_1000_weight) {
+               long ret = bindings.ChannelManager_close_channel_with_target_feerate(this.ptr, channel_id, target_feerate_sats_per_1000_weight);
+               if (ret < 1024) { return null; }
+               Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
        /**
         * Force closes a channel, immediately broadcasting the latest local commitment transaction to
         * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager.
@@ -243,6 +283,32 @@ public class ChannelManager extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Send a spontaneous payment, which is a payment that does not require the recipient to have
+        * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify
+        * the preimage, it must be a cryptographically secure random value that no intermediate node
+        * would be able to guess -- otherwise, an intermediate node may claim the payment and it will
+        * never reach the recipient.
+        * 
+        * See [`send_payment`] documentation for more details on the return value of this function.
+        * 
+        * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See
+        * [`send_payment`] for more information about the risks of duplicate preimage usage.
+        * 
+        * Note that `route` must have exactly one path.
+        * 
+        * [`send_payment`]: Self::send_payment
+        * 
+        * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       public Result_PaymentHashPaymentSendFailureZ send_spontaneous_payment(Route route, @Nullable byte[] payment_preimage) {
+               long ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_preimage);
+               if (ret < 1024) { return null; }
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               this.ptrs_to.add(route);
+               return ret_hu_conv;
+       }
+
        /**
         * Call this upon creation of a funding transaction for the given channel.
         * 
@@ -308,13 +374,16 @@ public class ChannelManager extends CommonBase {
        }
 
        /**
-        * If a peer is disconnected we mark any channels with that peer as 'disabled'.
-        * After some time, if channels are still disabled we need to broadcast a ChannelUpdate
-        * to inform the network about the uselessness of these channels.
+        * Performs actions which should happen on startup and roughly once per minute thereafter.
         * 
-        * This method handles all the details, and must be called roughly once per minute.
+        * This currently includes:
+        * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
+        * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
+        * than a minute, informing the network that they should no longer attempt to route over
+        * the channel.
         * 
-        * Note that in some rare cases this may generate a `chain::Watch::update_channel` call.
+        * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
+        * estimate fetches.
         */
        public void timer_tick_occurred() {
                bindings.ChannelManager_timer_tick_occurred(this.ptr);
@@ -427,7 +496,7 @@ public class ChannelManager extends CommonBase {
         * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This
         * method may return an Err if another payment with the same payment_hash is still pending.
         * 
-        * `user_payment_id` will be provided back in [`PaymentReceived::user_payment_id`] events to
+        * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to
         * allow tracking of which events correspond with which calls to this and
         * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply
         * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events
@@ -461,7 +530,7 @@ public class ChannelManager extends CommonBase {
         * 
         * [`create_inbound_payment`]: Self::create_inbound_payment
         * [`PaymentReceived`]: events::Event::PaymentReceived
-        * [`PaymentReceived::user_payment_id`]: events::Event::PaymentReceived::user_payment_id
+        * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id
         */
        public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash(byte[] payment_hash, Option_u64Z min_value_msat, int invoice_expiry_delta_secs, long user_payment_id) {
                long ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, payment_hash, min_value_msat.ptr, invoice_expiry_delta_secs, user_payment_id);
index 83482b26df88f7f993b2fd4df29b5acf9b7c4911..ca65285be6fc1ea1c347dd7315ae860d8308d379 100644 (file)
@@ -64,14 +64,41 @@ public class ClosingSigned extends CommonBase {
                bindings.ClosingSigned_set_signature(this.ptr, val);
        }
 
+       /**
+        * The minimum and maximum fees which the sender is willing to accept, provided only by new
+        * nodes.
+        * 
+        * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       @Nullable
+       public ClosingSignedFeeRange get_fee_range() {
+               long ret = bindings.ClosingSigned_get_fee_range(this.ptr);
+               if (ret < 1024) { return null; }
+               ClosingSignedFeeRange ret_hu_conv = new ClosingSignedFeeRange(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       /**
+        * The minimum and maximum fees which the sender is willing to accept, provided only by new
+        * nodes.
+        * 
+        * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       public void set_fee_range(@Nullable ClosingSignedFeeRange val) {
+               bindings.ClosingSigned_set_fee_range(this.ptr, val == null ? 0 : val.ptr & ~1);
+               this.ptrs_to.add(val);
+       }
+
        /**
         * Constructs a new ClosingSigned given each field
         */
-       public static ClosingSigned of(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg) {
-               long ret = bindings.ClosingSigned_new(channel_id_arg, fee_satoshis_arg, signature_arg);
+       public static ClosingSigned of(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg, ClosingSignedFeeRange fee_range_arg) {
+               long ret = bindings.ClosingSigned_new(channel_id_arg, fee_satoshis_arg, signature_arg, fee_range_arg == null ? 0 : fee_range_arg.ptr & ~1);
                if (ret < 1024) { return null; }
                ClosingSigned ret_hu_conv = new ClosingSigned(null, ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               ret_hu_conv.ptrs_to.add(fee_range_arg);
                return ret_hu_conv;
        }
 
diff --git a/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java b/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java
new file mode 100644 (file)
index 0000000..0dbbf6c
--- /dev/null
@@ -0,0 +1,98 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * The minimum and maximum fees which the sender is willing to place on the closing transaction.
+ * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
+ * to use.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class ClosingSignedFeeRange extends CommonBase {
+       ClosingSignedFeeRange(Object _dummy, long ptr) { super(ptr); }
+       @Override @SuppressWarnings("deprecation")
+       protected void finalize() throws Throwable {
+               super.finalize();
+               if (ptr != 0) { bindings.ClosingSignedFeeRange_free(ptr); }
+       }
+
+       /**
+        * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
+        * transaction.
+        */
+       public long get_min_fee_satoshis() {
+               long ret = bindings.ClosingSignedFeeRange_get_min_fee_satoshis(this.ptr);
+               return ret;
+       }
+
+       /**
+        * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing
+        * transaction.
+        */
+       public void set_min_fee_satoshis(long val) {
+               bindings.ClosingSignedFeeRange_set_min_fee_satoshis(this.ptr, val);
+       }
+
+       /**
+        * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
+        * transaction.
+        */
+       public long get_max_fee_satoshis() {
+               long ret = bindings.ClosingSignedFeeRange_get_max_fee_satoshis(this.ptr);
+               return ret;
+       }
+
+       /**
+        * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing
+        * transaction.
+        */
+       public void set_max_fee_satoshis(long val) {
+               bindings.ClosingSignedFeeRange_set_max_fee_satoshis(this.ptr, val);
+       }
+
+       /**
+        * Constructs a new ClosingSignedFeeRange given each field
+        */
+       public static ClosingSignedFeeRange of(long min_fee_satoshis_arg, long max_fee_satoshis_arg) {
+               long ret = bindings.ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
+               if (ret < 1024) { return null; }
+               ClosingSignedFeeRange ret_hu_conv = new ClosingSignedFeeRange(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a copy of the ClosingSignedFeeRange
+        */
+       public ClosingSignedFeeRange clone() {
+               long ret = bindings.ClosingSignedFeeRange_clone(this.ptr);
+               if (ret < 1024) { return null; }
+               ClosingSignedFeeRange ret_hu_conv = new ClosingSignedFeeRange(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.ClosingSignedFeeRange_write(this.ptr);
+               return ret;
+       }
+
+       /**
+        * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write
+        */
+       public static Result_ClosingSignedFeeRangeDecodeErrorZ read(byte[] ser) {
+               long ret = bindings.ClosingSignedFeeRange_read(ser);
+               if (ret < 1024) { return null; }
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
index 4bd1fad4408225d0cad607fbc413038b376d2680..11c852c24dbe46b15afc4ba79aa9d3d8147af0f7 100644 (file)
@@ -42,6 +42,9 @@ public class Event extends CommonBase {
                if (raw_val.getClass() == bindings.LDKEvent.SpendableOutputs.class) {
                        return new SpendableOutputs(ptr, (bindings.LDKEvent.SpendableOutputs)raw_val);
                }
+               if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
+                       return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
+               }
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
@@ -76,30 +79,6 @@ public class Event extends CommonBase {
                 * The hash for which the preimage should be handed to the ChannelManager.
                */
                public final byte[] payment_hash;
-               /**
-                * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
-                * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
-                * [`ChannelManager::claim_funds`].
-                * 
-                * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
-                * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
-                * 
-                * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
-               */
-               @Nullable public final byte[] payment_preimage;
-               /**
-                * The \"payment secret\". This authenticates the sender to the recipient, preventing a
-                * number of deanonymization attacks during the routing process.
-                * It is provided here for your reference, however its accuracy is enforced directly by
-                * [`ChannelManager`] using the values you previously provided to
-                * [`ChannelManager::create_inbound_payment`] or
-                * [`ChannelManager::create_inbound_payment_for_hash`].
-                * 
-                * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
-                * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
-                * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
-               */
-               public final byte[] payment_secret;
                /**
                 * The value, in thousandths of a satoshi, that this payment is for. Note that you must
                 * compare this to the expected value before accepting the payment (as otherwise you are
@@ -107,23 +86,18 @@ public class Event extends CommonBase {
                */
                public final long amt;
                /**
-                * This is the `user_payment_id` which was provided to
-                * [`ChannelManager::create_inbound_payment_for_hash`] or
-                * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
-                * simply copied here. It may be used to correlate PaymentReceived events with invoice
-                * metadata stored elsewhere.
-                * 
-                * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
-                * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+                * Information for claiming this received payment, based on whether the purpose of the
+                * payment is to pay an invoice or to send a spontaneous payment.
                */
-               public final long user_payment_id;
+               public final PaymentPurpose purpose;
                private PaymentReceived(long ptr, bindings.LDKEvent.PaymentReceived obj) {
                        super(null, ptr);
                        this.payment_hash = obj.payment_hash;
-                       this.payment_preimage = obj.payment_preimage;
-                       this.payment_secret = obj.payment_secret;
                        this.amt = obj.amt;
-                       this.user_payment_id = obj.user_payment_id;
+                       long purpose = obj.purpose;
+                       PaymentPurpose purpose_hu_conv = PaymentPurpose.constr_from_ptr(purpose);
+                       purpose_hu_conv.ptrs_to.add(this);
+                       this.purpose = purpose_hu_conv;
                }
        }
        public final static class PaymentSent extends Event {
@@ -186,6 +160,37 @@ public class Event extends CommonBase {
                        this.outputs = outputs_conv_27_arr;
                }
        }
+       public final static class PaymentForwarded extends Event {
+               /**
+                * The fee, in milli-satoshis, which was earned as a result of the payment.
+                * 
+                * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
+                * was pending, the amount the next hop claimed will have been rounded down to the nearest
+                * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
+                * claimed the full value in millisatoshis from the source. In this case,
+                * `claim_from_onchain_tx` will be set.
+                * 
+                * If the channel which sent us the payment has been force-closed, we will claim the funds
+                * via an on-chain transaction. In that case we do not yet know the on-chain transaction
+                * fees which we will spend and will instead set this to `None`. It is possible duplicate
+                * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
+                * `None`.
+               */
+               public final Option_u64Z fee_earned_msat;
+               /**
+                * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
+                * transaction.
+               */
+               public final boolean claim_from_onchain_tx;
+               private PaymentForwarded(long ptr, bindings.LDKEvent.PaymentForwarded obj) {
+                       super(null, ptr);
+                       long fee_earned_msat = obj.fee_earned_msat;
+                       Option_u64Z fee_earned_msat_hu_conv = Option_u64Z.constr_from_ptr(fee_earned_msat);
+                       fee_earned_msat_hu_conv.ptrs_to.add(this);
+                       this.fee_earned_msat = fee_earned_msat_hu_conv;
+                       this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
+               }
+       }
        /**
         * Creates a copy of the Event
         */
@@ -211,8 +216,8 @@ public class Event extends CommonBase {
        /**
         * Utility method to constructs a new PaymentReceived-variant Event
         */
-       public static Event payment_received(byte[] payment_hash, byte[] payment_preimage, byte[] payment_secret, long amt, long user_payment_id) {
-               long ret = bindings.Event_payment_received(payment_hash, payment_preimage, payment_secret, amt, user_payment_id);
+       public static Event payment_received(byte[] payment_hash, long amt, PaymentPurpose purpose) {
+               long ret = bindings.Event_payment_received(payment_hash, amt, purpose.ptr);
                if (ret < 1024) { return null; }
                Event ret_hu_conv = Event.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
@@ -264,6 +269,17 @@ public class Event extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Utility method to constructs a new PaymentForwarded-variant Event
+        */
+       public static Event payment_forwarded(Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx) {
+               long ret = bindings.Event_payment_forwarded(fee_earned_msat.ptr, claim_from_onchain_tx);
+               if (ret < 1024) { return null; }
+               Event ret_hu_conv = Event.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
        /**
         * Serialize the Event object into a byte array which can be read by Event_read
         */
diff --git a/src/main/java/org/ldk/structs/InvalidShutdownScript.java b/src/main/java/org/ldk/structs/InvalidShutdownScript.java
new file mode 100644 (file)
index 0000000..1d11668
--- /dev/null
@@ -0,0 +1,52 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * An error occurring when converting from [`Script`] to [`ShutdownScript`].
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class InvalidShutdownScript extends CommonBase {
+       InvalidShutdownScript(Object _dummy, long ptr) { super(ptr); }
+       @Override @SuppressWarnings("deprecation")
+       protected void finalize() throws Throwable {
+               super.finalize();
+               if (ptr != 0) { bindings.InvalidShutdownScript_free(ptr); }
+       }
+
+       /**
+        * The script that did not meet the requirements from [BOLT #2].
+        * 
+        * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+        */
+       public byte[] get_script() {
+               byte[] ret = bindings.InvalidShutdownScript_get_script(this.ptr);
+               return ret;
+       }
+
+       /**
+        * The script that did not meet the requirements from [BOLT #2].
+        * 
+        * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+        */
+       public void set_script(byte[] val) {
+               bindings.InvalidShutdownScript_set_script(this.ptr, val);
+       }
+
+       /**
+        * Constructs a new InvalidShutdownScript given each field
+        */
+       public static InvalidShutdownScript of(byte[] script_arg) {
+               long ret = bindings.InvalidShutdownScript_new(script_arg);
+               if (ret < 1024) { return null; }
+               InvalidShutdownScript ret_hu_conv = new InvalidShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+}
index 4fdc63351cb9a387353754ef7dd2643865a94160..19a0d62f177a7ada342cd650a6961c527b1de4a6 100644 (file)
@@ -38,13 +38,12 @@ public class KeysInterface extends CommonBase {
                 */
                byte[] get_destination_script();
                /**
-                * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
-                * a channel.
+                * Get a script pubkey which we will send funds to when closing a channel.
                 * 
                 * This method should return a different value each time it is called, to avoid linking
                 * on-chain funds across channels as controlled to the same user.
                 */
-               byte[] get_shutdown_pubkey();
+               ShutdownScript get_shutdown_scriptpubkey();
                /**
                 * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
                 * restarted with some stale data!
@@ -89,9 +88,11 @@ public class KeysInterface extends CommonBase {
                                byte[] ret = arg.get_destination_script();
                                return ret;
                        }
-                       @Override public byte[] get_shutdown_pubkey() {
-                               byte[] ret = arg.get_shutdown_pubkey();
-                               return ret;
+                       @Override public long get_shutdown_scriptpubkey() {
+                               ShutdownScript ret = arg.get_shutdown_scriptpubkey();
+                               long result = ret == null ? 0 : ret.ptr & ~1;
+                               impl_holder.held.ptrs_to.add(ret);
+                               return result;
                        }
                        @Override public long get_channel_signer(boolean inbound, long channel_value_satoshis) {
                                Sign ret = arg.get_channel_signer(inbound, channel_value_satoshis);
@@ -138,15 +139,17 @@ public class KeysInterface extends CommonBase {
        }
 
        /**
-        * Get a public key which we will send funds to (in the form of a P2WPKH output) when closing
-        * a channel.
+        * Get a script pubkey which we will send funds to when closing a channel.
         * 
         * This method should return a different value each time it is called, to avoid linking
         * on-chain funds across channels as controlled to the same user.
         */
-       public byte[] get_shutdown_pubkey() {
-               byte[] ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr);
-               return ret;
+       public ShutdownScript get_shutdown_scriptpubkey() {
+               long ret = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr);
+               if (ret < 1024) { return null; }
+               ShutdownScript ret_hu_conv = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
        }
 
        /**
diff --git a/src/main/java/org/ldk/structs/PaymentPurpose.java b/src/main/java/org/ldk/structs/PaymentPurpose.java
new file mode 100644 (file)
index 0000000..e2654da
--- /dev/null
@@ -0,0 +1,116 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * Some information provided on receipt of payment depends on whether the payment received is a
+ * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class PaymentPurpose extends CommonBase {
+       private PaymentPurpose(Object _dummy, long ptr) { super(ptr); }
+       @Override @SuppressWarnings("deprecation")
+       protected void finalize() throws Throwable {
+               super.finalize();
+               if (ptr != 0) { bindings.PaymentPurpose_free(ptr); }
+       }
+       static PaymentPurpose constr_from_ptr(long ptr) {
+               bindings.LDKPaymentPurpose raw_val = bindings.LDKPaymentPurpose_ref_from_ptr(ptr);
+               if (raw_val.getClass() == bindings.LDKPaymentPurpose.InvoicePayment.class) {
+                       return new InvoicePayment(ptr, (bindings.LDKPaymentPurpose.InvoicePayment)raw_val);
+               }
+               if (raw_val.getClass() == bindings.LDKPaymentPurpose.SpontaneousPayment.class) {
+                       return new SpontaneousPayment(ptr, (bindings.LDKPaymentPurpose.SpontaneousPayment)raw_val);
+               }
+               assert false; return null; // Unreachable without extending the (internal) bindings interface
+       }
+
+       public final static class InvoicePayment extends PaymentPurpose {
+               /**
+                * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
+                * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
+                * [`ChannelManager::claim_funds`].
+                * 
+                * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+                * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+                * 
+                * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+               */
+               @Nullable public final byte[] payment_preimage;
+               /**
+                * The \"payment secret\". This authenticates the sender to the recipient, preventing a
+                * number of deanonymization attacks during the routing process.
+                * It is provided here for your reference, however its accuracy is enforced directly by
+                * [`ChannelManager`] using the values you previously provided to
+                * [`ChannelManager::create_inbound_payment`] or
+                * [`ChannelManager::create_inbound_payment_for_hash`].
+                * 
+                * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+                * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+                * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+               */
+               public final byte[] payment_secret;
+               /**
+                * This is the `user_payment_id` which was provided to
+                * [`ChannelManager::create_inbound_payment_for_hash`] or
+                * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is
+                * simply copied here. It may be used to correlate PaymentReceived events with invoice
+                * metadata stored elsewhere.
+                * 
+                * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+                * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+               */
+               public final long user_payment_id;
+               private InvoicePayment(long ptr, bindings.LDKPaymentPurpose.InvoicePayment obj) {
+                       super(null, ptr);
+                       this.payment_preimage = obj.payment_preimage;
+                       this.payment_secret = obj.payment_secret;
+                       this.user_payment_id = obj.user_payment_id;
+               }
+       }
+       public final static class SpontaneousPayment extends PaymentPurpose {
+               public final byte[] spontaneous_payment;
+               private SpontaneousPayment(long ptr, bindings.LDKPaymentPurpose.SpontaneousPayment obj) {
+                       super(null, ptr);
+                       this.spontaneous_payment = obj.spontaneous_payment;
+               }
+       }
+       /**
+        * Creates a copy of the PaymentPurpose
+        */
+       public PaymentPurpose clone() {
+               long ret = bindings.PaymentPurpose_clone(this.ptr);
+               if (ret < 1024) { return null; }
+               PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
+        */
+       public static PaymentPurpose invoice_payment(byte[] payment_preimage, byte[] payment_secret, long user_payment_id) {
+               long ret = bindings.PaymentPurpose_invoice_payment(payment_preimage, payment_secret, user_payment_id);
+               if (ret < 1024) { return null; }
+               PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
+        */
+       public static PaymentPurpose spontaneous_payment(byte[] a) {
+               long ret = bindings.PaymentPurpose_spontaneous_payment(a);
+               if (ret < 1024) { return null; }
+               PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+}
index c78e85e79cf0976c3fefeb19783c5b6d4057eeed..4fa6c771f556ead8a30d1c21f67ead812ceb2ba9 100644 (file)
@@ -192,9 +192,12 @@ public class PeerManager extends CommonBase {
        }
 
        /**
-        * This function should be called roughly once every 30 seconds.
-        * It will send pings to each peer and disconnect those which did not respond to the last
-        * round of pings.
+        * Send pings to each peer and disconnect those which did not respond to the last round of
+        * pings.
+        * 
+        * This may be called on any timescale you want, however, roughly once every five to ten
+        * seconds is preferred. The call rate determines both how often we send a ping to our peers
+        * and how much time they have to respond before we disconnect them.
         * 
         * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy
         * issues!
diff --git a/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java
new file mode 100644 (file)
index 0000000..aca5557
--- /dev/null
@@ -0,0 +1,77 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase {
+       private Result_ClosingSignedFeeRangeDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_free(ptr); } super.finalize();
+       }
+
+       static Result_ClosingSignedFeeRangeDecodeErrorZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(ptr)) {
+                       return new Result_ClosingSignedFeeRangeDecodeErrorZ_OK(null, ptr);
+               } else {
+                       return new Result_ClosingSignedFeeRangeDecodeErrorZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_ClosingSignedFeeRangeDecodeErrorZ_OK extends Result_ClosingSignedFeeRangeDecodeErrorZ {
+               public final ClosingSignedFeeRange res;
+               private Result_ClosingSignedFeeRangeDecodeErrorZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       long res = bindings.LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(ptr);
+                       ClosingSignedFeeRange res_hu_conv = new ClosingSignedFeeRange(null, res);
+                       res_hu_conv.ptrs_to.add(this);
+                       this.res = res_hu_conv;
+               }
+       }
+
+       public static final class Result_ClosingSignedFeeRangeDecodeErrorZ_Err extends Result_ClosingSignedFeeRangeDecodeErrorZ {
+               public final DecodeError err;
+               private Result_ClosingSignedFeeRangeDecodeErrorZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       long err = bindings.LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(ptr);
+                       DecodeError err_hu_conv = new DecodeError(null, err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       /**
+        * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
+        */
+       public static Result_ClosingSignedFeeRangeDecodeErrorZ ok(ClosingSignedFeeRange o) {
+               long ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1);
+               if (ret < 1024) { return null; }
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(o);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
+        */
+       public static Result_ClosingSignedFeeRangeDecodeErrorZ err(DecodeError e) {
+               long ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
+               if (ret < 1024) { return null; }
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(e);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
+        * but with all dynamically-allocated buffers duplicated in new buffers.
+        */
+       public Result_ClosingSignedFeeRangeDecodeErrorZ clone() {
+               long ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(this.ptr);
+               if (ret < 1024) { return null; }
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_PaymentHashPaymentSendFailureZ.java
new file mode 100644 (file)
index 0000000..2edcb32
--- /dev/null
@@ -0,0 +1,72 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+public class Result_PaymentHashPaymentSendFailureZ extends CommonBase {
+       private Result_PaymentHashPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_PaymentHashPaymentSendFailureZ_free(ptr); } super.finalize();
+       }
+
+       static Result_PaymentHashPaymentSendFailureZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(ptr)) {
+                       return new Result_PaymentHashPaymentSendFailureZ_OK(null, ptr);
+               } else {
+                       return new Result_PaymentHashPaymentSendFailureZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_PaymentHashPaymentSendFailureZ_OK extends Result_PaymentHashPaymentSendFailureZ {
+               public final byte[] res;
+               private Result_PaymentHashPaymentSendFailureZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       this.res = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(ptr);
+               }
+       }
+
+       public static final class Result_PaymentHashPaymentSendFailureZ_Err extends Result_PaymentHashPaymentSendFailureZ {
+               public final PaymentSendFailure err;
+               private Result_PaymentHashPaymentSendFailureZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       long err = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_err(ptr);
+                       PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       /**
+        * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state.
+        */
+       public static Result_PaymentHashPaymentSendFailureZ ok(byte[] o) {
+               long ret = bindings.CResult_PaymentHashPaymentSendFailureZ_ok(o);
+               if (ret < 1024) { return null; }
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state.
+        */
+       public static Result_PaymentHashPaymentSendFailureZ err(PaymentSendFailure e) {
+               long ret = bindings.CResult_PaymentHashPaymentSendFailureZ_err(e.ptr);
+               if (ret < 1024) { return null; }
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig`
+        * but with all dynamically-allocated buffers duplicated in new buffers.
+        */
+       public Result_PaymentHashPaymentSendFailureZ clone() {
+               long ret = bindings.CResult_PaymentHashPaymentSendFailureZ_clone(this.ptr);
+               if (ret < 1024) { return null; }
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java
new file mode 100644 (file)
index 0000000..c254987
--- /dev/null
@@ -0,0 +1,77 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+public class Result_ShutdownScriptDecodeErrorZ extends CommonBase {
+       private Result_ShutdownScriptDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_ShutdownScriptDecodeErrorZ_free(ptr); } super.finalize();
+       }
+
+       static Result_ShutdownScriptDecodeErrorZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(ptr)) {
+                       return new Result_ShutdownScriptDecodeErrorZ_OK(null, ptr);
+               } else {
+                       return new Result_ShutdownScriptDecodeErrorZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_ShutdownScriptDecodeErrorZ_OK extends Result_ShutdownScriptDecodeErrorZ {
+               public final ShutdownScript res;
+               private Result_ShutdownScriptDecodeErrorZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       long res = bindings.LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(ptr);
+                       ShutdownScript res_hu_conv = new ShutdownScript(null, res);
+                       res_hu_conv.ptrs_to.add(this);
+                       this.res = res_hu_conv;
+               }
+       }
+
+       public static final class Result_ShutdownScriptDecodeErrorZ_Err extends Result_ShutdownScriptDecodeErrorZ {
+               public final DecodeError err;
+               private Result_ShutdownScriptDecodeErrorZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       long err = bindings.LDKCResult_ShutdownScriptDecodeErrorZ_get_err(ptr);
+                       DecodeError err_hu_conv = new DecodeError(null, err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       /**
+        * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
+        */
+       public static Result_ShutdownScriptDecodeErrorZ ok(ShutdownScript o) {
+               long ret = bindings.CResult_ShutdownScriptDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1);
+               if (ret < 1024) { return null; }
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(o);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
+        */
+       public static Result_ShutdownScriptDecodeErrorZ err(DecodeError e) {
+               long ret = bindings.CResult_ShutdownScriptDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
+               if (ret < 1024) { return null; }
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(e);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
+        * but with all dynamically-allocated buffers duplicated in new buffers.
+        */
+       public Result_ShutdownScriptDecodeErrorZ clone() {
+               long ret = bindings.CResult_ShutdownScriptDecodeErrorZ_clone(this.ptr);
+               if (ret < 1024) { return null; }
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/src/main/java/org/ldk/structs/Result_ShutdownScriptInvalidShutdownScriptZ.java b/src/main/java/org/ldk/structs/Result_ShutdownScriptInvalidShutdownScriptZ.java
new file mode 100644 (file)
index 0000000..2126ec0
--- /dev/null
@@ -0,0 +1,65 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+public class Result_ShutdownScriptInvalidShutdownScriptZ extends CommonBase {
+       private Result_ShutdownScriptInvalidShutdownScriptZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_free(ptr); } super.finalize();
+       }
+
+       static Result_ShutdownScriptInvalidShutdownScriptZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(ptr)) {
+                       return new Result_ShutdownScriptInvalidShutdownScriptZ_OK(null, ptr);
+               } else {
+                       return new Result_ShutdownScriptInvalidShutdownScriptZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_ShutdownScriptInvalidShutdownScriptZ_OK extends Result_ShutdownScriptInvalidShutdownScriptZ {
+               public final ShutdownScript res;
+               private Result_ShutdownScriptInvalidShutdownScriptZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       long res = bindings.LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(ptr);
+                       ShutdownScript res_hu_conv = new ShutdownScript(null, res);
+                       res_hu_conv.ptrs_to.add(this);
+                       this.res = res_hu_conv;
+               }
+       }
+
+       public static final class Result_ShutdownScriptInvalidShutdownScriptZ_Err extends Result_ShutdownScriptInvalidShutdownScriptZ {
+               public final InvalidShutdownScript err;
+               private Result_ShutdownScriptInvalidShutdownScriptZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       long err = bindings.LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(ptr);
+                       InvalidShutdownScript err_hu_conv = new InvalidShutdownScript(null, err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       /**
+        * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
+        */
+       public static Result_ShutdownScriptInvalidShutdownScriptZ ok(ShutdownScript o) {
+               long ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o == null ? 0 : o.ptr & ~1);
+               if (ret < 1024) { return null; }
+               Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(o);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
+        */
+       public static Result_ShutdownScriptInvalidShutdownScriptZ err(byte[] e_script_arg) {
+               long ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_err(bindings.InvalidShutdownScript_new(e_script_arg));
+               if (ret < 1024) { return null; }
+               Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/src/main/java/org/ldk/structs/ShutdownScript.java b/src/main/java/org/ldk/structs/ShutdownScript.java
new file mode 100644 (file)
index 0000000..3d4a8eb
--- /dev/null
@@ -0,0 +1,142 @@
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * A script pubkey for shutting down a channel as defined by [BOLT #2].
+ * 
+ * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class ShutdownScript extends CommonBase {
+       ShutdownScript(Object _dummy, long ptr) { super(ptr); }
+       @Override @SuppressWarnings("deprecation")
+       protected void finalize() throws Throwable {
+               super.finalize();
+               if (ptr != 0) { bindings.ShutdownScript_free(ptr); }
+       }
+
+       /**
+        * Creates a copy of the ShutdownScript
+        */
+       public ShutdownScript clone() {
+               long ret = bindings.ShutdownScript_clone(this.ptr);
+               if (ret < 1024) { return null; }
+               ShutdownScript ret_hu_conv = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.ShutdownScript_write(this.ptr);
+               return ret;
+       }
+
+       /**
+        * Read a ShutdownScript from a byte array, created by ShutdownScript_write
+        */
+       public static Result_ShutdownScriptDecodeErrorZ read(byte[] ser) {
+               long ret = bindings.ShutdownScript_read(ser);
+               if (ret < 1024) { return null; }
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Generates a P2PKH script pubkey from the given [`PubkeyHash`].
+        */
+       public static ShutdownScript new_p2pkh(byte[] pubkey_hash) {
+               long ret = bindings.ShutdownScript_new_p2pkh(pubkey_hash);
+               if (ret < 1024) { return null; }
+               ShutdownScript ret_hu_conv = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Generates a P2SH script pubkey from the given [`ScriptHash`].
+        */
+       public static ShutdownScript new_p2sh(byte[] script_hash) {
+               long ret = bindings.ShutdownScript_new_p2sh(script_hash);
+               if (ret < 1024) { return null; }
+               ShutdownScript ret_hu_conv = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
+        */
+       public static ShutdownScript new_p2wpkh(byte[] pubkey_hash) {
+               long ret = bindings.ShutdownScript_new_p2wpkh(pubkey_hash);
+               if (ret < 1024) { return null; }
+               ShutdownScript ret_hu_conv = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Generates a P2WSH script pubkey from the given [`WScriptHash`].
+        */
+       public static ShutdownScript new_p2wsh(byte[] script_hash) {
+               long ret = bindings.ShutdownScript_new_p2wsh(script_hash);
+               if (ret < 1024) { return null; }
+               ShutdownScript ret_hu_conv = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Generates a P2WSH script pubkey from the given segwit version and program.
+        * 
+        * # Errors
+        * 
+        * This function may return an error if `program` is invalid for the segwit `version`.
+        */
+       public static Result_ShutdownScriptInvalidShutdownScriptZ new_witness_program(byte version, byte[] program) {
+               long ret = bindings.ShutdownScript_new_witness_program(version, program);
+               if (ret < 1024) { return null; }
+               Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Converts the shutdown script into the underlying [`Script`].
+        */
+       public byte[] into_inner() {
+               byte[] ret = bindings.ShutdownScript_into_inner(this.ptr);
+               this.ptrs_to.add(this);
+               return ret;
+       }
+
+       /**
+        * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.
+        * 
+        * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       @Nullable
+       public byte[] as_legacy_pubkey() {
+               byte[] ret = bindings.ShutdownScript_as_legacy_pubkey(this.ptr);
+               return ret;
+       }
+
+       /**
+        * Returns whether the shutdown script is compatible with the features as defined by BOLT #2.
+        * 
+        * Specifically, checks for compliance with feature `option_shutdown_anysegwit`.
+        */
+       public boolean is_compatible(InitFeatures features) {
+               boolean ret = bindings.ShutdownScript_is_compatible(this.ptr, features == null ? 0 : features.ptr & ~1);
+               this.ptrs_to.add(features);
+               return ret;
+       }
+
+}
index 5d1eb7afeea0f1fc079dbbbc02aa04cf82d3f9a0..e7ea1861b68bc9923a92da15ea758402799de734 100644 (file)
@@ -197,6 +197,24 @@ public class UtilMethods {
                return ret;
        }
 
+       /**
+        * Gets a keysend route from us (payer) to the given target node (payee). This is needed because
+        * keysend payments do not have an invoice from which to pull the payee's supported features, which
+        * makes it tricky to otherwise supply the `payee_features` parameter of `get_route`.
+        * 
+        * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       public static Result_RouteLightningErrorZ get_keysend_route(byte[] our_node_id, NetworkGraph network, byte[] payee, @Nullable ChannelDetails[] first_hops, RouteHint[] last_hops, long final_value_msat, int final_cltv, Logger logger) {
+               long ret = bindings.get_keysend_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, last_hops != null ? Arrays.stream(last_hops).mapToLong(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray() : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr);
+               if (ret < 1024) { return null; }
+               Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(network);
+               /* TODO 2 ChannelDetails  */;
+               /* TODO 2 RouteHint  */;
+               ret_hu_conv.ptrs_to.add(logger);
+               return ret_hu_conv;
+       }
+
        /**
         * Gets a route from us (payer) to the given target node (payee).
         * 
index fa9b3853ded69ffe4c3c5f3597f96dbd37ce6407..21a1b0e6c1c3016cf8c627870f778311cf02305e 100644 (file)
@@ -133,7 +133,7 @@ static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
 }
 
 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
-       return str_ref_to_java(env, "v0.0.99.2", strlen("v0.0.99.2"));
+       return str_ref_to_java(env, "v0.0.100.0", strlen("v0.0.100.0"));
 }
 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
        return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
@@ -1031,6 +1031,48 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNo
        CHECK(!val->result_ok);
        return *val->contents.err;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKInvalidShutdownScript err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
        return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
 }
@@ -2254,7 +2296,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
@@ -2285,7 +2327,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
@@ -2314,7 +2356,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo
        (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
@@ -2351,7 +2393,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
@@ -2388,7 +2430,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
@@ -2415,7 +2457,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void*
        Transaction_free(closing_tx_var);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
@@ -2446,7 +2488,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
@@ -3015,6 +3057,8 @@ static jclass LDKAPIError_ChannelUnavailable_class = NULL;
 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
+static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
+static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
        LDKAPIError_APIMisuseError_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
@@ -3041,6 +3085,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv
        CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
        LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
        CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
+       LDKAPIError_IncompatibleShutdownScript_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
+       CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
+       LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
+       CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
 }
 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
        LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
@@ -3068,6 +3117,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr
                case LDKAPIError_MonitorUpdateFailed: {
                        return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
                }
+               case LDKAPIError_IncompatibleShutdownScript: {
+                       LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
+                       CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+                       CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+                       uint64_t script_ref = (uint64_t)script_var.inner & ~1;
+                       return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
+               }
                default: abort();
        }
 }
@@ -3226,6 +3282,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSend
        uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
        return err_ref;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
+}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       int8_tArray res_arr = (*env)->NewByteArray(env, 32);
+       (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
+       return res_arr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
+       return err_ref;
+}
 static jclass LDKNetAddress_IPv4_class = NULL;
 static jmethodID LDKNetAddress_IPv4_meth = NULL;
 static jclass LDKNetAddress_IPv6_class = NULL;
@@ -3424,7 +3496,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void*
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
@@ -3461,7 +3533,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
@@ -3675,7 +3747,7 @@ typedef struct LDKKeysInterface_JCalls {
        jweak o;
        jmethodID get_node_secret_meth;
        jmethodID get_destination_script_meth;
-       jmethodID get_shutdown_pubkey_meth;
+       jmethodID get_shutdown_scriptpubkey_meth;
        jmethodID get_channel_signer_meth;
        jmethodID get_secure_random_bytes_meth;
        jmethodID read_chan_signer_meth;
@@ -3747,7 +3819,7 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg)
        }
        return ret_ref;
 }
-LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
+LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
        JNIEnv *env;
        jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
@@ -3758,18 +3830,19 @@ LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A call to get_shutdown_pubkey in LDKKeysInterface from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
        }
-       LDKPublicKey ret_ref;
-       CHECK((*env)->GetArrayLength(env, ret) == 33);
-       (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
+       LDKShutdownScript ret_conv;
+       ret_conv.inner = (void*)(ret & (~1));
+       ret_conv.is_owned = (ret & 1) || (ret == 0);
+       ret_conv = ShutdownScript_clone(&ret_conv);
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
-       return ret_ref;
+       return ret_conv;
 }
 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
@@ -3782,13 +3855,13 @@ LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inb
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
        }
        LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
-       ret_conv = Sign_clone(ret);
+       ret_conv = Sign_clone(&ret_conv);
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
@@ -3832,7 +3905,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void*
        (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
@@ -3859,7 +3932,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v
        CVec_u8Z_free(invoice_preimage_var);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
@@ -3886,8 +3959,8 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j
        CHECK(calls->get_node_secret_meth != NULL);
        calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
        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_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
+       CHECK(calls->get_shutdown_scriptpubkey_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");
@@ -3901,7 +3974,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j
                .this_arg = (void*) calls,
                .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
                .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
-               .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
+               .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
                .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
                .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
                .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
@@ -3931,11 +4004,16 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1des
        return ret_arr;
 }
 
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
-       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;
+       LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
 }
 
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
@@ -4663,6 +4741,40 @@ static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCV
        }
        return ret;
 }
+static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
+static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
+static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
+static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
+       LDKPaymentPurpose_InvoicePayment_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
+       CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
+       LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
+       CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
+       LDKPaymentPurpose_SpontaneousPayment_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
+       CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
+       LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
+       CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+       LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
+       switch(obj->tag) {
+               case LDKPaymentPurpose_InvoicePayment: {
+                       int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
+                       int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
+                       return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
+               }
+               case LDKPaymentPurpose_SpontaneousPayment: {
+                       int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
+                       return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
+               }
+               default: abort();
+       }
+}
 static jclass LDKEvent_FundingGenerationReady_class = NULL;
 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
 static jclass LDKEvent_PaymentReceived_class = NULL;
@@ -4675,6 +4787,8 @@ static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
 static jclass LDKEvent_SpendableOutputs_class = NULL;
 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
+static jclass LDKEvent_PaymentForwarded_class = NULL;
+static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
        LDKEvent_FundingGenerationReady_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
@@ -4684,7 +4798,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en
        LDKEvent_PaymentReceived_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
        CHECK(LDKEvent_PaymentReceived_class != NULL);
-       LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
+       LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
        CHECK(LDKEvent_PaymentReceived_meth != NULL);
        LDKEvent_PaymentSent_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
@@ -4706,6 +4820,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en
        CHECK(LDKEvent_SpendableOutputs_class != NULL);
        LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
        CHECK(LDKEvent_SpendableOutputs_meth != NULL);
+       LDKEvent_PaymentForwarded_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
+       CHECK(LDKEvent_PaymentForwarded_class != NULL);
+       LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
+       CHECK(LDKEvent_PaymentForwarded_meth != NULL);
 }
 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
        LDKEvent *obj = (LDKEvent*)(ptr & ~1);
@@ -4721,11 +4840,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN
                case LDKEvent_PaymentReceived: {
                        int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
                        (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
-                       int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
-                       (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
-                       int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
-                       (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
-                       return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
+                       uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
+                       return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
                }
                case LDKEvent_PaymentSent: {
                        int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
@@ -4751,6 +4867,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN
                        (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
                        return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
                }
+               case LDKEvent_PaymentForwarded: {
+                       uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
+                       return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
+               }
                default: abort();
        }
 }
@@ -5478,6 +5598,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDe
        uint64_t err_ref = (uint64_t)err_var.inner & ~1;
        return err_ref;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKClosingSignedFeeRange res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
        return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
 }
@@ -6387,7 +6528,7 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons
        (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
@@ -6845,7 +6986,7 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
@@ -6961,7 +7102,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
@@ -7007,7 +7148,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
@@ -8109,7 +8250,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8140,7 +8281,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8171,7 +8312,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8328,7 +8469,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8360,7 +8501,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8392,7 +8533,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8424,7 +8565,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8855,7 +8996,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
@@ -9465,6 +9606,67 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNo
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+       LDKInvalidShutdownScript e_conv;
+       e_conv.inner = (void*)(e & (~1));
+       e_conv.is_owned = (e & 1) || (e == 0);
+       // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
        LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
        *ret_conv = CResult_NoneErrorZ_ok();
@@ -10611,6 +10813,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
+       LDKThirtyTwoBytes o_ref;
+       CHECK((*env)->GetArrayLength(env, o) == 32);
+       (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+       LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
        LDKCVec_NetAddressZ _res_constr;
        _res_constr.datalen = (*env)->GetArrayLength(env, _res);
@@ -12326,6 +12558,40 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecod
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKClosingSignedFeeRange o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ClosingSignedFeeRange_clone(&o_conv);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_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_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
        LDKCommitmentSigned o_conv;
        o_conv.inner = (void*)(o & (~1));
@@ -13275,6 +13541,44 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreat
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       if ((this_ptr & 1) != 0) return;
+       LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
+       FREE((void*)this_ptr);
+       PaymentPurpose_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_clone(orig_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
+       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
+       LDKThirtyTwoBytes payment_secret_ref;
+       CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
+       (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
+       LDKThirtyTwoBytes a_ref;
+       CHECK((*env)->GetArrayLength(env, a) == 32);
+       (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
@@ -13304,18 +13608,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_
        return ret_ref;
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t amt, int64_t user_payment_id) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
        LDKThirtyTwoBytes payment_hash_ref;
        CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
        (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
-       LDKThirtyTwoBytes payment_preimage_ref;
-       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
-       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
-       LDKThirtyTwoBytes payment_secret_ref;
-       CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
-       (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
+       LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
        LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
-       *ret_copy = Event_payment_received(payment_hash_ref, payment_preimage_ref, payment_secret_ref, amt, user_payment_id);
+       *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
        uint64_t ret_ref = (uint64_t)ret_copy;
        return ret_ref;
 }
@@ -13368,6 +13667,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(J
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
+       LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 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 ret_var = Event_write(obj_conv);
@@ -13733,6 +14040,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
+       LDKShutdownScript script_conv;
+       script_conv.inner = (void*)(script & (~1));
+       script_conv.is_owned = (script & 1) || (script == 0);
+       script_conv = ShutdownScript_clone(&script_conv);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_incompatible_shutdown_script(script_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
        LDKu8slice msg_ref;
        msg_ref.datalen = (*env)->GetArrayLength(env, msg);
@@ -14160,8 +14478,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1up
        ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
-       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
+       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -14621,6 +14969,13 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1pr
        return ret_conv;
 }
 
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+       LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
+       LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
+       jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
+       return ret_val;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
@@ -16881,6 +17236,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1chan
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       unsigned char channel_id_arr[32];
+       CHECK((*env)->GetArrayLength(env, channel_id) == 32);
+       (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
+       unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+       LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+       *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -16919,6 +17287,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payme
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKRoute route_conv;
+       route_conv.inner = (void*)(route & (~1));
+       route_conv.is_owned = false;
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
+       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -18518,6 +18901,68 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env
        return ret_ref;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKClosingSignedFeeRange this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ClosingSignedFeeRange_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKClosingSignedFeeRange orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKClosingSigned this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -18578,14 +19023,43 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(
        ClosingSigned_set_signature(&this_ptr_conv, val_ref);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange val_conv;
+       val_conv.inner = (void*)(val & (~1));
+       val_conv.is_owned = (val & 1) || (val == 0);
+       val_conv = ClosingSignedFeeRange_clone(&val_conv);
+       ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
        LDKThirtyTwoBytes channel_id_arg_ref;
        CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
        (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
        LDKSignature signature_arg_ref;
        CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
        (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
-       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
+       LDKClosingSignedFeeRange fee_range_arg_conv;
+       fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
+       fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
+       fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
+       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -21264,6 +21738,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
+       LDKClosingSignedFeeRange obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ClosingSignedFeeRange_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_ClosingSignedFeeRange_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_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = ClosingSignedFeeRange_read(ser_ref);
+       (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
        LDKCommitmentSigned obj_conv;
        obj_conv.inner = (void*)(obj & (~1));
@@ -23922,6 +24417,193 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEn
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ShutdownScript_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKShutdownScript orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKInvalidShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       InvalidShutdownScript_free(this_obj_conv);
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKu8slice ret_var = InvalidShutdownScript_get_script(&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_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCVec_u8Z val_ref;
+       val_ref.datalen = (*env)->GetArrayLength(env, val);
+       val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
+       (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
+       InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
+       LDKCVec_u8Z script_arg_ref;
+       script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
+       script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
+       (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
+       LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
+       LDKShutdownScript obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ShutdownScript_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_ShutdownScript_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = ShutdownScript_read(ser_ref);
+       (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
+       (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
+       unsigned char script_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, script_hash) == 20);
+       (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
+       unsigned char (*script_hash_ref)[20] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
+       (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
+       unsigned char script_hash_arr[32];
+       CHECK((*env)->GetArrayLength(env, script_hash) == 32);
+       (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
+       unsigned char (*script_hash_ref)[32] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
+       LDKu8slice program_ref;
+       program_ref.datalen = (*env)->GetArrayLength(env, program);
+       program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
+       (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       this_arg_conv = ShutdownScript_clone(&this_arg_conv);
+       LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
+       int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+       (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+       CVec_u8Z_free(ret_var);
+       return ret_arr;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
+       (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
+       return ret_arr;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKInitFeatures features_conv;
+       features_conv.inner = (void*)(features & (~1));
+       features_conv.is_owned = false;
+       jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
+       return ret_val;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKRouteHop this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -24406,6 +25088,62 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
+       LDKPublicKey our_node_id_ref;
+       CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
+       (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
+       LDKNetworkGraph network_conv;
+       network_conv.inner = (void*)(network & (~1));
+       network_conv.is_owned = false;
+       LDKPublicKey payee_ref;
+       CHECK((*env)->GetArrayLength(env, payee) == 33);
+       (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
+       LDKCVec_ChannelDetailsZ first_hops_constr;
+       LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
+       if (first_hops != NULL) {
+               first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
+               if (first_hops_constr.datalen > 0)
+                       first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+               else
+                       first_hops_constr.data = NULL;
+               int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
+               for (size_t q = 0; q < first_hops_constr.datalen; q++) {
+                       int64_t first_hops_conv_16 = first_hops_vals[q];
+                       LDKChannelDetails first_hops_conv_16_conv;
+                       first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
+                       first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
+                       first_hops_constr.data[q] = first_hops_conv_16_conv;
+               }
+               (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
+               first_hops_ptr = &first_hops_constr;
+       }
+       LDKCVec_RouteHintZ last_hops_constr;
+       last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
+       if (last_hops_constr.datalen > 0)
+               last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
+       else
+               last_hops_constr.data = NULL;
+       int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
+       for (size_t l = 0; l < last_hops_constr.datalen; l++) {
+               int64_t last_hops_conv_11 = last_hops_vals[l];
+               LDKRouteHint last_hops_conv_11_conv;
+               last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
+               last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
+               last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
+               last_hops_constr.data[l] = last_hops_conv_11_conv;
+       }
+       (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
+       LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+       if (logger_conv.free == LDKLogger_JCalls_free) {
+               // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+               LDKLogger_JCalls_cloned(&logger_conv);
+       }
+       LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+       *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
+       if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
        LDKPublicKey our_node_id_ref;
        CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
@@ -25735,6 +26473,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKBackgroundProcessor this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
+       LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
+       *ret_conv = BackgroundProcessor_join(this_arg_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKBackgroundProcessor this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
index 7b63fbd7f2c553f6f40592e212a09ce54def93e6..048b2b8588fd5c7f43987f2cdb723c3dc2a7aa8c 100644 (file)
@@ -131,7 +131,7 @@ static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
 }
 
 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
-       return str_ref_to_java(env, "v0.0.99.2", strlen("v0.0.99.2"));
+       return str_ref_to_java(env, "v0.0.100.0", strlen("v0.0.100.0"));
 }
 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
        return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
@@ -1029,6 +1029,48 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNo
        CHECK(!val->result_ok);
        return *val->contents.err;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKInvalidShutdownScript err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
        return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
 }
@@ -2252,7 +2294,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
@@ -2283,7 +2325,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
@@ -2312,7 +2354,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo
        (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
@@ -2349,7 +2391,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
@@ -2386,7 +2428,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
@@ -2413,7 +2455,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void*
        Transaction_free(closing_tx_var);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
@@ -2444,7 +2486,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
@@ -3013,6 +3055,8 @@ static jclass LDKAPIError_ChannelUnavailable_class = NULL;
 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
+static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL;
+static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
        LDKAPIError_APIMisuseError_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
@@ -3039,6 +3083,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv
        CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
        LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
        CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
+       LDKAPIError_IncompatibleShutdownScript_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;"));
+       CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL);
+       LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "<init>", "(J)V");
+       CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL);
 }
 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
        LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
@@ -3066,6 +3115,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr
                case LDKAPIError_MonitorUpdateFailed: {
                        return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
                }
+               case LDKAPIError_IncompatibleShutdownScript: {
+                       LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
+                       CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+                       CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+                       uint64_t script_ref = (uint64_t)script_var.inner & ~1;
+                       return (*env)->NewObject(env, LDKAPIError_IncompatibleShutdownScript_class, LDKAPIError_IncompatibleShutdownScript_meth, script_ref);
+               }
                default: abort();
        }
 }
@@ -3224,6 +3280,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSend
        uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
        return err_ref;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
+}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       int8_tArray res_arr = (*env)->NewByteArray(env, 32);
+       (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
+       return res_arr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
+       return err_ref;
+}
 static jclass LDKNetAddress_IPv4_class = NULL;
 static jmethodID LDKNetAddress_IPv4_meth = NULL;
 static jclass LDKNetAddress_IPv6_class = NULL;
@@ -3422,7 +3494,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void*
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
@@ -3459,7 +3531,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
@@ -3673,7 +3745,7 @@ typedef struct LDKKeysInterface_JCalls {
        jweak o;
        jmethodID get_node_secret_meth;
        jmethodID get_destination_script_meth;
-       jmethodID get_shutdown_pubkey_meth;
+       jmethodID get_shutdown_scriptpubkey_meth;
        jmethodID get_channel_signer_meth;
        jmethodID get_secure_random_bytes_meth;
        jmethodID read_chan_signer_meth;
@@ -3745,7 +3817,7 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg)
        }
        return ret_ref;
 }
-LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
+LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
        JNIEnv *env;
        jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
@@ -3756,18 +3828,19 @@ LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
-               (*env)->FatalError(env, "A call to get_shutdown_pubkey in LDKKeysInterface from rust threw an exception.");
+               (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception.");
        }
-       LDKPublicKey ret_ref;
-       CHECK((*env)->GetArrayLength(env, ret) == 33);
-       (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
+       LDKShutdownScript ret_conv;
+       ret_conv.inner = (void*)(ret & (~1));
+       ret_conv.is_owned = (ret & 1) || (ret == 0);
+       ret_conv = ShutdownScript_clone(&ret_conv);
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
-       return ret_ref;
+       return ret_conv;
 }
 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
@@ -3780,13 +3853,13 @@ LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inb
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
        }
        LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
-       ret_conv = Sign_clone(ret);
+       ret_conv = Sign_clone(&ret_conv);
        if (get_jenv_res == JNI_EDETACHED) {
                DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
        }
@@ -3830,7 +3903,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void*
        (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
@@ -3857,7 +3930,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v
        CVec_u8Z_free(invoice_preimage_var);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
@@ -3884,8 +3957,8 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j
        CHECK(calls->get_node_secret_meth != NULL);
        calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
        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_shutdown_scriptpubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_scriptpubkey", "()J");
+       CHECK(calls->get_shutdown_scriptpubkey_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");
@@ -3899,7 +3972,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j
                .this_arg = (void*) calls,
                .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
                .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
-               .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
+               .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
                .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
                .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
                .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
@@ -3929,11 +4002,16 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1des
        return ret_arr;
 }
 
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
-       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;
+       LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
 }
 
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
@@ -4661,6 +4739,40 @@ static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCV
        }
        return ret;
 }
+static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
+static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
+static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
+static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
+       LDKPaymentPurpose_InvoicePayment_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
+       CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
+       LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
+       CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
+       LDKPaymentPurpose_SpontaneousPayment_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
+       CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
+       LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
+       CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+       LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
+       switch(obj->tag) {
+               case LDKPaymentPurpose_InvoicePayment: {
+                       int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
+                       int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
+                       return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
+               }
+               case LDKPaymentPurpose_SpontaneousPayment: {
+                       int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
+                       (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
+                       return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
+               }
+               default: abort();
+       }
+}
 static jclass LDKEvent_FundingGenerationReady_class = NULL;
 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
 static jclass LDKEvent_PaymentReceived_class = NULL;
@@ -4673,6 +4785,8 @@ static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
 static jclass LDKEvent_SpendableOutputs_class = NULL;
 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
+static jclass LDKEvent_PaymentForwarded_class = NULL;
+static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
        LDKEvent_FundingGenerationReady_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
@@ -4682,7 +4796,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en
        LDKEvent_PaymentReceived_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
        CHECK(LDKEvent_PaymentReceived_class != NULL);
-       LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[B[BJJ)V");
+       LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
        CHECK(LDKEvent_PaymentReceived_meth != NULL);
        LDKEvent_PaymentSent_class =
                (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
@@ -4704,6 +4818,11 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *en
        CHECK(LDKEvent_SpendableOutputs_class != NULL);
        LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
        CHECK(LDKEvent_SpendableOutputs_meth != NULL);
+       LDKEvent_PaymentForwarded_class =
+               (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;"));
+       CHECK(LDKEvent_PaymentForwarded_class != NULL);
+       LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
+       CHECK(LDKEvent_PaymentForwarded_meth != NULL);
 }
 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
        LDKEvent *obj = (LDKEvent*)(ptr & ~1);
@@ -4719,11 +4838,8 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN
                case LDKEvent_PaymentReceived: {
                        int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
                        (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
-                       int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
-                       (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_received.payment_preimage.data);
-                       int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
-                       (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
-                       return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_preimage_arr, payment_secret_arr, obj->payment_received.amt, obj->payment_received.user_payment_id);
+                       uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
+                       return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
                }
                case LDKEvent_PaymentSent: {
                        int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
@@ -4749,6 +4865,10 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN
                        (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
                        return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
                }
+               case LDKEvent_PaymentForwarded: {
+                       uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
+                       return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
+               }
                default: abort();
        }
 }
@@ -5476,6 +5596,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDe
        uint64_t err_ref = (uint64_t)err_var.inner & ~1;
        return err_ref;
 }
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKClosingSignedFeeRange res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
        return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
 }
@@ -6385,7 +6526,7 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons
        (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
@@ -6843,7 +6984,7 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
@@ -6959,7 +7100,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
@@ -7005,7 +7146,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
@@ -8107,7 +8248,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8138,7 +8279,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8169,7 +8310,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8326,7 +8467,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8358,7 +8499,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8390,7 +8531,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8422,7 +8563,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
@@ -8853,7 +8994,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi
        }
        jobject obj = (*env)->NewLocalRef(env, j_calls->o);
        CHECK(obj != NULL);
-       LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
+       uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
        if ((*env)->ExceptionCheck(env)) {
                (*env)->ExceptionDescribe(env);
                (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
@@ -9463,6 +9604,67 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNo
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+       LDKInvalidShutdownScript e_conv;
+       e_conv.inner = (void*)(e & (~1));
+       e_conv.is_owned = (e & 1) || (e == 0);
+       // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
        LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
        *ret_conv = CResult_NoneErrorZ_ok();
@@ -10609,6 +10811,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFai
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
+       LDKThirtyTwoBytes o_ref;
+       CHECK((*env)->GetArrayLength(env, o) == 32);
+       (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+       LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
        LDKCVec_NetAddressZ _res_constr;
        _res_constr.datalen = (*env)->GetArrayLength(env, _res);
@@ -12324,6 +12556,40 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecod
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+       LDKClosingSignedFeeRange o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ClosingSignedFeeRange_clone(&o_conv);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_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_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
        LDKCommitmentSigned o_conv;
        o_conv.inner = (void*)(o & (~1));
@@ -13273,6 +13539,44 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreat
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       if ((this_ptr & 1) != 0) return;
+       LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
+       FREE((void*)this_ptr);
+       PaymentPurpose_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_clone(orig_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
+       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
+       LDKThirtyTwoBytes payment_secret_ref;
+       CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
+       (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment(JNIEnv *env, jclass clz, int8_tArray a) {
+       LDKThirtyTwoBytes a_ref;
+       CHECK((*env)->GetArrayLength(env, a) == 32);
+       (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
@@ -13302,18 +13606,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_
        return ret_ref;
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t amt, int64_t user_payment_id) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received(JNIEnv *env, jclass clz, int8_tArray payment_hash, int64_t amt, int64_t purpose) {
        LDKThirtyTwoBytes payment_hash_ref;
        CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
        (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
-       LDKThirtyTwoBytes payment_preimage_ref;
-       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
-       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
-       LDKThirtyTwoBytes payment_secret_ref;
-       CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
-       (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
+       LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
        LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
-       *ret_copy = Event_payment_received(payment_hash_ref, payment_preimage_ref, payment_secret_ref, amt, user_payment_id);
+       *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
        uint64_t ret_ref = (uint64_t)ret_copy;
        return ret_ref;
 }
@@ -13366,6 +13665,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs(J
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
+       LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 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 ret_var = Event_write(obj_conv);
@@ -13731,6 +14038,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script(JNIEnv *env, jclass clz, int64_t script) {
+       LDKShutdownScript script_conv;
+       script_conv.inner = (void*)(script & (~1));
+       script_conv.is_owned = (script & 1) || (script == 0);
+       script_conv = ShutdownScript_clone(&script_conv);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_incompatible_shutdown_script(script_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
        LDKu8slice msg_ref;
        msg_ref.datalen = (*env)->GetArrayLength(env, msg);
@@ -14158,8 +14476,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1up
        ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
-       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
+       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -14619,6 +14967,13 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1pr
        return ret_conv;
 }
 
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+       LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
+       LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
+       jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
+       return ret_val;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
@@ -16879,6 +17234,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1chan
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       unsigned char channel_id_arr[32];
+       CHECK((*env)->GetArrayLength(env, channel_id) == 32);
+       (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
+       unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+       LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+       *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -16917,6 +17285,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payme
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKRoute route_conv;
+       route_conv.inner = (void*)(route & (~1));
+       route_conv.is_owned = false;
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
+       (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -18516,6 +18899,68 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env
        return ret_ref;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKClosingSignedFeeRange this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ClosingSignedFeeRange_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new(JNIEnv *env, jclass clz, int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKClosingSignedFeeRange orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKClosingSigned this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -18576,14 +19021,43 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(
        ClosingSigned_set_signature(&this_ptr_conv, val_ref);
 }
 
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange val_conv;
+       val_conv.inner = (void*)(val & (~1));
+       val_conv.is_owned = (val & 1) || (val == 0);
+       val_conv = ClosingSignedFeeRange_clone(&val_conv);
+       ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, int64_t fee_range_arg) {
        LDKThirtyTwoBytes channel_id_arg_ref;
        CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
        (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
        LDKSignature signature_arg_ref;
        CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
        (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
-       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
+       LDKClosingSignedFeeRange fee_range_arg_conv;
+       fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
+       fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
+       fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
+       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -21262,6 +21736,27 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
+       LDKClosingSignedFeeRange obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ClosingSignedFeeRange_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_ClosingSignedFeeRange_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_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = ClosingSignedFeeRange_read(ser_ref);
+       (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
        LDKCommitmentSigned obj_conv;
        obj_conv.inner = (void*)(obj & (~1));
@@ -23920,6 +24415,193 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEn
        return (uint64_t)ret_conv;
 }
 
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ShutdownScript_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+       LDKShutdownScript orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+       LDKInvalidShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       InvalidShutdownScript_free(this_obj_conv);
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script(JNIEnv *env, jclass clz, int64_t this_ptr) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKu8slice ret_var = InvalidShutdownScript_get_script(&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_InvalidShutdownScript_1set_1script(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCVec_u8Z val_ref;
+       val_ref.datalen = (*env)->GetArrayLength(env, val);
+       val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
+       (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
+       InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new(JNIEnv *env, jclass clz, int8_tArray script_arg) {
+       LDKCVec_u8Z script_arg_ref;
+       script_arg_ref.datalen = (*env)->GetArrayLength(env, script_arg);
+       script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
+       (*env)->GetByteArrayRegion(env, script_arg, 0, script_arg_ref.datalen, script_arg_ref.data);
+       LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write(JNIEnv *env, jclass clz, int64_t obj) {
+       LDKShutdownScript obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ShutdownScript_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_ShutdownScript_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = ShutdownScript_read(ser_ref);
+       (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
+       (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
+       unsigned char script_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, script_hash) == 20);
+       (*env)->GetByteArrayRegion(env, script_hash, 0, 20, script_hash_arr);
+       unsigned char (*script_hash_ref)[20] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh(JNIEnv *env, jclass clz, int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK((*env)->GetArrayLength(env, pubkey_hash) == 20);
+       (*env)->GetByteArrayRegion(env, pubkey_hash, 0, 20, pubkey_hash_arr);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh(JNIEnv *env, jclass clz, int8_tArray script_hash) {
+       unsigned char script_hash_arr[32];
+       CHECK((*env)->GetArrayLength(env, script_hash) == 32);
+       (*env)->GetByteArrayRegion(env, script_hash, 0, 32, script_hash_arr);
+       unsigned char (*script_hash_ref)[32] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program(JNIEnv *env, jclass clz, int8_t version, int8_tArray program) {
+       LDKu8slice program_ref;
+       program_ref.datalen = (*env)->GetArrayLength(env, program);
+       program_ref.data = (*env)->GetByteArrayElements (env, program, NULL);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
+       (*env)->ReleaseByteArrayElements(env, program, (int8_t*)program_ref.data, 0);
+       return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       this_arg_conv = ShutdownScript_clone(&this_arg_conv);
+       LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
+       int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+       (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+       CVec_u8Z_free(ret_var);
+       return ret_arr;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
+       (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form);
+       return ret_arr;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible(JNIEnv *env, jclass clz, int64_t this_arg, int64_t features) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKInitFeatures features_conv;
+       features_conv.inner = (void*)(features & (~1));
+       features_conv.is_owned = false;
+       jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
+       return ret_val;
+}
+
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
        LDKRouteHop this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -24404,6 +25086,62 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
+       LDKPublicKey our_node_id_ref;
+       CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
+       (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
+       LDKNetworkGraph network_conv;
+       network_conv.inner = (void*)(network & (~1));
+       network_conv.is_owned = false;
+       LDKPublicKey payee_ref;
+       CHECK((*env)->GetArrayLength(env, payee) == 33);
+       (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
+       LDKCVec_ChannelDetailsZ first_hops_constr;
+       LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
+       if (first_hops != NULL) {
+               first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
+               if (first_hops_constr.datalen > 0)
+                       first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+               else
+                       first_hops_constr.data = NULL;
+               int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
+               for (size_t q = 0; q < first_hops_constr.datalen; q++) {
+                       int64_t first_hops_conv_16 = first_hops_vals[q];
+                       LDKChannelDetails first_hops_conv_16_conv;
+                       first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
+                       first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
+                       first_hops_constr.data[q] = first_hops_conv_16_conv;
+               }
+               (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
+               first_hops_ptr = &first_hops_constr;
+       }
+       LDKCVec_RouteHintZ last_hops_constr;
+       last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
+       if (last_hops_constr.datalen > 0)
+               last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
+       else
+               last_hops_constr.data = NULL;
+       int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
+       for (size_t l = 0; l < last_hops_constr.datalen; l++) {
+               int64_t last_hops_conv_11 = last_hops_vals[l];
+               LDKRouteHint last_hops_conv_11_conv;
+               last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
+               last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
+               last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
+               last_hops_constr.data[l] = last_hops_conv_11_conv;
+       }
+       (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
+       LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+       if (logger_conv.free == LDKLogger_JCalls_free) {
+               // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+               LDKLogger_JCalls_cloned(&logger_conv);
+       }
+       LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+       *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
+       if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
        LDKPublicKey our_node_id_ref;
        CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
@@ -25733,6 +26471,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(
        return ret_ref;
 }
 
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join(JNIEnv *env, jclass clz, int64_t this_arg) {
+       LDKBackgroundProcessor this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
+       LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
+       *ret_conv = BackgroundProcessor_join(this_arg_conv);
+       return (uint64_t)ret_conv;
+}
+
 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
        LDKBackgroundProcessor this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
index 4bc7528737af97e5909b9d2971ee10a515445b36..5e40e6a20ac99214224862a6f45d5231c5b26c13 100644 (file)
@@ -479,6 +479,54 @@ JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1Sign
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ShutdownScriptDecodeErrorZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1result_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ShutdownScriptDecodeErrorZ_get_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ShutdownScriptDecodeErrorZ_get_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptDecodeErrorZ_1get_1err
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1result_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownScriptInvalidShutdownScriptZ_1get_1err
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    LDKCResult_NoneErrorZ_result_ok
@@ -1399,6 +1447,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFai
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_PaymentHashPaymentSendFailureZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_PaymentHashPaymentSendFailureZ_get_ok
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_PaymentHashPaymentSendFailureZ_get_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    LDKNetAddress_ref_from_ptr
@@ -1545,10 +1617,10 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1dest
 
 /*
  * Class:     org_ldk_impl_bindings
- * Method:    KeysInterface_get_shutdown_pubkey
- * Signature: (J)[B
+ * Method:    KeysInterface_get_shutdown_scriptpubkey
+ * Signature: (J)J
  */
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1scriptpubkey
   (JNIEnv *, jclass, jlong);
 
 /*
@@ -2167,6 +2239,14 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new
   (JNIEnv *, jclass, jlongArray);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKPaymentPurpose_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKPaymentPurpose;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    LDKEvent_ref_from_ptr
@@ -2791,6 +2871,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDeco
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1result_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedFeeRangeDecodeErrorZ_1get_1err
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    LDKCResult_CommitmentSignedDecodeErrorZ_result_ok
@@ -4479,6 +4583,62 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ShutdownScriptDecodeErrorZ_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ShutdownScriptDecodeErrorZ_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1err
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ShutdownScriptDecodeErrorZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1free
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ShutdownScriptDecodeErrorZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptDecodeErrorZ_1clone
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ShutdownScriptInvalidShutdownScriptZ_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ShutdownScriptInvalidShutdownScriptZ_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1err
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ShutdownScriptInvalidShutdownScriptZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownScriptInvalidShutdownScriptZ_1free
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    CResult_NoneErrorZ_ok
@@ -5455,6 +5615,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailur
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_PaymentHashPaymentSendFailureZ_ok
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok
+  (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_PaymentHashPaymentSendFailureZ_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_PaymentHashPaymentSendFailureZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_PaymentHashPaymentSendFailureZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    CVec_NetAddressZ_free
@@ -6959,6 +7151,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeEr
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ClosingSignedFeeRangeDecodeErrorZ_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1ok
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ClosingSignedFeeRangeDecodeErrorZ_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1err
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ClosingSignedFeeRangeDecodeErrorZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1free
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    CResult_ClosingSignedFeeRangeDecodeErrorZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedFeeRangeDecodeErrorZ_1clone
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    CResult_CommitmentSignedDecodeErrorZ_ok
@@ -7855,6 +8079,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreation
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    PaymentPurpose_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    PaymentPurpose_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    PaymentPurpose_invoice_payment
+ * Signature: ([B[BJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment
+  (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    PaymentPurpose_spontaneous_payment
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment
+  (JNIEnv *, jclass, jbyteArray);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    Event_free
@@ -7882,10 +8138,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1funding_1generation_1r
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    Event_payment_received
- * Signature: ([B[B[BJJ)J
+ * Signature: ([BJJ)J
  */
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1received
-  (JNIEnv *, jclass, jbyteArray, jbyteArray, jbyteArray, jlong, jlong);
+  (JNIEnv *, jclass, jbyteArray, jlong, jlong);
 
 /*
  * Class:     org_ldk_impl_bindings
@@ -7919,6 +8175,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwar
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1spendable_1outputs
   (JNIEnv *, jclass, jlongArray);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    Event_payment_forwarded
+ * Signature: (JZ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded
+  (JNIEnv *, jclass, jlong, jboolean);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    Event_write
@@ -8183,6 +8447,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1channel_1unavailabl
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1monitor_1update_1failed
   (JNIEnv *, jclass);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    APIError_incompatible_shutdown_script
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1incompatible_1shutdown_1script
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    sign
@@ -8615,13 +8887,45 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey
   (JNIEnv *, jclass, jlong, jboolean);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ChannelConfig_get_max_dust_htlc_exposure_msat
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1max_1dust_1htlc_1exposure_1msat
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ChannelConfig_set_max_dust_htlc_exposure_msat
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1max_1dust_1htlc_1exposure_1msat
+  (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ChannelConfig_get_force_close_avoidance_max_fee_satoshis
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1force_1close_1avoidance_1max_1fee_1satoshis
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ChannelConfig_set_force_close_avoidance_max_fee_satoshis
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1force_1close_1avoidance_1max_1fee_1satoshis
+  (JNIEnv *, jclass, jlong, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    ChannelConfig_new
- * Signature: (IISZZ)J
+ * Signature: (IISZZJJ)J
  */
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new
-  (JNIEnv *, jclass, jint, jint, jshort, jboolean, jboolean);
+  (JNIEnv *, jclass, jint, jint, jshort, jboolean, jboolean, jlong, jlong);
 
 /*
  * Class:     org_ldk_impl_bindings
@@ -8983,6 +9287,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1normal
 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1high_1priority
   (JNIEnv *, jclass);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ConfirmationTarget_eq
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1eq
+  (JNIEnv *, jclass, jlong, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    FeeEstimator_free
@@ -10519,6 +10831,14 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1us
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel
   (JNIEnv *, jclass, jlong, jbyteArray);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ChannelManager_close_channel_with_target_feerate
+ * Signature: (J[BI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel_1with_1target_1feerate
+  (JNIEnv *, jclass, jlong, jbyteArray, jint);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    ChannelManager_force_close_channel
@@ -10543,6 +10863,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment
   (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ChannelManager_send_spontaneous_payment
+ * Signature: (JJ[B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment
+  (JNIEnv *, jclass, jlong, jlong, jbyteArray);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    ChannelManager_funding_transaction_generated
@@ -11823,6 +12151,62 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1free
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_get_min_fee_satoshis
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1min_1fee_1satoshis
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_set_min_fee_satoshis
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1min_1fee_1satoshis
+  (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_get_max_fee_satoshis
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1get_1max_1fee_1satoshis
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_set_max_fee_satoshis
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1set_1max_1fee_1satoshis
+  (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_new
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1new
+  (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1clone
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    ClosingSigned_free
@@ -11879,13 +12263,29 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1sign
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature
   (JNIEnv *, jclass, jlong, jbyteArray);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSigned_get_fee_range
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1range
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSigned_set_fee_range
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1range
+  (JNIEnv *, jclass, jlong, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    ClosingSigned_new
- * Signature: ([BJ[B)J
+ * Signature: ([BJ[BJ)J
  */
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new
-  (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray);
+  (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray, jlong);
 
 /*
  * Class:     org_ldk_impl_bindings
@@ -13895,6 +14295,22 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read
   (JNIEnv *, jclass, jbyteArray);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1write
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ClosingSignedFeeRange_read
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSignedFeeRange_1read
+  (JNIEnv *, jclass, jbyteArray);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    CommitmentSigned_write
@@ -15831,6 +16247,134 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read
   (JNIEnv *, jclass, jbyteArray);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1free
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1clone
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    InvalidShutdownScript_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1free
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    InvalidShutdownScript_get_script
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1get_1script
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    InvalidShutdownScript_set_script
+ * Signature: (J[B)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1set_1script
+  (JNIEnv *, jclass, jlong, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    InvalidShutdownScript_new
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvalidShutdownScript_1new
+  (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1write
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_read
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1read
+  (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_new_p2pkh
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2pkh
+  (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_new_p2sh
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2sh
+  (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_new_p2wpkh
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wpkh
+  (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_new_p2wsh
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1p2wsh
+  (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_new_witness_program
+ * Signature: (B[B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1new_1witness_1program
+  (JNIEnv *, jclass, jbyte, jbyteArray);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_into_inner
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1into_1inner
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_as_legacy_pubkey
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1as_1legacy_1pubkey
+  (JNIEnv *, jclass, jlong);
+
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    ShutdownScript_is_compatible
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible
+  (JNIEnv *, jclass, jlong, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    RouteHop_free
@@ -16167,6 +16711,14 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone
   (JNIEnv *, jclass, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    get_keysend_route
+ * Signature: ([BJ[B[J[JJIJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route
+  (JNIEnv *, jclass, jbyteArray, jlong, jbyteArray, jlongArray, jlongArray, jlong, jint, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    get_route
@@ -17007,6 +17559,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start
   (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong);
 
+/*
+ * Class:     org_ldk_impl_bindings
+ * Method:    BackgroundProcessor_join
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1join
+  (JNIEnv *, jclass, jlong);
+
 /*
  * Class:     org_ldk_impl_bindings
  * Method:    BackgroundProcessor_stop
diff --git a/src/main/jni/org_ldk_impl_bindings_LDKPaymentPurpose.h b/src/main/jni/org_ldk_impl_bindings_LDKPaymentPurpose.h
new file mode 100644 (file)
index 0000000..0d8dc49
--- /dev/null
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKPaymentPurpose */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKPaymentPurpose
+#define _Included_org_ldk_impl_bindings_LDKPaymentPurpose
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     org_ldk_impl_bindings_LDKPaymentPurpose
+ * Method:    init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init
+  (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
index f903c3fbb8b7138227aa5b10146cf970ed50c64f..74cae4f67efc889e2a4e712961968a36f6bf4eea 100644 (file)
@@ -41,7 +41,7 @@ class HumanObjectPeerTestInstance {
             return KeysInterface.new_impl(new KeysInterface.KeysInterfaceInterface() {
                 @Override public byte[] get_node_secret() { return underlying_if.get_node_secret(); }
                 @Override public byte[] get_destination_script() { return underlying_if.get_destination_script(); }
-                @Override public byte[] get_shutdown_pubkey() { return underlying_if.get_shutdown_pubkey(); }
+                @Override public ShutdownScript get_shutdown_scriptpubkey() { return underlying_if.get_shutdown_scriptpubkey(); }
 
                 @Override
                 public Sign get_channel_signer(boolean inbound, long channel_value_satoshis) {
@@ -762,7 +762,8 @@ class HumanObjectPeerTestInstance {
 
         events = state.peer2.get_manager_events(1, state.peer1, state.peer2);
         assert events[0] instanceof Event.PaymentReceived;
-        byte[] payment_preimage = ((Event.PaymentReceived)events[0]).payment_preimage;
+        assert ((Event.PaymentReceived)events[0]).purpose instanceof PaymentPurpose.InvoicePayment;
+        byte[] payment_preimage = ((PaymentPurpose.InvoicePayment)((Event.PaymentReceived)events[0]).purpose).payment_preimage;
         assert !Arrays.equals(payment_preimage, new byte[32]);
         state.peer2.chan_manager.claim_funds(payment_preimage);
 
index a05c899f5e12fa8077e0199c26c08ad18e171274..de96a8bfa0aa223626b15e436d7523cae3b04dbf 100644 (file)
@@ -302,7 +302,9 @@ public class PeerTest {
         assert events.size() == 1;
         bindings.LDKEvent payment_recvd = bindings.LDKEvent_ref_from_ptr(events.get(0));
         assert payment_recvd instanceof bindings.LDKEvent.PaymentReceived;
-        assert bindings.ChannelManager_claim_funds(peer2.chan_manager, ((bindings.LDKEvent.PaymentReceived) payment_recvd).payment_preimage);
+        bindings.LDKPaymentPurpose purpose = bindings.LDKPaymentPurpose_ref_from_ptr(((bindings.LDKEvent.PaymentReceived) payment_recvd).purpose);
+        assert purpose instanceof bindings.LDKPaymentPurpose.InvoicePayment;
+        assert bindings.ChannelManager_claim_funds(peer2.chan_manager, ((bindings.LDKPaymentPurpose.InvoicePayment) purpose).payment_preimage);
         bindings.Event_free(events.remove(0));
 
         deliver_peer_messages(list, peer1.peer_manager, peer2.peer_manager);
index cad8efba6ac42bb6c209e1cb08449e11ddc3ade9..d5fb16587dbaddc754157b94ac58c917f8f9ba2e 100644 (file)
@@ -609,6 +609,48 @@ void  __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_
        CHECK(!val->result_ok);
        return *val->contents.err;
 }
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKInvalidShutdownScript err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 jboolean  __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
        return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
 }
@@ -1501,7 +1543,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L
        if (commitment_tx_var.is_owned) {
                commitment_tx_ref |= 1;
        }
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
        LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1516,7 +1558,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl
        if (commitment_tx_var.is_owned) {
                commitment_tx_ref |= 1;
        }
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
        LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1529,7 +1571,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo
        Transaction_free(justice_tx_var);
        int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
        memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
+       uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1550,7 +1592,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void
        if (htlc_var.is_owned) {
                htlc_ref |= 1;
        }
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
+       uint32_t ret = js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1571,7 +1613,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c
        if (htlc_var.is_owned) {
                htlc_ref |= 1;
        }
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
+       uint32_t ret = js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1582,7 +1624,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void*
        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);
        Transaction_free(closing_tx_var);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1597,7 +1639,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2080,6 +2122,13 @@ uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint
                case LDKAPIError_MonitorUpdateFailed: {
                        return 0 /* LDKAPIError - MonitorUpdateFailed */;
                }
+               case LDKAPIError_IncompatibleShutdownScript: {
+                       LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
+                       CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+                       CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+                       uint64_t script_ref = (uint64_t)script_var.inner & ~1;
+                       return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
+               }
                default: abort();
        }
 }
@@ -2203,6 +2252,22 @@ uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFa
        uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
        return err_ref;
 }
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
+}
+int8_tArray  __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+       memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
+       return res_arr;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
+       return err_ref;
+}
 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
        LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
        switch(obj->tag) {
@@ -2350,7 +2415,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void*
        if (monitor_var.is_owned) {
                monitor_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2371,7 +2436,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void
        if (update_var.is_owned) {
                update_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2516,7 +2581,7 @@ typedef struct LDKKeysInterface_JCalls {
        atomic_size_t refcnt;
        uint32_t get_node_secret_meth;
        uint32_t get_destination_script_meth;
-       uint32_t get_shutdown_pubkey_meth;
+       uint32_t get_shutdown_scriptpubkey_meth;
        uint32_t get_channel_signer_meth;
        uint32_t get_secure_random_bytes_meth;
        uint32_t read_chan_signer_meth;
@@ -2527,7 +2592,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) {
        if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
                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_shutdown_scriptpubkey_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);
@@ -2552,19 +2617,20 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg)
        memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
        return ret_ref;
 }
-LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
+LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
-       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;
+       uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
+       LDKShutdownScript ret_conv;
+       ret_conv.inner = (void*)(ret & (~1));
+       ret_conv.is_owned = (ret & 1) || (ret == 0);
+       ret_conv = ShutdownScript_clone(&ret_conv);
+       return ret_conv;
 }
 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
-       LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
+       uint32_t ret = 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);
+       ret_conv = Sign_clone(&ret_conv);
        return ret_conv;
 }
 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
@@ -2580,7 +2646,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void*
        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_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
+       uint32_t ret = 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*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2591,7 +2657,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v
        int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
        memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
        CVec_u8Z_free(invoice_preimage_var);
-       LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
        LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2609,7 +2675,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Referenc
                .this_arg = (void*) calls,
                .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
                .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
-               .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
+               .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
                .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
                .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
                .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
@@ -2639,11 +2705,16 @@ int8_tArray  __attribute__((visibility("default"))) TS_KeysInterface_get_destina
        return ret_arr;
 }
 
-int8_tArray  __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
+uint32_t  __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
        LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
-       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;
+       LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
 }
 
 uint32_t  __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
@@ -3298,6 +3369,24 @@ static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCV
        }
        return ret;
 }
+uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
+       LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
+       switch(obj->tag) {
+               case LDKPaymentPurpose_InvoicePayment: {
+                       int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+                       memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
+                       int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+                       memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
+                       return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
+               }
+               case LDKPaymentPurpose_SpontaneousPayment: {
+                       int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+                       memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
+                       return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
+               }
+               default: abort();
+       }
+}
 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
        LDKEvent *obj = (LDKEvent*)(ptr & ~1);
        switch(obj->tag) {
@@ -3312,11 +3401,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_
                case LDKEvent_PaymentReceived: {
                        int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
                        memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
-                       int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
-                       memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_received.payment_preimage.data, 32);
-                       int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
-                       memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
-                       return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->payment_received.amt; (void) obj->payment_received.user_payment_id;
+                       uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
+                       return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
                }
                case LDKEvent_PaymentSent: {
                        int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
@@ -3341,6 +3427,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_
                        }
                        return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
                }
+               case LDKEvent_PaymentForwarded: {
+                       uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
+                       return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
+               }
                default: abort();
        }
 }
@@ -4056,6 +4146,27 @@ uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDeco
        uint64_t err_ref = (uint64_t)err_var.inner & ~1;
        return err_ref;
 }
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKClosingSignedFeeRange res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 jboolean  __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
        return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
 }
@@ -4823,7 +4934,7 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons
        LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
        int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
        memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
-       LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+       uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
        LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5097,7 +5208,7 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void
        if (output_var.is_owned) {
                output_ref |= 1;
        }
-       LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)js_invoke_function_1(j_calls->register_output_meth, output_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
        LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
        ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5178,7 +5289,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con
        if (data_var.is_owned) {
                data_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5208,7 +5319,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal
        if (data_var.is_owned) {
                data_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
+       uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5923,7 +6034,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5938,7 +6049,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5953,7 +6064,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6028,7 +6139,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6044,7 +6155,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6060,7 +6171,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6076,7 +6187,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6358,7 +6469,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi
        if (channel_manager_var.is_owned) {
                channel_manager_ref |= 1;
        }
-       LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
        LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6935,6 +7046,67 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
+       LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
+       LDKInvalidShutdownScript e_conv;
+       e_conv.inner = (void*)(e & (~1));
+       e_conv.is_owned = (e & 1) || (e == 0);
+       // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
        LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
        *ret_conv = CResult_NoneErrorZ_ok();
@@ -8069,6 +8241,36 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailu
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
+       LDKThirtyTwoBytes o_ref;
+       CHECK(*((uint32_t*)o) == 32);
+       memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
+       LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) {
+       LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 void  __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
        LDKCVec_NetAddressZ _res_constr;
        _res_constr.datalen = *((uint32_t*)_res);
@@ -9769,6 +9971,40 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeE
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
+       LDKClosingSignedFeeRange o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ClosingSignedFeeRange_clone(&o_conv);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_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_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
        LDKCommitmentSigned o_conv;
        o_conv.inner = (void*)(o & (~1));
@@ -10718,6 +10954,44 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreatio
        return (uint64_t)ret_conv;
 }
 
+void  __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
+       if ((this_ptr & 1) != 0) return;
+       LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
+       FREE((void*)this_ptr);
+       PaymentPurpose_free(this_ptr_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
+       LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_clone(orig_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK(*((uint32_t*)payment_preimage) == 32);
+       memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
+       LDKThirtyTwoBytes payment_secret_ref;
+       CHECK(*((uint32_t*)payment_secret) == 32);
+       memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
+       LDKThirtyTwoBytes a_ref;
+       CHECK(*((uint32_t*)a) == 32);
+       memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 void  __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
@@ -10747,18 +11021,13 @@ uint32_t  __attribute__((visibility("default"))) TS_Event_funding_generation_rea
        return ret_ref;
 }
 
-uint32_t  __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t amt, int64_t user_payment_id) {
+uint32_t  __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
        LDKThirtyTwoBytes payment_hash_ref;
        CHECK(*((uint32_t*)payment_hash) == 32);
        memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
-       LDKThirtyTwoBytes payment_preimage_ref;
-       CHECK(*((uint32_t*)payment_preimage) == 32);
-       memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
-       LDKThirtyTwoBytes payment_secret_ref;
-       CHECK(*((uint32_t*)payment_secret) == 32);
-       memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
+       LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
        LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
-       *ret_copy = Event_payment_received(payment_hash_ref, payment_preimage_ref, payment_secret_ref, amt, user_payment_id);
+       *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
        uint64_t ret_ref = (uint64_t)ret_copy;
        return ret_ref;
 }
@@ -10810,6 +11079,14 @@ uint32_t  __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
+       LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 int8_tArray  __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
        LDKEvent* obj_conv = (LDKEvent*)obj;
        LDKCVec_u8Z ret_var = Event_write(obj_conv);
@@ -11175,6 +11452,17 @@ uint32_t  __attribute__((visibility("default"))) TS_APIError_monitor_update_fail
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
+       LDKShutdownScript script_conv;
+       script_conv.inner = (void*)(script & (~1));
+       script_conv.is_owned = (script & 1) || (script == 0);
+       script_conv = ShutdownScript_clone(&script_conv);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_incompatible_shutdown_script(script_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
        LDKu8slice msg_ref;
        msg_ref.datalen = *((uint32_t*)msg);
@@ -11599,8 +11887,38 @@ void  __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront
        ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
 }
 
-uint32_t  __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
-       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+int64_t  __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
+}
+
+int64_t  __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
+       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -12059,6 +12377,13 @@ uint32_t  __attribute__((visibility("default"))) TS_ConfirmationTarget_high_prio
        return ret_conv;
 }
 
+jboolean  __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
+       LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
+       LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
+       jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
+       return ret_val;
+}
+
 void  __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
@@ -14196,6 +14521,19 @@ uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_close_channel
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       unsigned char channel_id_arr[32];
+       CHECK(*((uint32_t*)channel_id) == 32);
+       memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
+       unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+       LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+       *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -14234,6 +14572,21 @@ uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_send_payment(
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKRoute route_conv;
+       route_conv.inner = (void*)(route & (~1));
+       route_conv.is_owned = false;
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK(*((uint32_t*)payment_preimage) == 32);
+       memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -15790,6 +16143,68 @@ uint32_t  __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig
        return ret_ref;
 }
 
+void  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
+       LDKClosingSignedFeeRange this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ClosingSignedFeeRange_free(this_obj_conv);
+}
+
+int64_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
+}
+
+int64_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
+       LDKClosingSignedFeeRange orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
 void  __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
        LDKClosingSigned this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -15850,14 +16265,43 @@ void  __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint
        ClosingSigned_set_signature(&this_ptr_conv, val_ref);
 }
 
-uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+void  __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange val_conv;
+       val_conv.inner = (void*)(val & (~1));
+       val_conv.is_owned = (val & 1) || (val == 0);
+       val_conv = ClosingSignedFeeRange_clone(&val_conv);
+       ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
        LDKThirtyTwoBytes channel_id_arg_ref;
        CHECK(*((uint32_t*)channel_id_arg) == 32);
        memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
        LDKSignature signature_arg_ref;
        CHECK(*((uint32_t*)signature_arg) == 64);
        memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
-       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
+       LDKClosingSignedFeeRange fee_range_arg_conv;
+       fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
+       fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
+       fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
+       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -18519,6 +18963,26 @@ uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArr
        return (uint64_t)ret_conv;
 }
 
+int8_tArray  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
+       LDKClosingSignedFeeRange obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ClosingSignedFeeRange_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_ClosingSignedFeeRange_read(int8_tArray ser) {
+       LDKu8slice ser_ref;
+       ser_ref.datalen = *((uint32_t*)ser);
+       ser_ref.data = (int8_t*)(ser + 4);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = ClosingSignedFeeRange_read(ser_ref);
+       return (uint64_t)ret_conv;
+}
+
 int8_tArray  __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
        LDKCommitmentSigned obj_conv;
        obj_conv.inner = (void*)(obj & (~1));
@@ -21109,6 +21573,191 @@ uint32_t  __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tA
        return (uint64_t)ret_conv;
 }
 
+void  __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
+       LDKShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ShutdownScript_free(this_obj_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
+       LDKShutdownScript orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+void  __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
+       LDKInvalidShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       InvalidShutdownScript_free(this_obj_conv);
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKu8slice ret_var = InvalidShutdownScript_get_script(&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_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCVec_u8Z val_ref;
+       val_ref.datalen = *((uint32_t*)val);
+       val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
+       memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
+       InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
+       LDKCVec_u8Z script_arg_ref;
+       script_arg_ref.datalen = *((uint32_t*)script_arg);
+       script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
+       memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
+       LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
+       LDKShutdownScript obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ShutdownScript_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_ShutdownScript_read(int8_tArray ser) {
+       LDKu8slice ser_ref;
+       ser_ref.datalen = *((uint32_t*)ser);
+       ser_ref.data = (int8_t*)(ser + 4);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = ShutdownScript_read(ser_ref);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK(*((uint32_t*)pubkey_hash) == 20);
+       memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) {
+       unsigned char script_hash_arr[20];
+       CHECK(*((uint32_t*)script_hash) == 20);
+       memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20);
+       unsigned char (*script_hash_ref)[20] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK(*((uint32_t*)pubkey_hash) == 20);
+       memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
+       unsigned char script_hash_arr[32];
+       CHECK(*((uint32_t*)script_hash) == 32);
+       memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
+       unsigned char (*script_hash_ref)[32] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
+       LDKu8slice program_ref;
+       program_ref.datalen = *((uint32_t*)program);
+       program_ref.data = (int8_t*)(program + 4);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
+       return (uint64_t)ret_conv;
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       this_arg_conv = ShutdownScript_clone(&this_arg_conv);
+       LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
+       int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+       memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+       CVec_u8Z_free(ret_var);
+       return ret_arr;
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+       memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
+       return ret_arr;
+}
+
+jboolean  __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKInitFeatures features_conv;
+       features_conv.inner = (void*)(features & (~1));
+       features_conv.is_owned = false;
+       jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
+       return ret_val;
+}
+
 void  __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
        LDKRouteHop this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -21591,6 +22240,56 @@ uint32_t  __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
+       LDKPublicKey our_node_id_ref;
+       CHECK(*((uint32_t*)our_node_id) == 33);
+       memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
+       LDKNetworkGraph network_conv;
+       network_conv.inner = (void*)(network & (~1));
+       network_conv.is_owned = false;
+       LDKPublicKey payee_ref;
+       CHECK(*((uint32_t*)payee) == 33);
+       memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
+       LDKCVec_ChannelDetailsZ first_hops_constr;
+       LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
+       if (first_hops != 0) {
+               first_hops_constr.datalen = *((uint32_t*)first_hops);
+               if (first_hops_constr.datalen > 0)
+                       first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+               else
+                       first_hops_constr.data = NULL;
+               uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
+               for (size_t q = 0; q < first_hops_constr.datalen; q++) {
+                       uint32_t first_hops_conv_16 = first_hops_vals[q];
+                       LDKChannelDetails first_hops_conv_16_conv;
+                       first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
+                       first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
+                       first_hops_constr.data[q] = first_hops_conv_16_conv;
+               }
+               first_hops_ptr = &first_hops_constr;
+       }
+       LDKCVec_RouteHintZ last_hops_constr;
+       last_hops_constr.datalen = *((uint32_t*)last_hops);
+       if (last_hops_constr.datalen > 0)
+               last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
+       else
+               last_hops_constr.data = NULL;
+       uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
+       for (size_t l = 0; l < last_hops_constr.datalen; l++) {
+               uint32_t last_hops_conv_11 = last_hops_vals[l];
+               LDKRouteHint last_hops_conv_11_conv;
+               last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
+               last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
+               last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
+               last_hops_constr.data[l] = last_hops_conv_11_conv;
+       }
+       LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+       LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+       *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
+       if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
        LDKPublicKey our_node_id_ref;
        CHECK(*((uint32_t*)our_node_id) == 33);
@@ -22860,6 +23559,16 @@ uint32_t  __attribute__((visibility("default"))) TS_BackgroundProcessor_start(ui
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
+       LDKBackgroundProcessor this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
+       LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
+       *ret_conv = BackgroundProcessor_join(this_arg_conv);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
        LDKBackgroundProcessor this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
index d304be50a76fb212a86262cfc26d3a9dae6ba222..90ea56c0052200bbb6fb00dfd186eca908e03efa 100644 (file)
@@ -607,6 +607,48 @@ void  __attribute__((visibility("default"))) TS_LDKCResult_CVec_SignatureZNoneZ_
        CHECK(!val->result_ok);
        return *val->contents.err;
 }
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_ShutdownScriptDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(uint32_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptDecodeErrorZ_get_err(uint32_t arg) {
+       LDKCResult_ShutdownScriptDecodeErrorZ *val = (LDKCResult_ShutdownScriptDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)arg)->result_ok;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(uint32_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKShutdownScript res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(uint32_t arg) {
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ *val = (LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKInvalidShutdownScript err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 jboolean  __attribute__((visibility("default"))) TS_LDKCResult_NoneErrorZ_result_ok(uint32_t arg) {
        return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
 }
@@ -1499,7 +1541,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L
        if (commitment_tx_var.is_owned) {
                commitment_tx_ref |= 1;
        }
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
        LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1514,7 +1556,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl
        if (commitment_tx_var.is_owned) {
                commitment_tx_ref |= 1;
        }
-       LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
        LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1527,7 +1569,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo
        Transaction_free(justice_tx_var);
        int8_tArray per_commitment_key_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
        memcpy((uint8_t*)(per_commitment_key_arr + 4), *per_commitment_key, 32);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
+       uint32_t ret = js_invoke_function_4(j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1548,7 +1590,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void
        if (htlc_var.is_owned) {
                htlc_ref |= 1;
        }
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
+       uint32_t ret = js_invoke_function_5(j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1569,7 +1611,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c
        if (htlc_var.is_owned) {
                htlc_ref |= 1;
        }
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
+       uint32_t ret = js_invoke_function_5(j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1580,7 +1622,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void*
        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);
        Transaction_free(closing_tx_var);
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -1595,7 +1637,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_channel_announcement_meth, msg_ref);
        LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2078,6 +2120,13 @@ uint32_t __attribute__((visibility("default"))) TS_LDKAPIError_ref_from_ptr(uint
                case LDKAPIError_MonitorUpdateFailed: {
                        return 0 /* LDKAPIError - MonitorUpdateFailed */;
                }
+               case LDKAPIError_IncompatibleShutdownScript: {
+                       LDKShutdownScript script_var = obj->incompatible_shutdown_script.script;
+                       CHECK((((uint64_t)script_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+                       CHECK((((uint64_t)&script_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+                       uint64_t script_ref = (uint64_t)script_var.inner & ~1;
+                       return 0 /* LDKAPIError - IncompatibleShutdownScript */; (void) script_ref;
+               }
                default: abort();
        }
 }
@@ -2201,6 +2250,22 @@ uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_NonePaymentSendFa
        uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
        return err_ref;
 }
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
+}
+int8_tArray  __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(uint32_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+       memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32);
+       return res_arr;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_PaymentHashPaymentSendFailureZ_get_err(uint32_t arg) {
+       LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
+       return err_ref;
+}
 uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(uint32_t ptr) {
        LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
        switch(obj->tag) {
@@ -2348,7 +2413,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void*
        if (monitor_var.is_owned) {
                monitor_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2369,7 +2434,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void
        if (update_var.is_owned) {
                update_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->update_channel_meth, funding_txo_ref, update_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2514,7 +2579,7 @@ typedef struct LDKKeysInterface_JCalls {
        atomic_size_t refcnt;
        uint32_t get_node_secret_meth;
        uint32_t get_destination_script_meth;
-       uint32_t get_shutdown_pubkey_meth;
+       uint32_t get_shutdown_scriptpubkey_meth;
        uint32_t get_channel_signer_meth;
        uint32_t get_secure_random_bytes_meth;
        uint32_t read_chan_signer_meth;
@@ -2525,7 +2590,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) {
        if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
                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_shutdown_scriptpubkey_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);
@@ -2550,19 +2615,20 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg)
        memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
        return ret_ref;
 }
-LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
+LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
-       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;
+       uint32_t ret = js_invoke_function_0(j_calls->get_shutdown_scriptpubkey_meth);
+       LDKShutdownScript ret_conv;
+       ret_conv.inner = (void*)(ret & (~1));
+       ret_conv.is_owned = (ret & 1) || (ret == 0);
+       ret_conv = ShutdownScript_clone(&ret_conv);
+       return ret_conv;
 }
 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
        LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
-       LDKSign* ret = (LDKSign*)js_invoke_function_2(j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
+       uint32_t ret = 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);
+       ret_conv = Sign_clone(&ret_conv);
        return ret_conv;
 }
 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
@@ -2578,7 +2644,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void*
        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_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)js_invoke_function_1(j_calls->read_chan_signer_meth, reader_arr);
+       uint32_t ret = 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*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2589,7 +2655,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v
        int8_tArray invoice_preimage_arr = init_arr(invoice_preimage_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
        memcpy((uint8_t*)(invoice_preimage_arr + 4), invoice_preimage_var.data, invoice_preimage_var.datalen);
        CVec_u8Z_free(invoice_preimage_var);
-       LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
+       uint32_t ret = js_invoke_function_1(j_calls->sign_invoice_meth, invoice_preimage_arr);
        LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -2607,7 +2673,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Referenc
                .this_arg = (void*) calls,
                .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
                .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
-               .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
+               .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall,
                .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
                .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
                .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
@@ -2637,11 +2703,16 @@ int8_tArray  __attribute__((visibility("default"))) TS_KeysInterface_get_destina
        return ret_arr;
 }
 
-int8_tArray  __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_pubkey(uint32_t this_arg) {
+uint32_t  __attribute__((visibility("default"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint32_t this_arg) {
        LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
-       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;
+       LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(this_arg_conv->this_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
 }
 
 uint32_t  __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
@@ -3296,6 +3367,24 @@ static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCV
        }
        return ret;
 }
+uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_ptr(uint32_t ptr) {
+       LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
+       switch(obj->tag) {
+               case LDKPaymentPurpose_InvoicePayment: {
+                       int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+                       memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32);
+                       int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+                       memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32);
+                       return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id;
+               }
+               case LDKPaymentPurpose_SpontaneousPayment: {
+                       int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+                       memcpy((uint8_t*)(spontaneous_payment_arr + 4), obj->spontaneous_payment.data, 32);
+                       return 0 /* LDKPaymentPurpose - SpontaneousPayment */; (void) spontaneous_payment_arr;
+               }
+               default: abort();
+       }
+}
 uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
        LDKEvent *obj = (LDKEvent*)(ptr & ~1);
        switch(obj->tag) {
@@ -3310,11 +3399,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_
                case LDKEvent_PaymentReceived: {
                        int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
                        memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_received.payment_hash.data, 32);
-                       int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
-                       memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_received.payment_preimage.data, 32);
-                       int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
-                       memcpy((uint8_t*)(payment_secret_arr + 4), obj->payment_received.payment_secret.data, 32);
-                       return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->payment_received.amt; (void) obj->payment_received.user_payment_id;
+                       uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
+                       return 0 /* LDKEvent - PaymentReceived */; (void) payment_hash_arr; (void) obj->payment_received.amt; (void) purpose_ref;
                }
                case LDKEvent_PaymentSent: {
                        int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
@@ -3339,6 +3425,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_
                        }
                        return 0 /* LDKEvent - SpendableOutputs */; (void) outputs_arr;
                }
+               case LDKEvent_PaymentForwarded: {
+                       uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
+                       return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
+               }
                default: abort();
        }
 }
@@ -4054,6 +4144,27 @@ uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedDeco
        uint64_t err_ref = (uint64_t)err_var.inner & ~1;
        return err_ref;
 }
+jboolean  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(uint32_t arg) {
+       return ((LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint32_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(val->result_ok);
+       LDKClosingSignedFeeRange res_var = (*val->contents.result);
+       CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+       return res_ref;
+}
+uint32_t  __attribute__((visibility("default"))) TS_LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint32_t arg) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *val = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(arg & ~1);
+       CHECK(!val->result_ok);
+       LDKDecodeError err_var = (*val->contents.err);
+       CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+       return err_ref;
+}
 jboolean  __attribute__((visibility("default"))) TS_LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(uint32_t arg) {
        return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
 }
@@ -4821,7 +4932,7 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons
        LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
        int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
        memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
-       LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+       uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
        LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5095,7 +5206,7 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void
        if (output_var.is_owned) {
                output_ref |= 1;
        }
-       LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)js_invoke_function_1(j_calls->register_output_meth, output_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
        LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
        ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5176,7 +5287,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con
        if (data_var.is_owned) {
                data_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5206,7 +5317,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal
        if (data_var.is_owned) {
                data_ref |= 1;
        }
-       LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
+       uint32_t ret = js_invoke_function_3(j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
        LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5921,7 +6032,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->handle_node_announcement_meth, msg_ref);
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5936,7 +6047,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->handle_channel_announcement_meth, msg_ref);
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -5951,7 +6062,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->handle_channel_update_meth, msg_ref);
        LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6026,7 +6137,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6042,7 +6153,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6058,7 +6169,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6074,7 +6185,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH
        if (msg_var.is_owned) {
                msg_ref |= 1;
        }
-       LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
+       uint32_t ret = js_invoke_function_2(j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
        LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6356,7 +6467,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi
        if (channel_manager_var.is_owned) {
                channel_manager_ref |= 1;
        }
-       LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
+       uint32_t ret = js_invoke_function_1(j_calls->persist_manager_meth, channel_manager_ref);
        LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
        ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
        return ret_conv;
@@ -6933,6 +7044,67 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_CVec_SignatureZNoneZ
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_ok(uint32_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_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_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptDecodeErrorZ _res_conv = *(LDKCResult_ShutdownScriptDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptDecodeErrorZ_free(_res_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptDecodeErrorZ_clone(uint32_t orig) {
+       LDKCResult_ShutdownScriptDecodeErrorZ* orig_conv = (LDKCResult_ShutdownScriptDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = CResult_ShutdownScriptDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_ok(uint32_t o) {
+       LDKShutdownScript o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ShutdownScript_clone(&o_conv);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_err(uint32_t e) {
+       LDKInvalidShutdownScript e_conv;
+       e_conv.inner = (void*)(e & (~1));
+       e_conv.is_owned = (e & 1) || (e == 0);
+       // Warning: we need a move here but no clone is available for LDKInvalidShutdownScript
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = CResult_ShutdownScriptInvalidShutdownScriptZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_ShutdownScriptInvalidShutdownScriptZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res_conv = *(LDKCResult_ShutdownScriptInvalidShutdownScriptZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res_conv);
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_CResult_NoneErrorZ_ok() {
        LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
        *ret_conv = CResult_NoneErrorZ_ok();
@@ -8067,6 +8239,36 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailu
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) {
+       LDKThirtyTwoBytes o_ref;
+       CHECK(*((uint32_t*)o) == 32);
+       memcpy(o_ref.data, (uint8_t*)(o + 4), 32);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
+       LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint32_t orig) {
+       LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 void  __attribute__((visibility("default"))) TS_CVec_NetAddressZ_free(uint32_tArray _res) {
        LDKCVec_NetAddressZ _res_constr;
        _res_constr.datalen = *((uint32_t*)_res);
@@ -9767,6 +9969,40 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedDecodeE
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(uint32_t o) {
+       LDKClosingSignedFeeRange o_conv;
+       o_conv.inner = (void*)(o & (~1));
+       o_conv.is_owned = (o & 1) || (o == 0);
+       o_conv = ClosingSignedFeeRange_clone(&o_conv);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o_conv);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_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_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e_conv);
+       return (uint64_t)ret_conv;
+}
+
+void  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_free(uint32_t _res) {
+       if ((_res & 1) != 0) return;
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
+       FREE((void*)_res);
+       CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(uint32_t orig) {
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)(orig & ~1);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig_conv);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_CResult_CommitmentSignedDecodeErrorZ_ok(uint32_t o) {
        LDKCommitmentSigned o_conv;
        o_conv.inner = (void*)(o & (~1));
@@ -10716,6 +10952,44 @@ uint32_t  __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreatio
        return (uint64_t)ret_conv;
 }
 
+void  __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
+       if ((this_ptr & 1) != 0) return;
+       LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
+       FREE((void*)this_ptr);
+       PaymentPurpose_free(this_ptr_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_t orig) {
+       LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_clone(orig_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) {
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK(*((uint32_t*)payment_preimage) == 32);
+       memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
+       LDKThirtyTwoBytes payment_secret_ref;
+       CHECK(*((uint32_t*)payment_secret) == 32);
+       memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_PaymentPurpose_spontaneous_payment(int8_tArray a) {
+       LDKThirtyTwoBytes a_ref;
+       CHECK(*((uint32_t*)a) == 32);
+       memcpy(a_ref.data, (uint8_t*)(a + 4), 32);
+       LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
+       *ret_copy = PaymentPurpose_spontaneous_payment(a_ref);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 void  __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
@@ -10745,18 +11019,13 @@ uint32_t  __attribute__((visibility("default"))) TS_Event_funding_generation_rea
        return ret_ref;
 }
 
-uint32_t  __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t amt, int64_t user_payment_id) {
+uint32_t  __attribute__((visibility("default"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amt, uint32_t purpose) {
        LDKThirtyTwoBytes payment_hash_ref;
        CHECK(*((uint32_t*)payment_hash) == 32);
        memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
-       LDKThirtyTwoBytes payment_preimage_ref;
-       CHECK(*((uint32_t*)payment_preimage) == 32);
-       memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
-       LDKThirtyTwoBytes payment_secret_ref;
-       CHECK(*((uint32_t*)payment_secret) == 32);
-       memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32);
+       LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
        LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
-       *ret_copy = Event_payment_received(payment_hash_ref, payment_preimage_ref, payment_secret_ref, amt, user_payment_id);
+       *ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
        uint64_t ret_ref = (uint64_t)ret_copy;
        return ret_ref;
 }
@@ -10808,6 +11077,14 @@ uint32_t  __attribute__((visibility("default"))) TS_Event_spendable_outputs(uint
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
+       LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+       LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+       *ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 int8_tArray  __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
        LDKEvent* obj_conv = (LDKEvent*)obj;
        LDKCVec_u8Z ret_var = Event_write(obj_conv);
@@ -11173,6 +11450,17 @@ uint32_t  __attribute__((visibility("default"))) TS_APIError_monitor_update_fail
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_APIError_incompatible_shutdown_script(uint32_t script) {
+       LDKShutdownScript script_conv;
+       script_conv.inner = (void*)(script & (~1));
+       script_conv.is_owned = (script & 1) || (script == 0);
+       script_conv = ShutdownScript_clone(&script_conv);
+       LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
+       *ret_copy = APIError_incompatible_shutdown_script(script_conv);
+       uint64_t ret_ref = (uint64_t)ret_copy;
+       return ret_ref;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_sign(int8_tArray msg, int8_tArray sk) {
        LDKu8slice msg_ref;
        msg_ref.datalen = *((uint32_t*)msg);
@@ -11597,8 +11885,38 @@ void  __attribute__((visibility("default"))) TS_ChannelConfig_set_commit_upfront
        ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
 }
 
-uint32_t  __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
-       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+int64_t  __attribute__((visibility("default"))) TS_ChannelConfig_get_max_dust_htlc_exposure_msat(uint32_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_max_dust_htlc_exposure_msat(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ChannelConfig_set_max_dust_htlc_exposure_msat(uint32_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_max_dust_htlc_exposure_msat(&this_ptr_conv, val);
+}
+
+int64_t  __attribute__((visibility("default"))) TS_ChannelConfig_get_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ChannelConfig_get_force_close_avoidance_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ChannelConfig_set_force_close_avoidance_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
+       LDKChannelConfig this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ChannelConfig_set_force_close_avoidance_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ChannelConfig_new(int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg, int64_t max_dust_htlc_exposure_msat_arg, int64_t force_close_avoidance_max_fee_satoshis_arg) {
+       LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -12057,6 +12375,13 @@ uint32_t  __attribute__((visibility("default"))) TS_ConfirmationTarget_high_prio
        return ret_conv;
 }
 
+jboolean  __attribute__((visibility("default"))) TS_ConfirmationTarget_eq(uint32_t a, uint32_t b) {
+       LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)(a & ~1);
+       LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)(b & ~1);
+       jboolean ret_val = ConfirmationTarget_eq(a_conv, b_conv);
+       return ret_val;
+}
+
 void  __attribute__((visibility("default"))) TS_FeeEstimator_free(uint32_t this_ptr) {
        if ((this_ptr & 1) != 0) return;
        LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
@@ -14194,6 +14519,19 @@ uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_close_channel
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_close_channel_with_target_feerate(uint32_t this_arg, int8_tArray channel_id, int32_t target_feerate_sats_per_1000_weight) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       unsigned char channel_id_arr[32];
+       CHECK(*((uint32_t*)channel_id) == 32);
+       memcpy(channel_id_arr, (uint8_t*)(channel_id + 4), 32);
+       unsigned char (*channel_id_ref)[32] = &channel_id_arr;
+       LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
+       *ret_conv = ChannelManager_close_channel_with_target_feerate(&this_arg_conv, channel_id_ref, target_feerate_sats_per_1000_weight);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_force_close_channel(uint32_t this_arg, int8_tArray channel_id) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -14232,6 +14570,21 @@ uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_send_payment(
        return (uint64_t)ret_conv;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) {
+       LDKChannelManager this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKRoute route_conv;
+       route_conv.inner = (void*)(route & (~1));
+       route_conv.is_owned = false;
+       LDKThirtyTwoBytes payment_preimage_ref;
+       CHECK(*((uint32_t*)payment_preimage) == 32);
+       memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32);
+       LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
+       *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_ChannelManager_funding_transaction_generated(uint32_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
        LDKChannelManager this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
@@ -15788,6 +16141,68 @@ uint32_t  __attribute__((visibility("default"))) TS_Shutdown_clone(uint32_t orig
        return ret_ref;
 }
 
+void  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_free(uint32_t this_obj) {
+       LDKClosingSignedFeeRange this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ClosingSignedFeeRange_free(this_obj_conv);
+}
+
+int64_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_min_fee_satoshis(uint32_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_min_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_min_fee_satoshis(uint32_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_min_fee_satoshis(&this_ptr_conv, val);
+}
+
+int64_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_get_max_fee_satoshis(uint32_t this_ptr) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       int64_t ret_val = ClosingSignedFeeRange_get_max_fee_satoshis(&this_ptr_conv);
+       return ret_val;
+}
+
+void  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_set_max_fee_satoshis(uint32_t this_ptr, int64_t val) {
+       LDKClosingSignedFeeRange this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       ClosingSignedFeeRange_set_max_fee_satoshis(&this_ptr_conv, val);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_new(int64_t min_fee_satoshis_arg, int64_t max_fee_satoshis_arg) {
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_clone(uint32_t orig) {
+       LDKClosingSignedFeeRange orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSignedFeeRange_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
 void  __attribute__((visibility("default"))) TS_ClosingSigned_free(uint32_t this_obj) {
        LDKClosingSigned this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -15848,14 +16263,43 @@ void  __attribute__((visibility("default"))) TS_ClosingSigned_set_signature(uint
        ClosingSigned_set_signature(&this_ptr_conv, val_ref);
 }
 
-uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_get_fee_range(uint32_t this_ptr) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange ret_var = ClosingSigned_get_fee_range(&this_ptr_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+void  __attribute__((visibility("default"))) TS_ClosingSigned_set_fee_range(uint32_t this_ptr, uint32_t val) {
+       LDKClosingSigned this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKClosingSignedFeeRange val_conv;
+       val_conv.inner = (void*)(val & (~1));
+       val_conv.is_owned = (val & 1) || (val == 0);
+       val_conv = ClosingSignedFeeRange_clone(&val_conv);
+       ClosingSigned_set_fee_range(&this_ptr_conv, val_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_new(int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg, uint32_t fee_range_arg) {
        LDKThirtyTwoBytes channel_id_arg_ref;
        CHECK(*((uint32_t*)channel_id_arg) == 32);
        memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32);
        LDKSignature signature_arg_ref;
        CHECK(*((uint32_t*)signature_arg) == 64);
        memcpy(signature_arg_ref.compact_form, (uint8_t*)(signature_arg + 4), 64);
-       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
+       LDKClosingSignedFeeRange fee_range_arg_conv;
+       fee_range_arg_conv.inner = (void*)(fee_range_arg & (~1));
+       fee_range_arg_conv.is_owned = (fee_range_arg & 1) || (fee_range_arg == 0);
+       fee_range_arg_conv = ClosingSignedFeeRange_clone(&fee_range_arg_conv);
+       LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref, fee_range_arg_conv);
        CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
        CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
        uint64_t ret_ref = (uint64_t)ret_var.inner;
@@ -18517,6 +18961,26 @@ uint32_t  __attribute__((visibility("default"))) TS_ClosingSigned_read(int8_tArr
        return (uint64_t)ret_conv;
 }
 
+int8_tArray  __attribute__((visibility("default"))) TS_ClosingSignedFeeRange_write(uint32_t obj) {
+       LDKClosingSignedFeeRange obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ClosingSignedFeeRange_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_ClosingSignedFeeRange_read(int8_tArray ser) {
+       LDKu8slice ser_ref;
+       ser_ref.datalen = *((uint32_t*)ser);
+       ser_ref.data = (int8_t*)(ser + 4);
+       LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ), "LDKCResult_ClosingSignedFeeRangeDecodeErrorZ");
+       *ret_conv = ClosingSignedFeeRange_read(ser_ref);
+       return (uint64_t)ret_conv;
+}
+
 int8_tArray  __attribute__((visibility("default"))) TS_CommitmentSigned_write(uint32_t obj) {
        LDKCommitmentSigned obj_conv;
        obj_conv.inner = (void*)(obj & (~1));
@@ -21107,6 +21571,191 @@ uint32_t  __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tA
        return (uint64_t)ret_conv;
 }
 
+void  __attribute__((visibility("default"))) TS_ShutdownScript_free(uint32_t this_obj) {
+       LDKShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       ShutdownScript_free(this_obj_conv);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_clone(uint32_t orig) {
+       LDKShutdownScript orig_conv;
+       orig_conv.inner = (void*)(orig & (~1));
+       orig_conv.is_owned = false;
+       LDKShutdownScript ret_var = ShutdownScript_clone(&orig_conv);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+void  __attribute__((visibility("default"))) TS_InvalidShutdownScript_free(uint32_t this_obj) {
+       LDKInvalidShutdownScript this_obj_conv;
+       this_obj_conv.inner = (void*)(this_obj & (~1));
+       this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+       InvalidShutdownScript_free(this_obj_conv);
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_InvalidShutdownScript_get_script(uint32_t this_ptr) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKu8slice ret_var = InvalidShutdownScript_get_script(&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_InvalidShutdownScript_set_script(uint32_t this_ptr, int8_tArray val) {
+       LDKInvalidShutdownScript this_ptr_conv;
+       this_ptr_conv.inner = (void*)(this_ptr & (~1));
+       this_ptr_conv.is_owned = false;
+       LDKCVec_u8Z val_ref;
+       val_ref.datalen = *((uint32_t*)val);
+       val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
+       memcpy(val_ref.data, (uint8_t*)(val + 4), val_ref.datalen);
+       InvalidShutdownScript_set_script(&this_ptr_conv, val_ref);
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_InvalidShutdownScript_new(int8_tArray script_arg) {
+       LDKCVec_u8Z script_arg_ref;
+       script_arg_ref.datalen = *((uint32_t*)script_arg);
+       script_arg_ref.data = MALLOC(script_arg_ref.datalen, "LDKCVec_u8Z Bytes");
+       memcpy(script_arg_ref.data, (uint8_t*)(script_arg + 4), script_arg_ref.datalen);
+       LDKInvalidShutdownScript ret_var = InvalidShutdownScript_new(script_arg_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_ShutdownScript_write(uint32_t obj) {
+       LDKShutdownScript obj_conv;
+       obj_conv.inner = (void*)(obj & (~1));
+       obj_conv.is_owned = false;
+       LDKCVec_u8Z ret_var = ShutdownScript_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_ShutdownScript_read(int8_tArray ser) {
+       LDKu8slice ser_ref;
+       ser_ref.datalen = *((uint32_t*)ser);
+       ser_ref.data = (int8_t*)(ser + 4);
+       LDKCResult_ShutdownScriptDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptDecodeErrorZ), "LDKCResult_ShutdownScriptDecodeErrorZ");
+       *ret_conv = ShutdownScript_read(ser_ref);
+       return (uint64_t)ret_conv;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2pkh(int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK(*((uint32_t*)pubkey_hash) == 20);
+       memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2pkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2sh(int8_tArray script_hash) {
+       unsigned char script_hash_arr[20];
+       CHECK(*((uint32_t*)script_hash) == 20);
+       memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 20);
+       unsigned char (*script_hash_ref)[20] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2sh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) {
+       unsigned char pubkey_hash_arr[20];
+       CHECK(*((uint32_t*)pubkey_hash) == 20);
+       memcpy(pubkey_hash_arr, (uint8_t*)(pubkey_hash + 4), 20);
+       unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) {
+       unsigned char script_hash_arr[32];
+       CHECK(*((uint32_t*)script_hash) == 32);
+       memcpy(script_hash_arr, (uint8_t*)(script_hash + 4), 32);
+       unsigned char (*script_hash_ref)[32] = &script_hash_arr;
+       LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref);
+       CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+       CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+       uint64_t ret_ref = (uint64_t)ret_var.inner;
+       if (ret_var.is_owned) {
+               ret_ref |= 1;
+       }
+       return ret_ref;
+}
+
+uint32_t  __attribute__((visibility("default"))) TS_ShutdownScript_new_witness_program(int8_t version, int8_tArray program) {
+       LDKu8slice program_ref;
+       program_ref.datalen = *((uint32_t*)program);
+       program_ref.data = (int8_t*)(program + 4);
+       LDKCResult_ShutdownScriptInvalidShutdownScriptZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ), "LDKCResult_ShutdownScriptInvalidShutdownScriptZ");
+       *ret_conv = ShutdownScript_new_witness_program(version, program_ref);
+       return (uint64_t)ret_conv;
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_ShutdownScript_into_inner(uint32_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       this_arg_conv = ShutdownScript_clone(&this_arg_conv);
+       LDKCVec_u8Z ret_var = ShutdownScript_into_inner(this_arg_conv);
+       int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+       memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+       CVec_u8Z_free(ret_var);
+       return ret_arr;
+}
+
+int8_tArray  __attribute__((visibility("default"))) TS_ShutdownScript_as_legacy_pubkey(uint32_t this_arg) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+       memcpy((uint8_t*)(ret_arr + 4), ShutdownScript_as_legacy_pubkey(&this_arg_conv).compressed_form, 33);
+       return ret_arr;
+}
+
+jboolean  __attribute__((visibility("default"))) TS_ShutdownScript_is_compatible(uint32_t this_arg, uint32_t features) {
+       LDKShutdownScript this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = false;
+       LDKInitFeatures features_conv;
+       features_conv.inner = (void*)(features & (~1));
+       features_conv.is_owned = false;
+       jboolean ret_val = ShutdownScript_is_compatible(&this_arg_conv, &features_conv);
+       return ret_val;
+}
+
 void  __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
        LDKRouteHop this_obj_conv;
        this_obj_conv.inner = (void*)(this_obj & (~1));
@@ -21589,6 +22238,56 @@ uint32_t  __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
+       LDKPublicKey our_node_id_ref;
+       CHECK(*((uint32_t*)our_node_id) == 33);
+       memcpy(our_node_id_ref.compressed_form, (uint8_t*)(our_node_id + 4), 33);
+       LDKNetworkGraph network_conv;
+       network_conv.inner = (void*)(network & (~1));
+       network_conv.is_owned = false;
+       LDKPublicKey payee_ref;
+       CHECK(*((uint32_t*)payee) == 33);
+       memcpy(payee_ref.compressed_form, (uint8_t*)(payee + 4), 33);
+       LDKCVec_ChannelDetailsZ first_hops_constr;
+       LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL;
+       if (first_hops != 0) {
+               first_hops_constr.datalen = *((uint32_t*)first_hops);
+               if (first_hops_constr.datalen > 0)
+                       first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+               else
+                       first_hops_constr.data = NULL;
+               uint32_t* first_hops_vals = (uint32_t*)(first_hops + 4);
+               for (size_t q = 0; q < first_hops_constr.datalen; q++) {
+                       uint32_t first_hops_conv_16 = first_hops_vals[q];
+                       LDKChannelDetails first_hops_conv_16_conv;
+                       first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
+                       first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
+                       first_hops_constr.data[q] = first_hops_conv_16_conv;
+               }
+               first_hops_ptr = &first_hops_constr;
+       }
+       LDKCVec_RouteHintZ last_hops_constr;
+       last_hops_constr.datalen = *((uint32_t*)last_hops);
+       if (last_hops_constr.datalen > 0)
+               last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
+       else
+               last_hops_constr.data = NULL;
+       uint32_t* last_hops_vals = (uint32_t*)(last_hops + 4);
+       for (size_t l = 0; l < last_hops_constr.datalen; l++) {
+               uint32_t last_hops_conv_11 = last_hops_vals[l];
+               LDKRouteHint last_hops_conv_11_conv;
+               last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
+               last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
+               last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
+               last_hops_constr.data[l] = last_hops_conv_11_conv;
+       }
+       LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+       LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
+       *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, first_hops_ptr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
+       if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); }
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_get_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_t payee_features, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
        LDKPublicKey our_node_id_ref;
        CHECK(*((uint32_t*)our_node_id) == 33);
@@ -22858,6 +23557,16 @@ uint32_t  __attribute__((visibility("default"))) TS_BackgroundProcessor_start(ui
        return ret_ref;
 }
 
+uint32_t  __attribute__((visibility("default"))) TS_BackgroundProcessor_join(uint32_t this_arg) {
+       LDKBackgroundProcessor this_arg_conv;
+       this_arg_conv.inner = (void*)(this_arg & (~1));
+       this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
+       // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
+       LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
+       *ret_conv = BackgroundProcessor_join(this_arg_conv);
+       return (uint64_t)ret_conv;
+}
+
 uint32_t  __attribute__((visibility("default"))) TS_BackgroundProcessor_stop(uint32_t this_arg) {
        LDKBackgroundProcessor this_arg_conv;
        this_arg_conv.inner = (void*)(this_arg & (~1));
index 615aad462119f18fa5ccfc1036271cad5c98e0b9..d936b46e0b74b4819deaafec1c19f8c4b576fd86 100644 (file)
@@ -220,6 +220,12 @@ public static native long new_empty_slice_vec();
        public static native boolean LDKCResult_CVec_SignatureZNoneZ_result_ok(long arg);
        public static native Uint8Array[] LDKCResult_CVec_SignatureZNoneZ_get_ok(long arg);
        public static native void LDKCResult_CVec_SignatureZNoneZ_get_err(long arg);
+       public static native boolean LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(long arg);
+       public static native number LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(long arg);
+       public static native number LDKCResult_ShutdownScriptDecodeErrorZ_get_err(long arg);
+       public static native boolean LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(long arg);
+       public static native number LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(long arg);
+       public static native number LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(long arg);
        public static native boolean LDKCResult_NoneErrorZ_result_ok(long arg);
        public static native void LDKCResult_NoneErrorZ_get_ok(long arg);
        public static native IOError LDKCResult_NoneErrorZ_get_err(long arg);
@@ -685,6 +691,10 @@ public static native long new_empty_slice_vec();
                export class MonitorUpdateFailed extends LDKAPIError {
                        MonitorUpdateFailed() { }
                }
+               export class IncompatibleShutdownScript extends LDKAPIError {
+                       public number script;
+                       IncompatibleShutdownScript(number script) { this.script = script; }
+               }
                static native void init();
        }
        static { LDKAPIError.init(); }
@@ -719,6 +729,9 @@ public static native long new_empty_slice_vec();
        public static native boolean LDKCResult_NonePaymentSendFailureZ_result_ok(long arg);
        public static native void LDKCResult_NonePaymentSendFailureZ_get_ok(long arg);
        public static native number LDKCResult_NonePaymentSendFailureZ_get_err(long arg);
+       public static native boolean LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(long arg);
+       public static native Uint8Array LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(long arg);
+       public static native number LDKCResult_PaymentHashPaymentSendFailureZ_get_err(long arg);
        public static class LDKNetAddress {
                private LDKNetAddress() {}
                export class IPv4 extends LDKNetAddress {
@@ -829,7 +842,7 @@ public static native long new_empty_slice_vec();
                export interface LDKKeysInterface {
                        get_node_secret (): Uint8Array;
                        get_destination_script (): Uint8Array;
-                       get_shutdown_pubkey (): Uint8Array;
+                       get_shutdown_scriptpubkey (): number;
                        get_channel_signer (inbound: boolean, channel_value_satoshis: number): number;
                        get_secure_random_bytes (): Uint8Array;
                        read_chan_signer (reader: Uint8Array): number;
@@ -859,13 +872,13 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.KeysInterface_get_destination_script(this_arg);
                return decodeArray(nativeResponseValue);
        }
-       // LDKPublicKey KeysInterface_get_shutdown_pubkey LDKKeysInterface *NONNULL_PTR this_arg
-       export function KeysInterface_get_shutdown_pubkey(this_arg: number): Uint8Array {
+       // LDKShutdownScript KeysInterface_get_shutdown_scriptpubkey LDKKeysInterface *NONNULL_PTR this_arg
+       export function KeysInterface_get_shutdown_scriptpubkey(this_arg: number): number {
                if(!isWasmInitialized) {
                        throw new Error("initializeWasm() must be awaited first!");
                }
-               const nativeResponseValue = wasm.KeysInterface_get_shutdown_pubkey(this_arg);
-               return decodeArray(nativeResponseValue);
+               const nativeResponseValue = wasm.KeysInterface_get_shutdown_scriptpubkey(this_arg);
+               return nativeResponseValue;
        }
        // LDKSign KeysInterface_get_channel_signer LDKKeysInterface *NONNULL_PTR 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 {
@@ -1009,6 +1022,22 @@ public static native long new_empty_slice_vec();
        public static native Uint8Array LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(long ptr);
        public static native number[] LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(long ptr);
        public static native long LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_new(number[] elems);
+       public static class LDKPaymentPurpose {
+               private LDKPaymentPurpose() {}
+               export class InvoicePayment extends LDKPaymentPurpose {
+                       public Uint8Array payment_preimage;
+                       public Uint8Array payment_secret;
+                       public number user_payment_id;
+                       InvoicePayment(Uint8Array payment_preimage, Uint8Array payment_secret, number user_payment_id) { this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; this.user_payment_id = user_payment_id; }
+               }
+               export class SpontaneousPayment extends LDKPaymentPurpose {
+                       public Uint8Array spontaneous_payment;
+                       SpontaneousPayment(Uint8Array spontaneous_payment) { this.spontaneous_payment = spontaneous_payment; }
+               }
+               static native void init();
+       }
+       static { LDKPaymentPurpose.init(); }
+       public static native LDKPaymentPurpose LDKPaymentPurpose_ref_from_ptr(long ptr);
        public static class LDKEvent {
                private LDKEvent() {}
                export class FundingGenerationReady extends LDKEvent {
@@ -1020,11 +1049,9 @@ public static native long new_empty_slice_vec();
                }
                export class PaymentReceived extends LDKEvent {
                        public Uint8Array payment_hash;
-                       public Uint8Array payment_preimage;
-                       public Uint8Array payment_secret;
                        public number amt;
-                       public number user_payment_id;
-                       PaymentReceived(Uint8Array payment_hash, Uint8Array payment_preimage, Uint8Array payment_secret, number amt, number user_payment_id) { this.payment_hash = payment_hash; this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; this.amt = amt; this.user_payment_id = user_payment_id; }
+                       public number purpose;
+                       PaymentReceived(Uint8Array payment_hash, number amt, number purpose) { this.payment_hash = payment_hash; this.amt = amt; this.purpose = purpose; }
                }
                export class PaymentSent extends LDKEvent {
                        public Uint8Array payment_preimage;
@@ -1043,6 +1070,11 @@ public static native long new_empty_slice_vec();
                        public number[] outputs;
                        SpendableOutputs(number[] outputs) { this.outputs = outputs; }
                }
+               export class PaymentForwarded extends LDKEvent {
+                       public number fee_earned_msat;
+                       public boolean claim_from_onchain_tx;
+                       PaymentForwarded(number fee_earned_msat, boolean claim_from_onchain_tx) { this.fee_earned_msat = fee_earned_msat; this.claim_from_onchain_tx = claim_from_onchain_tx; }
+               }
                static native void init();
        }
        static { LDKEvent.init(); }
@@ -1124,6 +1156,9 @@ public static native long new_empty_slice_vec();
        public static native boolean LDKCResult_ClosingSignedDecodeErrorZ_result_ok(long arg);
        public static native number LDKCResult_ClosingSignedDecodeErrorZ_get_ok(long arg);
        public static native number LDKCResult_ClosingSignedDecodeErrorZ_get_err(long arg);
+       public static native boolean LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(long arg);
+       public static native number LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(long arg);
+       public static native number LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(long arg);
        public static native boolean LDKCResult_CommitmentSignedDecodeErrorZ_result_ok(long arg);
        public static native number LDKCResult_CommitmentSignedDecodeErrorZ_get_ok(long arg);
        public static native number LDKCResult_CommitmentSignedDecodeErrorZ_get_err(long arg);
@@ -2358,6 +2393,62 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.CResult_CVec_SignatureZNoneZ_clone(orig);
                return nativeResponseValue;
        }
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
+       export function CResult_ShutdownScriptDecodeErrorZ_ok(o: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ShutdownScriptDecodeErrorZ_ok(o);
+               return nativeResponseValue;
+       }
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
+       export function CResult_ShutdownScriptDecodeErrorZ_err(e: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ShutdownScriptDecodeErrorZ_err(e);
+               return nativeResponseValue;
+       }
+       // void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
+       export function CResult_ShutdownScriptDecodeErrorZ_free(_res: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ShutdownScriptDecodeErrorZ_free(_res);
+               // debug statements here
+       }
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
+       export function CResult_ShutdownScriptDecodeErrorZ_clone(orig: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ShutdownScriptDecodeErrorZ_clone(orig);
+               return nativeResponseValue;
+       }
+       // struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
+       export function CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o);
+               return nativeResponseValue;
+       }
+       // struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
+       export function CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ShutdownScriptInvalidShutdownScriptZ_err(e);
+               return nativeResponseValue;
+       }
+       // void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
+       export function CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res);
+               // debug statements here
+       }
        // struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
        export function CResult_NoneErrorZ_ok(): number {
                if(!isWasmInitialized) {
@@ -3334,6 +3425,38 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.CResult_NonePaymentSendFailureZ_clone(orig);
                return nativeResponseValue;
        }
+       // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
+       export function CResult_PaymentHashPaymentSendFailureZ_ok(o: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_ok(encodeArray(o));
+               return nativeResponseValue;
+       }
+       // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+       export function CResult_PaymentHashPaymentSendFailureZ_err(e: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_err(e);
+               return nativeResponseValue;
+       }
+       // void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res);
+       export function CResult_PaymentHashPaymentSendFailureZ_free(_res: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_free(_res);
+               // debug statements here
+       }
+       // struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig);
+       export function CResult_PaymentHashPaymentSendFailureZ_clone(orig: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_PaymentHashPaymentSendFailureZ_clone(orig);
+               return nativeResponseValue;
+       }
        // void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
        export function CVec_NetAddressZ_free(_res: number[]): void {
                if(!isWasmInitialized) {
@@ -4838,6 +4961,38 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.CResult_ClosingSignedDecodeErrorZ_clone(orig);
                return nativeResponseValue;
        }
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
+       export function CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o);
+               return nativeResponseValue;
+       }
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
+       export function CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e);
+               return nativeResponseValue;
+       }
+       // void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
+       export function CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res);
+               // debug statements here
+       }
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
+       export function CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig);
+               return nativeResponseValue;
+       }
        // struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
        export function CResult_CommitmentSignedDecodeErrorZ_ok(o: number): number {
                if(!isWasmInitialized) {
@@ -5734,6 +5889,38 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.CResult_InvoiceSignOrCreationErrorZ_clone(orig);
                return nativeResponseValue;
        }
+       // void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
+       export function PaymentPurpose_free(this_ptr: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.PaymentPurpose_free(this_ptr);
+               // debug statements here
+       }
+       // struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
+       export function PaymentPurpose_clone(orig: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.PaymentPurpose_clone(orig);
+               return nativeResponseValue;
+       }
+       // struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id);
+       export function PaymentPurpose_invoice_payment(payment_preimage: Uint8Array, payment_secret: Uint8Array, user_payment_id: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.PaymentPurpose_invoice_payment(encodeArray(payment_preimage), encodeArray(payment_secret), user_payment_id);
+               return nativeResponseValue;
+       }
+       // struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
+       export function PaymentPurpose_spontaneous_payment(a: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.PaymentPurpose_spontaneous_payment(encodeArray(a));
+               return nativeResponseValue;
+       }
        // void Event_free(struct LDKEvent this_ptr);
        export function Event_free(this_ptr: number): void {
                if(!isWasmInitialized) {
@@ -5758,12 +5945,12 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.Event_funding_generation_ready(encodeArray(temporary_channel_id), channel_value_satoshis, encodeArray(output_script), user_channel_id);
                return nativeResponseValue;
        }
-       // struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t amt, uint64_t user_payment_id);
-       export function Event_payment_received(payment_hash: Uint8Array, payment_preimage: Uint8Array, payment_secret: Uint8Array, amt: number, user_payment_id: number): number {
+       // struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
+       export function Event_payment_received(payment_hash: Uint8Array, amt: number, purpose: number): number {
                if(!isWasmInitialized) {
                        throw new Error("initializeWasm() must be awaited first!");
                }
-               const nativeResponseValue = wasm.Event_payment_received(encodeArray(payment_hash), encodeArray(payment_preimage), encodeArray(payment_secret), amt, user_payment_id);
+               const nativeResponseValue = wasm.Event_payment_received(encodeArray(payment_hash), amt, purpose);
                return nativeResponseValue;
        }
        // struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage);
@@ -5798,6 +5985,14 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.Event_spendable_outputs(outputs);
                return nativeResponseValue;
        }
+       // struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
+       export function Event_payment_forwarded(fee_earned_msat: number, claim_from_onchain_tx: boolean): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.Event_payment_forwarded(fee_earned_msat, claim_from_onchain_tx);
+               return nativeResponseValue;
+       }
        // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
        export function Event_write(obj: number): Uint8Array {
                if(!isWasmInitialized) {
@@ -6062,6 +6257,14 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.APIError_monitor_update_failed();
                return nativeResponseValue;
        }
+       // struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
+       export function APIError_incompatible_shutdown_script(script: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.APIError_incompatible_shutdown_script(script);
+               return nativeResponseValue;
+       }
        // struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
        export function sign(msg: Uint8Array, sk: Uint8Array): number {
                if(!isWasmInitialized) {
@@ -6494,12 +6697,44 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr, val);
                // debug statements here
        }
-       // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg);
-       export function ChannelConfig_new(forwarding_fee_proportional_millionths_arg: number, forwarding_fee_base_msat_arg: number, cltv_expiry_delta_arg: number, announced_channel_arg: boolean, commit_upfront_shutdown_pubkey_arg: boolean): number {
+       // uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+       export function ChannelConfig_get_max_dust_htlc_exposure_msat(this_ptr: number): number {
                if(!isWasmInitialized) {
                        throw new Error("initializeWasm() must be awaited first!");
                }
-               const nativeResponseValue = wasm.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+               const nativeResponseValue = wasm.ChannelConfig_get_max_dust_htlc_exposure_msat(this_ptr);
+               return nativeResponseValue;
+       }
+       // void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
+       export function ChannelConfig_set_max_dust_htlc_exposure_msat(this_ptr: number, val: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ChannelConfig_set_max_dust_htlc_exposure_msat(this_ptr, val);
+               // debug statements here
+       }
+       // uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+       export function ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this_ptr: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this_ptr);
+               return nativeResponseValue;
+       }
+       // void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
+       export function ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this_ptr: number, val: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this_ptr, val);
+               // debug statements here
+       }
+       // MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
+       export function ChannelConfig_new(forwarding_fee_proportional_millionths_arg: number, forwarding_fee_base_msat_arg: number, cltv_expiry_delta_arg: number, announced_channel_arg: boolean, commit_upfront_shutdown_pubkey_arg: boolean, max_dust_htlc_exposure_msat_arg: number, force_close_avoidance_max_fee_satoshis_arg: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
                return nativeResponseValue;
        }
        // struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
@@ -6862,6 +7097,14 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.ConfirmationTarget_high_priority();
                return nativeResponseValue;
        }
+       // bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
+       export function ConfirmationTarget_eq(a: number, b: number): boolean {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ConfirmationTarget_eq(a, b);
+               return nativeResponseValue;
+       }
        // void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
        export function FeeEstimator_free(this_ptr: number): void {
                if(!isWasmInitialized) {
@@ -8398,6 +8641,14 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.ChannelManager_close_channel(this_arg, encodeArray(channel_id));
                return nativeResponseValue;
        }
+       // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], uint32_t target_feerate_sats_per_1000_weight);
+       export function ChannelManager_close_channel_with_target_feerate(this_arg: number, channel_id: Uint8Array, target_feerate_sats_per_1000_weight: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ChannelManager_close_channel_with_target_feerate(this_arg, encodeArray(channel_id), target_feerate_sats_per_1000_weight);
+               return nativeResponseValue;
+       }
        // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]);
        export function ChannelManager_force_close_channel(this_arg: number, channel_id: Uint8Array): number {
                if(!isWasmInitialized) {
@@ -8422,6 +8673,14 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.ChannelManager_send_payment(this_arg, route, encodeArray(payment_hash), encodeArray(payment_secret));
                return nativeResponseValue;
        }
+       // MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
+       export function ChannelManager_send_spontaneous_payment(this_arg: number, route: number, payment_preimage: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ChannelManager_send_spontaneous_payment(this_arg, route, encodeArray(payment_preimage));
+               return nativeResponseValue;
+       }
        // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction);
        export function ChannelManager_funding_transaction_generated(this_arg: number, temporary_channel_id: Uint8Array, funding_transaction: Uint8Array): number {
                if(!isWasmInitialized) {
@@ -9702,6 +9961,62 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.Shutdown_clone(orig);
                return nativeResponseValue;
        }
+       // void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj);
+       export function ClosingSignedFeeRange_free(this_obj: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_free(this_obj);
+               // debug statements here
+       }
+       // uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
+       export function ClosingSignedFeeRange_get_min_fee_satoshis(this_ptr: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_get_min_fee_satoshis(this_ptr);
+               return nativeResponseValue;
+       }
+       // void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
+       export function ClosingSignedFeeRange_set_min_fee_satoshis(this_ptr: number, val: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_set_min_fee_satoshis(this_ptr, val);
+               // debug statements here
+       }
+       // uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr);
+       export function ClosingSignedFeeRange_get_max_fee_satoshis(this_ptr: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_get_max_fee_satoshis(this_ptr);
+               return nativeResponseValue;
+       }
+       // void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val);
+       export function ClosingSignedFeeRange_set_max_fee_satoshis(this_ptr: number, val: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_set_max_fee_satoshis(this_ptr, val);
+               // debug statements here
+       }
+       // MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg);
+       export function ClosingSignedFeeRange_new(min_fee_satoshis_arg: number, max_fee_satoshis_arg: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
+               return nativeResponseValue;
+       }
+       // struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig);
+       export function ClosingSignedFeeRange_clone(orig: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_clone(orig);
+               return nativeResponseValue;
+       }
        // void ClosingSigned_free(struct LDKClosingSigned this_obj);
        export function ClosingSigned_free(this_obj: number): void {
                if(!isWasmInitialized) {
@@ -9758,12 +10073,28 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.ClosingSigned_set_signature(this_ptr, encodeArray(val));
                // debug statements here
        }
-       // MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg);
-       export function ClosingSigned_new(channel_id_arg: Uint8Array, fee_satoshis_arg: number, signature_arg: Uint8Array): number {
+       // struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr);
+       export function ClosingSigned_get_fee_range(this_ptr: number): number {
                if(!isWasmInitialized) {
                        throw new Error("initializeWasm() must be awaited first!");
                }
-               const nativeResponseValue = wasm.ClosingSigned_new(encodeArray(channel_id_arg), fee_satoshis_arg, encodeArray(signature_arg));
+               const nativeResponseValue = wasm.ClosingSigned_get_fee_range(this_ptr);
+               return nativeResponseValue;
+       }
+       // void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val);
+       export function ClosingSigned_set_fee_range(this_ptr: number, val: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSigned_set_fee_range(this_ptr, val);
+               // debug statements here
+       }
+       // MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, struct LDKSignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg);
+       export function ClosingSigned_new(channel_id_arg: Uint8Array, fee_satoshis_arg: number, signature_arg: Uint8Array, fee_range_arg: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSigned_new(encodeArray(channel_id_arg), fee_satoshis_arg, encodeArray(signature_arg), fee_range_arg);
                return nativeResponseValue;
        }
        // struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig);
@@ -11774,6 +12105,22 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.ClosingSigned_read(encodeArray(ser));
                return nativeResponseValue;
        }
+       // struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj);
+       export function ClosingSignedFeeRange_write(obj: number): Uint8Array {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_write(obj);
+               return decodeArray(nativeResponseValue);
+       }
+       // struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser);
+       export function ClosingSignedFeeRange_read(ser: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ClosingSignedFeeRange_read(encodeArray(ser));
+               return nativeResponseValue;
+       }
        // struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj);
        export function CommitmentSigned_write(obj: number): Uint8Array {
                if(!isWasmInitialized) {
@@ -13710,6 +14057,134 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.InvoiceFeatures_read(encodeArray(ser));
                return nativeResponseValue;
        }
+       // void ShutdownScript_free(struct LDKShutdownScript this_obj);
+       export function ShutdownScript_free(this_obj: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_free(this_obj);
+               // debug statements here
+       }
+       // struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig);
+       export function ShutdownScript_clone(orig: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_clone(orig);
+               return nativeResponseValue;
+       }
+       // void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj);
+       export function InvalidShutdownScript_free(this_obj: number): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.InvalidShutdownScript_free(this_obj);
+               // debug statements here
+       }
+       // struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr);
+       export function InvalidShutdownScript_get_script(this_ptr: number): Uint8Array {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.InvalidShutdownScript_get_script(this_ptr);
+               return decodeArray(nativeResponseValue);
+       }
+       // void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
+       export function InvalidShutdownScript_set_script(this_ptr: number, val: Uint8Array): void {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.InvalidShutdownScript_set_script(this_ptr, encodeArray(val));
+               // debug statements here
+       }
+       // MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg);
+       export function InvalidShutdownScript_new(script_arg: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.InvalidShutdownScript_new(encodeArray(script_arg));
+               return nativeResponseValue;
+       }
+       // struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj);
+       export function ShutdownScript_write(obj: number): Uint8Array {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_write(obj);
+               return decodeArray(nativeResponseValue);
+       }
+       // struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser);
+       export function ShutdownScript_read(ser: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_read(encodeArray(ser));
+               return nativeResponseValue;
+       }
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2pkh(const uint8_t (*pubkey_hash)[20]);
+       export function ShutdownScript_new_p2pkh(pubkey_hash: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_new_p2pkh(encodeArray(pubkey_hash));
+               return nativeResponseValue;
+       }
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2sh(const uint8_t (*script_hash)[20]);
+       export function ShutdownScript_new_p2sh(script_hash: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_new_p2sh(encodeArray(script_hash));
+               return nativeResponseValue;
+       }
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]);
+       export function ShutdownScript_new_p2wpkh(pubkey_hash: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_new_p2wpkh(encodeArray(pubkey_hash));
+               return nativeResponseValue;
+       }
+       // MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]);
+       export function ShutdownScript_new_p2wsh(script_hash: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_new_p2wsh(encodeArray(script_hash));
+               return nativeResponseValue;
+       }
+       // MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program);
+       export function ShutdownScript_new_witness_program(version: number, program: Uint8Array): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_new_witness_program(version, encodeArray(program));
+               return nativeResponseValue;
+       }
+       // MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg);
+       export function ShutdownScript_into_inner(this_arg: number): Uint8Array {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_into_inner(this_arg);
+               return decodeArray(nativeResponseValue);
+       }
+       // MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg);
+       export function ShutdownScript_as_legacy_pubkey(this_arg: number): Uint8Array {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_as_legacy_pubkey(this_arg);
+               return decodeArray(nativeResponseValue);
+       }
+       // MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
+       export function ShutdownScript_is_compatible(this_arg: number, features: number): boolean {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.ShutdownScript_is_compatible(this_arg, features);
+               return nativeResponseValue;
+       }
        // void RouteHop_free(struct LDKRouteHop this_obj);
        export function RouteHop_free(this_obj: number): void {
                if(!isWasmInitialized) {
@@ -14046,6 +14521,14 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.RouteHintHop_clone(orig);
                return nativeResponseValue;
        }
+       // struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
+       export function get_keysend_route(our_node_id: Uint8Array, network: number, payee: Uint8Array, first_hops: number[], last_hops: number[], final_value_msat: number, final_cltv: number, logger: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.get_keysend_route(encodeArray(our_node_id), network, encodeArray(payee), first_hops, last_hops, final_value_msat, final_cltv, logger);
+               return nativeResponseValue;
+       }
        // struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
        export function get_route(our_node_id: Uint8Array, network: number, payee: Uint8Array, payee_features: number, first_hops: number[], last_hops: number[], final_value_msat: number, final_cltv: number, logger: number): number {
                if(!isWasmInitialized) {
@@ -14886,6 +15369,14 @@ public static native long new_empty_slice_vec();
                const nativeResponseValue = wasm.BackgroundProcessor_start(persister, event_handler, chain_monitor, channel_manager, peer_manager, logger);
                return nativeResponseValue;
        }
+       // MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
+       export function BackgroundProcessor_join(this_arg: number): number {
+               if(!isWasmInitialized) {
+                       throw new Error("initializeWasm() must be awaited first!");
+               }
+               const nativeResponseValue = wasm.BackgroundProcessor_join(this_arg);
+               return nativeResponseValue;
+       }
        // MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
        export function BackgroundProcessor_stop(this_arg: number): number {
                if(!isWasmInitialized) {
index 02a1ddbf41e30eb29b1a5b157319f31e3843b4b5..234c7b787703991e49f02cdc4ea41494717a7e09 100644 (file)
@@ -25,6 +25,9 @@ export default class APIError extends CommonBase {
                if (raw_val instanceof bindings.LDKAPIError.MonitorUpdateFailed) {
                        return new MonitorUpdateFailed(this.ptr, raw_val);
                }
+               if (raw_val instanceof bindings.LDKAPIError.IncompatibleShutdownScript) {
+                       return new IncompatibleShutdownScript(this.ptr, raw_val);
+               }
                throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
        }
 
@@ -63,6 +66,16 @@ export class MonitorUpdateFailed extends APIError {
        private constructor(ptr: number, obj: bindings.LDKAPIError.MonitorUpdateFailed) {
                super(null, ptr);
        }
+}
+export class IncompatibleShutdownScript extends APIError {
+       public script: ShutdownScript;
+       private constructor(ptr: number, obj: bindings.LDKAPIError.IncompatibleShutdownScript) {
+               super(null, ptr);
+               const script: number = obj.script;
+               const script_hu_conv: ShutdownScript = new ShutdownScript(null, script);
+                       script_hu_conv.ptrs_to.add(this);
+               this.script = script_hu_conv;
+       }
 }
        public APIError clone() {
                number ret = bindings.APIError_clone(this.ptr);
@@ -106,4 +119,12 @@ export class MonitorUpdateFailed extends APIError {
                return ret_hu_conv;
        }
 
+       public static APIError constructor_incompatible_shutdown_script(ShutdownScript script) {
+               number ret = bindings.APIError_incompatible_shutdown_script(script == null ? 0 : script.ptr & ~1);
+               APIError ret_hu_conv = APIError.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               ret_hu_conv.ptrs_to.add(script);
+               return ret_hu_conv;
+       }
+
 }
index 406504709e02645c84285a4821910f257b890500..232d7f4d70490050f11f523cb15f47cfc5e351aa 100644 (file)
@@ -31,6 +31,12 @@ import * as bindings from '../bindings' // TODO: figure out location
                return ret_hu_conv;
        }
 
+       public Result_NoneErrorZ join() {
+               number ret = bindings.BackgroundProcessor_join(this.ptr);
+               Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
        public Result_NoneErrorZ stop() {
                number ret = bindings.BackgroundProcessor_stop(this.ptr);
                Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
index f1c352e80391c0183684190747fa2210e0cbb8b2..570630c5599fc1d37f95f28f1c2edfd9a2305c08 100644 (file)
@@ -63,8 +63,26 @@ import * as bindings from '../bindings' // TODO: figure out location
                bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val);
        }
 
-       public static ChannelConfig constructor_new(number forwarding_fee_proportional_millionths_arg, number forwarding_fee_base_msat_arg, number cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg) {
-               number ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
+       public number get_max_dust_htlc_exposure_msat() {
+               number ret = bindings.ChannelConfig_get_max_dust_htlc_exposure_msat(this.ptr);
+               return ret;
+       }
+
+       public void set_max_dust_htlc_exposure_msat(number val) {
+               bindings.ChannelConfig_set_max_dust_htlc_exposure_msat(this.ptr, val);
+       }
+
+       public number get_force_close_avoidance_max_fee_satoshis() {
+               number ret = bindings.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this.ptr);
+               return ret;
+       }
+
+       public void set_force_close_avoidance_max_fee_satoshis(number val) {
+               bindings.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this.ptr, val);
+       }
+
+       public static ChannelConfig constructor_new(number forwarding_fee_proportional_millionths_arg, number forwarding_fee_base_msat_arg, number cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg, number max_dust_htlc_exposure_msat_arg, number force_close_avoidance_max_fee_satoshis_arg) {
+               number ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg);
                const ret_hu_conv: ChannelConfig = new ChannelConfig(null, ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
index 9d9eeffa4b65048b71d057dcb16a583fa779a0b0..6064707d445a888aaabba11476df79b20c938aa8 100644 (file)
@@ -76,6 +76,12 @@ import * as bindings from '../bindings' // TODO: figure out location
                return ret_hu_conv;
        }
 
+       public Result_NoneAPIErrorZ close_channel_with_target_feerate(Uint8Array channel_id, number target_feerate_sats_per_1000_weight) {
+               number ret = bindings.ChannelManager_close_channel_with_target_feerate(this.ptr, channel_id, target_feerate_sats_per_1000_weight);
+               Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
        public Result_NoneAPIErrorZ force_close_channel(Uint8Array channel_id) {
                number ret = bindings.ChannelManager_force_close_channel(this.ptr, channel_id);
                Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
@@ -93,6 +99,13 @@ import * as bindings from '../bindings' // TODO: figure out location
                return ret_hu_conv;
        }
 
+       public Result_PaymentHashPaymentSendFailureZ send_spontaneous_payment(Route route, Uint8Array payment_preimage) {
+               number ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, payment_preimage);
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               this.ptrs_to.add(route);
+               return ret_hu_conv;
+       }
+
        public Result_NoneAPIErrorZ funding_transaction_generated(Uint8Array temporary_channel_id, Uint8Array funding_transaction) {
                number ret = bindings.ChannelManager_funding_transaction_generated(this.ptr, temporary_channel_id, funding_transaction);
                Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret);
index 5056beda5b43841fc2d1ed7ef36e0c17a4b99faf..453347c012dedb37f90bbe5f5e86d673e98de380 100644 (file)
@@ -45,10 +45,23 @@ import * as bindings from '../bindings' // TODO: figure out location
                bindings.ClosingSigned_set_signature(this.ptr, val);
        }
 
-       public static ClosingSigned constructor_new(Uint8Array channel_id_arg, number fee_satoshis_arg, Uint8Array signature_arg) {
-               number ret = bindings.ClosingSigned_new(channel_id_arg, fee_satoshis_arg, signature_arg);
+       public ClosingSignedFeeRange get_fee_range() {
+               number ret = bindings.ClosingSigned_get_fee_range(this.ptr);
+               const ret_hu_conv: ClosingSignedFeeRange = new ClosingSignedFeeRange(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       public void set_fee_range(ClosingSignedFeeRange val) {
+               bindings.ClosingSigned_set_fee_range(this.ptr, val == null ? 0 : val.ptr & ~1);
+               this.ptrs_to.add(val);
+       }
+
+       public static ClosingSigned constructor_new(Uint8Array channel_id_arg, number fee_satoshis_arg, Uint8Array signature_arg, ClosingSignedFeeRange fee_range_arg) {
+               number ret = bindings.ClosingSigned_new(channel_id_arg, fee_satoshis_arg, signature_arg, fee_range_arg == null ? 0 : fee_range_arg.ptr & ~1);
                const ret_hu_conv: ClosingSigned = new ClosingSigned(null, ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               ret_hu_conv.ptrs_to.add(fee_range_arg);
                return ret_hu_conv;
        }
 
diff --git a/ts/structs/ClosingSignedFeeRange.ts b/ts/structs/ClosingSignedFeeRange.ts
new file mode 100644 (file)
index 0000000..b3dc2ba
--- /dev/null
@@ -0,0 +1,64 @@
+
+            
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+            export default class ClosingSignedFeeRange extends CommonBase {
+                constructor(_dummy: object, ptr: number) {
+                    super(ptr);
+                }
+
+                
+                protected finalize() {
+                    super.finalize();
+
+                    if (this.ptr != 0) {
+                        bindings.ClosingSignedFeeRange_free(this.ptr);
+                    }
+                }
+       public number get_min_fee_satoshis() {
+               number ret = bindings.ClosingSignedFeeRange_get_min_fee_satoshis(this.ptr);
+               return ret;
+       }
+
+       public void set_min_fee_satoshis(number val) {
+               bindings.ClosingSignedFeeRange_set_min_fee_satoshis(this.ptr, val);
+       }
+
+       public number get_max_fee_satoshis() {
+               number ret = bindings.ClosingSignedFeeRange_get_max_fee_satoshis(this.ptr);
+               return ret;
+       }
+
+       public void set_max_fee_satoshis(number val) {
+               bindings.ClosingSignedFeeRange_set_max_fee_satoshis(this.ptr, val);
+       }
+
+       public static ClosingSignedFeeRange constructor_new(number min_fee_satoshis_arg, number max_fee_satoshis_arg) {
+               number ret = bindings.ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg);
+               const ret_hu_conv: ClosingSignedFeeRange = new ClosingSignedFeeRange(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       public ClosingSignedFeeRange clone() {
+               number ret = bindings.ClosingSignedFeeRange_clone(this.ptr);
+               const ret_hu_conv: ClosingSignedFeeRange = new ClosingSignedFeeRange(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       public Uint8Array write() {
+               Uint8Array ret = bindings.ClosingSignedFeeRange_write(this.ptr);
+               return ret;
+       }
+
+       public static Result_ClosingSignedFeeRangeDecodeErrorZ constructor_read(Uint8Array ser) {
+               number ret = bindings.ClosingSignedFeeRange_read(ser);
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
index 2590433d0b15c33bf17f98dda1c67efb6698af4a..ef27cde9b5b7236497a115993e0df867df011c4b 100644 (file)
@@ -28,6 +28,9 @@ export default class Event extends CommonBase {
                if (raw_val instanceof bindings.LDKEvent.SpendableOutputs) {
                        return new SpendableOutputs(this.ptr, raw_val);
                }
+               if (raw_val instanceof bindings.LDKEvent.PaymentForwarded) {
+                       return new PaymentForwarded(this.ptr, raw_val);
+               }
                throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
        }
 
@@ -47,17 +50,16 @@ export class FundingGenerationReady extends Event {
 }
 export class PaymentReceived extends Event {
        public payment_hash: Uint8Array;
-       public payment_preimage: Uint8Array;
-       public payment_secret: Uint8Array;
        public amt: number;
-       public user_payment_id: number;
+       public purpose: PaymentPurpose;
        private constructor(ptr: number, obj: bindings.LDKEvent.PaymentReceived) {
                super(null, ptr);
                this.payment_hash = obj.payment_hash;
-               this.payment_preimage = obj.payment_preimage;
-               this.payment_secret = obj.payment_secret;
                this.amt = obj.amt;
-               this.user_payment_id = obj.user_payment_id;
+               const purpose: number = obj.purpose;
+               PaymentPurpose purpose_hu_conv = PaymentPurpose.constr_from_ptr(purpose);
+                       purpose_hu_conv.ptrs_to.add(this);
+               this.purpose = purpose_hu_conv;
        }
 }
 export class PaymentSent extends Event {
@@ -97,6 +99,18 @@ export class SpendableOutputs extends Event {
                        }
                this.outputs = outputs_conv_27_arr;
        }
+}
+export class PaymentForwarded extends Event {
+       public fee_earned_msat: Option_u64Z;
+       public claim_from_onchain_tx: boolean;
+       private constructor(ptr: number, obj: bindings.LDKEvent.PaymentForwarded) {
+               super(null, ptr);
+               const fee_earned_msat: number = obj.fee_earned_msat;
+               Option_u64Z fee_earned_msat_hu_conv = Option_u64Z.constr_from_ptr(fee_earned_msat);
+                       fee_earned_msat_hu_conv.ptrs_to.add(this);
+               this.fee_earned_msat = fee_earned_msat_hu_conv;
+               this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
+       }
 }
        public Event clone() {
                number ret = bindings.Event_clone(this.ptr);
@@ -112,8 +126,8 @@ export class SpendableOutputs extends Event {
                return ret_hu_conv;
        }
 
-       public static Event constructor_payment_received(Uint8Array payment_hash, Uint8Array payment_preimage, Uint8Array payment_secret, number amt, number user_payment_id) {
-               number ret = bindings.Event_payment_received(payment_hash, payment_preimage, payment_secret, amt, user_payment_id);
+       public static Event constructor_payment_received(Uint8Array payment_hash, number amt, PaymentPurpose purpose) {
+               number ret = bindings.Event_payment_received(payment_hash, amt, purpose.ptr);
                Event ret_hu_conv = Event.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
@@ -148,6 +162,13 @@ export class SpendableOutputs extends Event {
                return ret_hu_conv;
        }
 
+       public static Event constructor_payment_forwarded(Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx) {
+               number ret = bindings.Event_payment_forwarded(fee_earned_msat.ptr, claim_from_onchain_tx);
+               Event ret_hu_conv = Event.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
        public Uint8Array write() {
                Uint8Array ret = bindings.Event_write(this.ptr);
                return ret;
diff --git a/ts/structs/InvalidShutdownScript.ts b/ts/structs/InvalidShutdownScript.ts
new file mode 100644 (file)
index 0000000..ded8295
--- /dev/null
@@ -0,0 +1,37 @@
+
+            
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+            export default class InvalidShutdownScript extends CommonBase {
+                constructor(_dummy: object, ptr: number) {
+                    super(ptr);
+                }
+
+                
+                protected finalize() {
+                    super.finalize();
+
+                    if (this.ptr != 0) {
+                        bindings.InvalidShutdownScript_free(this.ptr);
+                    }
+                }
+       public Uint8Array get_script() {
+               Uint8Array ret = bindings.InvalidShutdownScript_get_script(this.ptr);
+               return ret;
+       }
+
+       public void set_script(Uint8Array val) {
+               bindings.InvalidShutdownScript_set_script(this.ptr, val);
+       }
+
+       public static InvalidShutdownScript constructor_new(Uint8Array script_arg) {
+               number ret = bindings.InvalidShutdownScript_new(script_arg);
+               const ret_hu_conv: InvalidShutdownScript = new InvalidShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+}
index be182a49455a38f0d243414c9ec3e704768f7036..d199662d5790ab847c1835fbf51a61519734a1de 100644 (file)
@@ -42,9 +42,11 @@ import * as bindings from '../bindings' // TODO: figure out location
                                return ret;
                                                },
 
-                                               get_shutdown_pubkey (): Uint8Array {
-                                                       Uint8Array ret = arg.get_shutdown_pubkey();
-                               return ret;
+                                               get_shutdown_scriptpubkey (): number {
+                                                       ShutdownScript ret = arg.get_shutdown_scriptpubkey();
+                               result: number = ret == null ? 0 : ret.ptr & ~1;
+                               impl_holder.held.ptrs_to.add(ret);
+                               return result;
                                                },
 
                                                get_channel_signer (inbound: boolean, channel_value_satoshis: number): number {
@@ -80,7 +82,7 @@ import * as bindings from '../bindings' // TODO: figure out location
             export interface KeysInterfaceInterface {
                 get_node_secret(): Uint8Array;
                                get_destination_script(): Uint8Array;
-                               get_shutdown_pubkey(): Uint8Array;
+                               get_shutdown_scriptpubkey(): ShutdownScript;
                                get_channel_signer(inbound: boolean, channel_value_satoshis: number): Sign;
                                get_secure_random_bytes(): Uint8Array;
                                read_chan_signer(reader: Uint8Array): Result_SignDecodeErrorZ;
@@ -101,9 +103,11 @@ import * as bindings from '../bindings' // TODO: figure out location
                return ret;
        }
 
-       public Uint8Array get_shutdown_pubkey() {
-               Uint8Array ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr);
-               return ret;
+       public ShutdownScript get_shutdown_scriptpubkey() {
+               number ret = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr);
+               const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
        }
 
        public Sign get_channel_signer(boolean inbound, number channel_value_satoshis) {
diff --git a/ts/structs/PaymentPurpose.ts b/ts/structs/PaymentPurpose.ts
new file mode 100644 (file)
index 0000000..69a9436
--- /dev/null
@@ -0,0 +1,62 @@
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class PaymentPurpose extends CommonBase {
+       protected constructor(_dummy: object, ptr: number) { super(ptr); }
+       protected finalize() {
+               super.finalize();
+               if (this.ptr != 0) { bindings.PaymentPurpose_free(this.ptr); }
+       }
+       static constr_from_ptr(ptr: number): PaymentPurpose {
+               const raw_val: bindings.LDKPaymentPurpose = bindings.LDKPaymentPurpose_ref_from_ptr(ptr);
+               if (raw_val instanceof bindings.LDKPaymentPurpose.InvoicePayment) {
+                       return new InvoicePayment(this.ptr, raw_val);
+               }
+               if (raw_val instanceof bindings.LDKPaymentPurpose.SpontaneousPayment) {
+                       return new SpontaneousPayment(this.ptr, raw_val);
+               }
+               throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+       }
+
+}
+export class InvoicePayment extends PaymentPurpose {
+       public payment_preimage: Uint8Array;
+       public payment_secret: Uint8Array;
+       public user_payment_id: number;
+       private constructor(ptr: number, obj: bindings.LDKPaymentPurpose.InvoicePayment) {
+               super(null, ptr);
+               this.payment_preimage = obj.payment_preimage;
+               this.payment_secret = obj.payment_secret;
+               this.user_payment_id = obj.user_payment_id;
+       }
+}
+export class SpontaneousPayment extends PaymentPurpose {
+       public spontaneous_payment: Uint8Array;
+       private constructor(ptr: number, obj: bindings.LDKPaymentPurpose.SpontaneousPayment) {
+               super(null, ptr);
+               this.spontaneous_payment = obj.spontaneous_payment;
+       }
+}
+       public PaymentPurpose clone() {
+               number ret = bindings.PaymentPurpose_clone(this.ptr);
+               PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       public static PaymentPurpose constructor_invoice_payment(Uint8Array payment_preimage, Uint8Array payment_secret, number user_payment_id) {
+               number ret = bindings.PaymentPurpose_invoice_payment(payment_preimage, payment_secret, user_payment_id);
+               PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       public static PaymentPurpose constructor_spontaneous_payment(Uint8Array a) {
+               number ret = bindings.PaymentPurpose_spontaneous_payment(a);
+               PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/ts/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.ts b/ts/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.ts
new file mode 100644 (file)
index 0000000..b324ff0
--- /dev/null
@@ -0,0 +1,60 @@
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase {
+       private Result_ClosingSignedFeeRangeDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_free(ptr); } super.finalize();
+       }
+
+       static Result_ClosingSignedFeeRangeDecodeErrorZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_result_ok(ptr)) {
+                       return new Result_ClosingSignedFeeRangeDecodeErrorZ_OK(null, ptr);
+               } else {
+                       return new Result_ClosingSignedFeeRangeDecodeErrorZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_ClosingSignedFeeRangeDecodeErrorZ_OK extends Result_ClosingSignedFeeRangeDecodeErrorZ {
+               public final ClosingSignedFeeRange res;
+               private Result_ClosingSignedFeeRangeDecodeErrorZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       number res = bindings.LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(ptr);
+                       const res_hu_conv: ClosingSignedFeeRange = new ClosingSignedFeeRange(null, res);
+                       res_hu_conv.ptrs_to.add(this);
+                       this.res = res_hu_conv;
+               }
+       }
+
+       public static final class Result_ClosingSignedFeeRangeDecodeErrorZ_Err extends Result_ClosingSignedFeeRangeDecodeErrorZ {
+               public final DecodeError err;
+               private Result_ClosingSignedFeeRangeDecodeErrorZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       number err = bindings.LDKCResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(ptr);
+                       const err_hu_conv: DecodeError = new DecodeError(null, err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       public static Result_ClosingSignedFeeRangeDecodeErrorZ constructor__ok(ClosingSignedFeeRange o) {
+               number ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1);
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(o);
+               return ret_hu_conv;
+       }
+
+       public static Result_ClosingSignedFeeRangeDecodeErrorZ constructor__err(DecodeError e) {
+               number ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(e);
+               return ret_hu_conv;
+       }
+
+       public Result_ClosingSignedFeeRangeDecodeErrorZ _clone() {
+               number ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(this.ptr);
+               Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/ts/structs/Result_PaymentHashPaymentSendFailureZ.ts b/ts/structs/Result_PaymentHashPaymentSendFailureZ.ts
new file mode 100644 (file)
index 0000000..41052fa
--- /dev/null
@@ -0,0 +1,55 @@
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+public class Result_PaymentHashPaymentSendFailureZ extends CommonBase {
+       private Result_PaymentHashPaymentSendFailureZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_PaymentHashPaymentSendFailureZ_free(ptr); } super.finalize();
+       }
+
+       static Result_PaymentHashPaymentSendFailureZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_PaymentHashPaymentSendFailureZ_result_ok(ptr)) {
+                       return new Result_PaymentHashPaymentSendFailureZ_OK(null, ptr);
+               } else {
+                       return new Result_PaymentHashPaymentSendFailureZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_PaymentHashPaymentSendFailureZ_OK extends Result_PaymentHashPaymentSendFailureZ {
+               public final Uint8Array res;
+               private Result_PaymentHashPaymentSendFailureZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       this.res = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_ok(ptr);
+               }
+       }
+
+       public static final class Result_PaymentHashPaymentSendFailureZ_Err extends Result_PaymentHashPaymentSendFailureZ {
+               public final PaymentSendFailure err;
+               private Result_PaymentHashPaymentSendFailureZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       number err = bindings.LDKCResult_PaymentHashPaymentSendFailureZ_get_err(ptr);
+                       PaymentSendFailure err_hu_conv = PaymentSendFailure.constr_from_ptr(err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       public static Result_PaymentHashPaymentSendFailureZ constructor__ok(Uint8Array o) {
+               number ret = bindings.CResult_PaymentHashPaymentSendFailureZ_ok(o);
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       public static Result_PaymentHashPaymentSendFailureZ constructor__err(PaymentSendFailure e) {
+               number ret = bindings.CResult_PaymentHashPaymentSendFailureZ_err(e.ptr);
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       public Result_PaymentHashPaymentSendFailureZ _clone() {
+               number ret = bindings.CResult_PaymentHashPaymentSendFailureZ_clone(this.ptr);
+               Result_PaymentHashPaymentSendFailureZ ret_hu_conv = Result_PaymentHashPaymentSendFailureZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/ts/structs/Result_ShutdownScriptDecodeErrorZ.ts b/ts/structs/Result_ShutdownScriptDecodeErrorZ.ts
new file mode 100644 (file)
index 0000000..df22024
--- /dev/null
@@ -0,0 +1,60 @@
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+public class Result_ShutdownScriptDecodeErrorZ extends CommonBase {
+       private Result_ShutdownScriptDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_ShutdownScriptDecodeErrorZ_free(ptr); } super.finalize();
+       }
+
+       static Result_ShutdownScriptDecodeErrorZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_ShutdownScriptDecodeErrorZ_result_ok(ptr)) {
+                       return new Result_ShutdownScriptDecodeErrorZ_OK(null, ptr);
+               } else {
+                       return new Result_ShutdownScriptDecodeErrorZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_ShutdownScriptDecodeErrorZ_OK extends Result_ShutdownScriptDecodeErrorZ {
+               public final ShutdownScript res;
+               private Result_ShutdownScriptDecodeErrorZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       number res = bindings.LDKCResult_ShutdownScriptDecodeErrorZ_get_ok(ptr);
+                       const res_hu_conv: ShutdownScript = new ShutdownScript(null, res);
+                       res_hu_conv.ptrs_to.add(this);
+                       this.res = res_hu_conv;
+               }
+       }
+
+       public static final class Result_ShutdownScriptDecodeErrorZ_Err extends Result_ShutdownScriptDecodeErrorZ {
+               public final DecodeError err;
+               private Result_ShutdownScriptDecodeErrorZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       number err = bindings.LDKCResult_ShutdownScriptDecodeErrorZ_get_err(ptr);
+                       const err_hu_conv: DecodeError = new DecodeError(null, err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       public static Result_ShutdownScriptDecodeErrorZ constructor__ok(ShutdownScript o) {
+               number ret = bindings.CResult_ShutdownScriptDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1);
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(o);
+               return ret_hu_conv;
+       }
+
+       public static Result_ShutdownScriptDecodeErrorZ constructor__err(DecodeError e) {
+               number ret = bindings.CResult_ShutdownScriptDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(e);
+               return ret_hu_conv;
+       }
+
+       public Result_ShutdownScriptDecodeErrorZ _clone() {
+               number ret = bindings.CResult_ShutdownScriptDecodeErrorZ_clone(this.ptr);
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/ts/structs/Result_ShutdownScriptInvalidShutdownScriptZ.ts b/ts/structs/Result_ShutdownScriptInvalidShutdownScriptZ.ts
new file mode 100644 (file)
index 0000000..4db137b
--- /dev/null
@@ -0,0 +1,53 @@
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+public class Result_ShutdownScriptInvalidShutdownScriptZ extends CommonBase {
+       private Result_ShutdownScriptInvalidShutdownScriptZ(Object _dummy, long ptr) { super(ptr); }
+       protected void finalize() throws Throwable {
+               if (ptr != 0) { bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_free(ptr); } super.finalize();
+       }
+
+       static Result_ShutdownScriptInvalidShutdownScriptZ constr_from_ptr(long ptr) {
+               if (bindings.LDKCResult_ShutdownScriptInvalidShutdownScriptZ_result_ok(ptr)) {
+                       return new Result_ShutdownScriptInvalidShutdownScriptZ_OK(null, ptr);
+               } else {
+                       return new Result_ShutdownScriptInvalidShutdownScriptZ_Err(null, ptr);
+               }
+       }
+       public static final class Result_ShutdownScriptInvalidShutdownScriptZ_OK extends Result_ShutdownScriptInvalidShutdownScriptZ {
+               public final ShutdownScript res;
+               private Result_ShutdownScriptInvalidShutdownScriptZ_OK(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       number res = bindings.LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_ok(ptr);
+                       const res_hu_conv: ShutdownScript = new ShutdownScript(null, res);
+                       res_hu_conv.ptrs_to.add(this);
+                       this.res = res_hu_conv;
+               }
+       }
+
+       public static final class Result_ShutdownScriptInvalidShutdownScriptZ_Err extends Result_ShutdownScriptInvalidShutdownScriptZ {
+               public final InvalidShutdownScript err;
+               private Result_ShutdownScriptInvalidShutdownScriptZ_Err(Object _dummy, long ptr) {
+                       super(_dummy, ptr);
+                       number err = bindings.LDKCResult_ShutdownScriptInvalidShutdownScriptZ_get_err(ptr);
+                       const err_hu_conv: InvalidShutdownScript = new InvalidShutdownScript(null, err);
+                       err_hu_conv.ptrs_to.add(this);
+                       this.err = err_hu_conv;
+               }
+       }
+
+       public static Result_ShutdownScriptInvalidShutdownScriptZ constructor__ok(ShutdownScript o) {
+               number ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o == null ? 0 : o.ptr & ~1);
+               Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(o);
+               return ret_hu_conv;
+       }
+
+       public static Result_ShutdownScriptInvalidShutdownScriptZ constructor__err(Uint8Array e_script_arg) {
+               number ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_err(bindings.InvalidShutdownScript_new(e_script_arg));
+               Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+}
diff --git a/ts/structs/ShutdownScript.ts b/ts/structs/ShutdownScript.ts
new file mode 100644 (file)
index 0000000..f829f7d
--- /dev/null
@@ -0,0 +1,89 @@
+
+            
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+            export default class ShutdownScript extends CommonBase {
+                constructor(_dummy: object, ptr: number) {
+                    super(ptr);
+                }
+
+                
+                protected finalize() {
+                    super.finalize();
+
+                    if (this.ptr != 0) {
+                        bindings.ShutdownScript_free(this.ptr);
+                    }
+                }
+       public ShutdownScript clone() {
+               number ret = bindings.ShutdownScript_clone(this.ptr);
+               const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       public Uint8Array write() {
+               Uint8Array ret = bindings.ShutdownScript_write(this.ptr);
+               return ret;
+       }
+
+       public static Result_ShutdownScriptDecodeErrorZ constructor_read(Uint8Array ser) {
+               number ret = bindings.ShutdownScript_read(ser);
+               Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       public static ShutdownScript constructor_new_p2pkh(Uint8Array pubkey_hash) {
+               number ret = bindings.ShutdownScript_new_p2pkh(pubkey_hash);
+               const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       public static ShutdownScript constructor_new_p2sh(Uint8Array script_hash) {
+               number ret = bindings.ShutdownScript_new_p2sh(script_hash);
+               const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       public static ShutdownScript constructor_new_p2wpkh(Uint8Array pubkey_hash) {
+               number ret = bindings.ShutdownScript_new_p2wpkh(pubkey_hash);
+               const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       public static ShutdownScript constructor_new_p2wsh(Uint8Array script_hash) {
+               number ret = bindings.ShutdownScript_new_p2wsh(script_hash);
+               const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       public static Result_ShutdownScriptInvalidShutdownScriptZ constructor_new_witness_program(number version, Uint8Array program) {
+               number ret = bindings.ShutdownScript_new_witness_program(version, program);
+               Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       public Uint8Array into_inner() {
+               Uint8Array ret = bindings.ShutdownScript_into_inner(this.ptr);
+               return ret;
+       }
+
+       public Uint8Array as_legacy_pubkey() {
+               Uint8Array ret = bindings.ShutdownScript_as_legacy_pubkey(this.ptr);
+               return ret;
+       }
+
+       public boolean is_compatible(InitFeatures features) {
+               boolean ret = bindings.ShutdownScript_is_compatible(this.ptr, features == null ? 0 : features.ptr & ~1);
+               this.ptrs_to.add(features);
+               return ret;
+       }
+
+}
index fa0c2d44248b6b670b5a6c0c32430535b2d783dc..a82e1193fb360c13ce080b100bc3e1ade5ee8e4d 100644 (file)
                return ret;
        }
 
+       public static Result_RouteLightningErrorZ constructor_et_keysend_route(Uint8Array our_node_id, NetworkGraph network, Uint8Array payee, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger) {
+               number ret = bindings.get_keysend_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr);
+               Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(network);
+               /* TODO 2 ChannelDetails  */;
+               /* TODO 2 RouteHint  */;
+               ret_hu_conv.ptrs_to.add(logger);
+               return ret_hu_conv;
+       }
+
        public static Result_RouteLightningErrorZ constructor_et_route(Uint8Array our_node_id, NetworkGraph network, Uint8Array payee, InvoiceFeatures payee_features, ChannelDetails[] first_hops, RouteHint[] last_hops, number final_value_msat, number final_cltv, Logger logger) {
                number ret = bindings.get_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, payee_features == null ? 0 : payee_features.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr);
                Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
index d1eae4e066f4c133aa10ce6a5503beba923004ea..9f0676a5e711e35552edd1c2761b7ae17e1cced7 100644 (file)
@@ -723,7 +723,7 @@ const decodeString = (stringPointer, free = true) => {
                 elif not fn_line.ret_ty_info.passed_as_ptr:
                     out_c = out_c + "\treturn js_invoke_function_" + str(len(fn_line.args_ty)) + "(j_calls->" + fn_line.fn_name + "_meth"
                 else:
-                    out_c = out_c + "\t" + fn_line.ret_ty_info.rust_obj + "* ret = (" + fn_line.ret_ty_info.rust_obj + "*)js_invoke_function_" + str(len(fn_line.args_ty)) + "(j_calls->" + fn_line.fn_name + "_meth"
+                    out_c = out_c + "\tuint32_t ret = js_invoke_function_" + str(len(fn_line.args_ty)) + "(j_calls->" + fn_line.fn_name + "_meth"
 
                 for idx, arg_info in enumerate(fn_line.args_ty):
                     if arg_info.ret_conv is not None: