X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fbindings.c.body;fp=ts%2Fbindings.c.body;h=58f134a6dc1c37a74236fb9e720b7762d2617f7c;hb=ff2768db6ca81caa2dba8da0f29ad2d33818c311;hp=4f107bea14f900786c5d41217f252ca159f03a6f;hpb=330ca992be304d0eac79bd59b411980dff294b03;p=ldk-java diff --git a/ts/bindings.c.body b/ts/bindings.c.body index 4f107bea..58f134a6 100644 --- a/ts/bindings.c.body +++ b/ts/bindings.c.body @@ -249,6 +249,26 @@ static inline int32_t LDKCurrency_to_js(LDKCurrency val) { default: abort(); } } +static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) { + switch (ord) { + case 0: return LDKHTLCClaim_OfferedTimeout; + case 1: return LDKHTLCClaim_OfferedPreimage; + case 2: return LDKHTLCClaim_AcceptedTimeout; + case 3: return LDKHTLCClaim_AcceptedPreimage; + case 4: return LDKHTLCClaim_Revocation; + } + abort(); +} +static inline int32_t LDKHTLCClaim_to_js(LDKHTLCClaim val) { + switch (val) { + case LDKHTLCClaim_OfferedTimeout: return 0; + case LDKHTLCClaim_OfferedPreimage: return 1; + case LDKHTLCClaim_AcceptedTimeout: return 2; + case LDKHTLCClaim_AcceptedPreimage: return 3; + case LDKHTLCClaim_Revocation: return 4; + default: abort(); + } +} static inline LDKIOError LDKIOError_from_js(int32_t ord) { switch (ord) { case 0: return LDKIOError_NotFound; @@ -495,27 +515,36 @@ uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t return ret_conv; } -static inline struct LDKBlindedRoute CResult_BlindedRouteNoneZ_get_ok(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){ - LDKBlindedRoute ret = *owner->contents.result; - ret.is_owned = false; - return ret; +uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_ty_from_ptr"))) TS_LDKCOption_HTLCClaimZ_ty_from_ptr(uint64_t ptr) { + LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_HTLCClaimZ_Some: return 0; + case LDKCOption_HTLCClaimZ_None: return 1; + default: abort(); + } } -uint64_t __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_ok"))) TS_CResult_BlindedRouteNoneZ_get_ok(uint64_t owner) { - LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner); - LDKBlindedRoute ret_var = CResult_BlindedRouteNoneZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; +uint32_t __attribute__((export_name("TS_LDKCOption_HTLCClaimZ_Some_get_some"))) TS_LDKCOption_HTLCClaimZ_Some_get_some(uint64_t ptr) { + LDKCOption_HTLCClaimZ *obj = (LDKCOption_HTLCClaimZ*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_HTLCClaimZ_Some); + uint32_t some_conv = LDKHTLCClaim_to_js(obj->some); + return some_conv; +} +static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) { + LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner); + CResult_NoneNoneZ_get_ok(owner_conv); } -static inline void CResult_BlindedRouteNoneZ_get_err(LDKCResult_BlindedRouteNoneZ *NONNULL_PTR owner){ +static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return *owner->contents.err; } -void __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_get_err"))) TS_CResult_BlindedRouteNoneZ_get_err(uint64_t owner) { - LDKCResult_BlindedRouteNoneZ* owner_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(owner); - CResult_BlindedRouteNoneZ_get_err(owner_conv); +void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) { + LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner); + CResult_NoneNoneZ_get_err(owner_conv); } uint32_t __attribute__((export_name("TS_LDKDecodeError_ty_from_ptr"))) TS_LDKDecodeError_ty_from_ptr(uint64_t ptr) { @@ -537,76 +566,6 @@ uint32_t __attribute__((export_name("TS_LDKDecodeError_Io_get_io"))) TS_LDKDecod uint32_t io_conv = LDKIOError_to_js(obj->io); return io_conv; } -static inline struct LDKBlindedRoute CResult_BlindedRouteDecodeErrorZ_get_ok(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){ - LDKBlindedRoute ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner); - LDKBlindedRoute ret_var = CResult_BlindedRouteDecodeErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKDecodeError CResult_BlindedRouteDecodeErrorZ_get_err(LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -uint64_t __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_get_err"))) TS_CResult_BlindedRouteDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_BlindedRouteDecodeErrorZ* owner_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_BlindedRouteDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){ - LDKBlindedHop ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner); - LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline void CResult_NoneNoneZ_get_ok(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -void __attribute__((export_name("TS_CResult_NoneNoneZ_get_ok"))) TS_CResult_NoneNoneZ_get_ok(uint64_t owner) { - LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner); - CResult_NoneNoneZ_get_ok(owner_conv); -} - -static inline void CResult_NoneNoneZ_get_err(LDKCResult_NoneNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -void __attribute__((export_name("TS_CResult_NoneNoneZ_get_err"))) TS_CResult_NoneNoneZ_get_err(uint64_t owner) { - LDKCResult_NoneNoneZ* owner_conv = (LDKCResult_NoneNoneZ*)untag_ptr(owner); - CResult_NoneNoneZ_get_err(owner_conv); -} - static inline struct LDKCounterpartyCommitmentSecrets CResult_CounterpartyCommitmentSecretsDecodeErrorZ_get_ok(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR owner){ LDKCounterpartyCommitmentSecrets ret = *owner->contents.result; ret.is_owned = false; @@ -633,48 +592,6 @@ uint64_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDe return ret_ref; } -static inline struct LDKSecretKey CResult_SecretKeyErrorZ_get_ok(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -int8_tArray __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_ok"))) TS_CResult_SecretKeyErrorZ_get_ok(uint64_t owner) { - LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, CResult_SecretKeyErrorZ_get_ok(owner_conv).bytes, 32); - return ret_arr; -} - -static inline enum LDKSecp256k1Error CResult_SecretKeyErrorZ_get_err(LDKCResult_SecretKeyErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -uint32_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_get_err"))) TS_CResult_SecretKeyErrorZ_get_err(uint64_t owner) { - LDKCResult_SecretKeyErrorZ* owner_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_SecretKeyErrorZ_get_err(owner_conv)); - return ret_conv; -} - -static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) { - LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33); - return ret_arr; -} - -static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) { - LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv)); - return ret_conv; -} - static inline struct LDKTxCreationKeys CResult_TxCreationKeysDecodeErrorZ_get_ok(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR owner){ LDKTxCreationKeys ret = *owner->contents.result; ret.is_owned = false; @@ -727,30 +644,6 @@ uint64_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_g return ret_ref; } -static inline struct LDKTxCreationKeys CResult_TxCreationKeysErrorZ_get_ok(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){ - LDKTxCreationKeys ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_ok"))) TS_CResult_TxCreationKeysErrorZ_get_ok(uint64_t owner) { - LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner); - LDKTxCreationKeys ret_var = CResult_TxCreationKeysErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline enum LDKSecp256k1Error CResult_TxCreationKeysErrorZ_get_err(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -uint32_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_get_err"))) TS_CResult_TxCreationKeysErrorZ_get_err(uint64_t owner) { - LDKCResult_TxCreationKeysErrorZ* owner_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_TxCreationKeysErrorZ_get_err(owner_conv)); - return ret_conv; -} - uint32_t __attribute__((export_name("TS_LDKCOption_u32Z_ty_from_ptr"))) TS_LDKCOption_u32Z_ty_from_ptr(uint64_t ptr) { LDKCOption_u32Z *obj = (LDKCOption_u32Z*)untag_ptr(ptr); switch(obj->tag) { @@ -1049,6 +942,163 @@ uint64_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownSc return ret_ref; } +static inline struct LDKBlindedPath CResult_BlindedPathNoneZ_get_ok(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){ + LDKBlindedPath ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_ok"))) TS_CResult_BlindedPathNoneZ_get_ok(uint64_t owner) { + LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner); + LDKBlindedPath ret_var = CResult_BlindedPathNoneZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline void CResult_BlindedPathNoneZ_get_err(LDKCResult_BlindedPathNoneZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +void __attribute__((export_name("TS_CResult_BlindedPathNoneZ_get_err"))) TS_CResult_BlindedPathNoneZ_get_err(uint64_t owner) { + LDKCResult_BlindedPathNoneZ* owner_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(owner); + CResult_BlindedPathNoneZ_get_err(owner_conv); +} + +static inline struct LDKBlindedPath CResult_BlindedPathDecodeErrorZ_get_ok(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){ + LDKBlindedPath ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_ok"))) TS_CResult_BlindedPathDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner); + LDKBlindedPath ret_var = CResult_BlindedPathDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_BlindedPathDecodeErrorZ_get_err(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_get_err"))) TS_CResult_BlindedPathDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_BlindedPathDecodeErrorZ* owner_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_BlindedPathDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKBlindedHop CResult_BlindedHopDecodeErrorZ_get_ok(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){ + LDKBlindedHop ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner); + LDKBlindedHop ret_var = CResult_BlindedHopDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_BlindedHopDecodeErrorZ_get_err(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_get_err"))) TS_CResult_BlindedHopDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_BlindedHopDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_BlindedHopDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) { + LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = ChannelDetails_clone(&orig->data[i]); + } + return ret; +} +static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){ + LDKRoute ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) { + LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner); + LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){ + LDKLightningError ret = *owner->contents.err; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) { + LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner); + LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) { + LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = RouteHop_clone(&orig->data[i]); + } + return ret; +} +uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) { + LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_u64Z_Some: return 0; + case LDKCOption_u64Z_None: return 1; + default: abort(); + } +} +int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) { + LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_u64Z_Some); + int64_t some_conv = obj->some; + return some_conv; +} +static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){ + LDKInFlightHtlcs ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner); + LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static inline struct LDKRouteHop CResult_RouteHopDecodeErrorZ_get_ok(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR owner){ LDKRouteHop ret = *owner->contents.result; ret.is_owned = false; @@ -1075,13 +1125,6 @@ uint64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_get_err")) return ret_ref; } -static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) { - LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = RouteHop_clone(&orig->data[i]); - } - return ret; -} static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) { LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -1148,20 +1191,6 @@ static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ } return ret; } -uint32_t __attribute__((export_name("TS_LDKCOption_u64Z_ty_from_ptr"))) TS_LDKCOption_u64Z_ty_from_ptr(uint64_t ptr) { - LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr); - switch(obj->tag) { - case LDKCOption_u64Z_Some: return 0; - case LDKCOption_u64Z_None: return 1; - default: abort(); - } -} -int64_t __attribute__((export_name("TS_LDKCOption_u64Z_Some_get_some"))) TS_LDKCOption_u64Z_Some_get_some(uint64_t ptr) { - LDKCOption_u64Z *obj = (LDKCOption_u64Z*)untag_ptr(ptr); - assert(obj->tag == LDKCOption_u64Z_Some); - int64_t some_conv = obj->some; - return some_conv; -} static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) { LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen }; memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen); @@ -1252,41 +1281,6 @@ uint64_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_get_er return ret_ref; } -static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) { - LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = ChannelDetails_clone(&orig->data[i]); - } - return ret; -} -static inline struct LDKRoute CResult_RouteLightningErrorZ_get_ok(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){ - LDKRoute ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_ok"))) TS_CResult_RouteLightningErrorZ_get_ok(uint64_t owner) { - LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner); - LDKRoute ret_var = CResult_RouteLightningErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKLightningError CResult_RouteLightningErrorZ_get_err(LDKCResult_RouteLightningErrorZ *NONNULL_PTR owner){ - LDKLightningError ret = *owner->contents.err; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_get_err"))) TS_CResult_RouteLightningErrorZ_get_err(uint64_t owner) { - LDKCResult_RouteLightningErrorZ* owner_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(owner); - LDKLightningError ret_var = CResult_RouteLightningErrorZ_get_err(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - uint32_t __attribute__((export_name("TS_LDKPaymentPurpose_ty_from_ptr"))) TS_LDKPaymentPurpose_ty_from_ptr(uint64_t ptr) { LDKPaymentPurpose *obj = (LDKPaymentPurpose*)untag_ptr(ptr); switch(obj->tag) { @@ -1411,7 +1405,8 @@ uint32_t __attribute__((export_name("TS_LDKHTLCDestination_ty_from_ptr"))) TS_LD switch(obj->tag) { case LDKHTLCDestination_NextHopChannel: return 0; case LDKHTLCDestination_UnknownNextHop: return 1; - case LDKHTLCDestination_FailedPayment: return 2; + case LDKHTLCDestination_InvalidForward: return 2; + case LDKHTLCDestination_FailedPayment: return 3; default: abort(); } } @@ -1435,6 +1430,12 @@ int64_t __attribute__((export_name("TS_LDKHTLCDestination_UnknownNextHop_get_req int64_t requested_forward_scid_conv = obj->unknown_next_hop.requested_forward_scid; return requested_forward_scid_conv; } +int64_t __attribute__((export_name("TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid"))) TS_LDKHTLCDestination_InvalidForward_get_requested_forward_scid(uint64_t ptr) { + LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr); + assert(obj->tag == LDKHTLCDestination_InvalidForward); + int64_t requested_forward_scid_conv = obj->invalid_forward.requested_forward_scid; + return requested_forward_scid_conv; +} int8_tArray __attribute__((export_name("TS_LDKHTLCDestination_FailedPayment_get_payment_hash"))) TS_LDKHTLCDestination_FailedPayment_get_payment_hash(uint64_t ptr) { LDKHTLCDestination *obj = (LDKHTLCDestination*)untag_ptr(ptr); assert(obj->tag == LDKHTLCDestination_FailedPayment); @@ -1480,6 +1481,21 @@ uint64_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeE return ret_ref; } +uint32_t __attribute__((export_name("TS_LDKCOption_u128Z_ty_from_ptr"))) TS_LDKCOption_u128Z_ty_from_ptr(uint64_t ptr) { + LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_u128Z_Some: return 0; + case LDKCOption_u128Z_None: return 1; + default: abort(); + } +} +int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS_LDKCOption_u128Z_Some_get_some(uint64_t ptr) { + LDKCOption_u128Z *obj = (LDKCOption_u128Z*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_u128Z_Some); + int8_tArray some_arr = init_int8_tArray(16, __LINE__); + memcpy(some_arr->elems, obj->some.le_bytes, 16); + return some_arr; +} uint32_t __attribute__((export_name("TS_LDKNetworkUpdate_ty_from_ptr"))) TS_LDKNetworkUpdate_ty_from_ptr(uint64_t ptr) { LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); switch(obj->tag) { @@ -1590,7 +1606,7 @@ uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_ LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); switch(obj->tag) { case LDKEvent_FundingGenerationReady: return 0; - case LDKEvent_PaymentReceived: return 1; + case LDKEvent_PaymentClaimable: return 1; case LDKEvent_PaymentClaimed: return 2; case LDKEvent_PaymentSent: return 3; case LDKEvent_PaymentFailed: return 4; @@ -1599,12 +1615,14 @@ uint32_t __attribute__((export_name("TS_LDKEvent_ty_from_ptr"))) TS_LDKEvent_ty_ case LDKEvent_ProbeSuccessful: return 7; case LDKEvent_ProbeFailed: return 8; case LDKEvent_PendingHTLCsForwardable: return 9; - case LDKEvent_SpendableOutputs: return 10; - case LDKEvent_PaymentForwarded: return 11; - case LDKEvent_ChannelClosed: return 12; - case LDKEvent_DiscardFunding: return 13; - case LDKEvent_OpenChannelRequest: return 14; - case LDKEvent_HTLCHandlingFailed: return 15; + case LDKEvent_HTLCIntercepted: return 10; + case LDKEvent_SpendableOutputs: return 11; + case LDKEvent_PaymentForwarded: return 12; + case LDKEvent_ChannelReady: return 13; + case LDKEvent_ChannelClosed: return 14; + case LDKEvent_DiscardFunding: return 15; + case LDKEvent_OpenChannelRequest: return 16; + case LDKEvent_HTLCHandlingFailed: return 17; default: abort(); } } @@ -1636,31 +1654,59 @@ int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_o memcpy(output_script_arr->elems, output_script_var.data, output_script_var.datalen); return output_script_arr; } -int64_t __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) { +int8_tArray __attribute__((export_name("TS_LDKEvent_FundingGenerationReady_get_user_channel_id"))) TS_LDKEvent_FundingGenerationReady_get_user_channel_id(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); assert(obj->tag == LDKEvent_FundingGenerationReady); - int64_t user_channel_id_conv = obj->funding_generation_ready.user_channel_id; - return user_channel_id_conv; + int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__); + memcpy(user_channel_id_arr->elems, obj->funding_generation_ready.user_channel_id.le_bytes, 16); + return user_channel_id_arr; +} +int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimable_get_receiver_node_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_PaymentClaimable); + int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__); + memcpy(receiver_node_id_arr->elems, obj->payment_claimable.receiver_node_id.compressed_form, 33); + return receiver_node_id_arr; } -int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_payment_hash"))) TS_LDKEvent_PaymentReceived_get_payment_hash(uint64_t ptr) { +int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_payment_hash"))) TS_LDKEvent_PaymentClaimable_get_payment_hash(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); - assert(obj->tag == LDKEvent_PaymentReceived); + assert(obj->tag == LDKEvent_PaymentClaimable); int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); - memcpy(payment_hash_arr->elems, obj->payment_received.payment_hash.data, 32); + memcpy(payment_hash_arr->elems, obj->payment_claimable.payment_hash.data, 32); return payment_hash_arr; } -int64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_amount_msat"))) TS_LDKEvent_PaymentReceived_get_amount_msat(uint64_t ptr) { +int64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_amount_msat"))) TS_LDKEvent_PaymentClaimable_get_amount_msat(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); - assert(obj->tag == LDKEvent_PaymentReceived); - int64_t amount_msat_conv = obj->payment_received.amount_msat; + assert(obj->tag == LDKEvent_PaymentClaimable); + int64_t amount_msat_conv = obj->payment_claimable.amount_msat; return amount_msat_conv; } -uint64_t __attribute__((export_name("TS_LDKEvent_PaymentReceived_get_purpose"))) TS_LDKEvent_PaymentReceived_get_purpose(uint64_t ptr) { +uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_purpose"))) TS_LDKEvent_PaymentClaimable_get_purpose(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); - assert(obj->tag == LDKEvent_PaymentReceived); - uint64_t purpose_ref = tag_ptr(&obj->payment_received.purpose, false); + assert(obj->tag == LDKEvent_PaymentClaimable); + uint64_t purpose_ref = tag_ptr(&obj->payment_claimable.purpose, false); return purpose_ref; } +int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_channel_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_PaymentClaimable); + int8_tArray via_channel_id_arr = init_int8_tArray(32, __LINE__); + memcpy(via_channel_id_arr->elems, obj->payment_claimable.via_channel_id.data, 32); + return via_channel_id_arr; +} +uint64_t __attribute__((export_name("TS_LDKEvent_PaymentClaimable_get_via_user_channel_id"))) TS_LDKEvent_PaymentClaimable_get_via_user_channel_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_PaymentClaimable); + uint64_t via_user_channel_id_ref = tag_ptr(&obj->payment_claimable.via_user_channel_id, false); + return via_user_channel_id_ref; +} +int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_receiver_node_id"))) TS_LDKEvent_PaymentClaimed_get_receiver_node_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_PaymentClaimed); + int8_tArray receiver_node_id_arr = init_int8_tArray(33, __LINE__); + memcpy(receiver_node_id_arr->elems, obj->payment_claimed.receiver_node_id.compressed_form, 33); + return receiver_node_id_arr; +} int8_tArray __attribute__((export_name("TS_LDKEvent_PaymentClaimed_get_payment_hash"))) TS_LDKEvent_PaymentClaimed_get_payment_hash(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); assert(obj->tag == LDKEvent_PaymentClaimed); @@ -1890,6 +1936,38 @@ int64_t __attribute__((export_name("TS_LDKEvent_PendingHTLCsForwardable_get_time int64_t time_forwardable_conv = obj->pending_htl_cs_forwardable.time_forwardable; return time_forwardable_conv; } +int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_intercept_id"))) TS_LDKEvent_HTLCIntercepted_get_intercept_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_HTLCIntercepted); + int8_tArray intercept_id_arr = init_int8_tArray(32, __LINE__); + memcpy(intercept_id_arr->elems, obj->htlc_intercepted.intercept_id.data, 32); + return intercept_id_arr; +} +int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid"))) TS_LDKEvent_HTLCIntercepted_get_requested_next_hop_scid(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_HTLCIntercepted); + int64_t requested_next_hop_scid_conv = obj->htlc_intercepted.requested_next_hop_scid; + return requested_next_hop_scid_conv; +} +int8_tArray __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_payment_hash"))) TS_LDKEvent_HTLCIntercepted_get_payment_hash(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_HTLCIntercepted); + int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_hash_arr->elems, obj->htlc_intercepted.payment_hash.data, 32); + return payment_hash_arr; +} +int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_inbound_amount_msat(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_HTLCIntercepted); + int64_t inbound_amount_msat_conv = obj->htlc_intercepted.inbound_amount_msat; + return inbound_amount_msat_conv; +} +int64_t __attribute__((export_name("TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat"))) TS_LDKEvent_HTLCIntercepted_get_expected_outbound_amount_msat(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_HTLCIntercepted); + int64_t expected_outbound_amount_msat_conv = obj->htlc_intercepted.expected_outbound_amount_msat; + return expected_outbound_amount_msat_conv; +} uint64_tArray __attribute__((export_name("TS_LDKEvent_SpendableOutputs_get_outputs"))) TS_LDKEvent_SpendableOutputs_get_outputs(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); assert(obj->tag == LDKEvent_SpendableOutputs); @@ -1930,6 +2008,36 @@ jboolean __attribute__((export_name("TS_LDKEvent_PaymentForwarded_get_claim_from jboolean claim_from_onchain_tx_conv = obj->payment_forwarded.claim_from_onchain_tx; return claim_from_onchain_tx_conv; } +int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_id"))) TS_LDKEvent_ChannelReady_get_channel_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_ChannelReady); + int8_tArray channel_id_arr = init_int8_tArray(32, __LINE__); + memcpy(channel_id_arr->elems, obj->channel_ready.channel_id.data, 32); + return channel_id_arr; +} +int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_user_channel_id"))) TS_LDKEvent_ChannelReady_get_user_channel_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_ChannelReady); + int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__); + memcpy(user_channel_id_arr->elems, obj->channel_ready.user_channel_id.le_bytes, 16); + return user_channel_id_arr; +} +int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelReady_get_counterparty_node_id"))) TS_LDKEvent_ChannelReady_get_counterparty_node_id(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_ChannelReady); + int8_tArray counterparty_node_id_arr = init_int8_tArray(33, __LINE__); + memcpy(counterparty_node_id_arr->elems, obj->channel_ready.counterparty_node_id.compressed_form, 33); + return counterparty_node_id_arr; +} +uint64_t __attribute__((export_name("TS_LDKEvent_ChannelReady_get_channel_type"))) TS_LDKEvent_ChannelReady_get_channel_type(uint64_t ptr) { + LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); + assert(obj->tag == LDKEvent_ChannelReady); + LDKChannelTypeFeatures channel_type_var = obj->channel_ready.channel_type; + uint64_t channel_type_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_var); + channel_type_ref = tag_ptr(channel_type_var.inner, false); + return channel_type_ref; +} int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id"))) TS_LDKEvent_ChannelClosed_get_channel_id(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); assert(obj->tag == LDKEvent_ChannelClosed); @@ -1937,11 +2045,12 @@ int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_channel_id memcpy(channel_id_arr->elems, obj->channel_closed.channel_id.data, 32); return channel_id_arr; } -int64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) { +int8_tArray __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_user_channel_id"))) TS_LDKEvent_ChannelClosed_get_user_channel_id(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); assert(obj->tag == LDKEvent_ChannelClosed); - int64_t user_channel_id_conv = obj->channel_closed.user_channel_id; - return user_channel_id_conv; + int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__); + memcpy(user_channel_id_arr->elems, obj->channel_closed.user_channel_id.le_bytes, 16); + return user_channel_id_arr; } uint64_t __attribute__((export_name("TS_LDKEvent_ChannelClosed_get_reason"))) TS_LDKEvent_ChannelClosed_get_reason(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); @@ -2503,10 +2612,30 @@ static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ } return ret; } -static inline LDKCVec_TxidZ CVec_TxidZ_clone(const LDKCVec_TxidZ *orig) { - LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen }; +static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_a(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){ + return ThirtyTwoBytes_clone(&owner->a); +} +int8_tArray __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_a"))) TS_C2Tuple_TxidBlockHashZ_get_a(uint64_t owner) { + LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_a(owner_conv).data, 32); + return ret_arr; +} + +static inline struct LDKThirtyTwoBytes C2Tuple_TxidBlockHashZ_get_b(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR owner){ + return ThirtyTwoBytes_clone(&owner->b); +} +int8_tArray __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_get_b"))) TS_C2Tuple_TxidBlockHashZ_get_b(uint64_t owner) { + LDKC2Tuple_TxidBlockHashZ* owner_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, C2Tuple_TxidBlockHashZ_get_b(owner_conv).data, 32); + return ret_arr; +} + +static inline LDKCVec_C2Tuple_TxidBlockHashZZ CVec_C2Tuple_TxidBlockHashZZ_clone(const LDKCVec_C2Tuple_TxidBlockHashZZ *orig) { + LDKCVec_C2Tuple_TxidBlockHashZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ) * orig->datalen, "LDKCVec_C2Tuple_TxidBlockHashZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]); + ret.data[i] = C2Tuple_TxidBlockHashZ_clone(&orig->data[i]); } return ret; } @@ -2883,6 +3012,58 @@ uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ return ret_ref; } +static inline struct LDKOfferFeatures CResult_OfferFeaturesDecodeErrorZ_get_ok(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKOfferFeatures ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_get_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKOfferFeatures ret_var = CResult_OfferFeaturesDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_OfferFeaturesDecodeErrorZ_get_err(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_get_err"))) TS_CResult_OfferFeaturesDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_OfferFeaturesDecodeErrorZ* owner_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_OfferFeaturesDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKInvoiceRequestFeatures CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKInvoiceRequestFeatures ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKInvoiceRequestFeatures ret_var = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* owner_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static inline struct LDKNodeId CResult_NodeIdDecodeErrorZ_get_ok(LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR owner){ LDKNodeId ret = *owner->contents.result; ret.is_owned = false; @@ -3889,7 +4070,7 @@ LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSig FREE(untag_ptr(ret)); return ret_conv; } -void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { +void provide_channel_parameters_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; uint64_t channel_parameters_ref = 0; @@ -3927,7 +4108,7 @@ static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) { .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall, .sign_holder_anchor_input = sign_holder_anchor_input_LDKBaseSign_jcall, .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall, - .ready_channel = ready_channel_LDKBaseSign_jcall, + .provide_channel_parameters = provide_channel_parameters_LDKBaseSign_jcall, .free = LDKBaseSign_JCalls_free, .pubkeys = pubkeys_conv, .set_pubkeys = NULL, @@ -4156,7 +4337,7 @@ uint64_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_ready_channel(uint64_t this_arg, uint64_t channel_parameters) { +void __attribute__((export_name("TS_BaseSign_provide_channel_parameters"))) TS_BaseSign_provide_channel_parameters(uint64_t this_arg, uint64_t channel_parameters) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKBaseSign* this_arg_conv = (LDKBaseSign*)this_arg_ptr; @@ -4165,7 +4346,7 @@ void __attribute__((export_name("TS_BaseSign_ready_channel"))) TS_BaseSign_read channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_conv); channel_parameters_conv.is_owned = false; - (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv); + (this_arg_conv->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv); } LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) { @@ -4399,7 +4580,7 @@ uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIErr switch(obj->tag) { case LDKAPIError_APIMisuseError: return 0; case LDKAPIError_FeeRateTooHigh: return 1; - case LDKAPIError_RouteError: return 2; + case LDKAPIError_InvalidRoute: return 2; case LDKAPIError_ChannelUnavailable: return 3; case LDKAPIError_MonitorUpdateInProgress: return 4; case LDKAPIError_IncompatibleShutdownScript: return 5; @@ -4426,10 +4607,10 @@ int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate")) int32_t feerate_conv = obj->fee_rate_too_high.feerate; return feerate_conv; } -jstring __attribute__((export_name("TS_LDKAPIError_RouteError_get_err"))) TS_LDKAPIError_RouteError_get_err(uint64_t ptr) { +jstring __attribute__((export_name("TS_LDKAPIError_InvalidRoute_get_err"))) TS_LDKAPIError_InvalidRoute_get_err(uint64_t ptr) { LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - assert(obj->tag == LDKAPIError_RouteError); - LDKStr err_str = obj->route_error.err; + assert(obj->tag == LDKAPIError_InvalidRoute); + LDKStr err_str = obj->invalid_route.err; jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); return err_conv; } @@ -4512,8 +4693,9 @@ uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS switch(obj->tag) { case LDKPaymentSendFailure_ParameterError: return 0; case LDKPaymentSendFailure_PathParameterError: return 1; - case LDKPaymentSendFailure_AllFailedRetrySafe: return 2; - case LDKPaymentSendFailure_PartialFailure: return 3; + case LDKPaymentSendFailure_AllFailedResendSafe: return 2; + case LDKPaymentSendFailure_DuplicatePayment: return 3; + case LDKPaymentSendFailure_PartialFailure: return 4; default: abort(); } } @@ -4539,19 +4721,19 @@ uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PathParameter return path_parameter_error_arr; } -uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe"))) TS_LDKPaymentSendFailure_AllFailedRetrySafe_get_all_failed_retry_safe(uint64_t ptr) { +uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe"))) TS_LDKPaymentSendFailure_AllFailedResendSafe_get_all_failed_resend_safe(uint64_t ptr) { LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr); - assert(obj->tag == LDKPaymentSendFailure_AllFailedRetrySafe); - LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe; - uint64_tArray all_failed_retry_safe_arr = NULL; - all_failed_retry_safe_arr = init_uint64_tArray(all_failed_retry_safe_var.datalen, __LINE__); - uint64_t *all_failed_retry_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_retry_safe_arr) + 8); - for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) { - uint64_t all_failed_retry_safe_conv_10_ref = tag_ptr(&all_failed_retry_safe_var.data[k], false); - all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref; + assert(obj->tag == LDKPaymentSendFailure_AllFailedResendSafe); + LDKCVec_APIErrorZ all_failed_resend_safe_var = obj->all_failed_resend_safe; + uint64_tArray all_failed_resend_safe_arr = NULL; + all_failed_resend_safe_arr = init_uint64_tArray(all_failed_resend_safe_var.datalen, __LINE__); + uint64_t *all_failed_resend_safe_arr_ptr = (uint64_t*)(((uint8_t*)all_failed_resend_safe_arr) + 8); + for (size_t k = 0; k < all_failed_resend_safe_var.datalen; k++) { + uint64_t all_failed_resend_safe_conv_10_ref = tag_ptr(&all_failed_resend_safe_var.data[k], false); + all_failed_resend_safe_arr_ptr[k] = all_failed_resend_safe_conv_10_ref; } - return all_failed_retry_safe_arr; + return all_failed_resend_safe_arr; } uint64_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_get_results"))) TS_LDKPaymentSendFailure_PartialFailure_get_results(uint64_t ptr) { LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr); @@ -4585,46 +4767,46 @@ int8_tArray __attribute__((export_name("TS_LDKPaymentSendFailure_PartialFailure_ memcpy(payment_id_arr->elems, obj->partial_failure.payment_id.data, 32); return payment_id_arr; } -static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentSendFailureZ_get_ok(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){ +static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return ThirtyTwoBytes_clone(&*owner->contents.result); + return *owner->contents.result; } -int8_tArray __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_ok(uint64_t owner) { - LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, CResult_PaymentIdPaymentSendFailureZ_get_ok(owner_conv).data, 32); - return ret_arr; +void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) { + LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner); + CResult_NonePaymentSendFailureZ_get_ok(owner_conv); } -static inline struct LDKPaymentSendFailure CResult_PaymentIdPaymentSendFailureZ_get_err(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR owner){ +static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return PaymentSendFailure_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_get_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_get_err(uint64_t owner) { - LDKCResult_PaymentIdPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(owner); +uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) { + LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner); LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = CResult_PaymentIdPaymentSendFailureZ_get_err(owner_conv); + *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline void CResult_NonePaymentSendFailureZ_get_ok(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){ +static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return *owner->contents.result; + return ThirtyTwoBytes_clone(&*owner->contents.result); } -void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_ok"))) TS_CResult_NonePaymentSendFailureZ_get_ok(uint64_t owner) { - LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner); - CResult_NonePaymentSendFailureZ_get_ok(owner_conv); +int8_tArray __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_ok(uint64_t owner) { + LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, CResult_PaymentHashPaymentSendFailureZ_get_ok(owner_conv).data, 32); + return ret_arr; } -static inline struct LDKPaymentSendFailure CResult_NonePaymentSendFailureZ_get_err(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR owner){ +static inline struct LDKPaymentSendFailure CResult_PaymentHashPaymentSendFailureZ_get_err(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return PaymentSendFailure_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err"))) TS_CResult_NonePaymentSendFailureZ_get_err(uint64_t owner) { - LDKCResult_NonePaymentSendFailureZ* owner_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(owner); +uint64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_get_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_get_err(uint64_t owner) { + LDKCResult_PaymentHashPaymentSendFailureZ* owner_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(owner); LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = CResult_NonePaymentSendFailureZ_get_err(owner_conv); + *ret_copy = CResult_PaymentHashPaymentSendFailureZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -5169,11 +5351,24 @@ LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* t CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); return ret_conv; } -LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) { +LDKThirtyTwoBytes generate_channel_keys_id_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; jboolean inbound_conv = inbound; int64_t channel_value_satoshis_conv = channel_value_satoshis; - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 26, inbound_conv, channel_value_satoshis_conv, 0, 0, 0, 0); + int8_tArray user_channel_id_arr = init_int8_tArray(16, __LINE__); + memcpy(user_channel_id_arr->elems, user_channel_id.le_bytes, 16); + int8_tArray ret = (int8_tArray)js_invoke_function_ubuuuu(j_calls->instance_ptr, 26, inbound_conv, channel_value_satoshis_conv, (uint32_t)user_channel_id_arr, 0, 0, 0); + LDKThirtyTwoBytes ret_ref; + CHECK(ret->arr_len == 32); + memcpy(ret_ref.data, ret->elems, 32); FREE(ret); + return ret_ref; +} +LDKSign derive_channel_signer_LDKKeysInterface_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + int64_t channel_value_satoshis_conv = channel_value_satoshis; + int8_tArray channel_keys_id_arr = init_int8_tArray(32, __LINE__); + memcpy(channel_keys_id_arr->elems, channel_keys_id.data, 32); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 27, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKSign ret_conv = *(LDKSign*)(ret_ptr); @@ -5182,7 +5377,7 @@ LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inb } LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 27, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, 0, 0, 0, 0, 0, 0); LDKThirtyTwoBytes ret_ref; CHECK(ret->arr_len == 32); memcpy(ret_ref.data, ret->elems, 32); FREE(ret); @@ -5193,19 +5388,19 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* LDKu8slice reader_var = reader; int8_tArray reader_arr = init_int8_tArray(reader_var.datalen, __LINE__); memcpy(reader_arr->elems, reader_var.data, reader_var.datalen); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 28, (uint32_t)reader_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_u5Z invoice_data, LDKRecipient receipient) { +LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient receipient) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; LDKu8slice hrp_bytes_var = hrp_bytes; int8_tArray hrp_bytes_arr = init_int8_tArray(hrp_bytes_var.datalen, __LINE__); memcpy(hrp_bytes_arr->elems, hrp_bytes_var.data, hrp_bytes_var.datalen); - LDKCVec_u5Z invoice_data_var = invoice_data; + LDKCVec_U5Z invoice_data_var = invoice_data; ptrArray invoice_data_arr = NULL; invoice_data_arr = init_ptrArray(invoice_data_var.datalen, __LINE__); int8_t *invoice_data_arr_ptr = (int8_t*)(((uint8_t*)invoice_data_arr) + 8); @@ -5216,7 +5411,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v FREE(invoice_data_var.data); uint32_t receipient_conv = LDKRecipient_to_js(receipient); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 29, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, receipient_conv, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, receipient_conv, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr); @@ -5225,7 +5420,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v } LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0); LDKThirtyTwoBytes ret_ref; CHECK(ret->arr_len == 32); memcpy(ret_ref.data, ret->elems, 32); FREE(ret); @@ -5247,7 +5442,8 @@ static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) { .ecdh = ecdh_LDKKeysInterface_jcall, .get_destination_script = get_destination_script_LDKKeysInterface_jcall, .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKKeysInterface_jcall, - .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall, + .generate_channel_keys_id = generate_channel_keys_id_LDKKeysInterface_jcall, + .derive_channel_signer = derive_channel_signer_LDKKeysInterface_jcall, .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, .sign_invoice = sign_invoice_LDKKeysInterface_jcall, @@ -5320,12 +5516,27 @@ uint64_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey return ret_ref; } -uint64_t __attribute__((export_name("TS_KeysInterface_get_channel_signer"))) TS_KeysInterface_get_channel_signer(uint64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) { +int8_tArray __attribute__((export_name("TS_KeysInterface_generate_channel_keys_id"))) TS_KeysInterface_generate_channel_keys_id(uint64_t this_arg, jboolean inbound, int64_t channel_value_satoshis, int8_tArray user_channel_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKU128 user_channel_id_ref; + CHECK(user_channel_id->arr_len == 16); + memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, (this_arg_conv->generate_channel_keys_id)(this_arg_conv->this_arg, inbound, channel_value_satoshis, user_channel_id_ref).data, 32); + return ret_arr; +} + +uint64_t __attribute__((export_name("TS_KeysInterface_derive_channel_signer"))) TS_KeysInterface_derive_channel_signer(uint64_t this_arg, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + LDKThirtyTwoBytes channel_keys_id_ref; + CHECK(channel_keys_id->arr_len == 32); + memcpy(channel_keys_id_ref.data, channel_keys_id->elems, 32); FREE(channel_keys_id); LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis); + *ret_ret = (this_arg_conv->derive_channel_signer)(this_arg_conv->this_arg, channel_value_satoshis, channel_keys_id_ref); return tag_ptr(ret_ret, true); } @@ -5358,17 +5569,17 @@ uint64_t __attribute__((export_name("TS_KeysInterface_sign_invoice"))) TS_KeysI LDKu8slice hrp_bytes_ref; hrp_bytes_ref.datalen = hrp_bytes->arr_len; hrp_bytes_ref.data = hrp_bytes->elems; - LDKCVec_u5Z invoice_data_constr; + LDKCVec_U5Z invoice_data_constr; invoice_data_constr.datalen = invoice_data->arr_len; if (invoice_data_constr.datalen > 0) - invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements"); + invoice_data_constr.data = MALLOC(invoice_data_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements"); else invoice_data_constr.data = NULL; int8_t* invoice_data_vals = (void*) invoice_data->elems; for (size_t h = 0; h < invoice_data_constr.datalen; h++) { int8_t invoice_data_conv_7 = invoice_data_vals[h]; - invoice_data_constr.data[h] = (LDKu5){ ._0 = invoice_data_conv_7 }; + invoice_data_constr.data[h] = (LDKU5){ ._0 = invoice_data_conv_7 }; } FREE(invoice_data); LDKRecipient receipient_conv = LDKRecipient_from_js(receipient); @@ -5400,7 +5611,7 @@ static void LDKFeeEstimator_JCalls_free(void* this_arg) { uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) { LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg; uint32_t confirmation_target_conv = LDKConfirmationTarget_to_js(confirmation_target); - return js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, confirmation_target_conv, 0, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, confirmation_target_conv, 0, 0, 0, 0, 0); } static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) { LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg; @@ -5542,17 +5753,17 @@ static void LDKType_JCalls_free(void* this_arg) { } uint16_t type_id_LDKType_jcall(const void* this_arg) { LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg; - return js_invoke_function_uuuuuu(j_calls->instance_ptr, 32, 0, 0, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0); } LDKStr debug_str_LDKType_jcall(const void* this_arg) { LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg; - jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 33, 0, 0, 0, 0, 0, 0); + jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0); LDKStr ret_conv = str_ref_to_owned_c(ret); return ret_conv; } LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) { LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg; - int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 34, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0); LDKCVec_u8Z ret_ref; ret_ref.datalen = ret->arr_len; ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); @@ -5705,542 +5916,225 @@ uint64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_get_err" return ret_ref; } -static inline struct LDKInFlightHtlcs CResult_InFlightHtlcsDecodeErrorZ_get_ok(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){ - LDKInFlightHtlcs ret = *owner->contents.result; - ret.is_owned = false; - return ret; +static inline void CResult_NonePaymentErrorZ_get_ok(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; } -uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner); - LDKInFlightHtlcs ret_var = CResult_InFlightHtlcsDecodeErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; +void __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_ok"))) TS_CResult_NonePaymentErrorZ_get_ok(uint64_t owner) { + LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner); + CResult_NonePaymentErrorZ_get_ok(owner_conv); } -static inline struct LDKDecodeError CResult_InFlightHtlcsDecodeErrorZ_get_err(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKPaymentError CResult_NonePaymentErrorZ_get_err(LDKCResult_NonePaymentErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); + return PaymentError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_get_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_InFlightHtlcsDecodeErrorZ* owner_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_InFlightHtlcsDecodeErrorZ_get_err(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_NonePaymentErrorZ_get_err"))) TS_CResult_NonePaymentErrorZ_get_err(uint64_t owner) { + LDKCResult_NonePaymentErrorZ* owner_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(owner); + LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); + *ret_copy = CResult_NonePaymentErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) { - LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); - switch(obj->tag) { - case LDKParseError_Bech32Error: return 0; - case LDKParseError_ParseAmountError: return 1; - case LDKParseError_MalformedSignature: return 2; - case LDKParseError_BadPrefix: return 3; - case LDKParseError_UnknownCurrency: return 4; - case LDKParseError_UnknownSiPrefix: return 5; - case LDKParseError_MalformedHRP: return 6; - case LDKParseError_TooShortDataPart: return 7; - case LDKParseError_UnexpectedEndOfTaggedFields: return 8; - case LDKParseError_DescriptionDecodeError: return 9; - case LDKParseError_PaddingError: return 10; - case LDKParseError_IntegerOverflowError: return 11; - case LDKParseError_InvalidSegWitProgramLength: return 12; - case LDKParseError_InvalidPubKeyHashLength: return 13; - case LDKParseError_InvalidScriptHashLength: return 14; - case LDKParseError_InvalidRecoveryId: return 15; - case LDKParseError_InvalidSliceLength: return 16; - case LDKParseError_Skip: return 17; - default: abort(); - } -} -uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) { - LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); - assert(obj->tag == LDKParseError_Bech32Error); - uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false); - return bech32_error_ref; -} -int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) { - LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); - assert(obj->tag == LDKParseError_ParseAmountError); - /*obj->parse_amount_error*/ - return 0; -} -uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) { - LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); - assert(obj->tag == LDKParseError_MalformedSignature); - uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature); - return malformed_signature_conv; -} -int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) { - LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); - assert(obj->tag == LDKParseError_DescriptionDecodeError); - /*obj->description_decode_error*/ - return 0; -} -jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) { - LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); - assert(obj->tag == LDKParseError_InvalidSliceLength); - LDKStr invalid_slice_length_str = obj->invalid_slice_length; - jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len); - return invalid_slice_length_conv; -} -static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ +static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return SiPrefix_clone(&*owner->contents.result); + return *owner->contents.result; } -uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) { - LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv)); +jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) { + LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner); + LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv); + jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len); return ret_conv; } -static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ +static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return ParseError_clone(&*owner->contents.err); + return *owner->contents.err; } -uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) { - LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner); - LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); - *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) { + LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv)); + return ret_conv; } -uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) { - LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr); - switch(obj->tag) { - case LDKParseOrSemanticError_ParseError: return 0; - case LDKParseOrSemanticError_SemanticError: return 1; - default: abort(); - } +static inline struct LDKPublicKey CResult_PublicKeyErrorZ_get_ok(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; } -uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) { - LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr); - assert(obj->tag == LDKParseOrSemanticError_ParseError); - uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false); - return parse_error_ref; +int8_tArray __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_ok"))) TS_CResult_PublicKeyErrorZ_get_ok(uint64_t owner) { + LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(33, __LINE__); + memcpy(ret_arr->elems, CResult_PublicKeyErrorZ_get_ok(owner_conv).compressed_form, 33); + return ret_arr; } -uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) { - LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr); - assert(obj->tag == LDKParseOrSemanticError_SemanticError); - uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error); - return semantic_error_conv; + +static inline enum LDKSecp256k1Error CResult_PublicKeyErrorZ_get_err(LDKCResult_PublicKeyErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; } -static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ - LDKInvoice ret = *owner->contents.result; +uint32_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_get_err"))) TS_CResult_PublicKeyErrorZ_get_err(uint64_t owner) { + LDKCResult_PublicKeyErrorZ* owner_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PublicKeyErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){ + LDKChannelMonitorUpdate ret = *owner->contents.result; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) { - LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner); - LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner); + LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return ParseOrSemanticError_clone(&*owner->contents.err); + return DecodeError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) { - LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner); - LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); - *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ - LDKSignedRawInvoice ret = *owner->contents.result; - ret.is_owned = false; - return ret; +uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) { + LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_MonitorEventZ_Some: return 0; + case LDKCOption_MonitorEventZ_None: return 1; + default: abort(); + } } -uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) { - LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner); - LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); +uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) { + LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_MonitorEventZ_Some); + uint64_t some_ref = tag_ptr(&obj->some, false); + return some_ref; +} +static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_MonitorEventZ_clone(&*owner->contents.result); +} +uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); + *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return ParseError_clone(&*owner->contents.err); + return DecodeError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) { - LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner); - LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); - *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ - LDKRawInvoice ret = owner->a; +static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){ + LDKHTLCUpdate ret = *owner->contents.result; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) { - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner); - LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner); + LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ - return ThirtyTwoBytes_clone(&owner->b); +static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); } -int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) { - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32); - return ret_arr; +uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; } -static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ - LDKInvoiceSignature ret = owner->c; +static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){ + LDKOutPoint ret = owner->a; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) { - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner); - LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv); +uint64_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) { + LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner); + LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){ - LDKPayeePubKey ret = *owner->contents.result; - ret.is_owned = false; - return ret; +static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){ + return CVec_u8Z_clone(&owner->b); } -uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) { - LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner); - LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; +int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) { + LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner); + LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; } -static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; +static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){ + return owner->a; } -uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) { - LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv)); +int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) { + LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner); + int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv); return ret_conv; } -static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) { - LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen }; +static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){ + return CVec_u8Z_clone(&owner->b); +} +int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) { + LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner); + LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) { + LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = PrivateRoute_clone(&orig->data[i]); + ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]); } return ret; } -static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){ - LDKPositiveTimestamp ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) { - LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner); - LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return CreationError_clone(&*owner->contents.err); +static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){ + return ThirtyTwoBytes_clone(&owner->a); } -uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) { - LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv)); - return ret_conv; +int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) { + LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32); + return ret_arr; } -static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) { - LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner); - CResult_NoneSemanticErrorZ_get_ok(owner_conv); -} - -static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return SemanticError_clone(&*owner->contents.err); -} -uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) { - LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv)); - return ret_conv; -} - -static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){ - LDKInvoice ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) { - LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner); - LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return SemanticError_clone(&*owner->contents.err); -} -uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) { - LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv)); - return ret_conv; -} - -static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){ - LDKDescription ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) { - LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner); - LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return CreationError_clone(&*owner->contents.err); -} -uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) { - LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv)); - return ret_conv; -} - -static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){ - LDKPrivateRoute ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) { - LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner); - LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return CreationError_clone(&*owner->contents.err); -} -uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) { - LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv)); - return ret_conv; -} - -static inline struct LDKStr CResult_StringErrorZ_get_ok(LDKCResult_StringErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -jstring __attribute__((export_name("TS_CResult_StringErrorZ_get_ok"))) TS_CResult_StringErrorZ_get_ok(uint64_t owner) { - LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner); - LDKStr ret_str = CResult_StringErrorZ_get_ok(owner_conv); - jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len); - return ret_conv; -} - -static inline enum LDKSecp256k1Error CResult_StringErrorZ_get_err(LDKCResult_StringErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -uint32_t __attribute__((export_name("TS_CResult_StringErrorZ_get_err"))) TS_CResult_StringErrorZ_get_err(uint64_t owner) { - LDKCResult_StringErrorZ* owner_conv = (LDKCResult_StringErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_StringErrorZ_get_err(owner_conv)); - return ret_conv; -} - -static inline struct LDKChannelMonitorUpdate CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){ - LDKChannelMonitorUpdate ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner); - LDKChannelMonitorUpdate ret_var = CResult_ChannelMonitorUpdateDecodeErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKDecodeError CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* owner_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ChannelMonitorUpdateDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -uint32_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_ty_from_ptr"))) TS_LDKCOption_MonitorEventZ_ty_from_ptr(uint64_t ptr) { - LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr); - switch(obj->tag) { - case LDKCOption_MonitorEventZ_Some: return 0; - case LDKCOption_MonitorEventZ_None: return 1; - default: abort(); - } -} -uint64_t __attribute__((export_name("TS_LDKCOption_MonitorEventZ_Some_get_some"))) TS_LDKCOption_MonitorEventZ_Some_get_some(uint64_t ptr) { - LDKCOption_MonitorEventZ *obj = (LDKCOption_MonitorEventZ*)untag_ptr(ptr); - assert(obj->tag == LDKCOption_MonitorEventZ_Some); - uint64_t some_ref = tag_ptr(&obj->some, false); - return some_ref; -} -static inline struct LDKCOption_MonitorEventZ CResult_COption_MonitorEventZDecodeErrorZ_get_ok(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return COption_MonitorEventZ_clone(&*owner->contents.result); -} -uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner); - LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); - *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_ok(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKDecodeError CResult_COption_MonitorEventZDecodeErrorZ_get_err(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_COption_MonitorEventZDecodeErrorZ* owner_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_COption_MonitorEventZDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKHTLCUpdate CResult_HTLCUpdateDecodeErrorZ_get_ok(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){ - LDKHTLCUpdate ret = *owner->contents.result; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner); - LDKHTLCUpdate ret_var = CResult_HTLCUpdateDecodeErrorZ_get_ok(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKDecodeError CResult_HTLCUpdateDecodeErrorZ_get_err(LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_get_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_HTLCUpdateDecodeErrorZ* owner_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_HTLCUpdateDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){ - LDKOutPoint ret = owner->a; - ret.is_owned = false; - return ret; -} -uint64_t __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_a"))) TS_C2Tuple_OutPointScriptZ_get_a(uint64_t owner) { - LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner); - LDKOutPoint ret_var = C2Tuple_OutPointScriptZ_get_a(owner_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -static inline struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR owner){ - return CVec_u8Z_clone(&owner->b); -} -int8_tArray __attribute__((export_name("TS_C2Tuple_OutPointScriptZ_get_b"))) TS_C2Tuple_OutPointScriptZ_get_b(uint64_t owner) { - LDKC2Tuple_OutPointScriptZ* owner_conv = (LDKC2Tuple_OutPointScriptZ*)untag_ptr(owner); - LDKCVec_u8Z ret_var = C2Tuple_OutPointScriptZ_get_b(owner_conv); - int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); - memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -static inline uint32_t C2Tuple_u32ScriptZ_get_a(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){ - return owner->a; -} -int32_t __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_a"))) TS_C2Tuple_u32ScriptZ_get_a(uint64_t owner) { - LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner); - int32_t ret_conv = C2Tuple_u32ScriptZ_get_a(owner_conv); - return ret_conv; -} - -static inline struct LDKCVec_u8Z C2Tuple_u32ScriptZ_get_b(LDKC2Tuple_u32ScriptZ *NONNULL_PTR owner){ - return CVec_u8Z_clone(&owner->b); -} -int8_tArray __attribute__((export_name("TS_C2Tuple_u32ScriptZ_get_b"))) TS_C2Tuple_u32ScriptZ_get_b(uint64_t owner) { - LDKC2Tuple_u32ScriptZ* owner_conv = (LDKC2Tuple_u32ScriptZ*)untag_ptr(owner); - LDKCVec_u8Z ret_var = C2Tuple_u32ScriptZ_get_b(owner_conv); - int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); - memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) { - LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]); - } - return ret; -} -static inline struct LDKThirtyTwoBytes C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){ - return ThirtyTwoBytes_clone(&owner->a); -} -int8_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(uint64_t owner) { - LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(owner_conv).data, 32); - return ret_arr; -} - -static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){ - return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b); +static inline struct LDKCVec_C2Tuple_u32ScriptZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR owner){ + return CVec_C2Tuple_u32ScriptZZ_clone(&owner->b); } uint64_tArray __attribute__((export_name("TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b"))) TS_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(uint64_t owner) { LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* owner_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)untag_ptr(owner); @@ -6499,11 +6393,11 @@ static void LDKCustomOnionMessageContents_JCalls_free(void* this_arg) { } uint64_t tlv_type_LDKCustomOnionMessageContents_jcall(const void* this_arg) { LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg; - return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 0, 0, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0); } LDKCVec_u8Z write_LDKCustomOnionMessageContents_jcall(const void* this_arg) { LDKCustomOnionMessageContents_JCalls *j_calls = (LDKCustomOnionMessageContents_JCalls*) this_arg; - int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, 0, 0, 0, 0, 0, 0); LDKCVec_u8Z ret_ref; ret_ref.datalen = ret->arr_len; ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); @@ -6688,6 +6582,8 @@ uint32_t __attribute__((export_name("TS_LDKSendError_ty_from_ptr"))) TS_LDKSendE case LDKSendError_InvalidFirstHop: return 3; case LDKSendError_InvalidMessage: return 4; case LDKSendError_BufferFull: return 5; + case LDKSendError_GetNodeIdFailed: return 6; + case LDKSendError_BlindedPathAdvanceFailed: return 7; default: abort(); } } @@ -6763,208 +6659,541 @@ uint64_t __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_get_err"))) return ret_ref; } -static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; +uint32_t __attribute__((export_name("TS_LDKParseError_ty_from_ptr"))) TS_LDKParseError_ty_from_ptr(uint64_t ptr) { + LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); + switch(obj->tag) { + case LDKParseError_Bech32Error: return 0; + case LDKParseError_ParseAmountError: return 1; + case LDKParseError_MalformedSignature: return 2; + case LDKParseError_BadPrefix: return 3; + case LDKParseError_UnknownCurrency: return 4; + case LDKParseError_UnknownSiPrefix: return 5; + case LDKParseError_MalformedHRP: return 6; + case LDKParseError_TooShortDataPart: return 7; + case LDKParseError_UnexpectedEndOfTaggedFields: return 8; + case LDKParseError_DescriptionDecodeError: return 9; + case LDKParseError_PaddingError: return 10; + case LDKParseError_IntegerOverflowError: return 11; + case LDKParseError_InvalidSegWitProgramLength: return 12; + case LDKParseError_InvalidPubKeyHashLength: return 13; + case LDKParseError_InvalidScriptHashLength: return 14; + case LDKParseError_InvalidRecoveryId: return 15; + case LDKParseError_InvalidSliceLength: return 16; + case LDKParseError_Skip: return 17; + default: abort(); + } } -void __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) { - LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner); - CResult_NoneErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_LDKParseError_Bech32Error_get_bech32_error"))) TS_LDKParseError_Bech32Error_get_bech32_error(uint64_t ptr) { + LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); + assert(obj->tag == LDKParseError_Bech32Error); + uint64_t bech32_error_ref = tag_ptr(&obj->bech32_error, false); + return bech32_error_ref; } - -static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; +int32_t __attribute__((export_name("TS_LDKParseError_ParseAmountError_get_parse_amount_error"))) TS_LDKParseError_ParseAmountError_get_parse_amount_error(uint64_t ptr) { + LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); + assert(obj->tag == LDKParseError_ParseAmountError); + /*obj->parse_amount_error*/ + return 0; } -uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) { - LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv)); - return ret_conv; +uint32_t __attribute__((export_name("TS_LDKParseError_MalformedSignature_get_malformed_signature"))) TS_LDKParseError_MalformedSignature_get_malformed_signature(uint64_t ptr) { + LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); + assert(obj->tag == LDKParseError_MalformedSignature); + uint32_t malformed_signature_conv = LDKSecp256k1Error_to_js(obj->malformed_signature); + return malformed_signature_conv; } - -static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){ +int32_t __attribute__((export_name("TS_LDKParseError_DescriptionDecodeError_get_description_decode_error"))) TS_LDKParseError_DescriptionDecodeError_get_description_decode_error(uint64_t ptr) { + LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); + assert(obj->tag == LDKParseError_DescriptionDecodeError); + /*obj->description_decode_error*/ + return 0; +} +jstring __attribute__((export_name("TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length"))) TS_LDKParseError_InvalidSliceLength_get_invalid_slice_length(uint64_t ptr) { + LDKParseError *obj = (LDKParseError*)untag_ptr(ptr); + assert(obj->tag == LDKParseError_InvalidSliceLength); + LDKStr invalid_slice_length_str = obj->invalid_slice_length; + jstring invalid_slice_length_conv = str_ref_to_ts(invalid_slice_length_str.chars, invalid_slice_length_str.len); + return invalid_slice_length_conv; +} +static inline enum LDKSiPrefix CResult_SiPrefixParseErrorZ_get_ok(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return NetAddress_clone(&*owner->contents.result); + return SiPrefix_clone(&*owner->contents.result); } -uint64_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner); - LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); - *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +uint32_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_ok"))) TS_CResult_SiPrefixParseErrorZ_get_ok(uint64_t owner) { + LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKSiPrefix_to_js(CResult_SiPrefixParseErrorZ_get_ok(owner_conv)); + return ret_conv; } -static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKParseError CResult_SiPrefixParseErrorZ_get_err(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); + return ParseError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_get_err"))) TS_CResult_SiPrefixParseErrorZ_get_err(uint64_t owner) { + LDKCResult_SiPrefixParseErrorZ* owner_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(owner); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = CResult_SiPrefixParseErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) { - LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]); - } - return ret; -} -static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) { - LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]); +uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_ty_from_ptr"))) TS_LDKParseOrSemanticError_ty_from_ptr(uint64_t ptr) { + LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr); + switch(obj->tag) { + case LDKParseOrSemanticError_ParseError: return 0; + case LDKParseOrSemanticError_SemanticError: return 1; + default: abort(); } - return ret; } -static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) { - LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]); - } - return ret; +uint64_t __attribute__((export_name("TS_LDKParseOrSemanticError_ParseError_get_parse_error"))) TS_LDKParseOrSemanticError_ParseError_get_parse_error(uint64_t ptr) { + LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr); + assert(obj->tag == LDKParseOrSemanticError_ParseError); + uint64_t parse_error_ref = tag_ptr(&obj->parse_error, false); + return parse_error_ref; } -static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) { - LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]); - } - return ret; +uint32_t __attribute__((export_name("TS_LDKParseOrSemanticError_SemanticError_get_semantic_error"))) TS_LDKParseOrSemanticError_SemanticError_get_semantic_error(uint64_t ptr) { + LDKParseOrSemanticError *obj = (LDKParseOrSemanticError*)untag_ptr(ptr); + assert(obj->tag == LDKParseOrSemanticError_SemanticError); + uint32_t semantic_error_conv = LDKSemanticError_to_js(obj->semantic_error); + return semantic_error_conv; } -static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){ - LDKAcceptChannel ret = *owner->contents.result; +static inline struct LDKInvoice CResult_InvoiceParseOrSemanticErrorZ_get_ok(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ + LDKInvoice ret = *owner->contents.result; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner); - LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_ok(uint64_t owner) { + LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner); + LDKInvoice ret_var = CResult_InvoiceParseOrSemanticErrorZ_get_ok(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKParseOrSemanticError CResult_InvoiceParseOrSemanticErrorZ_get_err(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); + return ParseOrSemanticError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_get_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_get_err(uint64_t owner) { + LDKCResult_InvoiceParseOrSemanticErrorZ* owner_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(owner); + LDKParseOrSemanticError *ret_copy = MALLOC(sizeof(LDKParseOrSemanticError), "LDKParseOrSemanticError"); + *ret_copy = CResult_InvoiceParseOrSemanticErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKAnnouncementSignatures ret = *owner->contents.result; +static inline struct LDKSignedRawInvoice CResult_SignedRawInvoiceParseErrorZ_get_ok(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ + LDKSignedRawInvoice ret = *owner->contents.result; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner); - LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_ok(uint64_t owner) { + LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner); + LDKSignedRawInvoice ret_var = CResult_SignedRawInvoiceParseErrorZ_get_ok(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKParseError CResult_SignedRawInvoiceParseErrorZ_get_err(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); + return ParseError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_get_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_get_err(uint64_t owner) { + LDKCResult_SignedRawInvoiceParseErrorZ* owner_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(owner); + LDKParseError *ret_copy = MALLOC(sizeof(LDKParseError), "LDKParseError"); + *ret_copy = CResult_SignedRawInvoiceParseErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){ - LDKChannelReestablish ret = *owner->contents.result; +static inline struct LDKRawInvoice C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ + LDKRawInvoice ret = owner->a; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner); - LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(uint64_t owner) { + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner); + LDKRawInvoice ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); +static inline struct LDKThirtyTwoBytes C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ + return ThirtyTwoBytes_clone(&owner->b); } -uint64_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +int8_tArray __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(uint64_t owner) { + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(owner_conv).data, 32); + return ret_arr; } -static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){ - LDKClosingSigned ret = *owner->contents.result; +static inline struct LDKInvoiceSignature C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR owner){ + LDKInvoiceSignature ret = owner->c; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner); - LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(uint64_t owner) { + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* owner_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(owner); + LDKInvoiceSignature ret_var = C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); -} -uint64_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){ - LDKClosingSignedFeeRange ret = *owner->contents.result; +static inline struct LDKPayeePubKey CResult_PayeePubKeyErrorZ_get_ok(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){ + LDKPayeePubKey ret = *owner->contents.result; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner); - LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_ok"))) TS_CResult_PayeePubKeyErrorZ_get_ok(uint64_t owner) { + LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner); + LDKPayeePubKey ret_var = CResult_PayeePubKeyErrorZ_get_ok(owner_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); return ret_ref; } -static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){ +static inline enum LDKSecp256k1Error CResult_PayeePubKeyErrorZ_get_err(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); - return DecodeError_clone(&*owner->contents.err); + return *owner->contents.err; } -uint64_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner); - LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +uint32_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_get_err"))) TS_CResult_PayeePubKeyErrorZ_get_err(uint64_t owner) { + LDKCResult_PayeePubKeyErrorZ* owner_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKSecp256k1Error_to_js(CResult_PayeePubKeyErrorZ_get_err(owner_conv)); + return ret_conv; } -static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){ +static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) { + LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = PrivateRoute_clone(&orig->data[i]); + } + return ret; +} +static inline struct LDKPositiveTimestamp CResult_PositiveTimestampCreationErrorZ_get_ok(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){ + LDKPositiveTimestamp ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_get_ok(uint64_t owner) { + LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner); + LDKPositiveTimestamp ret_var = CResult_PositiveTimestampCreationErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline enum LDKCreationError CResult_PositiveTimestampCreationErrorZ_get_err(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return CreationError_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_get_err"))) TS_CResult_PositiveTimestampCreationErrorZ_get_err(uint64_t owner) { + LDKCResult_PositiveTimestampCreationErrorZ* owner_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKCreationError_to_js(CResult_PositiveTimestampCreationErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static inline void CResult_NoneSemanticErrorZ_get_ok(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_ok"))) TS_CResult_NoneSemanticErrorZ_get_ok(uint64_t owner) { + LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner); + CResult_NoneSemanticErrorZ_get_ok(owner_conv); +} + +static inline enum LDKSemanticError CResult_NoneSemanticErrorZ_get_err(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return SemanticError_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_get_err"))) TS_CResult_NoneSemanticErrorZ_get_err(uint64_t owner) { + LDKCResult_NoneSemanticErrorZ* owner_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKSemanticError_to_js(CResult_NoneSemanticErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static inline struct LDKInvoice CResult_InvoiceSemanticErrorZ_get_ok(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){ + LDKInvoice ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_ok"))) TS_CResult_InvoiceSemanticErrorZ_get_ok(uint64_t owner) { + LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner); + LDKInvoice ret_var = CResult_InvoiceSemanticErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline enum LDKSemanticError CResult_InvoiceSemanticErrorZ_get_err(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return SemanticError_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_get_err"))) TS_CResult_InvoiceSemanticErrorZ_get_err(uint64_t owner) { + LDKCResult_InvoiceSemanticErrorZ* owner_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKSemanticError_to_js(CResult_InvoiceSemanticErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static inline struct LDKDescription CResult_DescriptionCreationErrorZ_get_ok(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){ + LDKDescription ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_ok"))) TS_CResult_DescriptionCreationErrorZ_get_ok(uint64_t owner) { + LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner); + LDKDescription ret_var = CResult_DescriptionCreationErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline enum LDKCreationError CResult_DescriptionCreationErrorZ_get_err(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return CreationError_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_get_err"))) TS_CResult_DescriptionCreationErrorZ_get_err(uint64_t owner) { + LDKCResult_DescriptionCreationErrorZ* owner_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKCreationError_to_js(CResult_DescriptionCreationErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static inline struct LDKPrivateRoute CResult_PrivateRouteCreationErrorZ_get_ok(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){ + LDKPrivateRoute ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_ok"))) TS_CResult_PrivateRouteCreationErrorZ_get_ok(uint64_t owner) { + LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner); + LDKPrivateRoute ret_var = CResult_PrivateRouteCreationErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline enum LDKCreationError CResult_PrivateRouteCreationErrorZ_get_err(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return CreationError_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_get_err"))) TS_CResult_PrivateRouteCreationErrorZ_get_err(uint64_t owner) { + LDKCResult_PrivateRouteCreationErrorZ* owner_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKCreationError_to_js(CResult_PrivateRouteCreationErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static inline void CResult_NoneErrorZ_get_ok(LDKCResult_NoneErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +void __attribute__((export_name("TS_CResult_NoneErrorZ_get_ok"))) TS_CResult_NoneErrorZ_get_ok(uint64_t owner) { + LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner); + CResult_NoneErrorZ_get_ok(owner_conv); +} + +static inline enum LDKIOError CResult_NoneErrorZ_get_err(LDKCResult_NoneErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +uint32_t __attribute__((export_name("TS_CResult_NoneErrorZ_get_err"))) TS_CResult_NoneErrorZ_get_err(uint64_t owner) { + LDKCResult_NoneErrorZ* owner_conv = (LDKCResult_NoneErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKIOError_to_js(CResult_NoneErrorZ_get_err(owner_conv)); + return ret_conv; +} + +static inline struct LDKNetAddress CResult_NetAddressDecodeErrorZ_get_ok(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return NetAddress_clone(&*owner->contents.result); +} +uint64_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_ok"))) TS_CResult_NetAddressDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner); + LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); + *ret_copy = CResult_NetAddressDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_NetAddressDecodeErrorZ_get_err(LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_NetAddressDecodeErrorZ_get_err"))) TS_CResult_NetAddressDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_NetAddressDecodeErrorZ* owner_conv = (LDKCResult_NetAddressDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_NetAddressDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) { + LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]); + } + return ret; +} +static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) { + LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]); + } + return ret; +} +static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) { + LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]); + } + return ret; +} +static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) { + LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]); + } + return ret; +} +static inline struct LDKAcceptChannel CResult_AcceptChannelDecodeErrorZ_get_ok(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){ + LDKAcceptChannel ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_ok"))) TS_CResult_AcceptChannelDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner); + LDKAcceptChannel ret_var = CResult_AcceptChannelDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_AcceptChannelDecodeErrorZ_get_err(LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_AcceptChannelDecodeErrorZ_get_err"))) TS_CResult_AcceptChannelDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_AcceptChannelDecodeErrorZ* owner_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_AcceptChannelDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKAnnouncementSignatures CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKAnnouncementSignatures ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner); + LDKAnnouncementSignatures ret_var = CResult_AnnouncementSignaturesDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_AnnouncementSignaturesDecodeErrorZ_get_err(LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err"))) TS_CResult_AnnouncementSignaturesDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_AnnouncementSignaturesDecodeErrorZ* owner_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_AnnouncementSignaturesDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKChannelReestablish CResult_ChannelReestablishDecodeErrorZ_get_ok(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){ + LDKChannelReestablish ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_ok"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner); + LDKChannelReestablish ret_var = CResult_ChannelReestablishDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ChannelReestablishDecodeErrorZ_get_err(LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_ChannelReestablishDecodeErrorZ_get_err"))) TS_CResult_ChannelReestablishDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_ChannelReestablishDecodeErrorZ* owner_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_ChannelReestablishDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKClosingSigned CResult_ClosingSignedDecodeErrorZ_get_ok(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){ + LDKClosingSigned ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner); + LDKClosingSigned ret_var = CResult_ClosingSignedDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ClosingSignedDecodeErrorZ_get_err(LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_ClosingSignedDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_ClosingSignedDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_ClosingSignedDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKClosingSignedFeeRange CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){ + LDKClosingSignedFeeRange ret = *owner->contents.result; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner); + LDKClosingSignedFeeRange ret_var = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err"))) TS_CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* owner_conv = (LDKCResult_ClosingSignedFeeRangeDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_ClosingSignedFeeRangeDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKCommitmentSigned CResult_CommitmentSignedDecodeErrorZ_get_ok(LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR owner){ LDKCommitmentSigned ret = *owner->contents.result; ret.is_owned = false; return ret; @@ -7775,7 +8004,7 @@ void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32 LDKu8slice script_pubkey_var = script_pubkey; int8_tArray script_pubkey_arr = init_int8_tArray(script_pubkey_var.datalen, __LINE__); memcpy(script_pubkey_arr->elems, script_pubkey_var.data, script_pubkey_var.datalen); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 37, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0); } void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg; @@ -7783,7 +8012,7 @@ void register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput outp uint64_t output_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(output_var); output_ref = tag_ptr(output_var.inner, output_var.is_owned); - js_invoke_function_buuuuu(j_calls->instance_ptr, 38, output_ref, 0, 0, 0, 0, 0); + js_invoke_function_buuuuu(j_calls->instance_ptr, 39, output_ref, 0, 0, 0, 0, 0); } static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) { LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg; @@ -7884,6 +8113,55 @@ static inline LDKCVec_OutPointZ CVec_OutPointZ_clone(const LDKCVec_OutPointZ *or } return ret; } +static inline LDKCVec_MonitorUpdateIdZ CVec_MonitorUpdateIdZ_clone(const LDKCVec_MonitorUpdateIdZ *orig) { + LDKCVec_MonitorUpdateIdZ ret = { .data = MALLOC(sizeof(LDKMonitorUpdateId) * orig->datalen, "LDKCVec_MonitorUpdateIdZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = MonitorUpdateId_clone(&orig->data[i]); + } + return ret; +} +static inline struct LDKOutPoint C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){ + LDKOutPoint ret = owner->a; + ret.is_owned = false; + return ret; +} +uint64_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(uint64_t owner) { + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner); + LDKOutPoint ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_a(owner_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline struct LDKCVec_MonitorUpdateIdZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR owner){ + return CVec_MonitorUpdateIdZ_clone(&owner->b); +} +uint64_tArray __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(uint64_t owner) { + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* owner_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(owner); + LDKCVec_MonitorUpdateIdZ ret_var = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_get_b(owner_conv); + uint64_tArray ret_arr = NULL; + ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__); + uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8); + for (size_t r = 0; r < ret_var.datalen; r++) { + LDKMonitorUpdateId ret_conv_17_var = ret_var.data[r]; + uint64_t ret_conv_17_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_17_var); + ret_conv_17_ref = tag_ptr(ret_conv_17_var.inner, ret_conv_17_var.is_owned); + ret_arr_ptr[r] = ret_conv_17_ref; + } + + FREE(ret_var.data); + return ret_arr; +} + +static inline LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_clone(const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ *orig) { + LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ) * orig->datalen, "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(&orig->data[i]); + } + return ret; +} typedef struct LDKMessageSendEventsProvider_JCalls { atomic_size_t refcnt; uint32_t instance_ptr; @@ -7896,7 +8174,7 @@ static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) { } LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) { LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg; - uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 0, 0, 0, 0, 0, 0); + uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, 0, 0, 0, 0, 0, 0); LDKCVec_MessageSendEventZ ret_constr; ret_constr.datalen = ret->arr_len; if (ret_constr.datalen > 0) @@ -7969,7 +8247,7 @@ LDKOnionMessage next_onion_message_for_peer_LDKOnionMessageProvider_jcall(const LDKOnionMessageProvider_JCalls *j_calls = (LDKOnionMessageProvider_JCalls*) this_arg; int8_tArray peer_node_id_arr = init_int8_tArray(33, __LINE__); memcpy(peer_node_id_arr->elems, peer_node_id.compressed_form, 33); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 41, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0); LDKOnionMessage ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -8021,12 +8299,12 @@ static void LDKEventHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) { +void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) { LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg; - LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion"); - *ret_event = Event_clone(event); - uint64_t ref_event = tag_ptr(ret_event, true); - js_invoke_function_buuuuu(j_calls->instance_ptr, 41, ref_event, 0, 0, 0, 0, 0); + LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *event_copy = event; + uint64_t event_ref = tag_ptr(event_copy, true); + js_invoke_function_buuuuu(j_calls->instance_ptr, 42, event_ref, 0, 0, 0, 0, 0); } static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) { LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg; @@ -8053,7 +8331,10 @@ void __attribute__((export_name("TS_EventHandler_handle_event"))) TS_EventHandl void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKEventHandler* this_arg_conv = (LDKEventHandler*)this_arg_ptr; - LDKEvent* event_conv = (LDKEvent*)untag_ptr(event); + void* event_ptr = untag_ptr(event); + CHECK_ACCESS(event_ptr); + LDKEvent event_conv = *(LDKEvent*)(event_ptr); + event_conv = Event_clone((LDKEvent*)untag_ptr(event)); (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv); } @@ -8071,7 +8352,7 @@ void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEve LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg; LDKEventHandler* handler_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); *handler_ret = handler; - js_invoke_function_buuuuu(j_calls->instance_ptr, 42, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0); + js_invoke_function_buuuuu(j_calls->instance_ptr, 43, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0); } static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) { LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg; @@ -8135,7 +8416,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor uint64_t usage_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(usage_var); usage_ref = tag_ptr(usage_var.inner, usage_var.is_owned); - return js_invoke_function_bbbbuu(j_calls->instance_ptr, 43, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0); + return js_invoke_function_bbbbuu(j_calls->instance_ptr, 44, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0); } void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -8153,7 +8434,7 @@ void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, FREE(path_var.data); int64_t short_channel_id_conv = short_channel_id; - js_invoke_function_ubuuuu(j_calls->instance_ptr, 44, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 45, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); } void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -8170,7 +8451,7 @@ void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ pa } FREE(path_var.data); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 45, (uint32_t)path_arr, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 46, (uint32_t)path_arr, 0, 0, 0, 0, 0); } void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -8188,7 +8469,7 @@ void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_ FREE(path_var.data); int64_t short_channel_id_conv = short_channel_id; - js_invoke_function_ubuuuu(j_calls->instance_ptr, 46, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); } void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -8205,11 +8486,11 @@ void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { } FREE(path_var.data); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 47, (uint32_t)path_arr, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)path_arr, 0, 0, 0, 0, 0); } LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; - int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0); LDKCVec_u8Z ret_ref; ret_ref.datalen = ret->arr_len; ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); @@ -8384,7 +8665,7 @@ static void LDKLockableScore_JCalls_free(void* this_arg) { } LDKScore lock_LDKLockableScore_jcall(const void* this_arg) { LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 49, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKScore ret_conv = *(LDKScore*)(ret_ptr); @@ -8438,7 +8719,7 @@ static void LDKWriteableScore_JCalls_free(void* this_arg) { } LDKCVec_u8Z write_LDKWriteableScore_jcall(const void* this_arg) { LDKWriteableScore_JCalls *j_calls = (LDKWriteableScore_JCalls*) this_arg; - int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 51, 0, 0, 0, 0, 0, 0); LDKCVec_u8Z ret_ref; ret_ref.datalen = ret->arr_len; ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes"); @@ -8497,7 +8778,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKPersister_jcall(const void* this_arg, c // WARNING: we may need a move here but no clone is available for LDKChannelManager CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_manager_var); channel_manager_ref = tag_ptr(channel_manager_var.inner, channel_manager_var.is_owned); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 51, channel_manager_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, channel_manager_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr); @@ -8511,7 +8792,7 @@ LDKCResult_NoneErrorZ persist_graph_LDKPersister_jcall(const void* this_arg, con // WARNING: we may need a move here but no clone is available for LDKNetworkGraph CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_var); network_graph_ref = tag_ptr(network_graph_var.inner, network_graph_var.is_owned); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 52, network_graph_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, network_graph_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr); @@ -8522,7 +8803,7 @@ LDKCResult_NoneErrorZ persist_scorer_LDKPersister_jcall(const void* this_arg, co LDKPersister_JCalls *j_calls = (LDKPersister_JCalls*) this_arg; // WARNING: This object doesn't live past this scope, needs clone! uint64_t ret_scorer = tag_ptr(scorer, false); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 53, ret_scorer, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 54, ret_scorer, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(ret_ptr); @@ -8604,7 +8885,7 @@ static void LDKFutureCallback_JCalls_free(void* this_arg) { } void call_LDKFutureCallback_jcall(const void* this_arg) { LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) this_arg; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 54, 0, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, 0, 0, 0, 0, 0, 0); } static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) { LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg; @@ -8660,7 +8941,7 @@ void filtered_block_connected_LDKListen_jcall(const void* this_arg, const uint8_ FREE(txdata_var.data); int32_t height_conv = height; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 55, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0); } void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) { LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; @@ -8668,14 +8949,14 @@ void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uin int8_tArray block_arr = init_int8_tArray(block_var.datalen, __LINE__); memcpy(block_arr->elems, block_var.data, block_var.datalen); int32_t height_conv = height; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 56, (uint32_t)block_arr, height_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)block_arr, height_conv, 0, 0, 0, 0); } void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg; int8_tArray header_arr = init_int8_tArray(80, __LINE__); memcpy(header_arr->elems, *header, 80); int32_t height_conv = height; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, (uint32_t)header_arr, height_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, height_conv, 0, 0, 0, 0); } static void LDKListen_JCalls_cloned(LDKListen* new_obj) { LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg; @@ -8775,37 +9056,38 @@ void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t FREE(txdata_var.data); int32_t height_conv = height; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0); } void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) { LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg; int8_tArray txid_arr = init_int8_tArray(32, __LINE__); memcpy(txid_arr->elems, *txid, 32); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (uint32_t)txid_arr, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)txid_arr, 0, 0, 0, 0, 0); } void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) { LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg; int8_tArray header_arr = init_int8_tArray(80, __LINE__); memcpy(header_arr->elems, *header, 80); int32_t height_conv = height; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (uint32_t)header_arr, height_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, (uint32_t)header_arr, height_conv, 0, 0, 0, 0); } -LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) { +LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) { LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg; - ptrArray ret = (ptrArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, 0, 0, 0, 0, 0, 0); - LDKCVec_TxidZ ret_constr; + uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0); + LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr; ret_constr.datalen = ret->arr_len; if (ret_constr.datalen > 0) - ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements"); + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements"); else ret_constr.data = NULL; - int8_tArray* ret_vals = (void*) ret->elems; - for (size_t m = 0; m < ret_constr.datalen; m++) { - int8_tArray ret_conv_12 = ret_vals[m]; - LDKThirtyTwoBytes ret_conv_12_ref; - CHECK(ret_conv_12->arr_len == 32); - memcpy(ret_conv_12_ref.data, ret_conv_12->elems, 32); FREE(ret_conv_12); - ret_constr.data[m] = ret_conv_12_ref; + uint64_t* ret_vals = ret->elems; + for (size_t z = 0; z < ret_constr.datalen; z++) { + uint64_t ret_conv_25 = ret_vals[z]; + void* ret_conv_25_ptr = untag_ptr(ret_conv_25); + CHECK_ACCESS(ret_conv_25_ptr); + LDKC2Tuple_TxidBlockHashZ ret_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(ret_conv_25_ptr); + FREE(untag_ptr(ret_conv_25)); + ret_constr.data[z] = ret_conv_25_conv; } FREE(ret); return ret_constr; @@ -8883,18 +9165,18 @@ void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_b (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height); } -ptrArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) { +uint64_tArray __attribute__((export_name("TS_Confirm_get_relevant_txids"))) TS_Confirm_get_relevant_txids(uint64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKConfirm* this_arg_conv = (LDKConfirm*)this_arg_ptr; - LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg); - ptrArray ret_arr = NULL; - ret_arr = init_ptrArray(ret_var.datalen, __LINE__); - int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8); - for (size_t m = 0; m < ret_var.datalen; m++) { - int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32); - ret_arr_ptr[m] = ret_conv_12_arr; + LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg); + uint64_tArray ret_arr = NULL; + ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__); + uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8); + for (size_t z = 0; z < ret_var.datalen; z++) { + LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ"); + *ret_conv_25_conv = ret_var.data[z]; + ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true); } FREE(ret_var.data); @@ -8926,7 +9208,7 @@ LDKChannelMonitorUpdateStatus persist_new_channel_LDKPersist_jcall(const void* t uint64_t update_id_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var); update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned); - uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 62, channel_id_ref, data_ref, update_id_ref, 0, 0, 0); + uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 63, channel_id_ref, data_ref, update_id_ref, 0, 0, 0); LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret); return ret_conv; } @@ -8950,7 +9232,7 @@ LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const vo uint64_t update_id_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_var); update_id_ref = tag_ptr(update_id_var.inner, update_id_var.is_owned); - uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 63, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0); + uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 64, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0); LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret); return ret_conv; } @@ -9051,7 +9333,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD msg_var = OpenChannel_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubbuuu(j_calls->instance_ptr, 64, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0); + js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0); } void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9066,7 +9348,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, msg_var = AcceptChannel_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubbuuu(j_calls->instance_ptr, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0); + js_invoke_function_ubbuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0); } void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9077,7 +9359,7 @@ void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, msg_var = FundingCreated_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 66, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9088,7 +9370,7 @@ void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, msg_var = FundingSigned_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 67, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReady * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9099,7 +9381,7 @@ void handle_channel_ready_LDKChannelMessageHandler_jcall(const void* this_arg, L msg_var = ChannelReady_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9115,7 +9397,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub msg_var = Shutdown_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubbuuu(j_calls->instance_ptr, 69, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0); + js_invoke_function_ubbuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 0, 0, 0); } void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9126,7 +9408,7 @@ void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, msg_var = ClosingSigned_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9137,7 +9419,7 @@ void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, msg_var = UpdateAddHTLC_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 71, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9148,7 +9430,7 @@ void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_ msg_var = UpdateFulfillHTLC_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 72, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9159,7 +9441,7 @@ void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg msg_var = UpdateFailHTLC_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 73, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9170,7 +9452,7 @@ void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void msg_var = UpdateFailMalformedHTLC_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 74, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9181,7 +9463,7 @@ void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_ar msg_var = CommitmentSigned_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 75, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9192,7 +9474,7 @@ void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, msg_var = RevokeAndACK_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 76, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9203,7 +9485,7 @@ void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP msg_var = UpdateFee_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 77, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9214,14 +9496,14 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t msg_var = AnnouncementSignatures_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__); memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33); jboolean no_connection_possible_conv = no_connection_possible; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 79, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0); } LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9232,7 +9514,7 @@ LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* t msg_var = Init_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr); @@ -9248,7 +9530,7 @@ void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_ msg_var = ChannelReestablish_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9259,7 +9541,7 @@ void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, msg_var = ChannelUpdate_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9270,11 +9552,11 @@ void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublic msg_var = ErrorMessage_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); } LDKNodeFeatures provided_node_features_LDKChannelMessageHandler_jcall(const void* this_arg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 84, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, 0, 0, 0, 0, 0, 0); LDKNodeFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -9285,7 +9567,7 @@ LDKInitFeatures provided_init_features_LDKChannelMessageHandler_jcall(const void LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__); memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 85, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 86, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); LDKInitFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -9692,7 +9974,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler msg_var = NodeAnnouncement_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 86, msg_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 87, msg_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr); @@ -9706,7 +9988,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand msg_var = ChannelAnnouncement_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 87, msg_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr); @@ -9720,7 +10002,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc msg_var = ChannelUpdate_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 88, msg_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, msg_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(ret_ptr); @@ -9730,7 +10012,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int64_t starting_point_conv = starting_point; - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 89, starting_point_conv, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, starting_point_conv, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_conv = *(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(ret_ptr); @@ -9741,7 +10023,7 @@ LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(co LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray starting_point_arr = init_int8_tArray(33, __LINE__); memcpy(starting_point_arr->elems, starting_point.compressed_form, 33); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 90, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 91, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0); LDKNodeAnnouncement ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -9757,7 +10039,7 @@ LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* t init_var = Init_clone(&init_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); init_ref = tag_ptr(init_var.inner, init_var.is_owned); - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 91, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr); @@ -9772,7 +10054,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl uint64_t msg_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 92, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr); @@ -9787,7 +10069,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess uint64_t msg_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 93, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr); @@ -9802,7 +10084,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl uint64_t msg_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr); @@ -9817,7 +10099,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH uint64_t msg_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr); @@ -9826,7 +10108,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH } LDKNodeFeatures provided_node_features_LDKRoutingMessageHandler_jcall(const void* this_arg) { LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 96, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, 0, 0, 0, 0, 0, 0); LDKNodeFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -9837,7 +10119,7 @@ LDKInitFeatures provided_init_features_LDKRoutingMessageHandler_jcall(const void LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__); memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 97, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 98, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); LDKInitFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -10075,7 +10357,7 @@ void handle_onion_message_LDKOnionMessageHandler_jcall(const void* this_arg, LDK msg_var = OnionMessage_clone(&msg_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); msg_ref = tag_ptr(msg_var.inner, msg_var.is_owned); - js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0); } LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; @@ -10086,7 +10368,7 @@ LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* thi init_var = Init_clone(&init_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(init_var); init_ref = tag_ptr(init_var.inner, init_var.is_owned); - uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 99, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr); @@ -10098,11 +10380,11 @@ void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPub int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__); memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33); jboolean no_connection_possible_conv = no_connection_possible; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0); } LDKNodeFeatures provided_node_features_LDKOnionMessageHandler_jcall(const void* this_arg) { LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, 0, 0, 0, 0, 0, 0); LDKNodeFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -10113,7 +10395,7 @@ LDKInitFeatures provided_init_features_LDKOnionMessageHandler_jcall(const void* LDKOnionMessageHandler_JCalls *j_calls = (LDKOnionMessageHandler_JCalls*) this_arg; int8_tArray their_node_id_arr = init_int8_tArray(33, __LINE__); memcpy(their_node_id_arr->elems, their_node_id.compressed_form, 33); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 102, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); LDKInitFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -10231,7 +10513,7 @@ LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const voi LDKu8slice buffer_var = buffer; int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__); memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 103, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(ret_ptr); @@ -10289,7 +10571,7 @@ LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jca *msg_ret = msg; int8_tArray sender_node_id_arr = init_int8_tArray(33, __LINE__); memcpy(sender_node_id_arr->elems, sender_node_id.compressed_form, 33); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 104, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 105, tag_ptr(msg_ret, true), (uint32_t)sender_node_id_arr, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(ret_ptr); @@ -10298,7 +10580,7 @@ LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jca } LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) { LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg; - uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0); + uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, 0, 0, 0, 0, 0, 0); LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr; ret_constr.datalen = ret->arr_len; if (ret_constr.datalen > 0) @@ -10393,7 +10675,7 @@ void handle_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_a LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg; LDKCustomOnionMessageContents* msg_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents"); *msg_ret = msg; - js_invoke_function_buuuuu(j_calls->instance_ptr, 106, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0); + js_invoke_function_buuuuu(j_calls->instance_ptr, 107, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0); } LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_LDKCustomOnionMessageHandler_jcall(const void* this_arg, uint64_t message_type, LDKu8slice buffer) { LDKCustomOnionMessageHandler_JCalls *j_calls = (LDKCustomOnionMessageHandler_JCalls*) this_arg; @@ -10401,7 +10683,7 @@ LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message_L LDKu8slice buffer_var = buffer; int8_tArray buffer_arr = init_int8_tArray(buffer_var.datalen, __LINE__); memcpy(buffer_arr->elems, buffer_var.data, buffer_var.datalen); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 107, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 108, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ ret_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(ret_ptr); @@ -10473,21 +10755,21 @@ uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, b int8_tArray data_arr = init_int8_tArray(data_var.datalen, __LINE__); memcpy(data_arr->elems, data_var.data, data_var.datalen); jboolean resume_read_conv = resume_read; - return js_invoke_function_uuuuuu(j_calls->instance_ptr, 108, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0); } void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 110, 0, 0, 0, 0, 0, 0); } bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor"); *other_arg_clone = SocketDescriptor_clone(other_arg); - return js_invoke_function_buuuuu(j_calls->instance_ptr, 110, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0); + return js_invoke_function_buuuuu(j_calls->instance_ptr, 111, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0); } uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg; - return js_invoke_function_uuuuuu(j_calls->instance_ptr, 111, 0, 0, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0); } static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg; @@ -10570,287 +10852,12 @@ int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_capacity_m int64_t capacity_msat_conv = obj->total.capacity_msat; return capacity_msat_conv; } -uint64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) { +int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat"))) TS_LDKEffectiveCapacity_Total_get_htlc_maximum_msat(uint64_t ptr) { LDKEffectiveCapacity *obj = (LDKEffectiveCapacity*)untag_ptr(ptr); assert(obj->tag == LDKEffectiveCapacity_Total); - uint64_t htlc_maximum_msat_ref = tag_ptr(&obj->total.htlc_maximum_msat, false); - return htlc_maximum_msat_ref; -} -uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) { - LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); - switch(obj->tag) { - case LDKDestination_Node: return 0; - case LDKDestination_BlindedRoute: return 1; - default: abort(); - } -} -int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) { - LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); - assert(obj->tag == LDKDestination_Node); - int8_tArray node_arr = init_int8_tArray(33, __LINE__); - memcpy(node_arr->elems, obj->node.compressed_form, 33); - return node_arr; -} -uint64_t __attribute__((export_name("TS_LDKDestination_BlindedRoute_get_blinded_route"))) TS_LDKDestination_BlindedRoute_get_blinded_route(uint64_t ptr) { - LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); - assert(obj->tag == LDKDestination_BlindedRoute); - LDKBlindedRoute blinded_route_var = obj->blinded_route; - uint64_t blinded_route_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_route_var); - blinded_route_ref = tag_ptr(blinded_route_var.inner, false); - return blinded_route_ref; -} -uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) { - LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); - switch(obj->tag) { - case LDKFallback_SegWitProgram: return 0; - case LDKFallback_PubKeyHash: return 1; - case LDKFallback_ScriptHash: return 2; - default: abort(); - } -} -int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) { - LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); - assert(obj->tag == LDKFallback_SegWitProgram); - uint8_t version_val = obj->seg_wit_program.version._0; - return version_val; -} -int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) { - LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); - assert(obj->tag == LDKFallback_SegWitProgram); - LDKCVec_u8Z program_var = obj->seg_wit_program.program; - int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__); - memcpy(program_arr->elems, program_var.data, program_var.datalen); - return program_arr; -} -int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) { - LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); - assert(obj->tag == LDKFallback_PubKeyHash); - int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__); - memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20); - return pub_key_hash_arr; -} -int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) { - LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); - assert(obj->tag == LDKFallback_ScriptHash); - int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__); - memcpy(script_hash_arr->elems, obj->script_hash.data, 20); - return script_hash_arr; -} -typedef struct LDKPayer_JCalls { - atomic_size_t refcnt; - uint32_t instance_ptr; -} LDKPayer_JCalls; -static void LDKPayer_JCalls_free(void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - FREE(j_calls); - } -} -LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, 0, 0, 0, 0, 0, 0); - LDKPublicKey ret_ref; - CHECK(ret->arr_len == 33); - memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret); - return ret_ref; -} -LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 0, 0, 0, 0, 0, 0); - LDKCVec_ChannelDetailsZ ret_constr; - ret_constr.datalen = ret->arr_len; - if (ret_constr.datalen > 0) - ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - ret_constr.data = NULL; - uint64_t* ret_vals = ret->elems; - for (size_t q = 0; q < ret_constr.datalen; q++) { - uint64_t ret_conv_16 = ret_vals[q]; - LDKChannelDetails ret_conv_16_conv; - ret_conv_16_conv.inner = untag_ptr(ret_conv_16); - ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv); - ret_constr.data[q] = ret_conv_16_conv; - } - FREE(ret); - return ret_constr; -} -LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - LDKRoute route_var = *route; - uint64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); - memcpy(payment_hash_arr->elems, payment_hash.data, 32); - int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__); - memcpy(payment_secret_arr->elems, payment_secret.data, 32); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 114, route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr, 0, 0, 0); - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - return ret_conv; -} -LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - LDKRoute route_var = *route; - uint64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__); - memcpy(payment_preimage_arr->elems, payment_preimage.data, 32); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 115, route_ref, (uint32_t)payment_preimage_arr, 0, 0, 0, 0); - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - return ret_conv; -} -LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - LDKRoute route_var = *route; - uint64_t route_ref = 0; - route_var = Route_clone(&route_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); - route_ref = tag_ptr(route_var.inner, route_var.is_owned); - int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__); - memcpy(payment_id_arr->elems, payment_id.data, 32); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 116, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0); - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); - FREE(untag_ptr(ret)); - return ret_conv; -} -void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; - int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__); - memcpy(payment_id_arr->elems, payment_id.data, 32); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0); -} -static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { - LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKPayer LDKPayer_init (JSValue o) { - LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls"); - atomic_init(&calls->refcnt, 1); - calls->instance_ptr = o; - - LDKPayer ret = { - .this_arg = (void*) calls, - .node_id = node_id_LDKPayer_jcall, - .first_hops = first_hops_LDKPayer_jcall, - .send_payment = send_payment_LDKPayer_jcall, - .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, - .retry_payment = retry_payment_LDKPayer_jcall, - .abandon_payment = abandon_payment_LDKPayer_jcall, - .free = LDKPayer_JCalls_free, - }; - return ret; + int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat; + return htlc_maximum_msat_conv; } -uint64_t __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) { - LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer"); - *res_ptr = LDKPayer_init(o); - return tag_ptr(res_ptr, true); -} -int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33); - return ret_arr; -} - -uint64_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg); - uint64_tArray ret_arr = NULL; - ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__); - uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8); - for (size_t q = 0; q < ret_var.datalen; q++) { - LDKChannelDetails ret_conv_16_var = ret_var.data[q]; - uint64_t ret_conv_16_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var); - ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned); - ret_arr_ptr[q] = ret_conv_16_ref; - } - - FREE(ret_var.data); - return ret_arr; -} - -uint64_t __attribute__((export_name("TS_Payer_send_payment"))) TS_Payer_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_hash_ref; - CHECK(payment_hash->arr_len == 32); - memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); - LDKThirtyTwoBytes payment_secret_ref; - CHECK(payment_secret->arr_len == 32); - memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret); - LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_Payer_send_spontaneous_payment"))) TS_Payer_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_preimage_ref; - CHECK(payment_preimage->arr_len == 32); - memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage); - LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKRoute route_conv; - route_conv.inner = untag_ptr(route); - route_conv.is_owned = ptr_is_owned(route); - CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); - route_conv.is_owned = false; - LDKThirtyTwoBytes payment_id_ref; - CHECK(payment_id->arr_len == 32); - memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref); - return tag_ptr(ret_conv, true); -} - -void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) { - void* this_arg_ptr = untag_ptr(this_arg); - if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; - LDKThirtyTwoBytes payment_id_ref; - CHECK(payment_id->arr_len == 32); - memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); - (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); -} - typedef struct LDKRouter_JCalls { atomic_size_t refcnt; uint32_t instance_ptr; @@ -10861,7 +10868,7 @@ static void LDKRouter_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) { +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; int8_tArray payer_arr = init_int8_tArray(33, __LINE__); memcpy(payer_arr->elems, payer.compressed_form, 33); @@ -10870,8 +10877,6 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, route_params_var = RouteParameters_clone(&route_params_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); - int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); - memcpy(payment_hash_arr->elems, *payment_hash, 32); LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; uint64_tArray first_hops_arr = NULL; if (first_hops != NULL) { @@ -10891,7 +10896,46 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, uint64_t inflight_htlcs_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); - uint64_t ret = js_invoke_function_ubuubu(j_calls->instance_ptr, 118, (uint32_t)payer_arr, route_params_ref, (uint32_t)payment_hash_arr, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0); + uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 113, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, 0, 0); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); + FREE(untag_ptr(ret)); + return ret_conv; +} +LDKCResult_RouteLightningErrorZ find_route_with_id_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, LDKInFlightHtlcs inflight_htlcs, LDKThirtyTwoBytes _payment_hash, LDKThirtyTwoBytes _payment_id) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; + int8_tArray payer_arr = init_int8_tArray(33, __LINE__); + memcpy(payer_arr->elems, payer.compressed_form, 33); + LDKRouteParameters route_params_var = *route_params; + uint64_t route_params_ref = 0; + route_params_var = RouteParameters_clone(&route_params_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_var); + route_params_ref = tag_ptr(route_params_var.inner, route_params_var.is_owned); + LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; + uint64_tArray first_hops_arr = NULL; + if (first_hops != NULL) { + LDKCVec_ChannelDetailsZ first_hops_var = *first_hops_var_ptr; + first_hops_arr = init_uint64_tArray(first_hops_var.datalen, __LINE__); + uint64_t *first_hops_arr_ptr = (uint64_t*)(((uint8_t*)first_hops_arr) + 8); + for (size_t q = 0; q < first_hops_var.datalen; q++) { + LDKChannelDetails first_hops_conv_16_var = first_hops_var.data[q]; + uint64_t first_hops_conv_16_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_var); + first_hops_conv_16_ref = tag_ptr(first_hops_conv_16_var.inner, first_hops_conv_16_var.is_owned); + first_hops_arr_ptr[q] = first_hops_conv_16_ref; + } + + } + LDKInFlightHtlcs inflight_htlcs_var = inflight_htlcs; + uint64_t inflight_htlcs_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_var); + inflight_htlcs_ref = tag_ptr(inflight_htlcs_var.inner, inflight_htlcs_var.is_owned); + int8_tArray _payment_hash_arr = init_int8_tArray(32, __LINE__); + memcpy(_payment_hash_arr->elems, _payment_hash.data, 32); + int8_tArray _payment_id_arr = init_int8_tArray(32, __LINE__); + memcpy(_payment_id_arr->elems, _payment_id.data, 32); + uint64_t ret = js_invoke_function_ububuu(j_calls->instance_ptr, 114, (uint32_t)payer_arr, route_params_ref, (uint32_t)first_hops_arr, inflight_htlcs_ref, (uint32_t)_payment_hash_arr, (uint32_t)_payment_id_arr); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); @@ -10914,7 +10958,7 @@ void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_Ro FREE(path_var.data); int64_t short_channel_id_conv = short_channel_id; - js_invoke_function_ubuuuu(j_calls->instance_ptr, 119, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 115, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); } void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; @@ -10931,7 +10975,7 @@ void notify_payment_path_successful_LDKRouter_jcall(const void* this_arg, LDKCVe } FREE(path_var.data); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, (uint32_t)path_arr, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 116, (uint32_t)path_arr, 0, 0, 0, 0, 0); } void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; @@ -10948,7 +10992,7 @@ void notify_payment_probe_successful_LDKRouter_jcall(const void* this_arg, LDKCV } FREE(path_var.data); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 121, (uint32_t)path_arr, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 117, (uint32_t)path_arr, 0, 0, 0, 0, 0); } void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; @@ -10966,7 +11010,7 @@ void notify_payment_probe_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_R FREE(path_var.data); int64_t short_channel_id_conv = short_channel_id; - js_invoke_function_ubuuuu(j_calls->instance_ptr, 122, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 118, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); } static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg; @@ -10980,6 +11024,7 @@ static inline LDKRouter LDKRouter_init (JSValue o) { LDKRouter ret = { .this_arg = (void*) calls, .find_route = find_route_LDKRouter_jcall, + .find_route_with_id = find_route_with_id_LDKRouter_jcall, .notify_payment_path_failed = notify_payment_path_failed_LDKRouter_jcall, .notify_payment_path_successful = notify_payment_path_successful_LDKRouter_jcall, .notify_payment_probe_successful = notify_payment_probe_successful_LDKRouter_jcall, @@ -10993,7 +11038,7 @@ uint64_t __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSVa *res_ptr = LDKRouter_init(o); return tag_ptr(res_ptr, true); } -uint64_t __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_route(uint64_t this_arg, int8_tArray payer, uint64_t route_params, int8_tArray payment_hash, uint64_tArray first_hops, uint64_t inflight_htlcs) { +uint64_t __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_route(uint64_t this_arg, int8_tArray payer, uint64_t route_params, uint64_tArray first_hops, uint64_t inflight_htlcs) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; @@ -11005,10 +11050,6 @@ uint64_t __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_ro route_params_conv.is_owned = ptr_is_owned(route_params); CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); route_params_conv.is_owned = false; - unsigned char payment_hash_arr[32]; - CHECK(payment_hash->arr_len == 32); - memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash); - unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; LDKCVec_ChannelDetailsZ first_hops_constr; LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; if (first_hops != 0) { @@ -11034,10 +11075,59 @@ uint64_t __attribute__((export_name("TS_Router_find_route"))) TS_Router_find_ro inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); - // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs - + inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv); + if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_Router_find_route_with_id"))) TS_Router_find_route_with_id(uint64_t this_arg, int8_tArray payer, uint64_t route_params, uint64_tArray first_hops, uint64_t inflight_htlcs, int8_tArray _payment_hash, int8_tArray _payment_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; + LDKPublicKey payer_ref; + CHECK(payer->arr_len == 33); + memcpy(payer_ref.compressed_form, payer->elems, 33); FREE(payer); + LDKRouteParameters route_params_conv; + route_params_conv.inner = untag_ptr(route_params); + route_params_conv.is_owned = ptr_is_owned(route_params); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_params_conv); + route_params_conv.is_owned = false; + LDKCVec_ChannelDetailsZ first_hops_constr; + LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; + if (first_hops != 0) { + first_hops_constr.datalen = first_hops->arr_len; + 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; + uint64_t* first_hops_vals = first_hops->elems; + for (size_t q = 0; q < first_hops_constr.datalen; q++) { + uint64_t first_hops_conv_16 = first_hops_vals[q]; + LDKChannelDetails first_hops_conv_16_conv; + first_hops_conv_16_conv.inner = untag_ptr(first_hops_conv_16); + first_hops_conv_16_conv.is_owned = ptr_is_owned(first_hops_conv_16); + CHECK_INNER_FIELD_ACCESS_OR_NULL(first_hops_conv_16_conv); + first_hops_conv_16_conv.is_owned = false; + first_hops_constr.data[q] = first_hops_conv_16_conv; + } + FREE(first_hops); + first_hops_ptr = &first_hops_constr; + } + LDKInFlightHtlcs inflight_htlcs_conv; + inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); + inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); + inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); + LDKThirtyTwoBytes _payment_hash_ref; + CHECK(_payment_hash->arr_len == 32); + memcpy(_payment_hash_ref.data, _payment_hash->elems, 32); FREE(_payment_hash); + LDKThirtyTwoBytes _payment_id_ref; + CHECK(_payment_id->arr_len == 32); + memcpy(_payment_id_ref.data, _payment_id->elems, 32); FREE(_payment_id); LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, &route_params_conv, payment_hash_ref, first_hops_ptr, inflight_htlcs_conv); + *ret_conv = (this_arg_conv->find_route_with_id)(this_arg_conv->this_arg, payer_ref, &route_params_conv, first_hops_ptr, inflight_htlcs_conv, _payment_hash_ref, _payment_id_ref); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return tag_ptr(ret_conv, true); } @@ -11138,6 +11228,326 @@ void __attribute__((export_name("TS_Router_notify_payment_probe_failed"))) TS_R (this_arg_conv->notify_payment_probe_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); } +uint32_t __attribute__((export_name("TS_LDKDestination_ty_from_ptr"))) TS_LDKDestination_ty_from_ptr(uint64_t ptr) { + LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); + switch(obj->tag) { + case LDKDestination_Node: return 0; + case LDKDestination_BlindedPath: return 1; + default: abort(); + } +} +int8_tArray __attribute__((export_name("TS_LDKDestination_Node_get_node"))) TS_LDKDestination_Node_get_node(uint64_t ptr) { + LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); + assert(obj->tag == LDKDestination_Node); + int8_tArray node_arr = init_int8_tArray(33, __LINE__); + memcpy(node_arr->elems, obj->node.compressed_form, 33); + return node_arr; +} +uint64_t __attribute__((export_name("TS_LDKDestination_BlindedPath_get_blinded_path"))) TS_LDKDestination_BlindedPath_get_blinded_path(uint64_t ptr) { + LDKDestination *obj = (LDKDestination*)untag_ptr(ptr); + assert(obj->tag == LDKDestination_BlindedPath); + LDKBlindedPath blinded_path_var = obj->blinded_path; + uint64_t blinded_path_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(blinded_path_var); + blinded_path_ref = tag_ptr(blinded_path_var.inner, false); + return blinded_path_ref; +} +uint32_t __attribute__((export_name("TS_LDKOnionMessageContents_ty_from_ptr"))) TS_LDKOnionMessageContents_ty_from_ptr(uint64_t ptr) { + LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr); + switch(obj->tag) { + case LDKOnionMessageContents_Custom: return 0; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custom"))) TS_LDKOnionMessageContents_Custom_get_custom(uint64_t ptr) { + LDKOnionMessageContents *obj = (LDKOnionMessageContents*)untag_ptr(ptr); + assert(obj->tag == LDKOnionMessageContents_Custom); + LDKCustomOnionMessageContents* custom_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents"); + *custom_ret = CustomOnionMessageContents_clone(&obj->custom); + return tag_ptr(custom_ret, true); +} +uint32_t __attribute__((export_name("TS_LDKFallback_ty_from_ptr"))) TS_LDKFallback_ty_from_ptr(uint64_t ptr) { + LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); + switch(obj->tag) { + case LDKFallback_SegWitProgram: return 0; + case LDKFallback_PubKeyHash: return 1; + case LDKFallback_ScriptHash: return 2; + default: abort(); + } +} +int8_t __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_version"))) TS_LDKFallback_SegWitProgram_get_version(uint64_t ptr) { + LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); + assert(obj->tag == LDKFallback_SegWitProgram); + uint8_t version_val = obj->seg_wit_program.version._0; + return version_val; +} +int8_tArray __attribute__((export_name("TS_LDKFallback_SegWitProgram_get_program"))) TS_LDKFallback_SegWitProgram_get_program(uint64_t ptr) { + LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); + assert(obj->tag == LDKFallback_SegWitProgram); + LDKCVec_u8Z program_var = obj->seg_wit_program.program; + int8_tArray program_arr = init_int8_tArray(program_var.datalen, __LINE__); + memcpy(program_arr->elems, program_var.data, program_var.datalen); + return program_arr; +} +int8_tArray __attribute__((export_name("TS_LDKFallback_PubKeyHash_get_pub_key_hash"))) TS_LDKFallback_PubKeyHash_get_pub_key_hash(uint64_t ptr) { + LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); + assert(obj->tag == LDKFallback_PubKeyHash); + int8_tArray pub_key_hash_arr = init_int8_tArray(20, __LINE__); + memcpy(pub_key_hash_arr->elems, obj->pub_key_hash.data, 20); + return pub_key_hash_arr; +} +int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_hash"))) TS_LDKFallback_ScriptHash_get_script_hash(uint64_t ptr) { + LDKFallback *obj = (LDKFallback*)untag_ptr(ptr); + assert(obj->tag == LDKFallback_ScriptHash); + int8_tArray script_hash_arr = init_int8_tArray(20, __LINE__); + memcpy(script_hash_arr->elems, obj->script_hash.data, 20); + return script_hash_arr; +} +typedef struct LDKPayer_JCalls { + atomic_size_t refcnt; + uint32_t instance_ptr; +} LDKPayer_JCalls; +static void LDKPayer_JCalls_free(void* this_arg) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + FREE(j_calls); + } +} +LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 119, 0, 0, 0, 0, 0, 0); + LDKPublicKey ret_ref; + CHECK(ret->arr_len == 33); + memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret); + return ret_ref; +} +LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 120, 0, 0, 0, 0, 0, 0); + LDKCVec_ChannelDetailsZ ret_constr; + ret_constr.datalen = ret->arr_len; + if (ret_constr.datalen > 0) + ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); + else + ret_constr.data = NULL; + uint64_t* ret_vals = ret->elems; + for (size_t q = 0; q < ret_constr.datalen; q++) { + uint64_t ret_conv_16 = ret_vals[q]; + LDKChannelDetails ret_conv_16_conv; + ret_conv_16_conv.inner = untag_ptr(ret_conv_16); + ret_conv_16_conv.is_owned = ptr_is_owned(ret_conv_16); + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_conv); + ret_constr.data[q] = ret_conv_16_conv; + } + FREE(ret); + return ret_constr; +} +LDKCResult_NonePaymentSendFailureZ send_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_secret, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(&route_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); + route_ref = tag_ptr(route_var.inner, route_var.is_owned); + int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_hash_arr->elems, payment_hash.data, 32); + int8_tArray payment_secret_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_secret_arr->elems, payment_secret.data, 32); + int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_id_arr->elems, payment_id.data, 32); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 121, route_ref, (uint32_t)payment_hash_arr, (uint32_t)payment_secret_arr, (uint32_t)payment_id_arr, 0, 0); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); + FREE(untag_ptr(ret)); + return ret_conv; +} +LDKCResult_NonePaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(&route_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); + route_ref = tag_ptr(route_var.inner, route_var.is_owned); + int8_tArray payment_preimage_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_preimage_arr->elems, payment_preimage.data, 32); + int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_id_arr->elems, payment_id.data, 32); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 122, route_ref, (uint32_t)payment_preimage_arr, (uint32_t)payment_id_arr, 0, 0, 0); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); + FREE(untag_ptr(ret)); + return ret_conv; +} +LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(&route_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); + route_ref = tag_ptr(route_var.inner, route_var.is_owned); + int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_id_arr->elems, payment_id.data, 32); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 123, route_ref, (uint32_t)payment_id_arr, 0, 0, 0, 0); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_NonePaymentSendFailureZ ret_conv = *(LDKCResult_NonePaymentSendFailureZ*)(ret_ptr); + FREE(untag_ptr(ret)); + return ret_conv; +} +void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + int8_tArray payment_id_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_id_arr->elems, payment_id.data, 32); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 124, (uint32_t)payment_id_arr, 0, 0, 0, 0, 0); +} +LDKInFlightHtlcs inflight_htlcs_LDKPayer_jcall(const void* this_arg) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 125, 0, 0, 0, 0, 0, 0); + LDKInFlightHtlcs ret_conv; + ret_conv.inner = untag_ptr(ret); + ret_conv.is_owned = ptr_is_owned(ret); + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv); + return ret_conv; +} +static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKPayer LDKPayer_init (JSValue o) { + LDKPayer_JCalls *calls = MALLOC(sizeof(LDKPayer_JCalls), "LDKPayer_JCalls"); + atomic_init(&calls->refcnt, 1); + calls->instance_ptr = o; + + LDKPayer ret = { + .this_arg = (void*) calls, + .node_id = node_id_LDKPayer_jcall, + .first_hops = first_hops_LDKPayer_jcall, + .send_payment = send_payment_LDKPayer_jcall, + .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, + .retry_payment = retry_payment_LDKPayer_jcall, + .abandon_payment = abandon_payment_LDKPayer_jcall, + .inflight_htlcs = inflight_htlcs_LDKPayer_jcall, + .free = LDKPayer_JCalls_free, + }; + return ret; +} +uint64_t __attribute__((export_name("TS_LDKPayer_new"))) TS_LDKPayer_new(JSValue o) { + LDKPayer *res_ptr = MALLOC(sizeof(LDKPayer), "LDKPayer"); + *res_ptr = LDKPayer_init(o); + return tag_ptr(res_ptr, true); +} +int8_tArray __attribute__((export_name("TS_Payer_node_id"))) TS_Payer_node_id(uint64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + int8_tArray ret_arr = init_int8_tArray(33, __LINE__); + memcpy(ret_arr->elems, (this_arg_conv->node_id)(this_arg_conv->this_arg).compressed_form, 33); + return ret_arr; +} + +uint64_tArray __attribute__((export_name("TS_Payer_first_hops"))) TS_Payer_first_hops(uint64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKCVec_ChannelDetailsZ ret_var = (this_arg_conv->first_hops)(this_arg_conv->this_arg); + uint64_tArray ret_arr = NULL; + ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__); + uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8); + for (size_t q = 0; q < ret_var.datalen; q++) { + LDKChannelDetails ret_conv_16_var = ret_var.data[q]; + uint64_t ret_conv_16_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_conv_16_var); + ret_conv_16_ref = tag_ptr(ret_conv_16_var.inner, ret_conv_16_var.is_owned); + ret_arr_ptr[q] = ret_conv_16_ref; + } + + FREE(ret_var.data); + return ret_arr; +} + +uint64_t __attribute__((export_name("TS_Payer_send_payment"))) TS_Payer_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = untag_ptr(route); + route_conv.is_owned = ptr_is_owned(route); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); + route_conv.is_owned = false; + LDKThirtyTwoBytes payment_hash_ref; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKThirtyTwoBytes payment_secret_ref; + CHECK(payment_secret->arr_len == 32); + memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret); + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = (this_arg_conv->send_payment)(this_arg_conv->this_arg, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_Payer_send_spontaneous_payment"))) TS_Payer_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage, int8_tArray payment_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = untag_ptr(route); + route_conv.is_owned = ptr_is_owned(route); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); + route_conv.is_owned = false; + LDKThirtyTwoBytes payment_preimage_ref; + CHECK(payment_preimage->arr_len == 32); + memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage); + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref, payment_id_ref); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_Payer_retry_payment"))) TS_Payer_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = untag_ptr(route); + route_conv.is_owned = ptr_is_owned(route); + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); + route_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = (this_arg_conv->retry_payment)(this_arg_conv->this_arg, &route_conv, payment_id_ref); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_Payer_abandon_payment"))) TS_Payer_abandon_payment(uint64_t this_arg, int8_tArray payment_id) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); +} + +uint64_t __attribute__((export_name("TS_Payer_inflight_htlcs"))) TS_Payer_inflight_htlcs(uint64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKInFlightHtlcs ret_var = (this_arg_conv->inflight_htlcs)(this_arg_conv->this_arg); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + uint32_t __attribute__((export_name("TS_LDKRetry_ty_from_ptr"))) TS_LDKRetry_ty_from_ptr(uint64_t ptr) { LDKRetry *obj = (LDKRetry*)untag_ptr(ptr); switch(obj->tag) { @@ -11165,6 +11575,24 @@ jstring __attribute__((export_name("TS__ldk_c_bindings_get_compiled_version"))) return ret_conv; } +int8_tArray __attribute__((export_name("TS_U128_le_bytes"))) TS_U128_le_bytes(int8_tArray val) { + LDKU128 val_ref; + CHECK(val->arr_len == 16); + memcpy(val_ref.le_bytes, val->elems, 16); FREE(val); + int8_tArray ret_arr = init_int8_tArray(16, __LINE__); + memcpy(ret_arr->elems, U128_le_bytes(val_ref).data, 16); + return ret_arr; +} + +int8_tArray __attribute__((export_name("TS_U128_new"))) TS_U128_new(int8_tArray le_bytes) { + LDKSixteenBytes le_bytes_ref; + CHECK(le_bytes->arr_len == 16); + memcpy(le_bytes_ref.data, le_bytes->elems, 16); FREE(le_bytes); + int8_tArray ret_arr = init_int8_tArray(16, __LINE__); + memcpy(ret_arr->elems, U128_new(le_bytes_ref).le_bytes, 16); + return ret_arr; +} + uint64_t __attribute__((export_name("TS_BigEndianScalar_new"))) TS_BigEndianScalar_new(int8_tArray big_endian_bytes) { LDKThirtyTwoBytes big_endian_bytes_ref; CHECK(big_endian_bytes->arr_len == 32); @@ -11212,6 +11640,15 @@ void __attribute__((export_name("TS_Transaction_free"))) TS_Transaction_free(in Transaction_free(_res_ref); } +void __attribute__((export_name("TS_Witness_free"))) TS_Witness_free(int8_tArray _res) { + LDKWitness _res_ref; + _res_ref.datalen = _res->arr_len; + _res_ref.data = MALLOC(_res_ref.datalen, "LDKWitness Bytes"); + memcpy(_res_ref.data, _res->elems, _res_ref.datalen); FREE(_res); + _res_ref.data_is_owned = true; + Witness_free(_res_ref); +} + uint64_t __attribute__((export_name("TS_TxOut_new"))) TS_TxOut_new(int8_tArray script_pubkey, int64_t value) { LDKCVec_u8Z script_pubkey_ref; script_pubkey_ref.datalen = script_pubkey->arr_len; @@ -11254,130 +11691,28 @@ void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) { Str_free(dummy); } -void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) { - LDKCVec_PublicKeyZ _res_constr; - _res_constr.datalen = _res->arr_len; - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements"); - else - _res_constr.data = NULL; - int8_tArray* _res_vals = (void*) _res->elems; - for (size_t m = 0; m < _res_constr.datalen; m++) { - int8_tArray _res_conv_12 = _res_vals[m]; - LDKPublicKey _res_conv_12_ref; - CHECK(_res_conv_12->arr_len == 33); - memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12); - _res_constr.data[m] = _res_conv_12_ref; - } - FREE(_res); - CVec_PublicKeyZ_free(_res_constr); -} - -uint64_t __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_ok"))) TS_CResult_BlindedRouteNoneZ_ok(uint64_t o) { - LDKBlindedRoute o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // WARNING: we need a move here but no clone is available for LDKBlindedRoute - - LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ"); - *ret_conv = CResult_BlindedRouteNoneZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_err"))) TS_CResult_BlindedRouteNoneZ_err() { - LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ"); - *ret_conv = CResult_BlindedRouteNoneZ_err(); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_is_ok"))) TS_CResult_BlindedRouteNoneZ_is_ok(uint64_t o) { - LDKCResult_BlindedRouteNoneZ* o_conv = (LDKCResult_BlindedRouteNoneZ*)untag_ptr(o); - jboolean ret_conv = CResult_BlindedRouteNoneZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_BlindedRouteNoneZ_free"))) TS_CResult_BlindedRouteNoneZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_BlindedRouteNoneZ _res_conv = *(LDKCResult_BlindedRouteNoneZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_BlindedRouteNoneZ_free(_res_conv); -} - -uint64_t __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_ok(uint64_t o) { - LDKBlindedRoute o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // WARNING: we need a move here but no clone is available for LDKBlindedRoute - - LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ"); - *ret_conv = CResult_BlindedRouteDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_err"))) TS_CResult_BlindedRouteDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ"); - *ret_conv = CResult_BlindedRouteDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_is_ok"))) TS_CResult_BlindedRouteDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_BlindedRouteDecodeErrorZ* o_conv = (LDKCResult_BlindedRouteDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_BlindedRouteDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_BlindedRouteDecodeErrorZ_free"))) TS_CResult_BlindedRouteDecodeErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_BlindedRouteDecodeErrorZ _res_conv = *(LDKCResult_BlindedRouteDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_BlindedRouteDecodeErrorZ_free(_res_conv); -} - -uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) { - LDKBlindedHop o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // WARNING: we need a move here but no clone is available for LDKBlindedHop - - LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ"); - *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ"); - *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); +uint64_t __attribute__((export_name("TS_COption_HTLCClaimZ_some"))) TS_COption_HTLCClaimZ_some(uint32_t o) { + LDKHTLCClaim o_conv = LDKHTLCClaim_from_js(o); + LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ"); + *ret_copy = COption_HTLCClaimZ_some(o_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; } -jboolean __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv); - return ret_conv; +uint64_t __attribute__((export_name("TS_COption_HTLCClaimZ_none"))) TS_COption_HTLCClaimZ_none() { + LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ"); + *ret_copy = COption_HTLCClaimZ_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; } -void __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_COption_HTLCClaimZ_free"))) TS_COption_HTLCClaimZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr); + LDKCOption_HTLCClaimZ _res_conv = *(LDKCOption_HTLCClaimZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_BlindedHopDecodeErrorZ_free(_res_conv); + COption_HTLCClaimZ_free(_res_conv); } uint64_t __attribute__((export_name("TS_CResult_NoneNoneZ_ok"))) TS_CResult_NoneNoneZ_ok() { @@ -11479,155 +11814,57 @@ uint64_t __attribute__((export_name("TS_CResult_CounterpartyCommitmentSecretsDe return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_ok"))) TS_CResult_SecretKeyErrorZ_ok(int8_tArray o) { - LDKSecretKey o_ref; - CHECK(o->arr_len == 32); - memcpy(o_ref.bytes, o->elems, 32); FREE(o); - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref); +uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) { + LDKTxCreationKeys o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = TxCreationKeys_clone(&o_conv); + LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); + *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_err"))) TS_CResult_SecretKeyErrorZ_err(uint32_t e) { - LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = CResult_SecretKeyErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); + *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_SecretKeyErrorZ_is_ok"))) TS_CResult_SecretKeyErrorZ_is_ok(uint64_t o) { - LDKCResult_SecretKeyErrorZ* o_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_SecretKeyErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_SecretKeyErrorZ_free"))) TS_CResult_SecretKeyErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(_res_ptr); + LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_SecretKeyErrorZ_free(_res_conv); + CResult_TxCreationKeysDecodeErrorZ_free(_res_conv); } -static inline uint64_t CResult_SecretKeyErrorZ_clone_ptr(LDKCResult_SecretKeyErrorZ *NONNULL_PTR arg) { - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = CResult_SecretKeyErrorZ_clone(arg); +static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); + *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone_ptr"))) TS_CResult_SecretKeyErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_SecretKeyErrorZ* arg_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SecretKeyErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_SecretKeyErrorZ_clone"))) TS_CResult_SecretKeyErrorZ_clone(uint64_t orig) { - LDKCResult_SecretKeyErrorZ* orig_conv = (LDKCResult_SecretKeyErrorZ*)untag_ptr(orig); - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = CResult_SecretKeyErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) { - LDKPublicKey o_ref; - CHECK(o->arr_len == 33); - memcpy(o_ref.compressed_form, o->elems, 33); FREE(o); - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) { - LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = CResult_PublicKeyErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) { - LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_PublicKeyErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) { - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = CResult_PublicKeyErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) { - LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig); - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_ok(uint64_t o) { - LDKTxCreationKeys o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = TxCreationKeys_clone(&o_conv); - LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); - *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_err"))) TS_CResult_TxCreationKeysDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); - *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_is_ok"))) TS_CResult_TxCreationKeysDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_TxCreationKeysDecodeErrorZ* o_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_TxCreationKeysDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_free"))) TS_CResult_TxCreationKeysDecodeErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_TxCreationKeysDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_TxCreationKeysDecodeErrorZ_clone_ptr(LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); - *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_TxCreationKeysDecodeErrorZ* arg_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig); - LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); - *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysDecodeErrorZ_clone"))) TS_CResult_TxCreationKeysDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)untag_ptr(orig); + LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ"); + *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } @@ -11685,57 +11922,6 @@ uint64_t __attribute__((export_name("TS_CResult_ChannelPublicKeysDecodeErrorZ_c return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_ok"))) TS_CResult_TxCreationKeysErrorZ_ok(uint64_t o) { - LDKTxCreationKeys o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = TxCreationKeys_clone(&o_conv); - LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ"); - *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_err"))) TS_CResult_TxCreationKeysErrorZ_err(uint32_t e) { - LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); - LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ"); - *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_is_ok"))) TS_CResult_TxCreationKeysErrorZ_is_ok(uint64_t o) { - LDKCResult_TxCreationKeysErrorZ* o_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_TxCreationKeysErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_free"))) TS_CResult_TxCreationKeysErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_TxCreationKeysErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_TxCreationKeysErrorZ_clone_ptr(LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR arg) { - LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ"); - *ret_conv = CResult_TxCreationKeysErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone_ptr"))) TS_CResult_TxCreationKeysErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_TxCreationKeysErrorZ* arg_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_TxCreationKeysErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_TxCreationKeysErrorZ_clone"))) TS_CResult_TxCreationKeysErrorZ_clone(uint64_t orig) { - LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)untag_ptr(orig); - LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ"); - *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - uint64_t __attribute__((export_name("TS_COption_u32Z_some"))) TS_COption_u32Z_some(int32_t o) { LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z"); *ret_copy = COption_u32Z_some(o); @@ -12372,238 +12558,276 @@ uint64_t __attribute__((export_name("TS_CResult_ShutdownScriptInvalidShutdownSc return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) { - LDKRouteHop o_conv; +void __attribute__((export_name("TS_CVec_PublicKeyZ_free"))) TS_CVec_PublicKeyZ_free(ptrArray _res) { + LDKCVec_PublicKeyZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements"); + else + _res_constr.data = NULL; + int8_tArray* _res_vals = (void*) _res->elems; + for (size_t m = 0; m < _res_constr.datalen; m++) { + int8_tArray _res_conv_12 = _res_vals[m]; + LDKPublicKey _res_conv_12_ref; + CHECK(_res_conv_12->arr_len == 33); + memcpy(_res_conv_12_ref.compressed_form, _res_conv_12->elems, 33); FREE(_res_conv_12); + _res_constr.data[m] = _res_conv_12_ref; + } + FREE(_res); + CVec_PublicKeyZ_free(_res_constr); +} + +uint64_t __attribute__((export_name("TS_CResult_BlindedPathNoneZ_ok"))) TS_CResult_BlindedPathNoneZ_ok(uint64_t o) { + LDKBlindedPath o_conv; o_conv.inner = untag_ptr(o); o_conv.is_owned = ptr_is_owned(o); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = RouteHop_clone(&o_conv); - LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv); + o_conv = BlindedPath_clone(&o_conv); + LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); + *ret_conv = CResult_BlindedPathNoneZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_BlindedPathNoneZ_err"))) TS_CResult_BlindedPathNoneZ_err() { + LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); + *ret_conv = CResult_BlindedPathNoneZ_err(); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_BlindedPathNoneZ_is_ok"))) TS_CResult_BlindedPathNoneZ_is_ok(uint64_t o) { + LDKCResult_BlindedPathNoneZ* o_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(o); + jboolean ret_conv = CResult_BlindedPathNoneZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_BlindedPathNoneZ_free"))) TS_CResult_BlindedPathNoneZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr); + LDKCResult_BlindedPathNoneZ _res_conv = *(LDKCResult_BlindedPathNoneZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_RouteHopDecodeErrorZ_free(_res_conv); + CResult_BlindedPathNoneZ_free(_res_conv); } -static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg); +static inline uint64_t CResult_BlindedPathNoneZ_clone_ptr(LDKCResult_BlindedPathNoneZ *NONNULL_PTR arg) { + LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); + *ret_conv = CResult_BlindedPathNoneZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone_ptr"))) TS_CResult_BlindedPathNoneZ_clone_ptr(uint64_t arg) { + LDKCResult_BlindedPathNoneZ* arg_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(arg); + int64_t ret_conv = CResult_BlindedPathNoneZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig); - LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); - *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_BlindedPathNoneZ_clone"))) TS_CResult_BlindedPathNoneZ_clone(uint64_t orig) { + LDKCResult_BlindedPathNoneZ* orig_conv = (LDKCResult_BlindedPathNoneZ*)untag_ptr(orig); + LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); + *ret_conv = CResult_BlindedPathNoneZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) { - LDKCVec_RouteHopZ _res_constr; - _res_constr.datalen = _res->arr_len; - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - _res_constr.data = NULL; - uint64_t* _res_vals = _res->elems; - for (size_t k = 0; k < _res_constr.datalen; k++) { - uint64_t _res_conv_10 = _res_vals[k]; - LDKRouteHop _res_conv_10_conv; - _res_conv_10_conv.inner = untag_ptr(_res_conv_10); - _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10); - CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv); - _res_constr.data[k] = _res_conv_10_conv; - } - FREE(_res); - CVec_RouteHopZ_free(_res_constr); -} - -void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) { - LDKCVec_CVec_RouteHopZZ _res_constr; - _res_constr.datalen = _res->arr_len; - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); - else - _res_constr.data = NULL; - uint64_tArray* _res_vals = (void*) _res->elems; - for (size_t m = 0; m < _res_constr.datalen; m++) { - uint64_tArray _res_conv_12 = _res_vals[m]; - LDKCVec_RouteHopZ _res_conv_12_constr; - _res_conv_12_constr.datalen = _res_conv_12->arr_len; - if (_res_conv_12_constr.datalen > 0) - _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - _res_conv_12_constr.data = NULL; - uint64_t* _res_conv_12_vals = _res_conv_12->elems; - for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) { - uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k]; - LDKRouteHop _res_conv_12_conv_10_conv; - _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10); - _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10); - CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv); - _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv; - } - FREE(_res_conv_12); - _res_constr.data[m] = _res_conv_12_constr; - } - FREE(_res); - CVec_CVec_RouteHopZZ_free(_res_constr); -} - -uint64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) { - LDKRoute o_conv; +uint64_t __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_ok"))) TS_CResult_BlindedPathDecodeErrorZ_ok(uint64_t o) { + LDKBlindedPath o_conv; o_conv.inner = untag_ptr(o); o_conv.is_owned = ptr_is_owned(o); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = Route_clone(&o_conv); - LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv); + o_conv = BlindedPath_clone(&o_conv); + LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ"); + *ret_conv = CResult_BlindedPathDecodeErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) { +uint64_t __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_err"))) TS_CResult_BlindedPathDecodeErrorZ_err(uint64_t e) { void* e_ptr = untag_ptr(e); CHECK_ACCESS(e_ptr); LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv); + LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ"); + *ret_conv = CResult_BlindedPathDecodeErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_is_ok"))) TS_CResult_BlindedPathDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_BlindedPathDecodeErrorZ* o_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_BlindedPathDecodeErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_free"))) TS_CResult_BlindedPathDecodeErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr); + LDKCResult_BlindedPathDecodeErrorZ _res_conv = *(LDKCResult_BlindedPathDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_RouteDecodeErrorZ_free(_res_conv); + CResult_BlindedPathDecodeErrorZ_free(_res_conv); } -static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = CResult_RouteDecodeErrorZ_clone(arg); +static inline uint64_t CResult_BlindedPathDecodeErrorZ_clone_ptr(LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ"); + *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedPathDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_BlindedPathDecodeErrorZ* arg_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_BlindedPathDecodeErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig); - LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); - *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_BlindedPathDecodeErrorZ_clone"))) TS_CResult_BlindedPathDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_BlindedPathDecodeErrorZ* orig_conv = (LDKCResult_BlindedPathDecodeErrorZ*)untag_ptr(orig); + LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ"); + *ret_conv = CResult_BlindedPathDecodeErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) { - LDKRouteParameters o_conv; +uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_ok"))) TS_CResult_BlindedHopDecodeErrorZ_ok(uint64_t o) { + LDKBlindedHop o_conv; o_conv.inner = untag_ptr(o); o_conv.is_owned = ptr_is_owned(o); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = RouteParameters_clone(&o_conv); - LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); - *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv); + o_conv = BlindedHop_clone(&o_conv); + LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ"); + *ret_conv = CResult_BlindedHopDecodeErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) { +uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_err"))) TS_CResult_BlindedHopDecodeErrorZ_err(uint64_t e) { void* e_ptr = untag_ptr(e); CHECK_ACCESS(e_ptr); LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); - *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv); + LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ"); + *ret_conv = CResult_BlindedHopDecodeErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_BlindedHopDecodeErrorZ* o_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_BlindedHopDecodeErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_free"))) TS_CResult_BlindedHopDecodeErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr); + LDKCResult_BlindedHopDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_RouteParametersDecodeErrorZ_free(_res_conv); + CResult_BlindedHopDecodeErrorZ_free(_res_conv); } -static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); - *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg); +static inline uint64_t CResult_BlindedHopDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ"); + *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_BlindedHopDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_BlindedHopDecodeErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig); - LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); - *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_BlindedHopDecodeErrorZ_clone"))) TS_CResult_BlindedHopDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_BlindedHopDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopDecodeErrorZ*)untag_ptr(orig); + LDKCResult_BlindedHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopDecodeErrorZ), "LDKCResult_BlindedHopDecodeErrorZ"); + *ret_conv = CResult_BlindedHopDecodeErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) { - LDKCVec_RouteHintZ _res_constr; +void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) { + LDKCVec_ChannelDetailsZ _res_constr; _res_constr.datalen = _res->arr_len; if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); else _res_constr.data = NULL; uint64_t* _res_vals = _res->elems; - for (size_t l = 0; l < _res_constr.datalen; l++) { - uint64_t _res_conv_11 = _res_vals[l]; - LDKRouteHint _res_conv_11_conv; - _res_conv_11_conv.inner = untag_ptr(_res_conv_11); - _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11); - CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv); - _res_constr.data[l] = _res_conv_11_conv; + for (size_t q = 0; q < _res_constr.datalen; q++) { + uint64_t _res_conv_16 = _res_vals[q]; + LDKChannelDetails _res_conv_16_conv; + _res_conv_16_conv.inner = untag_ptr(_res_conv_16); + _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv); + _res_constr.data[q] = _res_conv_16_conv; } FREE(_res); - CVec_RouteHintZ_free(_res_constr); + CVec_ChannelDetailsZ_free(_res_constr); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) { + LDKRoute o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = Route_clone(&o_conv); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) { + LDKLightningError e_conv; + e_conv.inner = untag_ptr(e); + e_conv.is_owned = ptr_is_owned(e); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = LightningError_clone(&e_conv); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = CResult_RouteLightningErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) { + LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_RouteLightningErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) { + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = CResult_RouteLightningErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) { + LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig); + LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); + *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_CVec_RouteHopZ_free"))) TS_CVec_RouteHopZ_free(uint64_tArray _res) { + LDKCVec_RouteHopZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t k = 0; k < _res_constr.datalen; k++) { + uint64_t _res_conv_10 = _res_vals[k]; + LDKRouteHop _res_conv_10_conv; + _res_conv_10_conv.inner = untag_ptr(_res_conv_10); + _res_conv_10_conv.is_owned = ptr_is_owned(_res_conv_10); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_10_conv); + _res_constr.data[k] = _res_conv_10_conv; + } + FREE(_res); + CVec_RouteHopZ_free(_res_constr); } uint64_t __attribute__((export_name("TS_COption_u64Z_some"))) TS_COption_u64Z_some(int64_t o) { @@ -12649,6 +12873,274 @@ uint64_t __attribute__((export_name("TS_COption_u64Z_clone"))) TS_COption_u64Z_ return ret_ref; } +uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) { + LDKInFlightHtlcs o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = InFlightHtlcs_clone(&o_conv); + LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); + *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); + *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); + *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_InFlightHtlcsDecodeErrorZ* arg_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_clone"))) TS_CResult_InFlightHtlcsDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_InFlightHtlcsDecodeErrorZ* orig_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(orig); + LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); + *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_ok"))) TS_CResult_RouteHopDecodeErrorZ_ok(uint64_t o) { + LDKRouteHop o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = RouteHop_clone(&o_conv); + LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_err"))) TS_CResult_RouteHopDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_is_ok"))) TS_CResult_RouteHopDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_RouteHopDecodeErrorZ* o_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_RouteHopDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_free"))) TS_CResult_RouteHopDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_RouteHopDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_RouteHopDecodeErrorZ_clone_ptr(LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = CResult_RouteHopDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone_ptr"))) TS_CResult_RouteHopDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_RouteHopDecodeErrorZ* arg_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_RouteHopDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_RouteHopDecodeErrorZ_clone"))) TS_CResult_RouteHopDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)untag_ptr(orig); + LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ"); + *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_CVec_CVec_RouteHopZZ_free"))) TS_CVec_CVec_RouteHopZZ_free(ptrArray _res) { + LDKCVec_CVec_RouteHopZZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements"); + else + _res_constr.data = NULL; + uint64_tArray* _res_vals = (void*) _res->elems; + for (size_t m = 0; m < _res_constr.datalen; m++) { + uint64_tArray _res_conv_12 = _res_vals[m]; + LDKCVec_RouteHopZ _res_conv_12_constr; + _res_conv_12_constr.datalen = _res_conv_12->arr_len; + if (_res_conv_12_constr.datalen > 0) + _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + _res_conv_12_constr.data = NULL; + uint64_t* _res_conv_12_vals = _res_conv_12->elems; + for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) { + uint64_t _res_conv_12_conv_10 = _res_conv_12_vals[k]; + LDKRouteHop _res_conv_12_conv_10_conv; + _res_conv_12_conv_10_conv.inner = untag_ptr(_res_conv_12_conv_10); + _res_conv_12_conv_10_conv.is_owned = ptr_is_owned(_res_conv_12_conv_10); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_12_conv_10_conv); + _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv; + } + FREE(_res_conv_12); + _res_constr.data[m] = _res_conv_12_constr; + } + FREE(_res); + CVec_CVec_RouteHopZZ_free(_res_constr); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_ok"))) TS_CResult_RouteDecodeErrorZ_ok(uint64_t o) { + LDKRoute o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = Route_clone(&o_conv); + LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_err"))) TS_CResult_RouteDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_is_ok"))) TS_CResult_RouteDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_RouteDecodeErrorZ* o_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_RouteDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_free"))) TS_CResult_RouteDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_RouteDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_RouteDecodeErrorZ_clone_ptr(LDKCResult_RouteDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = CResult_RouteDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone_ptr"))) TS_CResult_RouteDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_RouteDecodeErrorZ* arg_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_RouteDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_RouteDecodeErrorZ_clone"))) TS_CResult_RouteDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)untag_ptr(orig); + LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ"); + *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_ok"))) TS_CResult_RouteParametersDecodeErrorZ_ok(uint64_t o) { + LDKRouteParameters o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = RouteParameters_clone(&o_conv); + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = CResult_RouteParametersDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_err"))) TS_CResult_RouteParametersDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = CResult_RouteParametersDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_is_ok"))) TS_CResult_RouteParametersDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_RouteParametersDecodeErrorZ* o_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_RouteParametersDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_free"))) TS_CResult_RouteParametersDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_RouteParametersDecodeErrorZ _res_conv = *(LDKCResult_RouteParametersDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_RouteParametersDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_RouteParametersDecodeErrorZ_clone_ptr(LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone_ptr"))) TS_CResult_RouteParametersDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_RouteParametersDecodeErrorZ* arg_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_RouteParametersDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_RouteParametersDecodeErrorZ_clone"))) TS_CResult_RouteParametersDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_RouteParametersDecodeErrorZ* orig_conv = (LDKCResult_RouteParametersDecodeErrorZ*)untag_ptr(orig); + LDKCResult_RouteParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteParametersDecodeErrorZ), "LDKCResult_RouteParametersDecodeErrorZ"); + *ret_conv = CResult_RouteParametersDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_CVec_RouteHintZ_free"))) TS_CVec_RouteHintZ_free(uint64_tArray _res) { + LDKCVec_RouteHintZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t l = 0; l < _res_constr.datalen; l++) { + uint64_t _res_conv_11 = _res_vals[l]; + LDKRouteHint _res_conv_11_conv; + _res_conv_11_conv.inner = untag_ptr(_res_conv_11); + _res_conv_11_conv.is_owned = ptr_is_owned(_res_conv_11); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_11_conv); + _res_constr.data[l] = _res_conv_11_conv; + } + FREE(_res); + CVec_RouteHintZ_free(_res_constr); +} + void __attribute__((export_name("TS_CVec_u64Z_free"))) TS_CVec_u64Z_free(int64_tArray _res) { LDKCVec_u64Z _res_constr; _res_constr.datalen = _res->arr_len; @@ -12847,81 +13339,6 @@ uint64_t __attribute__((export_name("TS_CResult_RouteHintHopDecodeErrorZ_clone" return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_CVec_ChannelDetailsZ_free"))) TS_CVec_ChannelDetailsZ_free(uint64_tArray _res) { - LDKCVec_ChannelDetailsZ _res_constr; - _res_constr.datalen = _res->arr_len; - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements"); - else - _res_constr.data = NULL; - uint64_t* _res_vals = _res->elems; - for (size_t q = 0; q < _res_constr.datalen; q++) { - uint64_t _res_conv_16 = _res_vals[q]; - LDKChannelDetails _res_conv_16_conv; - _res_conv_16_conv.inner = untag_ptr(_res_conv_16); - _res_conv_16_conv.is_owned = ptr_is_owned(_res_conv_16); - CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_16_conv); - _res_constr.data[q] = _res_conv_16_conv; - } - FREE(_res); - CVec_ChannelDetailsZ_free(_res_constr); -} - -uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_ok"))) TS_CResult_RouteLightningErrorZ_ok(uint64_t o) { - LDKRoute o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = Route_clone(&o_conv); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_err"))) TS_CResult_RouteLightningErrorZ_err(uint64_t e) { - LDKLightningError e_conv; - e_conv.inner = untag_ptr(e); - e_conv.is_owned = ptr_is_owned(e); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = LightningError_clone(&e_conv); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = CResult_RouteLightningErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_RouteLightningErrorZ_is_ok"))) TS_CResult_RouteLightningErrorZ_is_ok(uint64_t o) { - LDKCResult_RouteLightningErrorZ* o_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_RouteLightningErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_RouteLightningErrorZ_free"))) TS_CResult_RouteLightningErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_RouteLightningErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_RouteLightningErrorZ_clone_ptr(LDKCResult_RouteLightningErrorZ *NONNULL_PTR arg) { - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = CResult_RouteLightningErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone_ptr"))) TS_CResult_RouteLightningErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_RouteLightningErrorZ* arg_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_RouteLightningErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_RouteLightningErrorZ_clone"))) TS_CResult_RouteLightningErrorZ_clone(uint64_t orig) { - LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)untag_ptr(orig); - LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - uint64_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_ok"))) TS_CResult_PaymentPurposeDecodeErrorZ_ok(uint64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); @@ -13175,6 +13592,52 @@ uint64_t __attribute__((export_name("TS_CResult_COption_HTLCDestinationZDecodeE return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_COption_u128Z_some"))) TS_COption_u128Z_some(int8_tArray o) { + LDKU128 o_ref; + CHECK(o->arr_len == 16); + memcpy(o_ref.le_bytes, o->elems, 16); FREE(o); + LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z"); + *ret_copy = COption_u128Z_some(o_ref); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_COption_u128Z_none"))) TS_COption_u128Z_none() { + LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z"); + *ret_copy = COption_u128Z_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_COption_u128Z_free"))) TS_COption_u128Z_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_u128Z _res_conv = *(LDKCOption_u128Z*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_u128Z_free(_res_conv); +} + +static inline uint64_t COption_u128Z_clone_ptr(LDKCOption_u128Z *NONNULL_PTR arg) { + LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z"); + *ret_copy = COption_u128Z_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_u128Z_clone_ptr"))) TS_COption_u128Z_clone_ptr(uint64_t arg) { + LDKCOption_u128Z* arg_conv = (LDKCOption_u128Z*)untag_ptr(arg); + int64_t ret_conv = COption_u128Z_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128Z_clone(uint64_t orig) { + LDKCOption_u128Z* orig_conv = (LDKCOption_u128Z*)untag_ptr(orig); + LDKCOption_u128Z *ret_copy = MALLOC(sizeof(LDKCOption_u128Z), "LDKCOption_u128Z"); + *ret_copy = COption_u128Z_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_some"))) TS_COption_NetworkUpdateZ_some(uint64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); @@ -13470,23 +13933,63 @@ void __attribute__((export_name("TS_CVec_C2Tuple_usizeTransactionZZ_free"))) TS CVec_C2Tuple_usizeTransactionZZ_free(_res_constr); } -void __attribute__((export_name("TS_CVec_TxidZ_free"))) TS_CVec_TxidZ_free(ptrArray _res) { - LDKCVec_TxidZ _res_constr; +static inline uint64_t C2Tuple_TxidBlockHashZ_clone_ptr(LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR arg) { + LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ"); + *ret_conv = C2Tuple_TxidBlockHashZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone_ptr"))) TS_C2Tuple_TxidBlockHashZ_clone_ptr(uint64_t arg) { + LDKC2Tuple_TxidBlockHashZ* arg_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_TxidBlockHashZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_clone"))) TS_C2Tuple_TxidBlockHashZ_clone(uint64_t orig) { + LDKC2Tuple_TxidBlockHashZ* orig_conv = (LDKC2Tuple_TxidBlockHashZ*)untag_ptr(orig); + LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ"); + *ret_conv = C2Tuple_TxidBlockHashZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_new"))) TS_C2Tuple_TxidBlockHashZ_new(int8_tArray a, int8_tArray b) { + LDKThirtyTwoBytes a_ref; + CHECK(a->arr_len == 32); + memcpy(a_ref.data, a->elems, 32); FREE(a); + LDKThirtyTwoBytes b_ref; + CHECK(b->arr_len == 32); + memcpy(b_ref.data, b->elems, 32); FREE(b); + LDKC2Tuple_TxidBlockHashZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ"); + *ret_conv = C2Tuple_TxidBlockHashZ_new(a_ref, b_ref); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_C2Tuple_TxidBlockHashZ_free"))) TS_C2Tuple_TxidBlockHashZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_TxidBlockHashZ _res_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_TxidBlockHashZ_free(_res_conv); +} + +void __attribute__((export_name("TS_CVec_C2Tuple_TxidBlockHashZZ_free"))) TS_CVec_C2Tuple_TxidBlockHashZZ_free(uint64_tArray _res) { + LDKCVec_C2Tuple_TxidBlockHashZZ _res_constr; _res_constr.datalen = _res->arr_len; if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements"); + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKCVec_C2Tuple_TxidBlockHashZZ Elements"); else _res_constr.data = NULL; - int8_tArray* _res_vals = (void*) _res->elems; - for (size_t m = 0; m < _res_constr.datalen; m++) { - int8_tArray _res_conv_12 = _res_vals[m]; - LDKThirtyTwoBytes _res_conv_12_ref; - CHECK(_res_conv_12->arr_len == 32); - memcpy(_res_conv_12_ref.data, _res_conv_12->elems, 32); FREE(_res_conv_12); - _res_constr.data[m] = _res_conv_12_ref; + uint64_t* _res_vals = _res->elems; + for (size_t z = 0; z < _res_constr.datalen; z++) { + uint64_t _res_conv_25 = _res_vals[z]; + void* _res_conv_25_ptr = untag_ptr(_res_conv_25); + CHECK_ACCESS(_res_conv_25_ptr); + LDKC2Tuple_TxidBlockHashZ _res_conv_25_conv = *(LDKC2Tuple_TxidBlockHashZ*)(_res_conv_25_ptr); + FREE(untag_ptr(_res_conv_25)); + _res_constr.data[z] = _res_conv_25_conv; } FREE(_res); - CVec_TxidZ_free(_res_constr); + CVec_C2Tuple_TxidBlockHashZZ_free(_res_constr); } void __attribute__((export_name("TS_CVec_MonitorEventZ_free"))) TS_CVec_MonitorEventZ_free(uint64_tArray _res) { @@ -14047,6 +14550,114 @@ uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_ok(uint64_t o) { + LDKOfferFeatures o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = OfferFeatures_clone(&o_conv); + LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); + *ret_conv = CResult_OfferFeaturesDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_err"))) TS_CResult_OfferFeaturesDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); + *ret_conv = CResult_OfferFeaturesDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_is_ok"))) TS_CResult_OfferFeaturesDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_OfferFeaturesDecodeErrorZ* o_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_OfferFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_free"))) TS_CResult_OfferFeaturesDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_OfferFeaturesDecodeErrorZ _res_conv = *(LDKCResult_OfferFeaturesDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_OfferFeaturesDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_OfferFeaturesDecodeErrorZ_clone_ptr(LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); + *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_OfferFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_OfferFeaturesDecodeErrorZ* arg_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_clone"))) TS_CResult_OfferFeaturesDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_OfferFeaturesDecodeErrorZ* orig_conv = (LDKCResult_OfferFeaturesDecodeErrorZ*)untag_ptr(orig); + LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); + *ret_conv = CResult_OfferFeaturesDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(uint64_t o) { + LDKInvoiceRequestFeatures o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = InvoiceRequestFeatures_clone(&o_conv); + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_err"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* arg_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* orig_conv = (LDKCResult_InvoiceRequestFeaturesDecodeErrorZ*)untag_ptr(orig); + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + uint64_t __attribute__((export_name("TS_CResult_NodeIdDecodeErrorZ_ok"))) TS_CResult_NodeIdDecodeErrorZ_ok(uint64_t o) { LDKNodeId o_conv; o_conv.inner = untag_ptr(o); @@ -15462,21 +16073,21 @@ uint64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_C return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_CVec_u5Z_free"))) TS_CVec_u5Z_free(ptrArray _res) { - LDKCVec_u5Z _res_constr; +void __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) { + LDKCVec_U5Z _res_constr; _res_constr.datalen = _res->arr_len; if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements"); + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements"); else _res_constr.data = NULL; int8_t* _res_vals = (void*) _res->elems; for (size_t h = 0; h < _res_constr.datalen; h++) { int8_t _res_conv_7 = _res_vals[h]; - _res_constr.data[h] = (LDKu5){ ._0 = _res_conv_7 }; + _res_constr.data[h] = (LDKU5){ ._0 = _res_conv_7 }; } FREE(_res); - CVec_u5Z_free(_res_constr); + CVec_U5Z_free(_res_constr); } uint64_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_ok"))) TS_CResult_RecoverableSignatureNoneZ_ok(int8_tArray o) { @@ -15924,104 +16535,104 @@ uint64_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CRe return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_ok(int8_tArray o) { - LDKThirtyTwoBytes o_ref; - CHECK(o->arr_len == 32); - memcpy(o_ref.data, o->elems, 32); FREE(o); - LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = CResult_PaymentIdPaymentSendFailureZ_ok(o_ref); +uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() { + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = CResult_NonePaymentSendFailureZ_ok(); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_err"))) TS_CResult_PaymentIdPaymentSendFailureZ_err(uint64_t e) { +uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) { void* e_ptr = untag_ptr(e); CHECK_ACCESS(e_ptr); LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr); e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e)); - LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = CResult_PaymentIdPaymentSendFailureZ_err(e_conv); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentIdPaymentSendFailureZ_is_ok(uint64_t o) { - LDKCResult_PaymentIdPaymentSendFailureZ* o_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(o); - jboolean ret_conv = CResult_PaymentIdPaymentSendFailureZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) { + LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_free"))) TS_CResult_PaymentIdPaymentSendFailureZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_PaymentIdPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(_res_ptr); + LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_PaymentIdPaymentSendFailureZ_free(_res_conv); + CResult_NonePaymentSendFailureZ_free(_res_conv); } -static inline uint64_t CResult_PaymentIdPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR arg) { - LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(arg); +static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) { + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone_ptr(uint64_t arg) { - LDKCResult_PaymentIdPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(arg); - int64_t ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) { + LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentSendFailureZ_clone"))) TS_CResult_PaymentIdPaymentSendFailureZ_clone(uint64_t orig) { - LDKCResult_PaymentIdPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentIdPaymentSendFailureZ*)untag_ptr(orig); - LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = CResult_PaymentIdPaymentSendFailureZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) { + LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_ok"))) TS_CResult_NonePaymentSendFailureZ_ok() { - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = CResult_NonePaymentSendFailureZ_ok(); +uint64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(o->arr_len == 32); + memcpy(o_ref.data, o->elems, 32); FREE(o); + LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_err"))) TS_CResult_NonePaymentSendFailureZ_err(uint64_t e) { +uint64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_err"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint64_t e) { void* e_ptr = untag_ptr(e); CHECK_ACCESS(e_ptr); LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(e_ptr); e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(e)); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv); + LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_is_ok"))) TS_CResult_NonePaymentSendFailureZ_is_ok(uint64_t o) { - LDKCResult_NonePaymentSendFailureZ* o_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(o); - jboolean ret_conv = CResult_NonePaymentSendFailureZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_is_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_is_ok(uint64_t o) { + LDKCResult_PaymentHashPaymentSendFailureZ* o_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_PaymentHashPaymentSendFailureZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_free"))) TS_CResult_NonePaymentSendFailureZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_free"))) TS_CResult_PaymentHashPaymentSendFailureZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(_res_ptr); + LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_NonePaymentSendFailureZ_free(_res_conv); + CResult_PaymentHashPaymentSendFailureZ_free(_res_conv); } -static inline uint64_t CResult_NonePaymentSendFailureZ_clone_ptr(LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR arg) { - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = CResult_NonePaymentSendFailureZ_clone(arg); +static inline uint64_t CResult_PaymentHashPaymentSendFailureZ_clone_ptr(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR arg) { + LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone_ptr"))) TS_CResult_NonePaymentSendFailureZ_clone_ptr(uint64_t arg) { - LDKCResult_NonePaymentSendFailureZ* arg_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(arg); - int64_t ret_conv = CResult_NonePaymentSendFailureZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone_ptr(uint64_t arg) { + LDKCResult_PaymentHashPaymentSendFailureZ* arg_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone"))) TS_CResult_NonePaymentSendFailureZ_clone(uint64_t orig) { - LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)untag_ptr(orig); - LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); - *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_clone"))) TS_CResult_PaymentHashPaymentSendFailureZ_clone(uint64_t orig) { + LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)untag_ptr(orig); + LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv); return tag_ptr(ret_conv, true); } @@ -16987,787 +17598,323 @@ uint64_t __attribute__((export_name("TS_CResult_PaymentIdPaymentErrorZ_clone")) return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_ok(uint64_t o) { - LDKInFlightHtlcs o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // WARNING: we need a move here but no clone is available for LDKInFlightHtlcs - - LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); - *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_ok(o_conv); +uint64_t __attribute__((export_name("TS_CResult_NonePaymentErrorZ_ok"))) TS_CResult_NonePaymentErrorZ_ok() { + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = CResult_NonePaymentErrorZ_ok(); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_err"))) TS_CResult_InFlightHtlcsDecodeErrorZ_err(uint64_t e) { +uint64_t __attribute__((export_name("TS_CResult_NonePaymentErrorZ_err"))) TS_CResult_NonePaymentErrorZ_err(uint64_t e) { void* e_ptr = untag_ptr(e); CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); - *ret_conv = CResult_InFlightHtlcsDecodeErrorZ_err(e_conv); + LDKPaymentError e_conv = *(LDKPaymentError*)(e_ptr); + e_conv = PaymentError_clone((LDKPaymentError*)untag_ptr(e)); + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = CResult_NonePaymentErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok"))) TS_CResult_InFlightHtlcsDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_InFlightHtlcsDecodeErrorZ* o_conv = (LDKCResult_InFlightHtlcsDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_InFlightHtlcsDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_NonePaymentErrorZ_is_ok"))) TS_CResult_NonePaymentErrorZ_is_ok(uint64_t o) { + LDKCResult_NonePaymentErrorZ* o_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NonePaymentErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_InFlightHtlcsDecodeErrorZ_free"))) TS_CResult_InFlightHtlcsDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_NonePaymentErrorZ_free"))) TS_CResult_NonePaymentErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_InFlightHtlcsDecodeErrorZ _res_conv = *(LDKCResult_InFlightHtlcsDecodeErrorZ*)(_res_ptr); + LDKCResult_NonePaymentErrorZ _res_conv = *(LDKCResult_NonePaymentErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_InFlightHtlcsDecodeErrorZ_free(_res_conv); + CResult_NonePaymentErrorZ_free(_res_conv); } -uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) { - LDKSiPrefix o_conv = LDKSiPrefix_from_js(o); - LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); - *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv); +static inline uint64_t CResult_NonePaymentErrorZ_clone_ptr(LDKCResult_NonePaymentErrorZ *NONNULL_PTR arg) { + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = CResult_NonePaymentErrorZ_clone(arg); return tag_ptr(ret_conv, true); } +int64_t __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone_ptr"))) TS_CResult_NonePaymentErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_NonePaymentErrorZ* arg_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NonePaymentErrorZ_clone_ptr(arg_conv); + return ret_conv; +} -uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKParseError e_conv = *(LDKParseError*)(e_ptr); - e_conv = ParseError_clone((LDKParseError*)untag_ptr(e)); - LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); - *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_NonePaymentErrorZ_clone"))) TS_CResult_NonePaymentErrorZ_clone(uint64_t orig) { + LDKCResult_NonePaymentErrorZ* orig_conv = (LDKCResult_NonePaymentErrorZ*)untag_ptr(orig); + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = CResult_NonePaymentErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) { - LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv); +uint64_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) { + LDKStr o_conv = str_ref_to_owned_c(o); + LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); + *ret_conv = CResult_StringErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) { + LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); + LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); + *ret_conv = CResult_StringErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) { + LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr); + LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_SiPrefixParseErrorZ_free(_res_conv); + CResult_StringErrorZ_free(_res_conv); } -static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) { - LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); - *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg); +static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) { + LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); + *ret_conv = CResult_StringErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) { - LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig); - LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); - *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) { + LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig); + LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); + *ret_conv = CResult_StringErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) { - LDKInvoice o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = Invoice_clone(&o_conv); - LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); - *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv); +uint64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_ok"))) TS_CResult_PublicKeyErrorZ_ok(int8_tArray o) { + LDKPublicKey o_ref; + CHECK(o->arr_len == 33); + memcpy(o_ref.compressed_form, o->elems, 33); FREE(o); + LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); + *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr); - e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e)); - LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); - *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_err"))) TS_CResult_PublicKeyErrorZ_err(uint32_t e) { + LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); + LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); + *ret_conv = CResult_PublicKeyErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) { - LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_PublicKeyErrorZ_is_ok"))) TS_CResult_PublicKeyErrorZ_is_ok(uint64_t o) { + LDKCResult_PublicKeyErrorZ* o_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_PublicKeyErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_PublicKeyErrorZ_free"))) TS_CResult_PublicKeyErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr); + LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv); + CResult_PublicKeyErrorZ_free(_res_conv); } -static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) { - LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); - *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg); +static inline uint64_t CResult_PublicKeyErrorZ_clone_ptr(LDKCResult_PublicKeyErrorZ *NONNULL_PTR arg) { + LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); + *ret_conv = CResult_PublicKeyErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone_ptr"))) TS_CResult_PublicKeyErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_PublicKeyErrorZ* arg_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PublicKeyErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) { - LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig); - LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); - *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_PublicKeyErrorZ_clone"))) TS_CResult_PublicKeyErrorZ_clone(uint64_t orig) { + LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)untag_ptr(orig); + LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); + *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) { - LDKSignedRawInvoice o_conv; +uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) { + LDKChannelMonitorUpdate o_conv; o_conv.inner = untag_ptr(o); o_conv.is_owned = ptr_is_owned(o); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = SignedRawInvoice_clone(&o_conv); - LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); - *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv); + o_conv = ChannelMonitorUpdate_clone(&o_conv); + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); + *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) { +uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) { void* e_ptr = untag_ptr(e); CHECK_ACCESS(e_ptr); - LDKParseError e_conv = *(LDKParseError*)(e_ptr); - e_conv = ParseError_clone((LDKParseError*)untag_ptr(e)); - LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); - *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); + *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) { - LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr); + LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_SignedRawInvoiceParseErrorZ_free(_res_conv); + CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv); } -static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) { - LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); - *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg); +static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); + *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) { - LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig); - LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); - *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) { - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ"); - *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg); +uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig); + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); + *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) { - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg); - int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv); - return ret_conv; -} -uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) { - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig); - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ"); - *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv); - return tag_ptr(ret_conv, true); +uint64_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr); + o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o)); + LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); + *ret_copy = COption_MonitorEventZ_some(o_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; } -uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) { - LDKRawInvoice a_conv; - a_conv.inner = untag_ptr(a); - a_conv.is_owned = ptr_is_owned(a); - CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - a_conv = RawInvoice_clone(&a_conv); - LDKThirtyTwoBytes b_ref; - CHECK(b->arr_len == 32); - memcpy(b_ref.data, b->elems, 32); FREE(b); - LDKInvoiceSignature c_conv; - c_conv.inner = untag_ptr(c); - c_conv.is_owned = ptr_is_owned(c); - CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv); - c_conv = InvoiceSignature_clone(&c_conv); - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ"); - *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv); - return tag_ptr(ret_conv, true); +uint64_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() { + LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); + *ret_copy = COption_MonitorEventZ_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; } -void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) { +void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr); + LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr); FREE(untag_ptr(_res)); - C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv); + COption_MonitorEventZ_free(_res_conv); } -uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) { - LDKPayeePubKey o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = PayeePubKey_clone(&o_conv); - LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); - *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv); +static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) { + LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); + *ret_copy = COption_MonitorEventZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) { + LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg); + int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) { + LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig); + LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); + *ret_copy = COption_MonitorEventZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr); + o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o)); + LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); + *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) { - LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); - LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); - *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); + *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) { - LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr); + LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_PayeePubKeyErrorZ_free(_res_conv); + CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv); } -static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) { - LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); - *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg); +static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); + *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) { - LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig); - LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); - *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); + *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) { - LDKCVec_PrivateRouteZ _res_constr; - _res_constr.datalen = _res->arr_len; - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements"); - else - _res_constr.data = NULL; - uint64_t* _res_vals = _res->elems; - for (size_t o = 0; o < _res_constr.datalen; o++) { - uint64_t _res_conv_14 = _res_vals[o]; - LDKPrivateRoute _res_conv_14_conv; - _res_conv_14_conv.inner = untag_ptr(_res_conv_14); - _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14); - CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv); - _res_constr.data[o] = _res_conv_14_conv; - } - FREE(_res); - CVec_PrivateRouteZ_free(_res_constr); -} - -uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) { - LDKPositiveTimestamp o_conv; +uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) { + LDKHTLCUpdate o_conv; o_conv.inner = untag_ptr(o); o_conv.is_owned = ptr_is_owned(o); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = PositiveTimestamp_clone(&o_conv); - LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); - *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv); + o_conv = HTLCUpdate_clone(&o_conv); + LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ"); + *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) { - LDKCreationError e_conv = LDKCreationError_from_js(e); - LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); - *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) { - LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_PositiveTimestampCreationErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) { - LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); - *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) { - LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig); - LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); - *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() { - LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); - *ret_conv = CResult_NoneSemanticErrorZ_ok(); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) { - LDKSemanticError e_conv = LDKSemanticError_from_js(e); - LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); - *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) { - LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_NoneSemanticErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); - *ret_conv = CResult_NoneSemanticErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) { - LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig); - LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); - *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) { - LDKInvoice o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = Invoice_clone(&o_conv); - LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); - *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) { - LDKSemanticError e_conv = LDKSemanticError_from_js(e); - LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); - *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) { - LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_InvoiceSemanticErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) { - LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); - *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) { - LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig); - LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); - *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) { - LDKDescription o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = Description_clone(&o_conv); - LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); - *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) { - LDKCreationError e_conv = LDKCreationError_from_js(e); - LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); - *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) { - LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_DescriptionCreationErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) { - LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); - *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) { - LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig); - LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); - *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) { - LDKPrivateRoute o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = PrivateRoute_clone(&o_conv); - LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); - *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) { - LDKCreationError e_conv = LDKCreationError_from_js(e); - LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); - *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) { - LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_PrivateRouteCreationErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) { - LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); - *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) { - LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig); - LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); - *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_StringErrorZ_ok"))) TS_CResult_StringErrorZ_ok(jstring o) { - LDKStr o_conv = str_ref_to_owned_c(o); - LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); - *ret_conv = CResult_StringErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_StringErrorZ_err"))) TS_CResult_StringErrorZ_err(uint32_t e) { - LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); - LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); - *ret_conv = CResult_StringErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_StringErrorZ_is_ok"))) TS_CResult_StringErrorZ_is_ok(uint64_t o) { - LDKCResult_StringErrorZ* o_conv = (LDKCResult_StringErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_StringErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_StringErrorZ_free"))) TS_CResult_StringErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_StringErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_StringErrorZ_clone_ptr(LDKCResult_StringErrorZ *NONNULL_PTR arg) { - LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); - *ret_conv = CResult_StringErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_StringErrorZ_clone_ptr"))) TS_CResult_StringErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_StringErrorZ* arg_conv = (LDKCResult_StringErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_StringErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_StringErrorZ_clone"))) TS_CResult_StringErrorZ_clone(uint64_t orig) { - LDKCResult_StringErrorZ* orig_conv = (LDKCResult_StringErrorZ*)untag_ptr(orig); - LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); - *ret_conv = CResult_StringErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_ok(uint64_t o) { - LDKChannelMonitorUpdate o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = ChannelMonitorUpdate_clone(&o_conv); - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); - *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); - *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* o_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); - *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* arg_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone"))) TS_CResult_ChannelMonitorUpdateDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)untag_ptr(orig); - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ"); - *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_COption_MonitorEventZ_some"))) TS_COption_MonitorEventZ_some(uint64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKMonitorEvent o_conv = *(LDKMonitorEvent*)(o_ptr); - o_conv = MonitorEvent_clone((LDKMonitorEvent*)untag_ptr(o)); - LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); - *ret_copy = COption_MonitorEventZ_some(o_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -uint64_t __attribute__((export_name("TS_COption_MonitorEventZ_none"))) TS_COption_MonitorEventZ_none() { - LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); - *ret_copy = COption_MonitorEventZ_none(); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -void __attribute__((export_name("TS_COption_MonitorEventZ_free"))) TS_COption_MonitorEventZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCOption_MonitorEventZ _res_conv = *(LDKCOption_MonitorEventZ*)(_res_ptr); - FREE(untag_ptr(_res)); - COption_MonitorEventZ_free(_res_conv); -} - -static inline uint64_t COption_MonitorEventZ_clone_ptr(LDKCOption_MonitorEventZ *NONNULL_PTR arg) { - LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); - *ret_copy = COption_MonitorEventZ_clone(arg); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -int64_t __attribute__((export_name("TS_COption_MonitorEventZ_clone_ptr"))) TS_COption_MonitorEventZ_clone_ptr(uint64_t arg) { - LDKCOption_MonitorEventZ* arg_conv = (LDKCOption_MonitorEventZ*)untag_ptr(arg); - int64_t ret_conv = COption_MonitorEventZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_COption_MonitorEventZ_clone"))) TS_COption_MonitorEventZ_clone(uint64_t orig) { - LDKCOption_MonitorEventZ* orig_conv = (LDKCOption_MonitorEventZ*)untag_ptr(orig); - LDKCOption_MonitorEventZ *ret_copy = MALLOC(sizeof(LDKCOption_MonitorEventZ), "LDKCOption_MonitorEventZ"); - *ret_copy = COption_MonitorEventZ_clone(orig_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_ok(uint64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKCOption_MonitorEventZ o_conv = *(LDKCOption_MonitorEventZ*)(o_ptr); - o_conv = COption_MonitorEventZ_clone((LDKCOption_MonitorEventZ*)untag_ptr(o)); - LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); - *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_err"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); - *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_COption_MonitorEventZDecodeErrorZ* o_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_free"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_COption_MonitorEventZDecodeErrorZ _res_conv = *(LDKCResult_COption_MonitorEventZDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_COption_MonitorEventZDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); - *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_COption_MonitorEventZDecodeErrorZ* arg_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_COption_MonitorEventZDecodeErrorZ_clone"))) TS_CResult_COption_MonitorEventZDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_COption_MonitorEventZDecodeErrorZ* orig_conv = (LDKCResult_COption_MonitorEventZDecodeErrorZ*)untag_ptr(orig); - LDKCResult_COption_MonitorEventZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ), "LDKCResult_COption_MonitorEventZDecodeErrorZ"); - *ret_conv = CResult_COption_MonitorEventZDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_ok"))) TS_CResult_HTLCUpdateDecodeErrorZ_ok(uint64_t o) { - LDKHTLCUpdate o_conv; - o_conv.inner = untag_ptr(o); - o_conv.is_owned = ptr_is_owned(o); - CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = HTLCUpdate_clone(&o_conv); - LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ"); - *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ"); - *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_HTLCUpdateDecodeErrorZ_err"))) TS_CResult_HTLCUpdateDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ"); + *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } @@ -18343,349 +18490,874 @@ uint64_t __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_non return ret_ref; } -void __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) { +void __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_free"))) TS_COption_CustomOnionMessageContentsZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_CustomOnionMessageContentsZ_free(_res_conv); +} + +static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) { + LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); + *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) { + LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg); + int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) { + LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig); + LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); + *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr); + o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o)); + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); + e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); + *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr); + o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o)); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_some(o_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() { + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_NetAddressZ_free(_res_conv); +} + +static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) { + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) { + LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg); + int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) { + LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = COption_NetAddressZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) { + LDKCVec_u8Z o_ref; + o_ref.datalen = o->arr_len; + o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes"); + memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o); + LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); + *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) { + LDKPeerHandleError e_conv; + e_conv.inner = untag_ptr(e); + e_conv.is_owned = ptr_is_owned(e); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = PeerHandleError_clone(&e_conv); + LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); + *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) { + LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) { + LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); + *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) { + LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig); + LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); + *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() { + LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); + *ret_conv = CResult_NonePeerHandleErrorZ_ok(); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) { + LDKPeerHandleError e_conv; + e_conv.inner = untag_ptr(e); + e_conv.is_owned = ptr_is_owned(e); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = PeerHandleError_clone(&e_conv); + LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); + *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) { + LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NonePeerHandleErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) { + LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); + *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) { + LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig); + LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); + *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) { + LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); + *ret_conv = CResult_boolPeerHandleErrorZ_ok(o); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) { + LDKPeerHandleError e_conv; + e_conv.inner = untag_ptr(e); + e_conv.is_owned = ptr_is_owned(e); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = PeerHandleError_clone(&e_conv); + LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); + *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) { + LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_boolPeerHandleErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) { + LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); + *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) { + LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig); + LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); + *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() { + LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); + *ret_conv = CResult_NoneSendErrorZ_ok(); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKSendError e_conv = *(LDKSendError*)(e_ptr); + e_conv = SendError_clone((LDKSendError*)untag_ptr(e)); + LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); + *ret_conv = CResult_NoneSendErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) { + LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneSendErrorZ_free(_res_conv); +} + +uint64_t __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) { + LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ"); + *ret_conv = CResult_u32GraphSyncErrorZ_ok(o); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr); + e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e)); + LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ"); + *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) { + LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_u32GraphSyncErrorZ_free(_res_conv); +} + +uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_ok"))) TS_CResult_SiPrefixParseErrorZ_ok(uint32_t o) { + LDKSiPrefix o_conv = LDKSiPrefix_from_js(o); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_err"))) TS_CResult_SiPrefixParseErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKParseError e_conv = *(LDKParseError*)(e_ptr); + e_conv = ParseError_clone((LDKParseError*)untag_ptr(e)); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_is_ok"))) TS_CResult_SiPrefixParseErrorZ_is_ok(uint64_t o) { + LDKCResult_SiPrefixParseErrorZ* o_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_SiPrefixParseErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_free"))) TS_CResult_SiPrefixParseErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_SiPrefixParseErrorZ _res_conv = *(LDKCResult_SiPrefixParseErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_SiPrefixParseErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_SiPrefixParseErrorZ_clone_ptr(LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR arg) { + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone_ptr"))) TS_CResult_SiPrefixParseErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_SiPrefixParseErrorZ* arg_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_SiPrefixParseErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_SiPrefixParseErrorZ_clone"))) TS_CResult_SiPrefixParseErrorZ_clone(uint64_t orig) { + LDKCResult_SiPrefixParseErrorZ* orig_conv = (LDKCResult_SiPrefixParseErrorZ*)untag_ptr(orig); + LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ"); + *ret_conv = CResult_SiPrefixParseErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_ok(uint64_t o) { + LDKInvoice o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = Invoice_clone(&o_conv); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_err"))) TS_CResult_InvoiceParseOrSemanticErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKParseOrSemanticError e_conv = *(LDKParseOrSemanticError*)(e_ptr); + e_conv = ParseOrSemanticError_clone((LDKParseOrSemanticError*)untag_ptr(e)); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok"))) TS_CResult_InvoiceParseOrSemanticErrorZ_is_ok(uint64_t o) { + LDKCResult_InvoiceParseOrSemanticErrorZ* o_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_InvoiceParseOrSemanticErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_free"))) TS_CResult_InvoiceParseOrSemanticErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_InvoiceParseOrSemanticErrorZ _res_conv = *(LDKCResult_InvoiceParseOrSemanticErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_InvoiceParseOrSemanticErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR arg) { + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_InvoiceParseOrSemanticErrorZ* arg_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_InvoiceParseOrSemanticErrorZ_clone"))) TS_CResult_InvoiceParseOrSemanticErrorZ_clone(uint64_t orig) { + LDKCResult_InvoiceParseOrSemanticErrorZ* orig_conv = (LDKCResult_InvoiceParseOrSemanticErrorZ*)untag_ptr(orig); + LDKCResult_InvoiceParseOrSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ), "LDKCResult_InvoiceParseOrSemanticErrorZ"); + *ret_conv = CResult_InvoiceParseOrSemanticErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_ok(uint64_t o) { + LDKSignedRawInvoice o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = SignedRawInvoice_clone(&o_conv); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_err"))) TS_CResult_SignedRawInvoiceParseErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKParseError e_conv = *(LDKParseError*)(e_ptr); + e_conv = ParseError_clone((LDKParseError*)untag_ptr(e)); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_is_ok"))) TS_CResult_SignedRawInvoiceParseErrorZ_is_ok(uint64_t o) { + LDKCResult_SignedRawInvoiceParseErrorZ* o_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_SignedRawInvoiceParseErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_free"))) TS_CResult_SignedRawInvoiceParseErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_SignedRawInvoiceParseErrorZ _res_conv = *(LDKCResult_SignedRawInvoiceParseErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_SignedRawInvoiceParseErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_SignedRawInvoiceParseErrorZ_clone_ptr(LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR arg) { + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_SignedRawInvoiceParseErrorZ* arg_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_SignedRawInvoiceParseErrorZ_clone"))) TS_CResult_SignedRawInvoiceParseErrorZ_clone(uint64_t orig) { + LDKCResult_SignedRawInvoiceParseErrorZ* orig_conv = (LDKCResult_SignedRawInvoiceParseErrorZ*)untag_ptr(orig); + LDKCResult_SignedRawInvoiceParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceParseErrorZ), "LDKCResult_SignedRawInvoiceParseErrorZ"); + *ret_conv = CResult_SignedRawInvoiceParseErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +static inline uint64_t C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR arg) { + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ"); + *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(uint64_t arg) { + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* arg_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(arg); + int64_t ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(uint64_t orig) { + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)untag_ptr(orig); + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ"); + *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(uint64_t a, int8_tArray b, uint64_t c) { + LDKRawInvoice a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = RawInvoice_clone(&a_conv); + LDKThirtyTwoBytes b_ref; + CHECK(b->arr_len == 32); + memcpy(b_ref.data, b->elems, 32); FREE(b); + LDKInvoiceSignature c_conv; + c_conv.inner = untag_ptr(c); + c_conv.is_owned = ptr_is_owned(c); + CHECK_INNER_FIELD_ACCESS_OR_NULL(c_conv); + c_conv = InvoiceSignature_clone(&c_conv); + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_conv = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ"); + *ret_conv = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free"))) TS_C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCOption_CustomOnionMessageContentsZ _res_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(_res_ptr); + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(_res_ptr); FREE(untag_ptr(_res)); - COption_CustomOnionMessageContentsZ_free(_res_conv); -} - -static inline uint64_t COption_CustomOnionMessageContentsZ_clone_ptr(LDKCOption_CustomOnionMessageContentsZ *NONNULL_PTR arg) { - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); - *ret_copy = COption_CustomOnionMessageContentsZ_clone(arg); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -int64_t __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone_ptr"))) TS_COption_CustomOnionMessageContentsZ_clone_ptr(uint64_t arg) { - LDKCOption_CustomOnionMessageContentsZ* arg_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(arg); - int64_t ret_conv = COption_CustomOnionMessageContentsZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_COption_CustomOnionMessageContentsZ_clone"))) TS_COption_CustomOnionMessageContentsZ_clone(uint64_t orig) { - LDKCOption_CustomOnionMessageContentsZ* orig_conv = (LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(orig); - LDKCOption_CustomOnionMessageContentsZ *ret_copy = MALLOC(sizeof(LDKCOption_CustomOnionMessageContentsZ), "LDKCOption_CustomOnionMessageContentsZ"); - *ret_copy = COption_CustomOnionMessageContentsZ_clone(orig_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; + C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv); } -uint64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(uint64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKCOption_CustomOnionMessageContentsZ o_conv = *(LDKCOption_CustomOnionMessageContentsZ*)(o_ptr); - o_conv = COption_CustomOnionMessageContentsZ_clone((LDKCOption_CustomOnionMessageContentsZ*)untag_ptr(o)); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o_conv); +uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_ok"))) TS_CResult_PayeePubKeyErrorZ_ok(uint64_t o) { + LDKPayeePubKey o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = PayeePubKey_clone(&o_conv); + LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); + *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKDecodeError e_conv = *(LDKDecodeError*)(e_ptr); - e_conv = DecodeError_clone((LDKDecodeError*)untag_ptr(e)); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_err"))) TS_CResult_PayeePubKeyErrorZ_err(uint32_t e) { + LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_js(e); + LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); + *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* o_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_is_ok"))) TS_CResult_PayeePubKeyErrorZ_is_ok(uint64_t o) { + LDKCResult_PayeePubKeyErrorZ* o_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_PayeePubKeyErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_free"))) TS_CResult_PayeePubKeyErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res_conv = *(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)(_res_ptr); + LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res_conv); + CResult_PayeePubKeyErrorZ_free(_res_conv); } -static inline uint64_t CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(arg); +static inline uint64_t CResult_PayeePubKeyErrorZ_clone_ptr(LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR arg) { + LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); + *ret_conv = CResult_PayeePubKeyErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* arg_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone_ptr"))) TS_CResult_PayeePubKeyErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_PayeePubKeyErrorZ* arg_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PayeePubKeyErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone"))) TS_CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* orig_conv = (LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ*)untag_ptr(orig); - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ), "LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ"); - *ret_conv = CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_PayeePubKeyErrorZ_clone"))) TS_CResult_PayeePubKeyErrorZ_clone(uint64_t orig) { + LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)untag_ptr(orig); + LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ"); + *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_COption_NetAddressZ_some"))) TS_COption_NetAddressZ_some(uint64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKNetAddress o_conv = *(LDKNetAddress*)(o_ptr); - o_conv = NetAddress_clone((LDKNetAddress*)untag_ptr(o)); - LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); - *ret_copy = COption_NetAddressZ_some(o_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +void __attribute__((export_name("TS_CVec_PrivateRouteZ_free"))) TS_CVec_PrivateRouteZ_free(uint64_tArray _res) { + LDKCVec_PrivateRouteZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t o = 0; o < _res_constr.datalen; o++) { + uint64_t _res_conv_14 = _res_vals[o]; + LDKPrivateRoute _res_conv_14_conv; + _res_conv_14_conv.inner = untag_ptr(_res_conv_14); + _res_conv_14_conv.is_owned = ptr_is_owned(_res_conv_14); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_14_conv); + _res_constr.data[o] = _res_conv_14_conv; + } + FREE(_res); + CVec_PrivateRouteZ_free(_res_constr); } -uint64_t __attribute__((export_name("TS_COption_NetAddressZ_none"))) TS_COption_NetAddressZ_none() { - LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); - *ret_copy = COption_NetAddressZ_none(); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_ok(uint64_t o) { + LDKPositiveTimestamp o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = PositiveTimestamp_clone(&o_conv); + LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); + *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_COption_NetAddressZ_free"))) TS_COption_NetAddressZ_free(uint64_t _res) { +uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_err"))) TS_CResult_PositiveTimestampCreationErrorZ_err(uint32_t e) { + LDKCreationError e_conv = LDKCreationError_from_js(e); + LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); + *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_is_ok"))) TS_CResult_PositiveTimestampCreationErrorZ_is_ok(uint64_t o) { + LDKCResult_PositiveTimestampCreationErrorZ* o_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_PositiveTimestampCreationErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_free"))) TS_CResult_PositiveTimestampCreationErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCOption_NetAddressZ _res_conv = *(LDKCOption_NetAddressZ*)(_res_ptr); + LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - COption_NetAddressZ_free(_res_conv); + CResult_PositiveTimestampCreationErrorZ_free(_res_conv); } -static inline uint64_t COption_NetAddressZ_clone_ptr(LDKCOption_NetAddressZ *NONNULL_PTR arg) { - LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); - *ret_copy = COption_NetAddressZ_clone(arg); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +static inline uint64_t CResult_PositiveTimestampCreationErrorZ_clone_ptr(LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR arg) { + LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); + *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(arg); + return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_COption_NetAddressZ_clone_ptr"))) TS_COption_NetAddressZ_clone_ptr(uint64_t arg) { - LDKCOption_NetAddressZ* arg_conv = (LDKCOption_NetAddressZ*)untag_ptr(arg); - int64_t ret_conv = COption_NetAddressZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr"))) TS_CResult_PositiveTimestampCreationErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_PositiveTimestampCreationErrorZ* arg_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PositiveTimestampCreationErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COption_NetAddressZ_clone(uint64_t orig) { - LDKCOption_NetAddressZ* orig_conv = (LDKCOption_NetAddressZ*)untag_ptr(orig); - LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); - *ret_copy = COption_NetAddressZ_clone(orig_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +uint64_t __attribute__((export_name("TS_CResult_PositiveTimestampCreationErrorZ_clone"))) TS_CResult_PositiveTimestampCreationErrorZ_clone(uint64_t orig) { + LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)untag_ptr(orig); + LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ"); + *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_ok(int8_tArray o) { - LDKCVec_u8Z o_ref; - o_ref.datalen = o->arr_len; - o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes"); - memcpy(o_ref.data, o->elems, o_ref.datalen); FREE(o); - LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); - *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref); +uint64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_ok"))) TS_CResult_NoneSemanticErrorZ_ok() { + LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); + *ret_conv = CResult_NoneSemanticErrorZ_ok(); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_err"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_err(uint64_t e) { - LDKPeerHandleError e_conv; - e_conv.inner = untag_ptr(e); - e_conv.is_owned = ptr_is_owned(e); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = PeerHandleError_clone(&e_conv); - LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); - *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_err"))) TS_CResult_NoneSemanticErrorZ_err(uint32_t e) { + LDKSemanticError e_conv = LDKSemanticError_from_js(e); + LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); + *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_is_ok(uint64_t o) { - LDKCResult_CVec_u8ZPeerHandleErrorZ* o_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_is_ok"))) TS_CResult_NoneSemanticErrorZ_is_ok(uint64_t o) { + LDKCResult_NoneSemanticErrorZ* o_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneSemanticErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_free"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_free"))) TS_CResult_NoneSemanticErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(_res_ptr); + LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv); + CResult_NoneSemanticErrorZ_free(_res_conv); } -static inline uint64_t CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR arg) { - LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); - *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(arg); +static inline uint64_t CResult_NoneSemanticErrorZ_clone_ptr(LDKCResult_NoneSemanticErrorZ *NONNULL_PTR arg) { + LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); + *ret_conv = CResult_NoneSemanticErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_CVec_u8ZPeerHandleErrorZ* arg_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone_ptr"))) TS_CResult_NoneSemanticErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_NoneSemanticErrorZ* arg_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneSemanticErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_CVec_u8ZPeerHandleErrorZ_clone"))) TS_CResult_CVec_u8ZPeerHandleErrorZ_clone(uint64_t orig) { - LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)untag_ptr(orig); - LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ"); - *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_NoneSemanticErrorZ_clone"))) TS_CResult_NoneSemanticErrorZ_clone(uint64_t orig) { + LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)untag_ptr(orig); + LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ"); + *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_ok"))) TS_CResult_NonePeerHandleErrorZ_ok() { - LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); - *ret_conv = CResult_NonePeerHandleErrorZ_ok(); +uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_ok"))) TS_CResult_InvoiceSemanticErrorZ_ok(uint64_t o) { + LDKInvoice o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = Invoice_clone(&o_conv); + LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); + *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_err"))) TS_CResult_NonePeerHandleErrorZ_err(uint64_t e) { - LDKPeerHandleError e_conv; - e_conv.inner = untag_ptr(e); - e_conv.is_owned = ptr_is_owned(e); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = PeerHandleError_clone(&e_conv); - LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); - *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_err"))) TS_CResult_InvoiceSemanticErrorZ_err(uint32_t e) { + LDKSemanticError e_conv = LDKSemanticError_from_js(e); + LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); + *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_is_ok"))) TS_CResult_NonePeerHandleErrorZ_is_ok(uint64_t o) { - LDKCResult_NonePeerHandleErrorZ* o_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_NonePeerHandleErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_is_ok"))) TS_CResult_InvoiceSemanticErrorZ_is_ok(uint64_t o) { + LDKCResult_InvoiceSemanticErrorZ* o_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_InvoiceSemanticErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_free"))) TS_CResult_NonePeerHandleErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_free"))) TS_CResult_InvoiceSemanticErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(_res_ptr); + LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_NonePeerHandleErrorZ_free(_res_conv); + CResult_InvoiceSemanticErrorZ_free(_res_conv); } -static inline uint64_t CResult_NonePeerHandleErrorZ_clone_ptr(LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR arg) { - LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); - *ret_conv = CResult_NonePeerHandleErrorZ_clone(arg); +static inline uint64_t CResult_InvoiceSemanticErrorZ_clone_ptr(LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR arg) { + LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); + *ret_conv = CResult_InvoiceSemanticErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone_ptr"))) TS_CResult_NonePeerHandleErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_NonePeerHandleErrorZ* arg_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_NonePeerHandleErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone_ptr"))) TS_CResult_InvoiceSemanticErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_InvoiceSemanticErrorZ* arg_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_InvoiceSemanticErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_NonePeerHandleErrorZ_clone"))) TS_CResult_NonePeerHandleErrorZ_clone(uint64_t orig) { - LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)untag_ptr(orig); - LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ"); - *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_InvoiceSemanticErrorZ_clone"))) TS_CResult_InvoiceSemanticErrorZ_clone(uint64_t orig) { + LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)untag_ptr(orig); + LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ"); + *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_ok"))) TS_CResult_boolPeerHandleErrorZ_ok(jboolean o) { - LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); - *ret_conv = CResult_boolPeerHandleErrorZ_ok(o); +uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_ok"))) TS_CResult_DescriptionCreationErrorZ_ok(uint64_t o) { + LDKDescription o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = Description_clone(&o_conv); + LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); + *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_err"))) TS_CResult_boolPeerHandleErrorZ_err(uint64_t e) { - LDKPeerHandleError e_conv; - e_conv.inner = untag_ptr(e); - e_conv.is_owned = ptr_is_owned(e); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = PeerHandleError_clone(&e_conv); - LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); - *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_err"))) TS_CResult_DescriptionCreationErrorZ_err(uint32_t e) { + LDKCreationError e_conv = LDKCreationError_from_js(e); + LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); + *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_is_ok"))) TS_CResult_boolPeerHandleErrorZ_is_ok(uint64_t o) { - LDKCResult_boolPeerHandleErrorZ* o_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_boolPeerHandleErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_is_ok"))) TS_CResult_DescriptionCreationErrorZ_is_ok(uint64_t o) { + LDKCResult_DescriptionCreationErrorZ* o_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_DescriptionCreationErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_free"))) TS_CResult_boolPeerHandleErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_free"))) TS_CResult_DescriptionCreationErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(_res_ptr); + LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_boolPeerHandleErrorZ_free(_res_conv); + CResult_DescriptionCreationErrorZ_free(_res_conv); } -static inline uint64_t CResult_boolPeerHandleErrorZ_clone_ptr(LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR arg) { - LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); - *ret_conv = CResult_boolPeerHandleErrorZ_clone(arg); +static inline uint64_t CResult_DescriptionCreationErrorZ_clone_ptr(LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR arg) { + LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); + *ret_conv = CResult_DescriptionCreationErrorZ_clone(arg); return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone_ptr"))) TS_CResult_boolPeerHandleErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_boolPeerHandleErrorZ* arg_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_boolPeerHandleErrorZ_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone_ptr"))) TS_CResult_DescriptionCreationErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_DescriptionCreationErrorZ* arg_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_DescriptionCreationErrorZ_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) TS_CResult_boolPeerHandleErrorZ_clone(uint64_t orig) { - LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)untag_ptr(orig); - LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ"); - *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv); +uint64_t __attribute__((export_name("TS_CResult_DescriptionCreationErrorZ_clone"))) TS_CResult_DescriptionCreationErrorZ_clone(uint64_t orig) { + LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)untag_ptr(orig); + LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ"); + *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_NoneSendErrorZ_ok"))) TS_CResult_NoneSendErrorZ_ok() { - LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); - *ret_conv = CResult_NoneSendErrorZ_ok(); +uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_ok"))) TS_CResult_PrivateRouteCreationErrorZ_ok(uint64_t o) { + LDKPrivateRoute o_conv; + o_conv.inner = untag_ptr(o); + o_conv.is_owned = ptr_is_owned(o); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = PrivateRoute_clone(&o_conv); + LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); + *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_NoneSendErrorZ_err"))) TS_CResult_NoneSendErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKSendError e_conv = *(LDKSendError*)(e_ptr); - e_conv = SendError_clone((LDKSendError*)untag_ptr(e)); - LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); - *ret_conv = CResult_NoneSendErrorZ_err(e_conv); +uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_err"))) TS_CResult_PrivateRouteCreationErrorZ_err(uint32_t e) { + LDKCreationError e_conv = LDKCreationError_from_js(e); + LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); + *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv); return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_CResult_NoneSendErrorZ_is_ok"))) TS_CResult_NoneSendErrorZ_is_ok(uint64_t o) { - LDKCResult_NoneSendErrorZ* o_conv = (LDKCResult_NoneSendErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_NoneSendErrorZ_is_ok(o_conv); +jboolean __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_is_ok"))) TS_CResult_PrivateRouteCreationErrorZ_is_ok(uint64_t o) { + LDKCResult_PrivateRouteCreationErrorZ* o_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_PrivateRouteCreationErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_NoneSendErrorZ_free"))) TS_CResult_NoneSendErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_free"))) TS_CResult_PrivateRouteCreationErrorZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCResult_NoneSendErrorZ _res_conv = *(LDKCResult_NoneSendErrorZ*)(_res_ptr); + LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_NoneSendErrorZ_free(_res_conv); -} - -uint64_t __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_ok"))) TS_CResult_u32GraphSyncErrorZ_ok(int32_t o) { - LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ"); - *ret_conv = CResult_u32GraphSyncErrorZ_ok(o); - return tag_ptr(ret_conv, true); + CResult_PrivateRouteCreationErrorZ_free(_res_conv); } -uint64_t __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_err"))) TS_CResult_u32GraphSyncErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKGraphSyncError e_conv = *(LDKGraphSyncError*)(e_ptr); - e_conv = GraphSyncError_clone((LDKGraphSyncError*)untag_ptr(e)); - LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ"); - *ret_conv = CResult_u32GraphSyncErrorZ_err(e_conv); +static inline uint64_t CResult_PrivateRouteCreationErrorZ_clone_ptr(LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR arg) { + LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); + *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(arg); return tag_ptr(ret_conv, true); } - -jboolean __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_is_ok"))) TS_CResult_u32GraphSyncErrorZ_is_ok(uint64_t o) { - LDKCResult_u32GraphSyncErrorZ* o_conv = (LDKCResult_u32GraphSyncErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_u32GraphSyncErrorZ_is_ok(o_conv); +int64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone_ptr"))) TS_CResult_PrivateRouteCreationErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_PrivateRouteCreationErrorZ* arg_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PrivateRouteCreationErrorZ_clone_ptr(arg_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_u32GraphSyncErrorZ_free"))) TS_CResult_u32GraphSyncErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_u32GraphSyncErrorZ _res_conv = *(LDKCResult_u32GraphSyncErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_u32GraphSyncErrorZ_free(_res_conv); +uint64_t __attribute__((export_name("TS_CResult_PrivateRouteCreationErrorZ_clone"))) TS_CResult_PrivateRouteCreationErrorZ_clone(uint64_t orig) { + LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)untag_ptr(orig); + LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ"); + *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); } uint64_t __attribute__((export_name("TS_CResult_NoneErrorZ_ok"))) TS_CResult_NoneErrorZ_ok() { @@ -20840,6 +21512,101 @@ void __attribute__((export_name("TS_CVec_OutPointZ_free"))) TS_CVec_OutPointZ_f CVec_OutPointZ_free(_res_constr); } +void __attribute__((export_name("TS_CVec_MonitorUpdateIdZ_free"))) TS_CVec_MonitorUpdateIdZ_free(uint64_tArray _res) { + LDKCVec_MonitorUpdateIdZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t r = 0; r < _res_constr.datalen; r++) { + uint64_t _res_conv_17 = _res_vals[r]; + LDKMonitorUpdateId _res_conv_17_conv; + _res_conv_17_conv.inner = untag_ptr(_res_conv_17); + _res_conv_17_conv.is_owned = ptr_is_owned(_res_conv_17); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_17_conv); + _res_constr.data[r] = _res_conv_17_conv; + } + FREE(_res); + CVec_MonitorUpdateIdZ_free(_res_constr); +} + +static inline uint64_t C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR arg) { + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ"); + *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(uint64_t arg) { + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* arg_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(uint64_t orig) { + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* orig_conv = (LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)untag_ptr(orig); + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ"); + *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(uint64_t a, uint64_tArray b) { + LDKOutPoint a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv = OutPoint_clone(&a_conv); + LDKCVec_MonitorUpdateIdZ b_constr; + b_constr.datalen = b->arr_len; + if (b_constr.datalen > 0) + b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKMonitorUpdateId), "LDKCVec_MonitorUpdateIdZ Elements"); + else + b_constr.data = NULL; + uint64_t* b_vals = b->elems; + for (size_t r = 0; r < b_constr.datalen; r++) { + uint64_t b_conv_17 = b_vals[r]; + LDKMonitorUpdateId b_conv_17_conv; + b_conv_17_conv.inner = untag_ptr(b_conv_17); + b_conv_17_conv.is_owned = ptr_is_owned(b_conv_17); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv_17_conv); + b_conv_17_conv = MonitorUpdateId_clone(&b_conv_17_conv); + b_constr.data[r] = b_conv_17_conv; + } + FREE(b); + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ"); + *ret_conv = C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a_conv, b_constr); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free"))) TS_C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res_conv); +} + +void __attribute__((export_name("TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free"))) TS_CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(uint64_tArray _res) { + LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t p = 0; p < _res_constr.datalen; p++) { + uint64_t _res_conv_41 = _res_vals[p]; + void* _res_conv_41_ptr = untag_ptr(_res_conv_41); + CHECK_ACCESS(_res_conv_41_ptr); + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res_conv_41_conv = *(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ*)(_res_conv_41_ptr); + FREE(untag_ptr(_res_conv_41)); + _res_constr.data[p] = _res_conv_41_conv; + } + FREE(_res); + CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res_constr); +} + void __attribute__((export_name("TS_PaymentPurpose_free"))) TS_PaymentPurpose_free(uint64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -21073,6 +21840,13 @@ uint64_t __attribute__((export_name("TS_HTLCDestination_unknown_next_hop"))) TS return ret_ref; } +uint64_t __attribute__((export_name("TS_HTLCDestination_invalid_forward"))) TS_HTLCDestination_invalid_forward(int64_t requested_forward_scid) { + LDKHTLCDestination *ret_copy = MALLOC(sizeof(LDKHTLCDestination), "LDKHTLCDestination"); + *ret_copy = HTLCDestination_invalid_forward(requested_forward_scid); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_HTLCDestination_failed_payment"))) TS_HTLCDestination_failed_payment(int8_tArray payment_hash) { LDKThirtyTwoBytes payment_hash_ref; CHECK(payment_hash->arr_len == 32); @@ -21138,7 +21912,7 @@ uint64_t __attribute__((export_name("TS_Event_clone"))) TS_Event_clone(uint64_t return ret_ref; } -uint64_t __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int64_t user_channel_id) { +uint64_t __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_Event_funding_generation_ready(int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t channel_value_satoshis, int8_tArray output_script, int8_tArray user_channel_id) { LDKThirtyTwoBytes temporary_channel_id_ref; CHECK(temporary_channel_id->arr_len == 32); memcpy(temporary_channel_id_ref.data, temporary_channel_id->elems, 32); FREE(temporary_channel_id); @@ -21149,13 +21923,19 @@ uint64_t __attribute__((export_name("TS_Event_funding_generation_ready"))) TS_E output_script_ref.datalen = output_script->arr_len; output_script_ref.data = MALLOC(output_script_ref.datalen, "LDKCVec_u8Z Bytes"); memcpy(output_script_ref.data, output_script->elems, output_script_ref.datalen); FREE(output_script); + LDKU128 user_channel_id_ref; + CHECK(user_channel_id->arr_len == 16); + memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id); + *ret_copy = Event_funding_generation_ready(temporary_channel_id_ref, counterparty_node_id_ref, channel_value_satoshis, output_script_ref, user_channel_id_ref); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -uint64_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_payment_received(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) { +uint64_t __attribute__((export_name("TS_Event_payment_claimable"))) TS_Event_payment_claimable(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose, int8_tArray via_channel_id, uint64_t via_user_channel_id) { + LDKPublicKey receiver_node_id_ref; + CHECK(receiver_node_id->arr_len == 33); + memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id); LDKThirtyTwoBytes payment_hash_ref; CHECK(payment_hash->arr_len == 32); memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); @@ -21163,13 +21943,23 @@ uint64_t __attribute__((export_name("TS_Event_payment_received"))) TS_Event_pay CHECK_ACCESS(purpose_ptr); LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr); purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose)); + LDKThirtyTwoBytes via_channel_id_ref; + CHECK(via_channel_id->arr_len == 32); + memcpy(via_channel_id_ref.data, via_channel_id->elems, 32); FREE(via_channel_id); + void* via_user_channel_id_ptr = untag_ptr(via_user_channel_id); + CHECK_ACCESS(via_user_channel_id_ptr); + LDKCOption_u128Z via_user_channel_id_conv = *(LDKCOption_u128Z*)(via_user_channel_id_ptr); + via_user_channel_id_conv = COption_u128Z_clone((LDKCOption_u128Z*)untag_ptr(via_user_channel_id)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_received(payment_hash_ref, amount_msat, purpose_conv); + *ret_copy = Event_payment_claimable(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv, via_channel_id_ref, via_user_channel_id_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -uint64_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) { +uint64_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_payment_claimed(int8_tArray receiver_node_id, int8_tArray payment_hash, int64_t amount_msat, uint64_t purpose) { + LDKPublicKey receiver_node_id_ref; + CHECK(receiver_node_id->arr_len == 33); + memcpy(receiver_node_id_ref.compressed_form, receiver_node_id->elems, 33); FREE(receiver_node_id); LDKThirtyTwoBytes payment_hash_ref; CHECK(payment_hash->arr_len == 32); memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); @@ -21178,7 +21968,7 @@ uint64_t __attribute__((export_name("TS_Event_payment_claimed"))) TS_Event_paym LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(purpose_ptr); purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)untag_ptr(purpose)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_claimed(payment_hash_ref, amount_msat, purpose_conv); + *ret_copy = Event_payment_claimed(receiver_node_id_ref, payment_hash_ref, amount_msat, purpose_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -21360,6 +22150,19 @@ uint64_t __attribute__((export_name("TS_Event_pending_htlcs_forwardable"))) TS_ return ret_ref; } +uint64_t __attribute__((export_name("TS_Event_htlcintercepted"))) TS_Event_htlcintercepted(int8_tArray intercept_id, int64_t requested_next_hop_scid, int8_tArray payment_hash, int64_t inbound_amount_msat, int64_t expected_outbound_amount_msat) { + LDKThirtyTwoBytes intercept_id_ref; + CHECK(intercept_id->arr_len == 32); + memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_htlcintercepted(intercept_id_ref, requested_next_hop_scid, payment_hash_ref, inbound_amount_msat, expected_outbound_amount_msat); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_Event_spendable_outputs"))) TS_Event_spendable_outputs(uint64_tArray outputs) { LDKCVec_SpendableOutputDescriptorZ outputs_constr; outputs_constr.datalen = outputs->arr_len; @@ -21400,16 +22203,40 @@ uint64_t __attribute__((export_name("TS_Event_payment_forwarded"))) TS_Event_pa return ret_ref; } -uint64_t __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int64_t user_channel_id, uint64_t reason) { +uint64_t __attribute__((export_name("TS_Event_channel_ready"))) TS_Event_channel_ready(int8_tArray channel_id, int8_tArray user_channel_id, int8_tArray counterparty_node_id, uint64_t channel_type) { + LDKThirtyTwoBytes channel_id_ref; + CHECK(channel_id->arr_len == 32); + memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id); + LDKU128 user_channel_id_ref; + CHECK(user_channel_id->arr_len == 16); + memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id); + LDKPublicKey counterparty_node_id_ref; + CHECK(counterparty_node_id->arr_len == 33); + memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id); + LDKChannelTypeFeatures channel_type_conv; + channel_type_conv.inner = untag_ptr(channel_type); + channel_type_conv.is_owned = ptr_is_owned(channel_type); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_type_conv); + channel_type_conv = ChannelTypeFeatures_clone(&channel_type_conv); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_channel_ready(channel_id_ref, user_channel_id_ref, counterparty_node_id_ref, channel_type_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_Event_channel_closed"))) TS_Event_channel_closed(int8_tArray channel_id, int8_tArray user_channel_id, uint64_t reason) { LDKThirtyTwoBytes channel_id_ref; CHECK(channel_id->arr_len == 32); memcpy(channel_id_ref.data, channel_id->elems, 32); FREE(channel_id); + LDKU128 user_channel_id_ref; + CHECK(user_channel_id->arr_len == 16); + memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id); void* reason_ptr = untag_ptr(reason); CHECK_ACCESS(reason_ptr); LDKClosureReason reason_conv = *(LDKClosureReason*)(reason_ptr); reason_conv = ClosureReason_clone((LDKClosureReason*)untag_ptr(reason)); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id, reason_conv); + *ret_copy = Event_channel_closed(channel_id_ref, user_channel_id_ref, reason_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -21893,10 +22720,10 @@ uint64_t __attribute__((export_name("TS_APIError_fee_rate_too_high"))) TS_APIEr return ret_ref; } -uint64_t __attribute__((export_name("TS_APIError_route_error"))) TS_APIError_route_error(jstring err) { +uint64_t __attribute__((export_name("TS_APIError_invalid_route"))) TS_APIError_invalid_route(jstring err) { LDKStr err_conv = str_ref_to_owned_c(err); LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError"); - *ret_copy = APIError_route_error(err_conv); + *ret_copy = APIError_invalid_route(err_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -22075,17 +22902,17 @@ int8_tArray __attribute__((export_name("TS_construct_invoice_preimage"))) TS_co LDKu8slice hrp_bytes_ref; hrp_bytes_ref.datalen = hrp_bytes->arr_len; hrp_bytes_ref.data = hrp_bytes->elems; - LDKCVec_u5Z data_without_signature_constr; + LDKCVec_U5Z data_without_signature_constr; data_without_signature_constr.datalen = data_without_signature->arr_len; if (data_without_signature_constr.datalen > 0) - data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKu5), "LDKCVec_u5Z Elements"); + data_without_signature_constr.data = MALLOC(data_without_signature_constr.datalen * sizeof(LDKU5), "LDKCVec_U5Z Elements"); else data_without_signature_constr.data = NULL; int8_t* data_without_signature_vals = (void*) data_without_signature->elems; for (size_t h = 0; h < data_without_signature_constr.datalen; h++) { int8_t data_without_signature_conv_7 = data_without_signature_vals[h]; - data_without_signature_constr.data[h] = (LDKu5){ ._0 = data_without_signature_conv_7 }; + data_without_signature_constr.data[h] = (LDKU5){ ._0 = data_without_signature_conv_7 }; } FREE(data_without_signature); LDKCVec_u8Z ret_var = construct_invoice_preimage(hrp_bytes_ref, data_without_signature_constr); @@ -22105,6 +22932,45 @@ void __attribute__((export_name("TS_Persister_free"))) TS_Persister_free(uint64 Persister_free(this_ptr_conv); } +void __attribute__((export_name("TS_PrintableString_free"))) TS_PrintableString_free(uint64_t this_obj) { + LDKPrintableString this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + PrintableString_free(this_obj_conv); +} + +jstring __attribute__((export_name("TS_PrintableString_get_a"))) TS_PrintableString_get_a(uint64_t this_ptr) { + LDKPrintableString this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + LDKStr ret_str = PrintableString_get_a(&this_ptr_conv); + jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len); + Str_free(ret_str); + return ret_conv; +} + +void __attribute__((export_name("TS_PrintableString_set_a"))) TS_PrintableString_set_a(uint64_t this_ptr, jstring val) { + LDKPrintableString this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + LDKStr val_conv = str_ref_to_owned_c(val); + PrintableString_set_a(&this_ptr_conv, val_conv); +} + +uint64_t __attribute__((export_name("TS_PrintableString_new"))) TS_PrintableString_new(jstring a_arg) { + LDKStr a_arg_conv = str_ref_to_owned_c(a_arg); + LDKPrintableString ret_var = PrintableString_new(a_arg_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + void __attribute__((export_name("TS_FutureCallback_free"))) TS_FutureCallback_free(uint64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -23127,7 +23993,26 @@ void __attribute__((export_name("TS_UserConfig_set_manually_accept_inbound_chan UserConfig_set_manually_accept_inbound_channels(&this_ptr_conv, val); } -uint64_t __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint64_t channel_handshake_config_arg, uint64_t channel_handshake_limits_arg, uint64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg) { +jboolean __attribute__((export_name("TS_UserConfig_get_accept_intercept_htlcs"))) TS_UserConfig_get_accept_intercept_htlcs(uint64_t this_ptr) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + jboolean ret_conv = UserConfig_get_accept_intercept_htlcs(&this_ptr_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_UserConfig_set_accept_intercept_htlcs"))) TS_UserConfig_set_accept_intercept_htlcs(uint64_t this_ptr, jboolean val) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + UserConfig_set_accept_intercept_htlcs(&this_ptr_conv, val); +} + +uint64_t __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(uint64_t channel_handshake_config_arg, uint64_t channel_handshake_limits_arg, uint64_t channel_config_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg, jboolean manually_accept_inbound_channels_arg, jboolean accept_intercept_htlcs_arg) { LDKChannelHandshakeConfig channel_handshake_config_arg_conv; channel_handshake_config_arg_conv.inner = untag_ptr(channel_handshake_config_arg); channel_handshake_config_arg_conv.is_owned = ptr_is_owned(channel_handshake_config_arg); @@ -23143,7 +24028,7 @@ uint64_t __attribute__((export_name("TS_UserConfig_new"))) TS_UserConfig_new(ui channel_config_arg_conv.is_owned = ptr_is_owned(channel_config_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_config_arg_conv); channel_config_arg_conv = ChannelConfig_clone(&channel_config_arg_conv); - LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg); + LDKUserConfig ret_var = UserConfig_new(channel_handshake_config_arg_conv, channel_handshake_limits_arg_conv, channel_config_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg, manually_accept_inbound_channels_arg, accept_intercept_htlcs_arg); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -23559,6 +24444,12 @@ uint32_t __attribute__((export_name("TS_ConfirmationTarget_high_priority"))) TS return ret_conv; } +int64_t __attribute__((export_name("TS_ConfirmationTarget_hash"))) TS_ConfirmationTarget_hash(uint64_t o) { + LDKConfirmationTarget* o_conv = (LDKConfirmationTarget*)untag_ptr(o); + int64_t ret_conv = ConfirmationTarget_hash(o_conv); + return ret_conv; +} + jboolean __attribute__((export_name("TS_ConfirmationTarget_eq"))) TS_ConfirmationTarget_eq(uint64_t a, uint64_t b) { LDKConfirmationTarget* a_conv = (LDKConfirmationTarget*)untag_ptr(a); LDKConfirmationTarget* b_conv = (LDKConfirmationTarget*)untag_ptr(b); @@ -23786,6 +24677,26 @@ uint64_tArray __attribute__((export_name("TS_ChainMonitor_list_monitors"))) TS_ return ret_arr; } +uint64_tArray __attribute__((export_name("TS_ChainMonitor_list_pending_monitor_updates"))) TS_ChainMonitor_list_pending_monitor_updates(uint64_t this_arg) { + LDKChainMonitor this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ret_var = ChainMonitor_list_pending_monitor_updates(&this_arg_conv); + uint64_tArray ret_arr = NULL; + ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__); + uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8); + for (size_t p = 0; p < ret_var.datalen; p++) { + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* ret_conv_41_conv = MALLOC(sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ), "LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ"); + *ret_conv_41_conv = ret_var.data[p]; + ret_arr_ptr[p] = tag_ptr(ret_conv_41_conv, true); + } + + FREE(ret_var.data); + return ret_arr; +} + uint64_t __attribute__((export_name("TS_ChainMonitor_channel_monitor_updated"))) TS_ChainMonitor_channel_monitor_updated(uint64_t this_arg, uint64_t funding_txo, uint64_t completed_update_id) { LDKChainMonitor this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -24634,20 +25545,20 @@ uint64_tArray __attribute__((export_name("TS_ChannelMonitor_best_block_updated" return ret_arr; } -ptrArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) { +uint64_tArray __attribute__((export_name("TS_ChannelMonitor_get_relevant_txids"))) TS_ChannelMonitor_get_relevant_txids(uint64_t this_arg) { LDKChannelMonitor this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv); - ptrArray ret_arr = NULL; - ret_arr = init_ptrArray(ret_var.datalen, __LINE__); - int8_tArray *ret_arr_ptr = (int8_tArray*)(((uint8_t*)ret_arr) + 8); - for (size_t m = 0; m < ret_var.datalen; m++) { - int8_tArray ret_conv_12_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_conv_12_arr->elems, ret_var.data[m].data, 32); - ret_arr_ptr[m] = ret_conv_12_arr; + LDKCVec_C2Tuple_TxidBlockHashZZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv); + uint64_tArray ret_arr = NULL; + ret_arr = init_uint64_tArray(ret_var.datalen, __LINE__); + uint64_t *ret_arr_ptr = (uint64_t*)(((uint8_t*)ret_arr) + 8); + for (size_t z = 0; z < ret_var.datalen; z++) { + LDKC2Tuple_TxidBlockHashZ* ret_conv_25_conv = MALLOC(sizeof(LDKC2Tuple_TxidBlockHashZ), "LDKC2Tuple_TxidBlockHashZ"); + *ret_conv_25_conv = ret_var.data[z]; + ret_arr_ptr[z] = tag_ptr(ret_conv_25_conv, true); } FREE(ret_var.data); @@ -26685,23 +27596,27 @@ void __attribute__((export_name("TS_ChannelDetails_set_unspendable_punishment_r ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv); } -int64_t __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) { +int8_tArray __attribute__((export_name("TS_ChannelDetails_get_user_channel_id"))) TS_ChannelDetails_get_user_channel_id(uint64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - int64_t ret_conv = ChannelDetails_get_user_channel_id(&this_ptr_conv); - return ret_conv; + int8_tArray ret_arr = init_int8_tArray(16, __LINE__); + memcpy(ret_arr->elems, ChannelDetails_get_user_channel_id(&this_ptr_conv).le_bytes, 16); + return ret_arr; } -void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int64_t val) { +void __attribute__((export_name("TS_ChannelDetails_set_user_channel_id"))) TS_ChannelDetails_set_user_channel_id(uint64_t this_ptr, int8_tArray val) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); this_ptr_conv.is_owned = false; - ChannelDetails_set_user_channel_id(&this_ptr_conv, val); + LDKU128 val_ref; + CHECK(val->arr_len == 16); + memcpy(val_ref.le_bytes, val->elems, 16); FREE(val); + ChannelDetails_set_user_channel_id(&this_ptr_conv, val_ref); } int64_t __attribute__((export_name("TS_ChannelDetails_get_balance_msat"))) TS_ChannelDetails_get_balance_msat(uint64_t this_ptr) { @@ -26805,6 +27720,31 @@ void __attribute__((export_name("TS_ChannelDetails_set_confirmations_required") ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv); } +uint64_t __attribute__((export_name("TS_ChannelDetails_get_confirmations"))) TS_ChannelDetails_get_confirmations(uint64_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z"); + *ret_copy = ChannelDetails_get_confirmations(&this_ptr_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_ChannelDetails_set_confirmations"))) TS_ChannelDetails_set_confirmations(uint64_t this_ptr, uint64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + void* val_ptr = untag_ptr(val); + CHECK_ACCESS(val_ptr); + LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(val_ptr); + val_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(val)); + ChannelDetails_set_confirmations(&this_ptr_conv, val_conv); +} + uint64_t __attribute__((export_name("TS_ChannelDetails_get_force_close_spend_delay"))) TS_ChannelDetails_get_force_close_spend_delay(uint64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); @@ -26983,7 +27923,7 @@ void __attribute__((export_name("TS_ChannelDetails_set_config"))) TS_ChannelDet ChannelDetails_set_config(&this_ptr_conv, val_conv); } -uint64_t __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint64_t counterparty_arg, uint64_t funding_txo_arg, uint64_t channel_type_arg, uint64_t short_channel_id_arg, uint64_t outbound_scid_alias_arg, uint64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, uint64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, uint64_t confirmations_required_arg, uint64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, uint64_t inbound_htlc_minimum_msat_arg, uint64_t inbound_htlc_maximum_msat_arg, uint64_t config_arg) { +uint64_t __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint64_t counterparty_arg, uint64_t funding_txo_arg, uint64_t channel_type_arg, uint64_t short_channel_id_arg, uint64_t outbound_scid_alias_arg, uint64_t inbound_scid_alias_arg, int64_t channel_value_satoshis_arg, uint64_t unspendable_punishment_reserve_arg, int8_tArray user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t next_outbound_htlc_limit_msat_arg, int64_t inbound_capacity_msat_arg, uint64_t confirmations_required_arg, uint64_t confirmations_arg, uint64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_channel_ready_arg, jboolean is_usable_arg, jboolean is_public_arg, uint64_t inbound_htlc_minimum_msat_arg, uint64_t inbound_htlc_maximum_msat_arg, uint64_t config_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK(channel_id_arg->arr_len == 32); memcpy(channel_id_arg_ref.data, channel_id_arg->elems, 32); FREE(channel_id_arg); @@ -27017,10 +27957,17 @@ uint64_t __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetail void* unspendable_punishment_reserve_arg_ptr = untag_ptr(unspendable_punishment_reserve_arg); CHECK_ACCESS(unspendable_punishment_reserve_arg_ptr); LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(unspendable_punishment_reserve_arg_ptr); + LDKU128 user_channel_id_arg_ref; + CHECK(user_channel_id_arg->arr_len == 16); + memcpy(user_channel_id_arg_ref.le_bytes, user_channel_id_arg->elems, 16); FREE(user_channel_id_arg); void* confirmations_required_arg_ptr = untag_ptr(confirmations_required_arg); CHECK_ACCESS(confirmations_required_arg_ptr); LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(confirmations_required_arg_ptr); confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_required_arg)); + void* confirmations_arg_ptr = untag_ptr(confirmations_arg); + CHECK_ACCESS(confirmations_arg_ptr); + LDKCOption_u32Z confirmations_arg_conv = *(LDKCOption_u32Z*)(confirmations_arg_ptr); + confirmations_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)untag_ptr(confirmations_arg)); void* force_close_spend_delay_arg_ptr = untag_ptr(force_close_spend_delay_arg); CHECK_ACCESS(force_close_spend_delay_arg_ptr); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); @@ -27038,7 +27985,7 @@ uint64_t __attribute__((export_name("TS_ChannelDetails_new"))) TS_ChannelDetail config_arg_conv.is_owned = ptr_is_owned(config_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(config_arg_conv); config_arg_conv = ChannelConfig_clone(&config_arg_conv); - LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv); + LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, channel_type_arg_conv, short_channel_id_arg_conv, outbound_scid_alias_arg_conv, inbound_scid_alias_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg_ref, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, confirmations_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg_conv, inbound_htlc_maximum_msat_arg_conv, config_arg_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -27162,7 +28109,7 @@ uint64_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error return ret_ref; } -uint64_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_safe"))) TS_PaymentSendFailure_all_failed_retry_safe(uint64_tArray a) { +uint64_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_resend_safe"))) TS_PaymentSendFailure_all_failed_resend_safe(uint64_tArray a) { LDKCVec_APIErrorZ a_constr; a_constr.datalen = a->arr_len; if (a_constr.datalen > 0) @@ -27180,7 +28127,14 @@ uint64_t __attribute__((export_name("TS_PaymentSendFailure_all_failed_retry_saf } FREE(a); LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_all_failed_retry_safe(a_constr); + *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_PaymentSendFailure_duplicate_payment"))) TS_PaymentSendFailure_duplicate_payment() { + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_duplicate_payment(); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -27437,7 +28391,7 @@ uint64_t __attribute__((export_name("TS_ChannelManager_get_current_default_conf return ret_ref; } -uint64_t __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_channel_id, uint64_t override_config) { +uint64_t __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_ChannelManager_create_channel(uint64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int8_tArray user_channel_id, uint64_t override_config) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -27446,13 +28400,16 @@ uint64_t __attribute__((export_name("TS_ChannelManager_create_channel"))) TS_Ch LDKPublicKey their_network_key_ref; CHECK(their_network_key->arr_len == 33); memcpy(their_network_key_ref.compressed_form, their_network_key->elems, 33); FREE(their_network_key); + LDKU128 user_channel_id_ref; + CHECK(user_channel_id->arr_len == 16); + memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id); LDKUserConfig override_config_conv; override_config_conv.inner = untag_ptr(override_config); override_config_conv.is_owned = ptr_is_owned(override_config); CHECK_INNER_FIELD_ACCESS_OR_NULL(override_config_conv); override_config_conv = UserConfig_clone(&override_config_conv); LDKCResult__u832APIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult__u832APIErrorZ), "LDKCResult__u832APIErrorZ"); - *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id, override_config_conv); + *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_channel_id_ref, override_config_conv); return tag_ptr(ret_conv, true); } @@ -27590,7 +28547,7 @@ void __attribute__((export_name("TS_ChannelManager_force_close_all_channels_wit ChannelManager_force_close_all_channels_without_broadcasting_txn(&this_arg_conv); } -uint64_t __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret) { +uint64_t __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_ChannelManager_send_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -27607,8 +28564,11 @@ uint64_t __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_Chan LDKThirtyTwoBytes payment_secret_ref; CHECK(payment_secret->arr_len == 32); memcpy(payment_secret_ref.data, payment_secret->elems, 32); FREE(payment_secret); - LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); - *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref); + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ"); + *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref, payment_id_ref); return tag_ptr(ret_conv, true); } @@ -27643,7 +28603,7 @@ void __attribute__((export_name("TS_ChannelManager_abandon_payment"))) TS_Chann ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref); } -uint64_t __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage) { +uint64_t __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment"))) TS_ChannelManager_send_spontaneous_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_preimage, int8_tArray payment_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -27657,8 +28617,11 @@ uint64_t __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment LDKThirtyTwoBytes payment_preimage_ref; CHECK(payment_preimage->arr_len == 32); memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage); - LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ), "LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ"); - *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref); + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ"); + *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref, payment_id_ref); return tag_ptr(ret_conv, true); } @@ -27747,6 +28710,41 @@ uint64_t __attribute__((export_name("TS_ChannelManager_update_channel_config")) return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_ChannelManager_forward_intercepted_htlc"))) TS_ChannelManager_forward_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id, int8_tArray next_hop_channel_id, int8_tArray _next_node_id, int64_t amt_to_forward_msat) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKThirtyTwoBytes intercept_id_ref; + CHECK(intercept_id->arr_len == 32); + memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id); + unsigned char next_hop_channel_id_arr[32]; + CHECK(next_hop_channel_id->arr_len == 32); + memcpy(next_hop_channel_id_arr, next_hop_channel_id->elems, 32); FREE(next_hop_channel_id); + unsigned char (*next_hop_channel_id_ref)[32] = &next_hop_channel_id_arr; + LDKPublicKey _next_node_id_ref; + CHECK(_next_node_id->arr_len == 33); + memcpy(_next_node_id_ref.compressed_form, _next_node_id->elems, 33); FREE(_next_node_id); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = ChannelManager_forward_intercepted_htlc(&this_arg_conv, intercept_id_ref, next_hop_channel_id_ref, _next_node_id_ref, amt_to_forward_msat); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_ChannelManager_fail_intercepted_htlc"))) TS_ChannelManager_fail_intercepted_htlc(uint64_t this_arg, int8_tArray intercept_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKThirtyTwoBytes intercept_id_ref; + CHECK(intercept_id->arr_len == 32); + memcpy(intercept_id_ref.data, intercept_id->elems, 32); FREE(intercept_id); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = ChannelManager_fail_intercepted_htlc(&this_arg_conv, intercept_id_ref); + return tag_ptr(ret_conv, true); +} + void __attribute__((export_name("TS_ChannelManager_process_pending_htlc_forwards"))) TS_ChannelManager_process_pending_htlc_forwards(uint64_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -27801,7 +28799,7 @@ int8_tArray __attribute__((export_name("TS_ChannelManager_get_our_node_id"))) T return ret_arr; } -uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) { +uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel"))) TS_ChannelManager_accept_inbound_channel(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -27814,12 +28812,15 @@ uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel") LDKPublicKey counterparty_node_id_ref; CHECK(counterparty_node_id->arr_len == 33); memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id); + LDKU128 user_channel_id_ref; + CHECK(user_channel_id->arr_len == 16); + memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id); LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id); + *ret_conv = ChannelManager_accept_inbound_channel(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf"))) TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int64_t user_channel_id) { +uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf"))) TS_ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(uint64_t this_arg, int8_tArray temporary_channel_id, int8_tArray counterparty_node_id, int8_tArray user_channel_id) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -27832,8 +28833,11 @@ uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_f LDKPublicKey counterparty_node_id_ref; CHECK(counterparty_node_id->arr_len == 33); memcpy(counterparty_node_id_ref.compressed_form, counterparty_node_id->elems, 33); FREE(counterparty_node_id); + LDKU128 user_channel_id_ref; + CHECK(user_channel_id->arr_len == 16); + memcpy(user_channel_id_ref.le_bytes, user_channel_id->elems, 16); FREE(user_channel_id); LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id); + *ret_conv = ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(&this_arg_conv, temporary_channel_id_ref, counterparty_node_id_ref, user_channel_id_ref); return tag_ptr(ret_conv, true); } @@ -27943,6 +28947,29 @@ uint64_t __attribute__((export_name("TS_ChannelManager_get_phantom_route_hints" return ret_ref; } +int64_t __attribute__((export_name("TS_ChannelManager_get_intercept_scid"))) TS_ChannelManager_get_intercept_scid(uint64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + int64_t ret_conv = ChannelManager_get_intercept_scid(&this_arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_ChannelManager_compute_inflight_htlcs"))) TS_ChannelManager_compute_inflight_htlcs(uint64_t this_arg) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKInFlightHtlcs ret_var = ChannelManager_compute_inflight_htlcs(&this_arg_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_ChannelManager_as_MessageSendEventsProvider"))) TS_ChannelManager_as_MessageSendEventsProvider(uint64_t this_arg) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -35975,6 +37002,56 @@ int64_t __attribute__((export_name("TS_htlc_timeout_tx_weight"))) TS_htlc_timeo return ret_conv; } +uint32_t __attribute__((export_name("TS_HTLCClaim_clone"))) TS_HTLCClaim_clone(uint64_t orig) { + LDKHTLCClaim* orig_conv = (LDKHTLCClaim*)untag_ptr(orig); + uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_clone(orig_conv)); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_HTLCClaim_offered_timeout"))) TS_HTLCClaim_offered_timeout() { + uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_timeout()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_HTLCClaim_offered_preimage"))) TS_HTLCClaim_offered_preimage() { + uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_offered_preimage()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_HTLCClaim_accepted_timeout"))) TS_HTLCClaim_accepted_timeout() { + uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_timeout()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_HTLCClaim_accepted_preimage"))) TS_HTLCClaim_accepted_preimage() { + uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_accepted_preimage()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_HTLCClaim_revocation"))) TS_HTLCClaim_revocation() { + uint32_t ret_conv = LDKHTLCClaim_to_js(HTLCClaim_revocation()); + return ret_conv; +} + +jboolean __attribute__((export_name("TS_HTLCClaim_eq"))) TS_HTLCClaim_eq(uint64_t a, uint64_t b) { + LDKHTLCClaim* a_conv = (LDKHTLCClaim*)untag_ptr(a); + LDKHTLCClaim* b_conv = (LDKHTLCClaim*)untag_ptr(b); + jboolean ret_conv = HTLCClaim_eq(a_conv, b_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim_from_witness(int8_tArray witness) { + LDKWitness witness_ref; + witness_ref.datalen = witness->arr_len; + witness_ref.data = MALLOC(witness_ref.datalen, "LDKWitness Bytes"); + memcpy(witness_ref.data, witness->elems, witness_ref.datalen); FREE(witness); + witness_ref.data_is_owned = true; + LDKCOption_HTLCClaimZ *ret_copy = MALLOC(sizeof(LDKCOption_HTLCClaimZ), "LDKCOption_HTLCClaimZ"); + *ret_copy = HTLCClaim_from_witness(witness_ref); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + int8_tArray __attribute__((export_name("TS_build_commitment_secret"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) { unsigned char commitment_seed_arr[32]; CHECK(commitment_seed->arr_len == 32); @@ -36110,7 +37187,7 @@ uint64_t __attribute__((export_name("TS_CounterpartyCommitmentSecrets_read"))) return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) { +int8_tArray __attribute__((export_name("TS_derive_private_key"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) { LDKPublicKey per_commitment_point_ref; CHECK(per_commitment_point->arr_len == 33); memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point); @@ -36118,24 +37195,24 @@ uint64_t __attribute__((export_name("TS_derive_private_key"))) TS_derive_privat CHECK(base_secret->arr_len == 32); memcpy(base_secret_arr, base_secret->elems, 32); FREE(base_secret); unsigned char (*base_secret_ref)[32] = &base_secret_arr; - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref); - return tag_ptr(ret_conv, true); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, derive_private_key(per_commitment_point_ref, base_secret_ref).bytes, 32); + return ret_arr; } -uint64_t __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) { +int8_tArray __attribute__((export_name("TS_derive_public_key"))) TS_derive_public_key(int8_tArray per_commitment_point, int8_tArray base_point) { LDKPublicKey per_commitment_point_ref; CHECK(per_commitment_point->arr_len == 33); memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point); LDKPublicKey base_point_ref; CHECK(base_point->arr_len == 33); memcpy(base_point_ref.compressed_form, base_point->elems, 33); FREE(base_point); - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref); - return tag_ptr(ret_conv, true); + int8_tArray ret_arr = init_int8_tArray(33, __LINE__); + memcpy(ret_arr->elems, derive_public_key(per_commitment_point_ref, base_point_ref).compressed_form, 33); + return ret_arr; } -uint64_t __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) { +int8_tArray __attribute__((export_name("TS_derive_private_revocation_key"))) TS_derive_private_revocation_key(int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) { unsigned char per_commitment_secret_arr[32]; CHECK(per_commitment_secret->arr_len == 32); memcpy(per_commitment_secret_arr, per_commitment_secret->elems, 32); FREE(per_commitment_secret); @@ -36144,21 +37221,21 @@ uint64_t __attribute__((export_name("TS_derive_private_revocation_key"))) TS_de CHECK(countersignatory_revocation_base_secret->arr_len == 32); memcpy(countersignatory_revocation_base_secret_arr, countersignatory_revocation_base_secret->elems, 32); FREE(countersignatory_revocation_base_secret); unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr; - LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ"); - *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref); - return tag_ptr(ret_conv, true); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref).bytes, 32); + return ret_arr; } -uint64_t __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) { +int8_tArray __attribute__((export_name("TS_derive_public_revocation_key"))) TS_derive_public_revocation_key(int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) { LDKPublicKey per_commitment_point_ref; CHECK(per_commitment_point->arr_len == 33); memcpy(per_commitment_point_ref.compressed_form, per_commitment_point->elems, 33); FREE(per_commitment_point); LDKPublicKey countersignatory_revocation_base_point_ref; CHECK(countersignatory_revocation_base_point->arr_len == 33); memcpy(countersignatory_revocation_base_point_ref.compressed_form, countersignatory_revocation_base_point->elems, 33); FREE(countersignatory_revocation_base_point); - LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ"); - *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref); - return tag_ptr(ret_conv, true); + int8_tArray ret_arr = init_int8_tArray(33, __LINE__); + memcpy(ret_arr->elems, derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref).compressed_form, 33); + return ret_arr; } void __attribute__((export_name("TS_TxCreationKeys_free"))) TS_TxCreationKeys_free(uint64_t this_obj) { @@ -36605,9 +37682,11 @@ uint64_t __attribute__((export_name("TS_TxCreationKeys_derive_new"))) TS_TxCrea LDKPublicKey countersignatory_htlc_base_ref; CHECK(countersignatory_htlc_base->arr_len == 33); memcpy(countersignatory_htlc_base_ref.compressed_form, countersignatory_htlc_base->elems, 33); FREE(countersignatory_htlc_base); - LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ"); - *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref); - return tag_ptr(ret_conv, true); + LDKTxCreationKeys ret_var = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } uint64_t __attribute__((export_name("TS_TxCreationKeys_from_channel_static_keys"))) TS_TxCreationKeys_from_channel_static_keys(int8_tArray per_commitment_point, uint64_t broadcaster_keys, uint64_t countersignatory_keys) { @@ -36624,9 +37703,11 @@ uint64_t __attribute__((export_name("TS_TxCreationKeys_from_channel_static_keys countersignatory_keys_conv.is_owned = ptr_is_owned(countersignatory_keys); CHECK_INNER_FIELD_ACCESS_OR_NULL(countersignatory_keys_conv); countersignatory_keys_conv.is_owned = false; - LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ"); - *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv); - return tag_ptr(ret_conv, true); + LDKTxCreationKeys ret_var = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } int8_tArray __attribute__((export_name("TS_get_revokeable_redeemscript"))) TS_get_revokeable_redeemscript(int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) { @@ -36871,7 +37952,7 @@ int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_mak return ret_arr; } -int8_tArray __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint64_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { +int8_tArray __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint64_t htlc, jboolean opt_anchors, jboolean use_non_zero_fee_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { unsigned char commitment_txid_arr[32]; CHECK(commitment_txid->arr_len == 32); memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid); @@ -36887,13 +37968,45 @@ int8_tArray __attribute__((export_name("TS_build_htlc_transaction"))) TS_build_ LDKPublicKey revocation_key_ref; CHECK(revocation_key->arr_len == 33); memcpy(revocation_key_ref.compressed_form, revocation_key->elems, 33); FREE(revocation_key); - LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref); + LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, use_non_zero_fee_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref); int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); Transaction_free(ret_var); return ret_arr; } +int8_tArray __attribute__((export_name("TS_build_htlc_input_witness"))) TS_build_htlc_input_witness(int8_tArray local_sig, int8_tArray remote_sig, int8_tArray preimage, int8_tArray redeem_script, jboolean opt_anchors) { + LDKSignature local_sig_ref; + CHECK(local_sig->arr_len == 64); + memcpy(local_sig_ref.compact_form, local_sig->elems, 64); FREE(local_sig); + LDKSignature remote_sig_ref; + CHECK(remote_sig->arr_len == 64); + memcpy(remote_sig_ref.compact_form, remote_sig->elems, 64); FREE(remote_sig); + LDKThirtyTwoBytes preimage_ref; + CHECK(preimage->arr_len == 32); + memcpy(preimage_ref.data, preimage->elems, 32); FREE(preimage); + LDKu8slice redeem_script_ref; + redeem_script_ref.datalen = redeem_script->arr_len; + redeem_script_ref.data = redeem_script->elems; + LDKWitness ret_var = build_htlc_input_witness(local_sig_ref, remote_sig_ref, preimage_ref, redeem_script_ref, opt_anchors); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + Witness_free(ret_var); + FREE(redeem_script); + return ret_arr; +} + +int8_tArray __attribute__((export_name("TS_get_to_countersignatory_with_anchors_redeemscript"))) TS_get_to_countersignatory_with_anchors_redeemscript(int8_tArray payment_point) { + LDKPublicKey payment_point_ref; + CHECK(payment_point->arr_len == 33); + memcpy(payment_point_ref.compressed_form, payment_point->elems, 33); FREE(payment_point); + LDKCVec_u8Z ret_var = get_to_countersignatory_with_anchors_redeemscript(payment_point_ref); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) { LDKPublicKey funding_pubkey_ref; CHECK(funding_pubkey->arr_len == 33); @@ -36905,6 +38018,20 @@ int8_tArray __attribute__((export_name("TS_get_anchor_redeemscript"))) TS_get_a return ret_arr; } +int8_tArray __attribute__((export_name("TS_build_anchor_input_witness"))) TS_build_anchor_input_witness(int8_tArray funding_key, int8_tArray funding_sig) { + LDKPublicKey funding_key_ref; + CHECK(funding_key->arr_len == 33); + memcpy(funding_key_ref.compressed_form, funding_key->elems, 33); FREE(funding_key); + LDKSignature funding_sig_ref; + CHECK(funding_sig->arr_len == 64); + memcpy(funding_sig_ref.compact_form, funding_sig->elems, 64); FREE(funding_sig); + LDKWitness ret_var = build_anchor_input_witness(funding_key_ref, funding_sig_ref); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + Witness_free(ret_var); + return ret_arr; +} + void __attribute__((export_name("TS_ChannelTransactionParameters_free"))) TS_ChannelTransactionParameters_free(uint64_t this_obj) { LDKChannelTransactionParameters this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -37052,7 +38179,27 @@ void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_anchor ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv); } -uint64_t __attribute__((export_name("TS_ChannelTransactionParameters_new"))) TS_ChannelTransactionParameters_new(uint64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint64_t counterparty_parameters_arg, uint64_t funding_outpoint_arg, uint32_t opt_anchors_arg) { +uint32_t __attribute__((export_name("TS_ChannelTransactionParameters_get_opt_non_zero_fee_anchors"))) TS_ChannelTransactionParameters_get_opt_non_zero_fee_anchors(uint64_t this_ptr) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_non_zero_fee_anchors(&this_ptr_conv)); + return ret_conv; +} + +void __attribute__((export_name("TS_ChannelTransactionParameters_set_opt_non_zero_fee_anchors"))) TS_ChannelTransactionParameters_set_opt_non_zero_fee_anchors(uint64_t this_ptr, uint32_t val) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = untag_ptr(this_ptr); + this_ptr_conv.is_owned = ptr_is_owned(this_ptr); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + this_ptr_conv.is_owned = false; + LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val); + ChannelTransactionParameters_set_opt_non_zero_fee_anchors(&this_ptr_conv, val_conv); +} + +uint64_t __attribute__((export_name("TS_ChannelTransactionParameters_new"))) TS_ChannelTransactionParameters_new(uint64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint64_t counterparty_parameters_arg, uint64_t funding_outpoint_arg, uint32_t opt_anchors_arg, uint32_t opt_non_zero_fee_anchors_arg) { LDKChannelPublicKeys holder_pubkeys_arg_conv; holder_pubkeys_arg_conv.inner = untag_ptr(holder_pubkeys_arg); holder_pubkeys_arg_conv.is_owned = ptr_is_owned(holder_pubkeys_arg); @@ -37069,7 +38216,8 @@ uint64_t __attribute__((export_name("TS_ChannelTransactionParameters_new"))) TS CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv); funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv); LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg); - LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, opt_anchors_arg_conv); + LDKCOption_NoneZ opt_non_zero_fee_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_non_zero_fee_anchors_arg); + LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, opt_anchors_arg_conv, opt_non_zero_fee_anchors_arg_conv); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -38186,6 +39334,36 @@ jboolean __attribute__((export_name("TS_InvoiceFeatures_eq"))) TS_InvoiceFeatur return ret_conv; } +jboolean __attribute__((export_name("TS_OfferFeatures_eq"))) TS_OfferFeatures_eq(uint64_t a, uint64_t b) { + LDKOfferFeatures a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKOfferFeatures b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = OfferFeatures_eq(&a_conv, &b_conv); + return ret_conv; +} + +jboolean __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_InvoiceRequestFeatures_eq(uint64_t a, uint64_t b) { + LDKInvoiceRequestFeatures a_conv; + a_conv.inner = untag_ptr(a); + a_conv.is_owned = ptr_is_owned(a); + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + a_conv.is_owned = false; + LDKInvoiceRequestFeatures b_conv; + b_conv.inner = untag_ptr(b); + b_conv.is_owned = ptr_is_owned(b); + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + b_conv.is_owned = false; + jboolean ret_conv = InvoiceRequestFeatures_eq(&a_conv, &b_conv); + return ret_conv; +} + jboolean __attribute__((export_name("TS_ChannelTypeFeatures_eq"))) TS_ChannelTypeFeatures_eq(uint64_t a, uint64_t b) { LDKChannelTypeFeatures a_conv; a_conv.inner = untag_ptr(a); @@ -38321,6 +39499,66 @@ uint64_t __attribute__((export_name("TS_InvoiceFeatures_clone"))) TS_InvoiceFea return ret_ref; } +static inline uint64_t OfferFeatures_clone_ptr(LDKOfferFeatures *NONNULL_PTR arg) { + LDKOfferFeatures ret_var = OfferFeatures_clone(arg); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +int64_t __attribute__((export_name("TS_OfferFeatures_clone_ptr"))) TS_OfferFeatures_clone_ptr(uint64_t arg) { + LDKOfferFeatures arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = OfferFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_OfferFeatures_clone"))) TS_OfferFeatures_clone(uint64_t orig) { + LDKOfferFeatures orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKOfferFeatures ret_var = OfferFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +static inline uint64_t InvoiceRequestFeatures_clone_ptr(LDKInvoiceRequestFeatures *NONNULL_PTR arg) { + LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(arg); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +int64_t __attribute__((export_name("TS_InvoiceRequestFeatures_clone_ptr"))) TS_InvoiceRequestFeatures_clone_ptr(uint64_t arg) { + LDKInvoiceRequestFeatures arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = InvoiceRequestFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_InvoiceRequestFeatures_clone(uint64_t orig) { + LDKInvoiceRequestFeatures orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) { LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg); uint64_t ret_ref = 0; @@ -38383,6 +39621,22 @@ void __attribute__((export_name("TS_InvoiceFeatures_free"))) TS_InvoiceFeatures InvoiceFeatures_free(this_obj_conv); } +void __attribute__((export_name("TS_OfferFeatures_free"))) TS_OfferFeatures_free(uint64_t this_obj) { + LDKOfferFeatures this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + OfferFeatures_free(this_obj_conv); +} + +void __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceRequestFeatures_free(uint64_t this_obj) { + LDKInvoiceRequestFeatures this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + InvoiceRequestFeatures_free(this_obj_conv); +} + void __attribute__((export_name("TS_ChannelTypeFeatures_free"))) TS_ChannelTypeFeatures_free(uint64_t this_obj) { LDKChannelTypeFeatures this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -38463,6 +39717,42 @@ jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_unknown_bits") return ret_conv; } +uint64_t __attribute__((export_name("TS_OfferFeatures_empty"))) TS_OfferFeatures_empty() { + LDKOfferFeatures ret_var = OfferFeatures_empty(); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +jboolean __attribute__((export_name("TS_OfferFeatures_requires_unknown_bits"))) TS_OfferFeatures_requires_unknown_bits(uint64_t this_arg) { + LDKOfferFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = OfferFeatures_requires_unknown_bits(&this_arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_InvoiceRequestFeatures_empty"))) TS_InvoiceRequestFeatures_empty() { + LDKInvoiceRequestFeatures ret_var = InvoiceRequestFeatures_empty(); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +jboolean __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown_bits"))) TS_InvoiceRequestFeatures_requires_unknown_bits(uint64_t this_arg) { + LDKInvoiceRequestFeatures this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + jboolean ret_conv = InvoiceRequestFeatures_requires_unknown_bits(&this_arg_conv); + return ret_conv; +} + uint64_t __attribute__((export_name("TS_ChannelTypeFeatures_empty"))) TS_ChannelTypeFeatures_empty() { LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty(); uint64_t ret_ref = 0; @@ -38596,6 +39886,52 @@ uint64_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_Channel return tag_ptr(ret_conv, true); } +int8_tArray __attribute__((export_name("TS_OfferFeatures_write"))) TS_OfferFeatures_write(uint64_t obj) { + LDKOfferFeatures obj_conv; + obj_conv.inner = untag_ptr(obj); + obj_conv.is_owned = ptr_is_owned(obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = OfferFeatures_write(&obj_conv); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint64_t __attribute__((export_name("TS_OfferFeatures_read"))) TS_OfferFeatures_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = ser->arr_len; + ser_ref.data = ser->elems; + LDKCResult_OfferFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OfferFeaturesDecodeErrorZ), "LDKCResult_OfferFeaturesDecodeErrorZ"); + *ret_conv = OfferFeatures_read(ser_ref); + FREE(ser); + return tag_ptr(ret_conv, true); +} + +int8_tArray __attribute__((export_name("TS_InvoiceRequestFeatures_write"))) TS_InvoiceRequestFeatures_write(uint64_t obj) { + LDKInvoiceRequestFeatures obj_conv; + obj_conv.inner = untag_ptr(obj); + obj_conv.is_owned = ptr_is_owned(obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = InvoiceRequestFeatures_write(&obj_conv); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint64_t __attribute__((export_name("TS_InvoiceRequestFeatures_read"))) TS_InvoiceRequestFeatures_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = ser->arr_len; + ser_ref.data = ser->elems; + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ), "LDKCResult_InvoiceRequestFeaturesDecodeErrorZ"); + *ret_conv = InvoiceRequestFeatures_read(ser_ref); + FREE(ser); + return tag_ptr(ret_conv, true); +} + void __attribute__((export_name("TS_InitFeatures_set_data_loss_protect_optional"))) TS_InitFeatures_set_data_loss_protect_optional(uint64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -40396,15 +41732,14 @@ void __attribute__((export_name("TS_P2PGossipSync_add_chain_access"))) TS_P2PGo P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv); } -uint64_t __attribute__((export_name("TS_NetworkGraph_as_EventHandler"))) TS_NetworkGraph_as_EventHandler(uint64_t this_arg) { +void __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); this_arg_conv.is_owned = false; - LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = NetworkGraph_as_EventHandler(&this_arg_conv); - return tag_ptr(ret_ret, true); + LDKNetworkUpdate* network_update_conv = (LDKNetworkUpdate*)untag_ptr(network_update); + NetworkGraph_handle_network_update(&this_arg_conv, network_update_conv); } uint64_t __attribute__((export_name("TS_P2PGossipSync_as_RoutingMessageHandler"))) TS_P2PGossipSync_as_RoutingMessageHandler(uint64_t this_arg) { @@ -40999,19 +42334,6 @@ uint64_t __attribute__((export_name("TS_DirectedChannelInfo_channel"))) TS_Dire return ret_ref; } -uint64_t __attribute__((export_name("TS_DirectedChannelInfo_direction"))) TS_DirectedChannelInfo_direction(uint64_t this_arg) { - LDKDirectedChannelInfo this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKChannelUpdateInfo ret_var = DirectedChannelInfo_direction(&this_arg_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - int64_t __attribute__((export_name("TS_DirectedChannelInfo_htlc_maximum_msat"))) TS_DirectedChannelInfo_htlc_maximum_msat(uint64_t this_arg) { LDKDirectedChannelInfo this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -41077,13 +42399,9 @@ uint64_t __attribute__((export_name("TS_EffectiveCapacity_maximum_htlc"))) TS_E return ret_ref; } -uint64_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, uint64_t htlc_maximum_msat) { - void* htlc_maximum_msat_ptr = untag_ptr(htlc_maximum_msat); - CHECK_ACCESS(htlc_maximum_msat_ptr); - LDKCOption_u64Z htlc_maximum_msat_conv = *(LDKCOption_u64Z*)(htlc_maximum_msat_ptr); - htlc_maximum_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(htlc_maximum_msat)); +uint64_t __attribute__((export_name("TS_EffectiveCapacity_total"))) TS_EffectiveCapacity_total(int64_t capacity_msat, int64_t htlc_maximum_msat) { LDKEffectiveCapacity *ret_copy = MALLOC(sizeof(LDKEffectiveCapacity), "LDKEffectiveCapacity"); - *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat_conv); + *ret_copy = EffectiveCapacity_total(capacity_msat, htlc_maximum_msat); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -42175,6 +43493,207 @@ uint64_t __attribute__((export_name("TS_ReadOnlyNetworkGraph_get_addresses"))) return ret_ref; } +void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) { + LDKDefaultRouter this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + DefaultRouter_free(this_obj_conv); +} + +uint64_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes, uint64_t scorer) { + LDKNetworkGraph network_graph_conv; + network_graph_conv.inner = untag_ptr(network_graph); + network_graph_conv.is_owned = ptr_is_owned(network_graph); + CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); + network_graph_conv.is_owned = false; + void* logger_ptr = untag_ptr(logger); + CHECK_ACCESS(logger_ptr); + LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); + if (logger_conv.free == LDKLogger_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLogger_JCalls_cloned(&logger_conv); + } + LDKThirtyTwoBytes random_seed_bytes_ref; + CHECK(random_seed_bytes->arr_len == 32); + memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes); + void* scorer_ptr = untag_ptr(scorer); + CHECK_ACCESS(scorer_ptr); + LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr); + if (scorer_conv.free == LDKLockableScore_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKLockableScore_JCalls_cloned(&scorer_conv); + } + LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) { + LDKDefaultRouter this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter"); + *ret_ret = DefaultRouter_as_Router(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + Router_free(this_ptr_conv); +} + +void __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_free"))) TS_ScorerAccountingForInFlightHtlcs_free(uint64_t this_obj) { + LDKScorerAccountingForInFlightHtlcs this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ScorerAccountingForInFlightHtlcs_free(this_obj_conv); +} + +uint64_t __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new"))) TS_ScorerAccountingForInFlightHtlcs_new(uint64_t scorer, uint64_t inflight_htlcs) { + void* scorer_ptr = untag_ptr(scorer); + CHECK_ACCESS(scorer_ptr); + LDKScore scorer_conv = *(LDKScore*)(scorer_ptr); + if (scorer_conv.free == LDKScore_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKScore_JCalls_cloned(&scorer_conv); + } + LDKInFlightHtlcs inflight_htlcs_conv; + inflight_htlcs_conv.inner = untag_ptr(inflight_htlcs); + inflight_htlcs_conv.is_owned = ptr_is_owned(inflight_htlcs); + CHECK_INNER_FIELD_ACCESS_OR_NULL(inflight_htlcs_conv); + inflight_htlcs_conv = InFlightHtlcs_clone(&inflight_htlcs_conv); + LDKScorerAccountingForInFlightHtlcs ret_var = ScorerAccountingForInFlightHtlcs_new(scorer_conv, inflight_htlcs_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +int8_tArray __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_write"))) TS_ScorerAccountingForInFlightHtlcs_write(uint64_t obj) { + LDKScorerAccountingForInFlightHtlcs obj_conv; + obj_conv.inner = untag_ptr(obj); + obj_conv.is_owned = ptr_is_owned(obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = ScorerAccountingForInFlightHtlcs_write(&obj_conv); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint64_t __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_as_Score"))) TS_ScorerAccountingForInFlightHtlcs_as_Score(uint64_t this_arg) { + LDKScorerAccountingForInFlightHtlcs this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = ScorerAccountingForInFlightHtlcs_as_Score(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +void __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) { + LDKInFlightHtlcs this_obj_conv; + this_obj_conv.inner = untag_ptr(this_obj); + this_obj_conv.is_owned = ptr_is_owned(this_obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + InFlightHtlcs_free(this_obj_conv); +} + +static inline uint64_t InFlightHtlcs_clone_ptr(LDKInFlightHtlcs *NONNULL_PTR arg) { + LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(arg); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +int64_t __attribute__((export_name("TS_InFlightHtlcs_clone_ptr"))) TS_InFlightHtlcs_clone_ptr(uint64_t arg) { + LDKInFlightHtlcs arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = InFlightHtlcs_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_InFlightHtlcs_clone"))) TS_InFlightHtlcs_clone(uint64_t orig) { + LDKInFlightHtlcs orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKInFlightHtlcs ret_var = InFlightHtlcs_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_InFlightHtlcs_new"))) TS_InFlightHtlcs_new() { + LDKInFlightHtlcs ret_var = InFlightHtlcs_new(); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_InFlightHtlcs_used_liquidity_msat"))) TS_InFlightHtlcs_used_liquidity_msat(uint64_t this_arg, uint64_t source, uint64_t target, int64_t channel_scid) { + LDKInFlightHtlcs this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKNodeId source_conv; + source_conv.inner = untag_ptr(source); + source_conv.is_owned = ptr_is_owned(source); + CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv); + source_conv.is_owned = false; + LDKNodeId target_conv; + target_conv.inner = untag_ptr(target); + target_conv.is_owned = ptr_is_owned(target); + CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); + target_conv.is_owned = false; + LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +int8_tArray __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) { + LDKInFlightHtlcs obj_conv; + obj_conv.inner = untag_ptr(obj); + obj_conv.is_owned = ptr_is_owned(obj); + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + obj_conv.is_owned = false; + LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv); + int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); + memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint64_t __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = ser->arr_len; + ser_ref.data = ser->elems; + LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); + *ret_conv = InFlightHtlcs_read(ser_ref); + FREE(ser); + return tag_ptr(ret_conv, true); +} + void __attribute__((export_name("TS_RouteHop_free"))) TS_RouteHop_free(uint64_t this_obj) { LDKRouteHop this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -44430,12 +45949,42 @@ uint64_t __attribute__((export_name("TS_ProbabilisticScorer_read"))) TS_Probabi return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_BlindedRoute_free"))) TS_BlindedRoute_free(uint64_t this_obj) { - LDKBlindedRoute this_obj_conv; +void __attribute__((export_name("TS_BlindedPath_free"))) TS_BlindedPath_free(uint64_t this_obj) { + LDKBlindedPath this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); this_obj_conv.is_owned = ptr_is_owned(this_obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - BlindedRoute_free(this_obj_conv); + BlindedPath_free(this_obj_conv); +} + +static inline uint64_t BlindedPath_clone_ptr(LDKBlindedPath *NONNULL_PTR arg) { + LDKBlindedPath ret_var = BlindedPath_clone(arg); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +int64_t __attribute__((export_name("TS_BlindedPath_clone_ptr"))) TS_BlindedPath_clone_ptr(uint64_t arg) { + LDKBlindedPath arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = BlindedPath_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_BlindedPath_clone"))) TS_BlindedPath_clone(uint64_t orig) { + LDKBlindedPath orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKBlindedPath ret_var = BlindedPath_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; } void __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint64_t this_obj) { @@ -44446,7 +45995,37 @@ void __attribute__((export_name("TS_BlindedHop_free"))) TS_BlindedHop_free(uint BlindedHop_free(this_obj_conv); } -uint64_t __attribute__((export_name("TS_BlindedRoute_new"))) TS_BlindedRoute_new(ptrArray node_pks, uint64_t keys_manager) { +static inline uint64_t BlindedHop_clone_ptr(LDKBlindedHop *NONNULL_PTR arg) { + LDKBlindedHop ret_var = BlindedHop_clone(arg); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} +int64_t __attribute__((export_name("TS_BlindedHop_clone_ptr"))) TS_BlindedHop_clone_ptr(uint64_t arg) { + LDKBlindedHop arg_conv; + arg_conv.inner = untag_ptr(arg); + arg_conv.is_owned = ptr_is_owned(arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + arg_conv.is_owned = false; + int64_t ret_conv = BlindedHop_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clone(uint64_t orig) { + LDKBlindedHop orig_conv; + orig_conv.inner = untag_ptr(orig); + orig_conv.is_owned = ptr_is_owned(orig); + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + orig_conv.is_owned = false; + LDKBlindedHop ret_var = BlindedHop_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(ptrArray node_pks, uint64_t keys_manager) { LDKCVec_PublicKeyZ node_pks_constr; node_pks_constr.datalen = node_pks->arr_len; if (node_pks_constr.datalen > 0) @@ -44465,30 +46044,30 @@ uint64_t __attribute__((export_name("TS_BlindedRoute_new"))) TS_BlindedRoute_ne void* keys_manager_ptr = untag_ptr(keys_manager); if (ptr_is_owned(keys_manager)) { CHECK_ACCESS(keys_manager_ptr); } LDKKeysInterface* keys_manager_conv = (LDKKeysInterface*)keys_manager_ptr; - LDKCResult_BlindedRouteNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteNoneZ), "LDKCResult_BlindedRouteNoneZ"); - *ret_conv = BlindedRoute_new(node_pks_constr, keys_manager_conv); + LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); + *ret_conv = BlindedPath_new(node_pks_constr, keys_manager_conv); return tag_ptr(ret_conv, true); } -int8_tArray __attribute__((export_name("TS_BlindedRoute_write"))) TS_BlindedRoute_write(uint64_t obj) { - LDKBlindedRoute obj_conv; +int8_tArray __attribute__((export_name("TS_BlindedPath_write"))) TS_BlindedPath_write(uint64_t obj) { + LDKBlindedPath obj_conv; obj_conv.inner = untag_ptr(obj); obj_conv.is_owned = ptr_is_owned(obj); CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = BlindedRoute_write(&obj_conv); + LDKCVec_u8Z ret_var = BlindedPath_write(&obj_conv); int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint64_t __attribute__((export_name("TS_BlindedRoute_read"))) TS_BlindedRoute_read(int8_tArray ser) { +uint64_t __attribute__((export_name("TS_BlindedPath_read"))) TS_BlindedPath_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = ser->arr_len; ser_ref.data = ser->elems; - LDKCResult_BlindedRouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedRouteDecodeErrorZ), "LDKCResult_BlindedRouteDecodeErrorZ"); - *ret_conv = BlindedRoute_read(ser_ref); + LDKCResult_BlindedPathDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathDecodeErrorZ), "LDKCResult_BlindedPathDecodeErrorZ"); + *ret_conv = BlindedPath_read(ser_ref); FREE(ser); return tag_ptr(ret_conv, true); } @@ -44533,6 +46112,26 @@ void __attribute__((export_name("TS_Destination_free"))) TS_Destination_free(ui Destination_free(this_ptr_conv); } +static inline uint64_t Destination_clone_ptr(LDKDestination *NONNULL_PTR arg) { + LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination"); + *ret_copy = Destination_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_Destination_clone_ptr"))) TS_Destination_clone_ptr(uint64_t arg) { + LDKDestination* arg_conv = (LDKDestination*)untag_ptr(arg); + int64_t ret_conv = Destination_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_Destination_clone"))) TS_Destination_clone(uint64_t orig) { + LDKDestination* orig_conv = (LDKDestination*)untag_ptr(orig); + LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination"); + *ret_copy = Destination_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_Destination_node"))) TS_Destination_node(int8_tArray a) { LDKPublicKey a_ref; CHECK(a->arr_len == 33); @@ -44543,15 +46142,14 @@ uint64_t __attribute__((export_name("TS_Destination_node"))) TS_Destination_nod return ret_ref; } -uint64_t __attribute__((export_name("TS_Destination_blinded_route"))) TS_Destination_blinded_route(uint64_t a) { - LDKBlindedRoute a_conv; +uint64_t __attribute__((export_name("TS_Destination_blinded_path"))) TS_Destination_blinded_path(uint64_t a) { + LDKBlindedPath a_conv; a_conv.inner = untag_ptr(a); a_conv.is_owned = ptr_is_owned(a); CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); - // WARNING: we need a move here but no clone is available for LDKBlindedRoute - + a_conv = BlindedPath_clone(&a_conv); LDKDestination *ret_copy = MALLOC(sizeof(LDKDestination), "LDKDestination"); - *ret_copy = Destination_blinded_route(a_conv); + *ret_copy = Destination_blinded_path(a_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -44628,6 +46226,20 @@ uint64_t __attribute__((export_name("TS_SendError_buffer_full"))) TS_SendError_ return ret_ref; } +uint64_t __attribute__((export_name("TS_SendError_get_node_id_failed"))) TS_SendError_get_node_id_failed() { + LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError"); + *ret_copy = SendError_get_node_id_failed(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_SendError_blinded_path_advance_failed"))) TS_SendError_blinded_path_advance_failed() { + LDKSendError *ret_copy = MALLOC(sizeof(LDKSendError), "LDKSendError"); + *ret_copy = SendError_blinded_path_advance_failed(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + jboolean __attribute__((export_name("TS_SendError_eq"))) TS_SendError_eq(uint64_t a, uint64_t b) { LDKSendError* a_conv = (LDKSendError*)untag_ptr(a); LDKSendError* b_conv = (LDKSendError*)untag_ptr(b); @@ -44673,7 +46285,7 @@ uint64_t __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenge return ret_ref; } -uint64_t __attribute__((export_name("TS_OnionMessenger_send_custom_onion_message"))) TS_OnionMessenger_send_custom_onion_message(uint64_t this_arg, ptrArray intermediate_nodes, uint64_t destination, uint64_t msg, uint64_t reply_path) { +uint64_t __attribute__((export_name("TS_OnionMessenger_send_onion_message"))) TS_OnionMessenger_send_onion_message(uint64_t this_arg, ptrArray intermediate_nodes, uint64_t destination, uint64_t message, uint64_t reply_path) { LDKOnionMessenger this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -44697,21 +46309,18 @@ uint64_t __attribute__((export_name("TS_OnionMessenger_send_custom_onion_messag void* destination_ptr = untag_ptr(destination); CHECK_ACCESS(destination_ptr); LDKDestination destination_conv = *(LDKDestination*)(destination_ptr); - // WARNING: we may need a move here but no clone is available for LDKDestination - void* msg_ptr = untag_ptr(msg); - CHECK_ACCESS(msg_ptr); - LDKCustomOnionMessageContents msg_conv = *(LDKCustomOnionMessageContents*)(msg_ptr); - if (msg_conv.free == LDKCustomOnionMessageContents_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKCustomOnionMessageContents_JCalls_cloned(&msg_conv); - } - LDKBlindedRoute reply_path_conv; + destination_conv = Destination_clone((LDKDestination*)untag_ptr(destination)); + void* message_ptr = untag_ptr(message); + CHECK_ACCESS(message_ptr); + LDKOnionMessageContents message_conv = *(LDKOnionMessageContents*)(message_ptr); + message_conv = OnionMessageContents_clone((LDKOnionMessageContents*)untag_ptr(message)); + LDKBlindedPath reply_path_conv; reply_path_conv.inner = untag_ptr(reply_path); reply_path_conv.is_owned = ptr_is_owned(reply_path); CHECK_INNER_FIELD_ACCESS_OR_NULL(reply_path_conv); - reply_path_conv.is_owned = false; + reply_path_conv = BlindedPath_clone(&reply_path_conv); LDKCResult_NoneSendErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSendErrorZ), "LDKCResult_NoneSendErrorZ"); - *ret_conv = OnionMessenger_send_custom_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, msg_conv, reply_path_conv); + *ret_conv = OnionMessenger_send_onion_message(&this_arg_conv, intermediate_nodes_constr, destination_conv, message_conv, reply_path_conv); return tag_ptr(ret_conv, true); } @@ -44737,6 +46346,49 @@ uint64_t __attribute__((export_name("TS_OnionMessenger_as_OnionMessageProvider" return tag_ptr(ret_ret, true); } +void __attribute__((export_name("TS_OnionMessageContents_free"))) TS_OnionMessageContents_free(uint64_t this_ptr) { + if (!ptr_is_owned(this_ptr)) return; + void* this_ptr_ptr = untag_ptr(this_ptr); + CHECK_ACCESS(this_ptr_ptr); + LDKOnionMessageContents this_ptr_conv = *(LDKOnionMessageContents*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + OnionMessageContents_free(this_ptr_conv); +} + +static inline uint64_t OnionMessageContents_clone_ptr(LDKOnionMessageContents *NONNULL_PTR arg) { + LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *ret_copy = OnionMessageContents_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_OnionMessageContents_clone_ptr"))) TS_OnionMessageContents_clone_ptr(uint64_t arg) { + LDKOnionMessageContents* arg_conv = (LDKOnionMessageContents*)untag_ptr(arg); + int64_t ret_conv = OnionMessageContents_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_OnionMessageContents_clone"))) TS_OnionMessageContents_clone(uint64_t orig) { + LDKOnionMessageContents* orig_conv = (LDKOnionMessageContents*)untag_ptr(orig); + LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *ret_copy = OnionMessageContents_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_OnionMessageContents_custom"))) TS_OnionMessageContents_custom(uint64_t a) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKCustomOnionMessageContents a_conv = *(LDKCustomOnionMessageContents*)(a_ptr); + if (a_conv.free == LDKCustomOnionMessageContents_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKCustomOnionMessageContents_JCalls_cloned(&a_conv); + } + LDKOnionMessageContents *ret_copy = MALLOC(sizeof(LDKOnionMessageContents), "LDKOnionMessageContents"); + *ret_copy = OnionMessageContents_custom(a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static inline uint64_t CustomOnionMessageContents_clone_ptr(LDKCustomOnionMessageContents *NONNULL_PTR arg) { LDKCustomOnionMessageContents* ret_ret = MALLOC(sizeof(LDKCustomOnionMessageContents), "LDKCustomOnionMessageContents"); *ret_ret = CustomOnionMessageContents_clone(arg); @@ -45961,7 +47613,7 @@ uint64_t __attribute__((export_name("TS_Fallback_seg_wit_program"))) TS_Fallbac program_ref.data = MALLOC(program_ref.datalen, "LDKCVec_u8Z Bytes"); memcpy(program_ref.data, program->elems, program_ref.datalen); FREE(program); LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback"); - *ret_copy = Fallback_seg_wit_program((LDKu5){ ._0 = version }, program_ref); + *ret_copy = Fallback_seg_wit_program((LDKU5){ ._0 = version }, program_ref); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -46853,15 +48505,6 @@ void __attribute__((export_name("TS_Payer_free"))) TS_Payer_free(uint64_t this_ Payer_free(this_ptr_conv); } -void __attribute__((export_name("TS_Router_free"))) TS_Router_free(uint64_t this_ptr) { - if (!ptr_is_owned(this_ptr)) return; - void* this_ptr_ptr = untag_ptr(this_ptr); - CHECK_ACCESS(this_ptr_ptr); - LDKRouter this_ptr_conv = *(LDKRouter*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Router_free(this_ptr_conv); -} - void __attribute__((export_name("TS_Retry_free"))) TS_Retry_free(uint64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -47027,6 +48670,25 @@ uint64_t __attribute__((export_name("TS_InvoicePayer_pay_invoice"))) TS_Invoice return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_InvoicePayer_pay_invoice_with_id"))) TS_InvoicePayer_pay_invoice_with_id(uint64_t this_arg, uint64_t invoice, int8_tArray payment_id) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = InvoicePayer_pay_invoice_with_id(&this_arg_conv, &invoice_conv, payment_id_ref); + return tag_ptr(ret_conv, true); +} + uint64_t __attribute__((export_name("TS_InvoicePayer_pay_zero_value_invoice"))) TS_InvoicePayer_pay_zero_value_invoice(uint64_t this_arg, uint64_t invoice, int64_t amount_msats) { LDKInvoicePayer this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -47043,6 +48705,25 @@ uint64_t __attribute__((export_name("TS_InvoicePayer_pay_zero_value_invoice"))) return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_InvoicePayer_pay_zero_value_invoice_with_id"))) TS_InvoicePayer_pay_zero_value_invoice_with_id(uint64_t this_arg, uint64_t invoice, int64_t amount_msats, int8_tArray payment_id) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKInvoice invoice_conv; + invoice_conv.inner = untag_ptr(invoice); + invoice_conv.is_owned = ptr_is_owned(invoice); + CHECK_INNER_FIELD_ACCESS_OR_NULL(invoice_conv); + invoice_conv.is_owned = false; + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = InvoicePayer_pay_zero_value_invoice_with_id(&this_arg_conv, &invoice_conv, amount_msats, payment_id_ref); + return tag_ptr(ret_conv, true); +} + uint64_t __attribute__((export_name("TS_InvoicePayer_pay_pubkey"))) TS_InvoicePayer_pay_pubkey(uint64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) { LDKInvoicePayer this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -47060,6 +48741,26 @@ uint64_t __attribute__((export_name("TS_InvoicePayer_pay_pubkey"))) TS_InvoiceP return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_InvoicePayer_pay_pubkey_with_id"))) TS_InvoicePayer_pay_pubkey_with_id(uint64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int8_tArray payment_id, int64_t amount_msats, int32_t final_cltv_expiry_delta) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = untag_ptr(this_arg); + this_arg_conv.is_owned = ptr_is_owned(this_arg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + this_arg_conv.is_owned = false; + LDKPublicKey pubkey_ref; + CHECK(pubkey->arr_len == 33); + memcpy(pubkey_ref.compressed_form, pubkey->elems, 33); FREE(pubkey); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK(payment_preimage->arr_len == 32); + memcpy(payment_preimage_ref.data, payment_preimage->elems, 32); FREE(payment_preimage); + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = InvoicePayer_pay_pubkey_with_id(&this_arg_conv, pubkey_ref, payment_preimage_ref, payment_id_ref, amount_msats, final_cltv_expiry_delta); + return tag_ptr(ret_conv, true); +} + void __attribute__((export_name("TS_InvoicePayer_remove_cached_payment"))) TS_InvoicePayer_remove_cached_payment(uint64_t this_arg, int8_tArray payment_hash) { LDKInvoicePayer this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -47084,59 +48785,6 @@ uint64_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_Inv return tag_ptr(ret_ret, true); } -void __attribute__((export_name("TS_InFlightHtlcs_free"))) TS_InFlightHtlcs_free(uint64_t this_obj) { - LDKInFlightHtlcs this_obj_conv; - this_obj_conv.inner = untag_ptr(this_obj); - this_obj_conv.is_owned = ptr_is_owned(this_obj); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - InFlightHtlcs_free(this_obj_conv); -} - -uint64_t __attribute__((export_name("TS_InFlightHtlcs_used_liquidity_msat"))) TS_InFlightHtlcs_used_liquidity_msat(uint64_t this_arg, uint64_t source, uint64_t target, int64_t channel_scid) { - LDKInFlightHtlcs this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKNodeId source_conv; - source_conv.inner = untag_ptr(source); - source_conv.is_owned = ptr_is_owned(source); - CHECK_INNER_FIELD_ACCESS_OR_NULL(source_conv); - source_conv.is_owned = false; - LDKNodeId target_conv; - target_conv.inner = untag_ptr(target); - target_conv.is_owned = ptr_is_owned(target); - CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); - target_conv.is_owned = false; - LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); - *ret_copy = InFlightHtlcs_used_liquidity_msat(&this_arg_conv, &source_conv, &target_conv, channel_scid); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -int8_tArray __attribute__((export_name("TS_InFlightHtlcs_write"))) TS_InFlightHtlcs_write(uint64_t obj) { - LDKInFlightHtlcs obj_conv; - obj_conv.inner = untag_ptr(obj); - obj_conv.is_owned = ptr_is_owned(obj); - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - obj_conv.is_owned = false; - LDKCVec_u8Z ret_var = InFlightHtlcs_write(&obj_conv); - int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); - memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - -uint64_t __attribute__((export_name("TS_InFlightHtlcs_read"))) TS_InFlightHtlcs_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = ser->arr_len; - ser_ref.data = ser->elems; - LDKCResult_InFlightHtlcsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ), "LDKCResult_InFlightHtlcsDecodeErrorZ"); - *ret_conv = InFlightHtlcs_read(ser_ref); - FREE(ser); - return tag_ptr(ret_conv, true); -} - uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch"))) TS_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(uint64_t channelmanager, uint64_t keys_manager, uint64_t logger, uint32_t network, uint64_t amt_msat, uint64_t description_hash, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs) { LDKChannelManager channelmanager_conv; channelmanager_conv.inner = untag_ptr(channelmanager); @@ -47203,20 +48851,19 @@ uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_and_ return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_DefaultRouter_free"))) TS_DefaultRouter_free(uint64_t this_obj) { - LDKDefaultRouter this_obj_conv; - this_obj_conv.inner = untag_ptr(this_obj); - this_obj_conv.is_owned = ptr_is_owned(this_obj); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - DefaultRouter_free(this_obj_conv); -} - -uint64_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_new(uint64_t network_graph, uint64_t logger, int8_tArray random_seed_bytes, uint64_t scorer) { - LDKNetworkGraph network_graph_conv; - network_graph_conv.inner = untag_ptr(network_graph); - network_graph_conv.is_owned = ptr_is_owned(network_graph); - CHECK_INNER_FIELD_ACCESS_OR_NULL(network_graph_conv); - network_graph_conv.is_owned = false; +uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash"))) TS_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(uint64_t channelmanager, uint64_t keys_manager, uint64_t logger, uint32_t network, uint64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, int8_tArray payment_hash) { + LDKChannelManager channelmanager_conv; + channelmanager_conv.inner = untag_ptr(channelmanager); + channelmanager_conv.is_owned = ptr_is_owned(channelmanager); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channelmanager_conv); + channelmanager_conv.is_owned = false; + void* keys_manager_ptr = untag_ptr(keys_manager); + CHECK_ACCESS(keys_manager_ptr); + LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(keys_manager_ptr); + if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -47224,32 +48871,18 @@ uint64_t __attribute__((export_name("TS_DefaultRouter_new"))) TS_DefaultRouter_ // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKThirtyTwoBytes random_seed_bytes_ref; - CHECK(random_seed_bytes->arr_len == 32); - memcpy(random_seed_bytes_ref.data, random_seed_bytes->elems, 32); FREE(random_seed_bytes); - void* scorer_ptr = untag_ptr(scorer); - CHECK_ACCESS(scorer_ptr); - LDKLockableScore scorer_conv = *(LDKLockableScore*)(scorer_ptr); - if (scorer_conv.free == LDKLockableScore_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKLockableScore_JCalls_cloned(&scorer_conv); - } - LDKDefaultRouter ret_var = DefaultRouter_new(&network_graph_conv, logger_conv, random_seed_bytes_ref, scorer_conv); - uint64_t ret_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); - return ret_ref; -} - -uint64_t __attribute__((export_name("TS_DefaultRouter_as_Router"))) TS_DefaultRouter_as_Router(uint64_t this_arg) { - LDKDefaultRouter this_arg_conv; - this_arg_conv.inner = untag_ptr(this_arg); - this_arg_conv.is_owned = ptr_is_owned(this_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - this_arg_conv.is_owned = false; - LDKRouter* ret_ret = MALLOC(sizeof(LDKRouter), "LDKRouter"); - *ret_ret = DefaultRouter_as_Router(&this_arg_conv); - return tag_ptr(ret_ret, true); + LDKCurrency network_conv = LDKCurrency_from_js(network); + void* amt_msat_ptr = untag_ptr(amt_msat); + CHECK_ACCESS(amt_msat_ptr); + LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(amt_msat_ptr); + amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(amt_msat)); + LDKStr description_conv = str_ref_to_owned_c(description); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref); + return tag_ptr(ret_conv, true); } uint64_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(uint64_t this_arg) {