X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fbindings.c;fp=ts%2Fbindings.c;h=3bb608209ac195026e4cda8079048bafcd725a9a;hb=578905367ec9ecc59f50a12c5d49cc5e15f21836;hp=d17181493b6b8046cef4aae673aea2b8a850e3ff;hpb=eab9331afd014558a982441138e222999a9955d1;p=ldk-java diff --git a/ts/bindings.c b/ts/bindings.c index d1718149..3bb60820 100644 --- a/ts/bindings.c +++ b/ts/bindings.c @@ -52,6 +52,7 @@ _Static_assert(sizeof(void*) == 4, "Pointers mut be 32 bits"); DECL_ARR_TYPE(int64_t, int64_t); DECL_ARR_TYPE(uint64_t, uint64_t); DECL_ARR_TYPE(int8_t, int8_t); +DECL_ARR_TYPE(int16_t, int16_t); DECL_ARR_TYPE(uint32_t, uint32_t); DECL_ARR_TYPE(void*, ptr); DECL_ARR_TYPE(char, char); @@ -151,20 +152,6 @@ static inline uint64_t tag_ptr(const void* ptr, bool is_owned) { } } -static inline LDKAccessError LDKAccessError_from_js(int32_t ord) { - switch (ord) { - case 0: return LDKAccessError_UnknownChain; - case 1: return LDKAccessError_UnknownTx; - } - abort(); -} -static inline int32_t LDKAccessError_to_js(LDKAccessError val) { - switch (val) { - case LDKAccessError_UnknownChain: return 0; - case LDKAccessError_UnknownTx: return 1; - default: abort(); - } -} static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) { switch (ord) { case 0: return LDKCOption_NoneZ_Some; @@ -218,6 +205,7 @@ static inline LDKCreationError LDKCreationError_from_js(int32_t ord) { case 2: return LDKCreationError_TimestampOutOfBounds; case 3: return LDKCreationError_InvalidAmount; case 4: return LDKCreationError_MissingRouteHints; + case 5: return LDKCreationError_MinFinalCltvExpiryDeltaTooShort; } abort(); } @@ -228,6 +216,7 @@ static inline int32_t LDKCreationError_to_js(LDKCreationError val) { case LDKCreationError_TimestampOutOfBounds: return 2; case LDKCreationError_InvalidAmount: return 3; case LDKCreationError_MissingRouteHints: return 4; + case LDKCreationError_MinFinalCltvExpiryDeltaTooShort: return 5; default: abort(); } } @@ -251,6 +240,22 @@ static inline int32_t LDKCurrency_to_js(LDKCurrency val) { default: abort(); } } +static inline LDKFailureCode LDKFailureCode_from_js(int32_t ord) { + switch (ord) { + case 0: return LDKFailureCode_TemporaryNodeFailure; + case 1: return LDKFailureCode_RequiredNodeFeatureMissing; + case 2: return LDKFailureCode_IncorrectOrUnknownPaymentDetails; + } + abort(); +} +static inline int32_t LDKFailureCode_to_js(LDKFailureCode val) { + switch (val) { + case LDKFailureCode_TemporaryNodeFailure: return 0; + case LDKFailureCode_RequiredNodeFeatureMissing: return 1; + case LDKFailureCode_IncorrectOrUnknownPaymentDetails: return 2; + default: abort(); + } +} static inline LDKHTLCClaim LDKHTLCClaim_from_js(int32_t ord) { switch (ord) { case 0: return LDKHTLCClaim_OfferedTimeout; @@ -371,6 +376,22 @@ static inline int32_t LDKRecipient_to_js(LDKRecipient val) { default: abort(); } } +static inline LDKRetryableSendFailure LDKRetryableSendFailure_from_js(int32_t ord) { + switch (ord) { + case 0: return LDKRetryableSendFailure_PaymentExpired; + case 1: return LDKRetryableSendFailure_RouteNotFound; + case 2: return LDKRetryableSendFailure_DuplicatePayment; + } + abort(); +} +static inline int32_t LDKRetryableSendFailure_to_js(LDKRetryableSendFailure val) { + switch (val) { + case LDKRetryableSendFailure_PaymentExpired: return 0; + case LDKRetryableSendFailure_RouteNotFound: return 1; + case LDKRetryableSendFailure_DuplicatePayment: return 2; + default: abort(); + } +} static inline LDKSecp256k1Error LDKSecp256k1Error_from_js(int32_t ord) { switch (ord) { case 0: return LDKSecp256k1Error_IncorrectSignature; @@ -451,6 +472,20 @@ static inline int32_t LDKSiPrefix_to_js(LDKSiPrefix val) { default: abort(); } } +static inline LDKUtxoLookupError LDKUtxoLookupError_from_js(int32_t ord) { + switch (ord) { + case 0: return LDKUtxoLookupError_UnknownChain; + case 1: return LDKUtxoLookupError_UnknownTx; + } + abort(); +} +static inline int32_t LDKUtxoLookupError_to_js(LDKUtxoLookupError val) { + switch (val) { + case LDKUtxoLookupError_UnknownChain: return 0; + case LDKUtxoLookupError_UnknownTx: return 1; + default: abort(); + } +} struct LDKThirtyTwoBytes BigEndianScalar_get_bytes (struct LDKBigEndianScalar* thing) { LDKThirtyTwoBytes ret = { .data = *thing->big_endian_bytes }; return ret; @@ -517,6 +552,96 @@ uint64_t TxOut_get_value (struct LDKTxOut* thing) { return thing->value;}int64_t return ret_conv; } +uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + switch(obj->tag) { + case LDKAPIError_APIMisuseError: return 0; + case LDKAPIError_FeeRateTooHigh: return 1; + case LDKAPIError_InvalidRoute: return 2; + case LDKAPIError_ChannelUnavailable: return 3; + case LDKAPIError_MonitorUpdateInProgress: return 4; + case LDKAPIError_IncompatibleShutdownScript: return 5; + default: abort(); + } +} +jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + assert(obj->tag == LDKAPIError_APIMisuseError); + LDKStr err_str = obj->api_misuse_error.err; + jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); + return err_conv; +} +jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + assert(obj->tag == LDKAPIError_FeeRateTooHigh); + LDKStr err_str = obj->fee_rate_too_high.err; + jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); + return err_conv; +} +int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + assert(obj->tag == LDKAPIError_FeeRateTooHigh); + int32_t feerate_conv = obj->fee_rate_too_high.feerate; + return feerate_conv; +} +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_InvalidRoute); + LDKStr err_str = obj->invalid_route.err; + jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); + return err_conv; +} +jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + assert(obj->tag == LDKAPIError_ChannelUnavailable); + LDKStr err_str = obj->channel_unavailable.err; + jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); + return err_conv; +} +uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) { + LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); + assert(obj->tag == LDKAPIError_IncompatibleShutdownScript); + LDKShutdownScript script_var = obj->incompatible_shutdown_script.script; + uint64_t script_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var); + script_ref = tag_ptr(script_var.inner, false); + return script_ref; +} +static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) { + LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); + CResult_NoneAPIErrorZ_get_ok(owner_conv); +} + +static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return APIError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) { + LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); + LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError"); + *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { + LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); + } + return ret; +} +static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { + LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = APIError_clone(&orig->data[i]); + } + return ret; +} uint32_t __attribute__((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) { @@ -1336,6 +1461,121 @@ uint64_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_get_ return ret_ref; } +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) { + case LDKNetworkUpdate_ChannelUpdateMessage: return 0; + case LDKNetworkUpdate_ChannelFailure: return 1; + case LDKNetworkUpdate_NodeFailure: return 2; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) { + LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); + assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage); + LDKChannelUpdate msg_var = obj->channel_update_message.msg; + uint64_t msg_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = tag_ptr(msg_var.inner, false); + return msg_ref; +} +int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) { + LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); + assert(obj->tag == LDKNetworkUpdate_ChannelFailure); + int64_t short_channel_id_conv = obj->channel_failure.short_channel_id; + return short_channel_id_conv; +} +jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) { + LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); + assert(obj->tag == LDKNetworkUpdate_ChannelFailure); + jboolean is_permanent_conv = obj->channel_failure.is_permanent; + return is_permanent_conv; +} +int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) { + LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); + assert(obj->tag == LDKNetworkUpdate_NodeFailure); + int8_tArray node_id_arr = init_int8_tArray(33, __LINE__); + memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33); + return node_id_arr; +} +jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) { + LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); + assert(obj->tag == LDKNetworkUpdate_NodeFailure); + jboolean is_permanent_conv = obj->node_failure.is_permanent; + return is_permanent_conv; +} +uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) { + LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_NetworkUpdateZ_Some: return 0; + case LDKCOption_NetworkUpdateZ_None: return 1; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) { + LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_NetworkUpdateZ_Some); + uint64_t some_ref = tag_ptr(&obj->some, false); + return some_ref; +} +uint32_t __attribute__((export_name("TS_LDKPathFailure_ty_from_ptr"))) TS_LDKPathFailure_ty_from_ptr(uint64_t ptr) { + LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr); + switch(obj->tag) { + case LDKPathFailure_InitialSend: return 0; + case LDKPathFailure_OnPath: return 1; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKPathFailure_InitialSend_get_err"))) TS_LDKPathFailure_InitialSend_get_err(uint64_t ptr) { + LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr); + assert(obj->tag == LDKPathFailure_InitialSend); + uint64_t err_ref = tag_ptr(&obj->initial_send.err, false); + return err_ref; +} +uint64_t __attribute__((export_name("TS_LDKPathFailure_OnPath_get_network_update"))) TS_LDKPathFailure_OnPath_get_network_update(uint64_t ptr) { + LDKPathFailure *obj = (LDKPathFailure*)untag_ptr(ptr); + assert(obj->tag == LDKPathFailure_OnPath); + uint64_t network_update_ref = tag_ptr(&obj->on_path.network_update, false); + return network_update_ref; +} +uint32_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_ty_from_ptr"))) TS_LDKCOption_PathFailureZ_ty_from_ptr(uint64_t ptr) { + LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_PathFailureZ_Some: return 0; + case LDKCOption_PathFailureZ_None: return 1; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKCOption_PathFailureZ_Some_get_some"))) TS_LDKCOption_PathFailureZ_Some_get_some(uint64_t ptr) { + LDKCOption_PathFailureZ *obj = (LDKCOption_PathFailureZ*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_PathFailureZ_Some); + uint64_t some_ref = tag_ptr(&obj->some, false); + return some_ref; +} +static inline struct LDKCOption_PathFailureZ CResult_COption_PathFailureZDecodeErrorZ_get_ok(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_PathFailureZ_clone(&*owner->contents.result); +} +uint64_t __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_PathFailureZDecodeErrorZ_get_err(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_get_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_COption_PathFailureZDecodeErrorZ* owner_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_COption_PathFailureZDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint32_t __attribute__((export_name("TS_LDKClosureReason_ty_from_ptr"))) TS_LDKClosureReason_ty_from_ptr(uint64_t ptr) { LDKClosureReason *obj = (LDKClosureReason*)untag_ptr(ptr); switch(obj->tag) { @@ -1498,63 +1738,6 @@ int8_tArray __attribute__((export_name("TS_LDKCOption_u128Z_Some_get_some"))) TS 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) { - case LDKNetworkUpdate_ChannelUpdateMessage: return 0; - case LDKNetworkUpdate_ChannelFailure: return 1; - case LDKNetworkUpdate_NodeFailure: return 2; - default: abort(); - } -} -uint64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg"))) TS_LDKNetworkUpdate_ChannelUpdateMessage_get_msg(uint64_t ptr) { - LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); - assert(obj->tag == LDKNetworkUpdate_ChannelUpdateMessage); - LDKChannelUpdate msg_var = obj->channel_update_message.msg; - uint64_t msg_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); - msg_ref = tag_ptr(msg_var.inner, false); - return msg_ref; -} -int64_t __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id"))) TS_LDKNetworkUpdate_ChannelFailure_get_short_channel_id(uint64_t ptr) { - LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); - assert(obj->tag == LDKNetworkUpdate_ChannelFailure); - int64_t short_channel_id_conv = obj->channel_failure.short_channel_id; - return short_channel_id_conv; -} -jboolean __attribute__((export_name("TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent"))) TS_LDKNetworkUpdate_ChannelFailure_get_is_permanent(uint64_t ptr) { - LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); - assert(obj->tag == LDKNetworkUpdate_ChannelFailure); - jboolean is_permanent_conv = obj->channel_failure.is_permanent; - return is_permanent_conv; -} -int8_tArray __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_node_id"))) TS_LDKNetworkUpdate_NodeFailure_get_node_id(uint64_t ptr) { - LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); - assert(obj->tag == LDKNetworkUpdate_NodeFailure); - int8_tArray node_id_arr = init_int8_tArray(33, __LINE__); - memcpy(node_id_arr->elems, obj->node_failure.node_id.compressed_form, 33); - return node_id_arr; -} -jboolean __attribute__((export_name("TS_LDKNetworkUpdate_NodeFailure_get_is_permanent"))) TS_LDKNetworkUpdate_NodeFailure_get_is_permanent(uint64_t ptr) { - LDKNetworkUpdate *obj = (LDKNetworkUpdate*)untag_ptr(ptr); - assert(obj->tag == LDKNetworkUpdate_NodeFailure); - jboolean is_permanent_conv = obj->node_failure.is_permanent; - return is_permanent_conv; -} -uint32_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_ty_from_ptr"))) TS_LDKCOption_NetworkUpdateZ_ty_from_ptr(uint64_t ptr) { - LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); - switch(obj->tag) { - case LDKCOption_NetworkUpdateZ_Some: return 0; - case LDKCOption_NetworkUpdateZ_None: return 1; - default: abort(); - } -} -uint64_t __attribute__((export_name("TS_LDKCOption_NetworkUpdateZ_Some_get_some"))) TS_LDKCOption_NetworkUpdateZ_Some_get_some(uint64_t ptr) { - LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)untag_ptr(ptr); - assert(obj->tag == LDKCOption_NetworkUpdateZ_Some); - uint64_t some_ref = tag_ptr(&obj->some, false); - return some_ref; -} uint32_t __attribute__((export_name("TS_LDKSpendableOutputDescriptor_ty_from_ptr"))) TS_LDKSpendableOutputDescriptor_ty_from_ptr(uint64_t ptr) { LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)untag_ptr(ptr); switch(obj->tag) { @@ -1820,17 +2003,11 @@ jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_payment_f jboolean payment_failed_permanently_conv = obj->payment_path_failed.payment_failed_permanently; return payment_failed_permanently_conv; } -uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_network_update"))) TS_LDKEvent_PaymentPathFailed_get_network_update(uint64_t ptr) { +uint64_t __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_failure"))) TS_LDKEvent_PaymentPathFailed_get_failure(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); assert(obj->tag == LDKEvent_PaymentPathFailed); - uint64_t network_update_ref = tag_ptr(&obj->payment_path_failed.network_update, false); - return network_update_ref; -} -jboolean __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_all_paths_failed"))) TS_LDKEvent_PaymentPathFailed_get_all_paths_failed(uint64_t ptr) { - LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); - assert(obj->tag == LDKEvent_PaymentPathFailed); - jboolean all_paths_failed_conv = obj->payment_path_failed.all_paths_failed; - return all_paths_failed_conv; + uint64_t failure_ref = tag_ptr(&obj->payment_path_failed.failure, false); + return failure_ref; } uint64_tArray __attribute__((export_name("TS_LDKEvent_PaymentPathFailed_get_path"))) TS_LDKEvent_PaymentPathFailed_get_path(uint64_t ptr) { LDKEvent *obj = (LDKEvent*)untag_ptr(ptr); @@ -2229,12 +2406,13 @@ uint32_t __attribute__((export_name("TS_LDKMessageSendEvent_ty_from_ptr"))) TS_L case LDKMessageSendEvent_SendChannelAnnouncement: return 11; case LDKMessageSendEvent_BroadcastChannelAnnouncement: return 12; case LDKMessageSendEvent_BroadcastChannelUpdate: return 13; - case LDKMessageSendEvent_SendChannelUpdate: return 14; - case LDKMessageSendEvent_HandleError: return 15; - case LDKMessageSendEvent_SendChannelRangeQuery: return 16; - case LDKMessageSendEvent_SendShortIdsQuery: return 17; - case LDKMessageSendEvent_SendReplyChannelRange: return 18; - case LDKMessageSendEvent_SendGossipTimestampFilter: return 19; + case LDKMessageSendEvent_BroadcastNodeAnnouncement: return 14; + case LDKMessageSendEvent_SendChannelUpdate: return 15; + case LDKMessageSendEvent_HandleError: return 16; + case LDKMessageSendEvent_SendChannelRangeQuery: return 17; + case LDKMessageSendEvent_SendShortIdsQuery: return 18; + case LDKMessageSendEvent_SendReplyChannelRange: return 19; + case LDKMessageSendEvent_SendGossipTimestampFilter: return 20; default: abort(); } } @@ -2466,6 +2644,15 @@ uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastChannelUpda msg_ref = tag_ptr(msg_var.inner, false); return msg_ref; } +uint64_t __attribute__((export_name("TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg"))) TS_LDKMessageSendEvent_BroadcastNodeAnnouncement_get_msg(uint64_t ptr) { + LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr); + assert(obj->tag == LDKMessageSendEvent_BroadcastNodeAnnouncement); + LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg; + uint64_t msg_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_var); + msg_ref = tag_ptr(msg_var.inner, false); + return msg_ref; +} int8_tArray __attribute__((export_name("TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id"))) TS_LDKMessageSendEvent_SendChannelUpdate_get_node_id(uint64_t ptr) { LDKMessageSendEvent *obj = (LDKMessageSendEvent*)untag_ptr(ptr); assert(obj->tag == LDKMessageSendEvent_SendChannelUpdate); @@ -2566,27 +2753,6 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -static inline struct LDKTxOut CResult_TxOutAccessErrorZ_get_ok(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return TxOut_clone(&*owner->contents.result); -} -uint64_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_ok"))) TS_CResult_TxOutAccessErrorZ_get_ok(uint64_t owner) { - LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner); - LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); - *ret_ref = CResult_TxOutAccessErrorZ_get_ok(owner_conv); - return tag_ptr(ret_ref, true); -} - -static inline enum LDKAccessError CResult_TxOutAccessErrorZ_get_err(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return AccessError_clone(&*owner->contents.err); -} -uint32_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_get_err"))) TS_CResult_TxOutAccessErrorZ_get_err(uint64_t owner) { - LDKCResult_TxOutAccessErrorZ* owner_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(owner); - uint32_t ret_conv = LDKAccessError_to_js(CResult_TxOutAccessErrorZ_get_err(owner_conv)); - return ret_conv; -} - static inline uintptr_t C2Tuple_usizeTransactionZ_get_a(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR owner){ return owner->a; } @@ -2811,6 +2977,62 @@ uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_u64u64ZZ_Some_get_som *some_conv = C2Tuple_u64u64Z_clone(some_conv); return tag_ptr(some_conv, true); } +static inline struct LDKEightU16s C2Tuple_Z_get_a(LDKC2Tuple_Z *NONNULL_PTR owner){ + return owner->a; +} +int16_tArray __attribute__((export_name("TS_C2Tuple_Z_get_a"))) TS_C2Tuple_Z_get_a(uint64_t owner) { + LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner); + int16_tArray ret_arr = init_int16_tArray(8, __LINE__); + memcpy(ret_arr->elems, C2Tuple_Z_get_a(owner_conv).data, 8 * 2); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple_Z_get_b(LDKC2Tuple_Z *NONNULL_PTR owner){ + return owner->b; +} +int16_tArray __attribute__((export_name("TS_C2Tuple_Z_get_b"))) TS_C2Tuple_Z_get_b(uint64_t owner) { + LDKC2Tuple_Z* owner_conv = (LDKC2Tuple_Z*)untag_ptr(owner); + int16_tArray ret_arr = init_int16_tArray(8, __LINE__); + memcpy(ret_arr->elems, C2Tuple_Z_get_b(owner_conv).data, 8 * 2); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_a(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){ + return owner->a; +} +int16_tArray __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_a"))) TS_C2Tuple__u168_u168Z_get_a(uint64_t owner) { + LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner); + int16_tArray ret_arr = init_int16_tArray(8, __LINE__); + memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_a(owner_conv).data, 8 * 2); + return ret_arr; +} + +static inline struct LDKEightU16s C2Tuple__u168_u168Z_get_b(LDKC2Tuple__u168_u168Z *NONNULL_PTR owner){ + return owner->b; +} +int16_tArray __attribute__((export_name("TS_C2Tuple__u168_u168Z_get_b"))) TS_C2Tuple__u168_u168Z_get_b(uint64_t owner) { + LDKC2Tuple__u168_u168Z* owner_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(owner); + int16_tArray ret_arr = init_int16_tArray(8, __LINE__); + memcpy(ret_arr->elems, C2Tuple__u168_u168Z_get_b(owner_conv).data, 8 * 2); + return ret_arr; +} + +uint32_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_ty_from_ptr(uint64_t ptr) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some: return 0; + case LDKCOption_C2Tuple_EightU16sEightU16sZZ_None: return 1; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some"))) TS_LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some_get_some(uint64_t ptr) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *obj = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some); + LDKC2Tuple__u168_u168Z* some_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *some_conv = obj->some; + *some_conv = C2Tuple__u168_u168Z_clone(some_conv); + return tag_ptr(some_conv, true); +} static inline LDKCVec_NodeIdZ CVec_NodeIdZ_clone(const LDKCVec_NodeIdZ *orig) { LDKCVec_NodeIdZ ret = { .data = MALLOC(sizeof(LDKNodeId) * orig->datalen, "LDKCVec_NodeIdZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -2988,80 +3210,54 @@ uint64_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_get return ret_ref; } -static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ - LDKChannelTypeFeatures ret = *owner->contents.result; +static inline struct LDKBlindedHopFeatures CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKBlindedHopFeatures ret = *owner->contents.result; ret.is_owned = false; return ret; } -uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); - LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKBlindedHopFeatures ret_var = CResult_BlindedHopFeaturesDecodeErrorZ_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_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_BlindedHopFeaturesDecodeErrorZ_get_err(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); +uint64_t __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* owner_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_BlindedHopFeaturesDecodeErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); 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; +static inline struct LDKChannelTypeFeatures CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR owner){ + LDKChannelTypeFeatures 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 __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); + LDKChannelTypeFeatures ret_var = CResult_ChannelTypeFeaturesDecodeErrorZ_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){ +static inline struct LDKDecodeError CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *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); +uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* owner_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_InvoiceRequestFeaturesDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_ChannelTypeFeaturesDecodeErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -3116,79 +3312,126 @@ uint64_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErr return ret_ref; } -typedef struct LDKAccess_JCalls { +static inline struct LDKTxOut CResult_TxOutUtxoLookupErrorZ_get_ok(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return TxOut_clone(&*owner->contents.result); +} +uint64_t __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_get_ok(uint64_t owner) { + LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner); + LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut"); + *ret_ref = CResult_TxOutUtxoLookupErrorZ_get_ok(owner_conv); + return tag_ptr(ret_ref, true); +} + +static inline enum LDKUtxoLookupError CResult_TxOutUtxoLookupErrorZ_get_err(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return UtxoLookupError_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_get_err"))) TS_CResult_TxOutUtxoLookupErrorZ_get_err(uint64_t owner) { + LDKCResult_TxOutUtxoLookupErrorZ* owner_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(owner); + uint32_t ret_conv = LDKUtxoLookupError_to_js(CResult_TxOutUtxoLookupErrorZ_get_err(owner_conv)); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_LDKUtxoResult_ty_from_ptr"))) TS_LDKUtxoResult_ty_from_ptr(uint64_t ptr) { + LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr); + switch(obj->tag) { + case LDKUtxoResult_Sync: return 0; + case LDKUtxoResult_Async: return 1; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKUtxoResult_Sync_get_sync"))) TS_LDKUtxoResult_Sync_get_sync(uint64_t ptr) { + LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr); + assert(obj->tag == LDKUtxoResult_Sync); + LDKCResult_TxOutUtxoLookupErrorZ* sync_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *sync_conv = obj->sync; + *sync_conv = CResult_TxOutUtxoLookupErrorZ_clone(sync_conv); + return tag_ptr(sync_conv, true); +} +uint64_t __attribute__((export_name("TS_LDKUtxoResult_Async_get_async"))) TS_LDKUtxoResult_Async_get_async(uint64_t ptr) { + LDKUtxoResult *obj = (LDKUtxoResult*)untag_ptr(ptr); + assert(obj->tag == LDKUtxoResult_Async); + LDKUtxoFuture async_var = obj->async; + uint64_t async_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(async_var); + async_ref = tag_ptr(async_var.inner, false); + return async_ref; +} +typedef struct LDKUtxoLookup_JCalls { atomic_size_t refcnt; uint32_t instance_ptr; -} LDKAccess_JCalls; -static void LDKAccess_JCalls_free(void* this_arg) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; +} LDKUtxoLookup_JCalls; +static void LDKUtxoLookup_JCalls_free(void* this_arg) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { FREE(j_calls); } } -LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg; +LDKUtxoResult get_utxo_LDKUtxoLookup_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) this_arg; int8_tArray genesis_hash_arr = init_int8_tArray(32, __LINE__); memcpy(genesis_hash_arr->elems, *genesis_hash, 32); int64_t short_channel_id_conv = short_channel_id; uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 1, (uint32_t)genesis_hash_arr, short_channel_id_conv, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(ret_ptr); + LDKUtxoResult ret_conv = *(LDKUtxoResult*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) { - LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg; +static void LDKUtxoLookup_JCalls_cloned(LDKUtxoLookup* new_obj) { + LDKUtxoLookup_JCalls *j_calls = (LDKUtxoLookup_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKAccess LDKAccess_init (JSValue o) { - LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls"); +static inline LDKUtxoLookup LDKUtxoLookup_init (JSValue o) { + LDKUtxoLookup_JCalls *calls = MALLOC(sizeof(LDKUtxoLookup_JCalls), "LDKUtxoLookup_JCalls"); atomic_init(&calls->refcnt, 1); calls->instance_ptr = o; - LDKAccess ret = { + LDKUtxoLookup ret = { .this_arg = (void*) calls, - .get_utxo = get_utxo_LDKAccess_jcall, - .free = LDKAccess_JCalls_free, + .get_utxo = get_utxo_LDKUtxoLookup_jcall, + .free = LDKUtxoLookup_JCalls_free, }; return ret; } -uint64_t __attribute__((export_name("TS_LDKAccess_new"))) TS_LDKAccess_new(JSValue o) { - LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess"); - *res_ptr = LDKAccess_init(o); +uint64_t __attribute__((export_name("TS_LDKUtxoLookup_new"))) TS_LDKUtxoLookup_new(JSValue o) { + LDKUtxoLookup *res_ptr = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup"); + *res_ptr = LDKUtxoLookup_init(o); return tag_ptr(res_ptr, true); } -uint64_t __attribute__((export_name("TS_Access_get_utxo"))) TS_Access_get_utxo(uint64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) { +uint64_t __attribute__((export_name("TS_UtxoLookup_get_utxo"))) TS_UtxoLookup_get_utxo(uint64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKAccess* this_arg_conv = (LDKAccess*)this_arg_ptr; - unsigned char genesis_hash_arr[32]; + LDKUtxoLookup* this_arg_conv = (LDKUtxoLookup*)this_arg_ptr; + uint8_t genesis_hash_arr[32]; CHECK(genesis_hash->arr_len == 32); memcpy(genesis_hash_arr, genesis_hash->elems, 32); FREE(genesis_hash); - unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr; - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); - return tag_ptr(ret_conv, true); + uint8_t (*genesis_hash_ref)[32] = &genesis_hash_arr; + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; } -uint32_t __attribute__((export_name("TS_LDKCOption_AccessZ_ty_from_ptr"))) TS_LDKCOption_AccessZ_ty_from_ptr(uint64_t ptr) { - LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr); +uint32_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_ty_from_ptr"))) TS_LDKCOption_UtxoLookupZ_ty_from_ptr(uint64_t ptr) { + LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr); switch(obj->tag) { - case LDKCOption_AccessZ_Some: return 0; - case LDKCOption_AccessZ_None: return 1; + case LDKCOption_UtxoLookupZ_Some: return 0; + case LDKCOption_UtxoLookupZ_None: return 1; default: abort(); } } -uint64_t __attribute__((export_name("TS_LDKCOption_AccessZ_Some_get_some"))) TS_LDKCOption_AccessZ_Some_get_some(uint64_t ptr) { - LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)untag_ptr(ptr); - assert(obj->tag == LDKCOption_AccessZ_Some); - LDKAccess* some_ret = MALLOC(sizeof(LDKAccess), "LDKAccess"); +uint64_t __attribute__((export_name("TS_LDKCOption_UtxoLookupZ_Some_get_some"))) TS_LDKCOption_UtxoLookupZ_Some_get_some(uint64_t ptr) { + LDKCOption_UtxoLookupZ *obj = (LDKCOption_UtxoLookupZ*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_UtxoLookupZ_Some); + LDKUtxoLookup* some_ret = MALLOC(sizeof(LDKUtxoLookup), "LDKUtxoLookup"); *some_ret = obj->some; // WARNING: We likely need to clone here, but no clone is available, so we just do it for Java instances - if ((*some_ret).free == LDKAccess_JCalls_free) { + if ((*some_ret).free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&(*some_ret)); + LDKUtxoLookup_JCalls_cloned(&(*some_ret)); } return tag_ptr(some_ret, true); } @@ -3743,66 +3986,6 @@ void __attribute__((export_name("TS_CResult_SignatureNoneZ_get_err"))) TS_CResu CResult_SignatureNoneZ_get_err(owner_conv); } -static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_a(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){ - return owner->a; -} -int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_a"))) TS_C2Tuple_SignatureSignatureZ_get_a(uint64_t owner) { - LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(64, __LINE__); - memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_a(owner_conv).compact_form, 64); - return ret_arr; -} - -static inline struct LDKSignature C2Tuple_SignatureSignatureZ_get_b(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR owner){ - return owner->b; -} -int8_tArray __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_get_b"))) TS_C2Tuple_SignatureSignatureZ_get_b(uint64_t owner) { - LDKC2Tuple_SignatureSignatureZ* owner_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(64, __LINE__); - memcpy(ret_arr->elems, C2Tuple_SignatureSignatureZ_get_b(owner_conv).compact_form, 64); - return ret_arr; -} - -static inline struct LDKC2Tuple_SignatureSignatureZ CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return C2Tuple_SignatureSignatureZ_clone(&*owner->contents.result); -} -uint64_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(uint64_t owner) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_get_ok(owner_conv); - return tag_ptr(ret_conv, true); -} - -static inline void CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(uint64_t owner) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* owner_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(owner); - CResult_C2Tuple_SignatureSignatureZNoneZ_get_err(owner_conv); -} - -static inline struct LDKSecretKey CResult_SecretKeyNoneZ_get_ok(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -int8_tArray __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_ok"))) TS_CResult_SecretKeyNoneZ_get_ok(uint64_t owner) { - LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, CResult_SecretKeyNoneZ_get_ok(owner_conv).bytes, 32); - return ret_arr; -} - -static inline void CResult_SecretKeyNoneZ_get_err(LDKCResult_SecretKeyNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_get_err"))) TS_CResult_SecretKeyNoneZ_get_err(uint64_t owner) { - LDKCResult_SecretKeyNoneZ* owner_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(owner); - CResult_SecretKeyNoneZ_get_err(owner_conv); -} - static inline struct LDKPublicKey CResult_PublicKeyNoneZ_get_ok(LDKCResult_PublicKeyNoneZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return *owner->contents.result; @@ -3857,18 +4040,38 @@ void __attribute__((export_name("TS_CResult_SharedSecretNoneZ_get_err"))) TS_CR CResult_SharedSecretNoneZ_get_err(owner_conv); } -typedef struct LDKBaseSign_JCalls { +static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) { + LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(68, __LINE__); + memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68); + return ret_arr; +} + +static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return *owner->contents.err; +} +void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) { + LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); + CResult_RecoverableSignatureNoneZ_get_err(owner_conv); +} + +typedef struct LDKChannelSigner_JCalls { atomic_size_t refcnt; uint32_t instance_ptr; -} LDKBaseSign_JCalls; -static void LDKBaseSign_JCalls_free(void* this_arg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +} LDKChannelSigner_JCalls; +static void LDKChannelSigner_JCalls_free(void* this_arg) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { FREE(j_calls); } } -LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKPublicKey get_per_commitment_point_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; int64_t idx_conv = idx; int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 2, idx_conv, 0, 0, 0, 0, 0); LDKPublicKey ret_ref; @@ -3876,8 +4079,8 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui memcpy(ret_ref.compressed_form, ret->elems, 33); FREE(ret); return ret_ref; } -LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKThirtyTwoBytes release_commitment_secret_LDKChannelSigner_jcall(const void* this_arg, uint64_t idx) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; int64_t idx_conv = idx; int8_tArray ret = (int8_tArray)js_invoke_function_buuuuu(j_calls->instance_ptr, 3, idx_conv, 0, 0, 0, 0, 0); LDKThirtyTwoBytes ret_ref; @@ -3885,8 +4088,8 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a memcpy(ret_ref.data, ret->elems, 32); FREE(ret); return ret_ref; } -LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_NoneNoneZ validate_holder_commitment_LDKChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx, LDKCVec_PaymentPreimageZ preimages) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; LDKHolderCommitmentTransaction holder_tx_var = *holder_tx; uint64_t holder_tx_ref = 0; holder_tx_var = HolderCommitmentTransaction_clone(&holder_tx_var); @@ -3910,16 +4113,152 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th FREE(untag_ptr(ret)); return ret_conv; } -LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKThirtyTwoBytes channel_keys_id_LDKChannelSigner_jcall(const void* this_arg) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 5, 0, 0, 0, 0, 0, 0); LDKThirtyTwoBytes ret_ref; CHECK(ret->arr_len == 32); memcpy(ret_ref.data, ret->elems, 32); FREE(ret); return ret_ref; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +void provide_channel_parameters_LDKChannelSigner_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) this_arg; + LDKChannelTransactionParameters channel_parameters_var = *channel_parameters; + uint64_t channel_parameters_ref = 0; + channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); + channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned); + js_invoke_function_buuuuu(j_calls->instance_ptr, 6, channel_parameters_ref, 0, 0, 0, 0, 0); +} +static void LDKChannelSigner_JCalls_cloned(LDKChannelSigner* new_obj) { + LDKChannelSigner_JCalls *j_calls = (LDKChannelSigner_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKChannelSigner LDKChannelSigner_init (JSValue o, uint64_t pubkeys) { + LDKChannelSigner_JCalls *calls = MALLOC(sizeof(LDKChannelSigner_JCalls), "LDKChannelSigner_JCalls"); + atomic_init(&calls->refcnt, 1); + calls->instance_ptr = o; + + LDKChannelPublicKeys pubkeys_conv; + pubkeys_conv.inner = untag_ptr(pubkeys); + pubkeys_conv.is_owned = ptr_is_owned(pubkeys); + CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); + + LDKChannelSigner ret = { + .this_arg = (void*) calls, + .get_per_commitment_point = get_per_commitment_point_LDKChannelSigner_jcall, + .release_commitment_secret = release_commitment_secret_LDKChannelSigner_jcall, + .validate_holder_commitment = validate_holder_commitment_LDKChannelSigner_jcall, + .channel_keys_id = channel_keys_id_LDKChannelSigner_jcall, + .provide_channel_parameters = provide_channel_parameters_LDKChannelSigner_jcall, + .free = LDKChannelSigner_JCalls_free, + .pubkeys = pubkeys_conv, + .set_pubkeys = NULL, + }; + return ret; +} +uint64_t __attribute__((export_name("TS_LDKChannelSigner_new"))) TS_LDKChannelSigner_new(JSValue o, uint64_t pubkeys) { + LDKChannelSigner *res_ptr = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner"); + *res_ptr = LDKChannelSigner_init(o, pubkeys); + return tag_ptr(res_ptr, true); +} +int8_tArray __attribute__((export_name("TS_ChannelSigner_get_per_commitment_point"))) TS_ChannelSigner_get_per_commitment_point(uint64_t this_arg, int64_t idx) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = init_int8_tArray(33, __LINE__); + memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33); + return ret_arr; +} + +int8_tArray __attribute__((export_name("TS_ChannelSigner_release_commitment_secret"))) TS_ChannelSigner_release_commitment_secret(uint64_t this_arg, int64_t idx) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32); + return ret_arr; +} + +uint64_t __attribute__((export_name("TS_ChannelSigner_validate_holder_commitment"))) TS_ChannelSigner_validate_holder_commitment(uint64_t this_arg, uint64_t holder_tx, ptrArray preimages) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKHolderCommitmentTransaction holder_tx_conv; + holder_tx_conv.inner = untag_ptr(holder_tx); + holder_tx_conv.is_owned = ptr_is_owned(holder_tx); + CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); + holder_tx_conv.is_owned = false; + LDKCVec_PaymentPreimageZ preimages_constr; + preimages_constr.datalen = preimages->arr_len; + if (preimages_constr.datalen > 0) + preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); + else + preimages_constr.data = NULL; + int8_tArray* preimages_vals = (void*) preimages->elems; + for (size_t m = 0; m < preimages_constr.datalen; m++) { + int8_tArray preimages_conv_12 = preimages_vals[m]; + LDKThirtyTwoBytes preimages_conv_12_ref; + CHECK(preimages_conv_12->arr_len == 32); + memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12); + preimages_constr.data[m] = preimages_conv_12_ref; + } + FREE(preimages); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); + *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); + return tag_ptr(ret_conv, true); +} + +int8_tArray __attribute__((export_name("TS_ChannelSigner_channel_keys_id"))) TS_ChannelSigner_channel_keys_id(uint64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32); + return ret_arr; +} + +void __attribute__((export_name("TS_ChannelSigner_provide_channel_parameters"))) TS_ChannelSigner_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); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKChannelTransactionParameters channel_parameters_conv; + channel_parameters_conv.inner = untag_ptr(channel_parameters); + 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->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv); +} + +LDKChannelPublicKeys LDKChannelSigner_set_get_pubkeys(LDKChannelSigner* this_arg) { + if (this_arg->set_pubkeys != NULL) + this_arg->set_pubkeys(this_arg); + return this_arg->pubkeys; +} +uint64_t __attribute__((export_name("TS_ChannelSigner_get_pubkeys"))) TS_ChannelSigner_get_pubkeys(uint64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKChannelSigner* this_arg_conv = (LDKChannelSigner*)this_arg_ptr; + LDKChannelPublicKeys ret_var = LDKChannelSigner_set_get_pubkeys(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; +} + +typedef struct LDKEcdsaChannelSigner_JCalls { + atomic_size_t refcnt; + uint32_t instance_ptr; + LDKChannelSigner_JCalls* ChannelSigner; +} LDKEcdsaChannelSigner_JCalls; +static void LDKEcdsaChannelSigner_JCalls_free(void* this_arg) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + FREE(j_calls); + } +} +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx, LDKCVec_PaymentPreimageZ preimages) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKCommitmentTransaction commitment_tx_var = *commitment_tx; uint64_t commitment_tx_ref = 0; commitment_tx_var = CommitmentTransaction_clone(&commitment_tx_var); @@ -3936,41 +4275,41 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L } FREE(preimages_var.data); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 6, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, commitment_tx_ref, (uint32_t)preimages_arr, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; int64_t idx_conv = idx; int8_tArray secret_arr = init_int8_tArray(32, __LINE__); memcpy(secret_arr->elems, *secret, 32); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 7, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, idx_conv, (uint32_t)secret_arr, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx; uint64_t commitment_tx_ref = 0; commitment_tx_var = HolderCommitmentTransaction_clone(&commitment_tx_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(commitment_tx_var); commitment_tx_ref = tag_ptr(commitment_tx_var.inner, commitment_tx_var.is_owned); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 8, commitment_tx_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 9, commitment_tx_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKTransaction justice_tx_var = justice_tx; int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__); memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen); @@ -3979,15 +4318,15 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo int64_t amount_conv = amount; int8_tArray per_commitment_key_arr = init_int8_tArray(32, __LINE__); memcpy(per_commitment_key_arr->elems, *per_commitment_key, 32); - uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 9, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, 0, 0); + uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKTransaction justice_tx_var = justice_tx; int8_tArray justice_tx_arr = init_int8_tArray(justice_tx_var.datalen, __LINE__); memcpy(justice_tx_arr->elems, justice_tx_var.data, justice_tx_var.datalen); @@ -4001,15 +4340,15 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void htlc_var = HTLCOutputInCommitment_clone(&htlc_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var); htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned); - uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 10, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, htlc_ref, 0); + uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 11, (uint32_t)justice_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_key_arr, htlc_ref, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKTransaction htlc_tx_var = htlc_tx; int8_tArray htlc_tx_arr = init_int8_tArray(htlc_tx_var.datalen, __LINE__); memcpy(htlc_tx_arr->elems, htlc_tx_var.data, htlc_tx_var.datalen); @@ -4023,70 +4362,62 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c htlc_var = HTLCOutputInCommitment_clone(&htlc_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(htlc_var); htlc_ref = tag_ptr(htlc_var.inner, htlc_var.is_owned); - uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 11, (uint32_t)htlc_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_point_arr, htlc_ref, 0); + uint64_t ret = js_invoke_function_uububu(j_calls->instance_ptr, 12, (uint32_t)htlc_tx_arr, input_conv, amount_conv, (uint32_t)per_commitment_point_arr, htlc_ref, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_closing_transaction_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKClosingTransaction closing_tx_var = *closing_tx; uint64_t closing_tx_ref = 0; closing_tx_var = ClosingTransaction_clone(&closing_tx_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(closing_tx_var); closing_tx_ref = tag_ptr(closing_tx_var.inner, closing_tx_var.is_owned); - uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 12, closing_tx_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 13, closing_tx_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKBaseSign_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall(const void* this_arg, LDKTransaction anchor_tx, uintptr_t input) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKTransaction anchor_tx_var = anchor_tx; int8_tArray anchor_tx_arr = init_int8_tArray(anchor_tx_var.datalen, __LINE__); memcpy(anchor_tx_arr->elems, anchor_tx_var.data, anchor_tx_var.datalen); Transaction_free(anchor_tx_var); uint32_t input_conv = input; - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 13, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 14, (uint32_t)anchor_tx_arr, input_conv, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg; +LDKCResult_SignatureNoneZ sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) this_arg; LDKUnsignedChannelAnnouncement msg_var = *msg; uint64_t msg_ref = 0; msg_var = UnsignedChannelAnnouncement_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, 14, msg_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 15, msg_ref, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(ret_ptr); + LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -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; - channel_parameters_var = ChannelTransactionParameters_clone(&channel_parameters_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_parameters_var); - channel_parameters_ref = tag_ptr(channel_parameters_var.inner, channel_parameters_var.is_owned); - js_invoke_function_buuuuu(j_calls->instance_ptr, 15, channel_parameters_ref, 0, 0, 0, 0, 0); -} -static void LDKBaseSign_JCalls_cloned(LDKBaseSign* new_obj) { - LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) new_obj->this_arg; +static void LDKEcdsaChannelSigner_JCalls_cloned(LDKEcdsaChannelSigner* new_obj) { + LDKEcdsaChannelSigner_JCalls *j_calls = (LDKEcdsaChannelSigner_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->ChannelSigner->refcnt, 1, memory_order_release); } -static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) { - LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls"); +static inline LDKEcdsaChannelSigner LDKEcdsaChannelSigner_init (JSValue o, JSValue ChannelSigner, uint64_t pubkeys) { + LDKEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKEcdsaChannelSigner_JCalls), "LDKEcdsaChannelSigner_JCalls"); atomic_init(&calls->refcnt, 1); calls->instance_ptr = o; @@ -4095,93 +4426,32 @@ static inline LDKBaseSign LDKBaseSign_init (JSValue o, uint64_t pubkeys) { pubkeys_conv.is_owned = ptr_is_owned(pubkeys); CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); - LDKBaseSign ret = { + LDKEcdsaChannelSigner ret = { .this_arg = (void*) calls, - .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall, - .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall, - .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall, - .channel_keys_id = channel_keys_id_LDKBaseSign_jcall, - .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall, - .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall, - .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall, - .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall, - .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall, - .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall, - .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, - .provide_channel_parameters = provide_channel_parameters_LDKBaseSign_jcall, - .free = LDKBaseSign_JCalls_free, - .pubkeys = pubkeys_conv, - .set_pubkeys = NULL, + .sign_counterparty_commitment = sign_counterparty_commitment_LDKEcdsaChannelSigner_jcall, + .validate_counterparty_revocation = validate_counterparty_revocation_LDKEcdsaChannelSigner_jcall, + .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKEcdsaChannelSigner_jcall, + .sign_justice_revoked_output = sign_justice_revoked_output_LDKEcdsaChannelSigner_jcall, + .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKEcdsaChannelSigner_jcall, + .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKEcdsaChannelSigner_jcall, + .sign_closing_transaction = sign_closing_transaction_LDKEcdsaChannelSigner_jcall, + .sign_holder_anchor_input = sign_holder_anchor_input_LDKEcdsaChannelSigner_jcall, + .sign_channel_announcement_with_funding_key = sign_channel_announcement_with_funding_key_LDKEcdsaChannelSigner_jcall, + .free = LDKEcdsaChannelSigner_JCalls_free, + .ChannelSigner = LDKChannelSigner_init(ChannelSigner, pubkeys), }; + calls->ChannelSigner = ret.ChannelSigner.this_arg; return ret; } -uint64_t __attribute__((export_name("TS_LDKBaseSign_new"))) TS_LDKBaseSign_new(JSValue o, uint64_t pubkeys) { - LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); - *res_ptr = LDKBaseSign_init(o, pubkeys); +uint64_t __attribute__((export_name("TS_LDKEcdsaChannelSigner_new"))) TS_LDKEcdsaChannelSigner_new(JSValue o, JSValue ChannelSigner, uint64_t pubkeys) { + LDKEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner"); + *res_ptr = LDKEcdsaChannelSigner_init(o, ChannelSigner, pubkeys); return tag_ptr(res_ptr, true); } -int8_tArray __attribute__((export_name("TS_BaseSign_get_per_commitment_point"))) TS_BaseSign_get_per_commitment_point(uint64_t this_arg, int64_t idx) { - 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; - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form, 33); - return ret_arr; -} - -int8_tArray __attribute__((export_name("TS_BaseSign_release_commitment_secret"))) TS_BaseSign_release_commitment_secret(uint64_t this_arg, int64_t idx) { - 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; - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data, 32); - return ret_arr; -} - -uint64_t __attribute__((export_name("TS_BaseSign_validate_holder_commitment"))) TS_BaseSign_validate_holder_commitment(uint64_t this_arg, uint64_t holder_tx, ptrArray preimages) { - 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; - LDKHolderCommitmentTransaction holder_tx_conv; - holder_tx_conv.inner = untag_ptr(holder_tx); - holder_tx_conv.is_owned = ptr_is_owned(holder_tx); - CHECK_INNER_FIELD_ACCESS_OR_NULL(holder_tx_conv); - holder_tx_conv.is_owned = false; - LDKCVec_PaymentPreimageZ preimages_constr; - preimages_constr.datalen = preimages->arr_len; - if (preimages_constr.datalen > 0) - preimages_constr.data = MALLOC(preimages_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_PaymentPreimageZ Elements"); - else - preimages_constr.data = NULL; - int8_tArray* preimages_vals = (void*) preimages->elems; - for (size_t m = 0; m < preimages_constr.datalen; m++) { - int8_tArray preimages_conv_12 = preimages_vals[m]; - LDKThirtyTwoBytes preimages_conv_12_ref; - CHECK(preimages_conv_12->arr_len == 32); - memcpy(preimages_conv_12_ref.data, preimages_conv_12->elems, 32); FREE(preimages_conv_12); - preimages_constr.data[m] = preimages_conv_12_ref; - } - FREE(preimages); - LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv, preimages_constr); - return tag_ptr(ret_conv, true); -} - -int8_tArray __attribute__((export_name("TS_BaseSign_channel_keys_id"))) TS_BaseSign_channel_keys_id(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_counterparty_commitment"))) TS_EcdsaChannelSigner_sign_counterparty_commitment(uint64_t this_arg, uint64_t commitment_tx, ptrArray preimages) { 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; - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data, 32); - return ret_arr; -} - -uint64_t __attribute__((export_name("TS_BaseSign_sign_counterparty_commitment"))) TS_BaseSign_sign_counterparty_commitment(uint64_t this_arg, uint64_t commitment_tx, ptrArray preimages) { - 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = untag_ptr(commitment_tx); commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx); @@ -4207,23 +4477,23 @@ uint64_t __attribute__((export_name("TS_BaseSign_sign_counterparty_commitment") return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_validate_counterparty_revocation"))) TS_BaseSign_validate_counterparty_revocation(uint64_t this_arg, int64_t idx, int8_tArray secret) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_validate_counterparty_revocation"))) TS_EcdsaChannelSigner_validate_counterparty_revocation(uint64_t this_arg, int64_t idx, int8_tArray secret) { 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; - unsigned char secret_arr[32]; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; + uint8_t secret_arr[32]; CHECK(secret->arr_len == 32); memcpy(secret_arr, secret->elems, 32); FREE(secret); - unsigned char (*secret_ref)[32] = &secret_arr; + uint8_t (*secret_ref)[32] = &secret_arr; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_sign_holder_commitment_and_htlcs"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint64_t this_arg, uint64_t commitment_tx) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_commitment_and_htlcs"))) TS_EcdsaChannelSigner_sign_holder_commitment_and_htlcs(uint64_t this_arg, uint64_t commitment_tx) { 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKHolderCommitmentTransaction commitment_tx_conv; commitment_tx_conv.inner = untag_ptr(commitment_tx); commitment_tx_conv.is_owned = ptr_is_owned(commitment_tx); @@ -4234,37 +4504,37 @@ uint64_t __attribute__((export_name("TS_BaseSign_sign_holder_commitment_and_htl return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_output"))) TS_BaseSign_sign_justice_revoked_output(uint64_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_justice_revoked_output"))) TS_EcdsaChannelSigner_sign_justice_revoked_output(uint64_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key) { 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = justice_tx->arr_len; justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx); justice_tx_ref.data_is_owned = true; - unsigned char per_commitment_key_arr[32]; + uint8_t per_commitment_key_arr[32]; CHECK(per_commitment_key->arr_len == 32); memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key); - unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr; + uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr; LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_htlc"))) TS_BaseSign_sign_justice_revoked_htlc(uint64_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key, uint64_t htlc) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_justice_revoked_htlc"))) TS_EcdsaChannelSigner_sign_justice_revoked_htlc(uint64_t this_arg, int8_tArray justice_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_key, uint64_t htlc) { 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction justice_tx_ref; justice_tx_ref.datalen = justice_tx->arr_len; justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes"); memcpy(justice_tx_ref.data, justice_tx->elems, justice_tx_ref.datalen); FREE(justice_tx); justice_tx_ref.data_is_owned = true; - unsigned char per_commitment_key_arr[32]; + uint8_t per_commitment_key_arr[32]; CHECK(per_commitment_key->arr_len == 32); memcpy(per_commitment_key_arr, per_commitment_key->elems, 32); FREE(per_commitment_key); - unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr; + uint8_t (*per_commitment_key_ref)[32] = &per_commitment_key_arr; LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = untag_ptr(htlc); htlc_conv.is_owned = ptr_is_owned(htlc); @@ -4275,10 +4545,10 @@ uint64_t __attribute__((export_name("TS_BaseSign_sign_justice_revoked_htlc"))) return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_sign_counterparty_htlc_transaction"))) TS_BaseSign_sign_counterparty_htlc_transaction(uint64_t this_arg, int8_tArray htlc_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_point, uint64_t htlc) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_counterparty_htlc_transaction"))) TS_EcdsaChannelSigner_sign_counterparty_htlc_transaction(uint64_t this_arg, int8_tArray htlc_tx, uint32_t input, int64_t amount, int8_tArray per_commitment_point, uint64_t htlc) { 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction htlc_tx_ref; htlc_tx_ref.datalen = htlc_tx->arr_len; htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes"); @@ -4297,10 +4567,10 @@ uint64_t __attribute__((export_name("TS_BaseSign_sign_counterparty_htlc_transac return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) TS_BaseSign_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_closing_transaction"))) TS_EcdsaChannelSigner_sign_closing_transaction(uint64_t this_arg, uint64_t closing_tx) { 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKClosingTransaction closing_tx_conv; closing_tx_conv.inner = untag_ptr(closing_tx); closing_tx_conv.is_owned = ptr_is_owned(closing_tx); @@ -4311,10 +4581,10 @@ uint64_t __attribute__((export_name("TS_BaseSign_sign_closing_transaction"))) T return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_sign_holder_anchor_input"))) TS_BaseSign_sign_holder_anchor_input(uint64_t this_arg, int8_tArray anchor_tx, uint32_t input) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_holder_anchor_input"))) TS_EcdsaChannelSigner_sign_holder_anchor_input(uint64_t this_arg, int8_tArray anchor_tx, uint32_t input) { 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKTransaction anchor_tx_ref; anchor_tx_ref.datalen = anchor_tx->arr_len; anchor_tx_ref.data = MALLOC(anchor_tx_ref.datalen, "LDKTransaction Bytes"); @@ -4325,61 +4595,34 @@ uint64_t __attribute__((export_name("TS_BaseSign_sign_holder_anchor_input"))) T return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_BaseSign_sign_channel_announcement"))) TS_BaseSign_sign_channel_announcement(uint64_t this_arg, uint64_t msg) { +uint64_t __attribute__((export_name("TS_EcdsaChannelSigner_sign_channel_announcement_with_funding_key"))) TS_EcdsaChannelSigner_sign_channel_announcement_with_funding_key(uint64_t this_arg, uint64_t msg) { 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; + LDKEcdsaChannelSigner* this_arg_conv = (LDKEcdsaChannelSigner*)this_arg_ptr; LDKUnsignedChannelAnnouncement msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv); + LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_channel_announcement_with_funding_key)(this_arg_conv->this_arg, &msg_conv); return tag_ptr(ret_conv, true); } -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; - LDKChannelTransactionParameters channel_parameters_conv; - channel_parameters_conv.inner = untag_ptr(channel_parameters); - 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->provide_channel_parameters)(this_arg_conv->this_arg, &channel_parameters_conv); -} - -LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) { - if (this_arg->set_pubkeys != NULL) - this_arg->set_pubkeys(this_arg); - return this_arg->pubkeys; -} -uint64_t __attribute__((export_name("TS_BaseSign_get_pubkeys"))) TS_BaseSign_get_pubkeys(uint64_t this_arg) { - 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; - LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(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; -} - -typedef struct LDKSign_JCalls { +typedef struct LDKWriteableEcdsaChannelSigner_JCalls { atomic_size_t refcnt; uint32_t instance_ptr; - LDKBaseSign_JCalls* BaseSign; -} LDKSign_JCalls; -static void LDKSign_JCalls_free(void* this_arg) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; + LDKEcdsaChannelSigner_JCalls* EcdsaChannelSigner; + LDKChannelSigner_JCalls* ChannelSigner; +} LDKWriteableEcdsaChannelSigner_JCalls; +static void LDKWriteableEcdsaChannelSigner_JCalls_free(void* this_arg) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { FREE(j_calls); } } -LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg; +LDKCVec_u8Z write_LDKWriteableEcdsaChannelSigner_jcall(const void* this_arg) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) this_arg; int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 16, 0, 0, 0, 0, 0, 0); LDKCVec_u8Z ret_ref; ret_ref.datalen = ret->arr_len; @@ -4387,13 +4630,14 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret); return ret_ref; } -static void LDKSign_JCalls_cloned(LDKSign* new_obj) { - LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg; +static void LDKWriteableEcdsaChannelSigner_JCalls_cloned(LDKWriteableEcdsaChannelSigner* new_obj) { + LDKWriteableEcdsaChannelSigner_JCalls *j_calls = (LDKWriteableEcdsaChannelSigner_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); - atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->refcnt, 1, memory_order_release); + atomic_fetch_add_explicit(&j_calls->EcdsaChannelSigner->ChannelSigner->refcnt, 1, memory_order_release); } -static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkeys) { - LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls"); +static inline LDKWriteableEcdsaChannelSigner LDKWriteableEcdsaChannelSigner_init (JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) { + LDKWriteableEcdsaChannelSigner_JCalls *calls = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner_JCalls), "LDKWriteableEcdsaChannelSigner_JCalls"); atomic_init(&calls->refcnt, 1); calls->instance_ptr = o; @@ -4402,25 +4646,26 @@ static inline LDKSign LDKSign_init (JSValue o, JSValue BaseSign, uint64_t pubkey pubkeys_conv.is_owned = ptr_is_owned(pubkeys); CHECK_INNER_FIELD_ACCESS_OR_NULL(pubkeys_conv); - LDKSign ret = { + LDKWriteableEcdsaChannelSigner ret = { .this_arg = (void*) calls, - .write = write_LDKSign_jcall, - .cloned = LDKSign_JCalls_cloned, - .free = LDKSign_JCalls_free, - .BaseSign = LDKBaseSign_init(BaseSign, pubkeys), + .write = write_LDKWriteableEcdsaChannelSigner_jcall, + .cloned = LDKWriteableEcdsaChannelSigner_JCalls_cloned, + .free = LDKWriteableEcdsaChannelSigner_JCalls_free, + .EcdsaChannelSigner = LDKEcdsaChannelSigner_init(EcdsaChannelSigner, ChannelSigner, pubkeys), }; - calls->BaseSign = ret.BaseSign.this_arg; + calls->EcdsaChannelSigner = ret.EcdsaChannelSigner.this_arg; + calls->ChannelSigner = ret.EcdsaChannelSigner.ChannelSigner.this_arg; return ret; } -uint64_t __attribute__((export_name("TS_LDKSign_new"))) TS_LDKSign_new(JSValue o, JSValue BaseSign, uint64_t pubkeys) { - LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign"); - *res_ptr = LDKSign_init(o, BaseSign, pubkeys); +uint64_t __attribute__((export_name("TS_LDKWriteableEcdsaChannelSigner_new"))) TS_LDKWriteableEcdsaChannelSigner_new(JSValue o, JSValue EcdsaChannelSigner, JSValue ChannelSigner, uint64_t pubkeys) { + LDKWriteableEcdsaChannelSigner *res_ptr = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *res_ptr = LDKWriteableEcdsaChannelSigner_init(o, EcdsaChannelSigner, ChannelSigner, pubkeys); return tag_ptr(res_ptr, true); } -int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_t this_arg) { +int8_tArray __attribute__((export_name("TS_WriteableEcdsaChannelSigner_write"))) TS_WriteableEcdsaChannelSigner_write(uint64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } - LDKSign* this_arg_conv = (LDKSign*)this_arg_ptr; + LDKWriteableEcdsaChannelSigner* this_arg_conv = (LDKWriteableEcdsaChannelSigner*)this_arg_ptr; LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg); int8_tArray ret_arr = init_int8_tArray(ret_var.datalen, __LINE__); memcpy(ret_arr->elems, ret_var.data, ret_var.datalen); @@ -4428,49 +4673,29 @@ int8_tArray __attribute__((export_name("TS_Sign_write"))) TS_Sign_write(uint64_ return ret_arr; } -static inline struct LDKSign CResult_SignDecodeErrorZ_get_ok(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKWriteableEcdsaChannelSigner CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); - return Sign_clone(&*owner->contents.result); + return WriteableEcdsaChannelSigner_clone(&*owner->contents.result); } -uint64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_ok"))) TS_CResult_SignDecodeErrorZ_get_ok(uint64_t owner) { - LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner); - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = CResult_SignDecodeErrorZ_get_ok(owner_conv); +uint64_t __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_ok(owner_conv); return tag_ptr(ret_ret, true); } -static inline struct LDKDecodeError CResult_SignDecodeErrorZ_get_err(LDKCResult_SignDecodeErrorZ *NONNULL_PTR owner){ +static inline struct LDKDecodeError CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR owner){ CHECK(!owner->result_ok); return DecodeError_clone(&*owner->contents.err); } -uint64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_get_err"))) TS_CResult_SignDecodeErrorZ_get_err(uint64_t owner) { - LDKCResult_SignDecodeErrorZ* owner_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(owner); +uint64_t __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* owner_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(owner); LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); - *ret_copy = CResult_SignDecodeErrorZ_get_err(owner_conv); + *ret_copy = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_get_err(owner_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -static inline struct LDKRecoverableSignature CResult_RecoverableSignatureNoneZ_get_ok(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -int8_tArray __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_ok"))) TS_CResult_RecoverableSignatureNoneZ_get_ok(uint64_t owner) { - LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); - int8_tArray ret_arr = init_int8_tArray(68, __LINE__); - memcpy(ret_arr->elems, CResult_RecoverableSignatureNoneZ_get_ok(owner_conv).serialized_form, 68); - return ret_arr; -} - -static inline void CResult_RecoverableSignatureNoneZ_get_err(LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return *owner->contents.err; -} -void __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_get_err"))) TS_CResult_RecoverableSignatureNoneZ_get_err(uint64_t owner) { - LDKCResult_RecoverableSignatureNoneZ* owner_conv = (LDKCResult_RecoverableSignatureNoneZ*)untag_ptr(owner); - CResult_RecoverableSignatureNoneZ_get_err(owner_conv); -} - static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) { LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -4577,96 +4802,6 @@ int16_t __attribute__((export_name("TS_LDKCOption_u16Z_Some_get_some"))) TS_LDKC int16_t some_conv = obj->some; return some_conv; } -uint32_t __attribute__((export_name("TS_LDKAPIError_ty_from_ptr"))) TS_LDKAPIError_ty_from_ptr(uint64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - switch(obj->tag) { - case LDKAPIError_APIMisuseError: return 0; - case LDKAPIError_FeeRateTooHigh: return 1; - case LDKAPIError_InvalidRoute: return 2; - case LDKAPIError_ChannelUnavailable: return 3; - case LDKAPIError_MonitorUpdateInProgress: return 4; - case LDKAPIError_IncompatibleShutdownScript: return 5; - default: abort(); - } -} -jstring __attribute__((export_name("TS_LDKAPIError_APIMisuseError_get_err"))) TS_LDKAPIError_APIMisuseError_get_err(uint64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - assert(obj->tag == LDKAPIError_APIMisuseError); - LDKStr err_str = obj->api_misuse_error.err; - jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); - return err_conv; -} -jstring __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_err"))) TS_LDKAPIError_FeeRateTooHigh_get_err(uint64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - assert(obj->tag == LDKAPIError_FeeRateTooHigh); - LDKStr err_str = obj->fee_rate_too_high.err; - jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); - return err_conv; -} -int32_t __attribute__((export_name("TS_LDKAPIError_FeeRateTooHigh_get_feerate"))) TS_LDKAPIError_FeeRateTooHigh_get_feerate(uint64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - assert(obj->tag == LDKAPIError_FeeRateTooHigh); - int32_t feerate_conv = obj->fee_rate_too_high.feerate; - return feerate_conv; -} -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_InvalidRoute); - LDKStr err_str = obj->invalid_route.err; - jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); - return err_conv; -} -jstring __attribute__((export_name("TS_LDKAPIError_ChannelUnavailable_get_err"))) TS_LDKAPIError_ChannelUnavailable_get_err(uint64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - assert(obj->tag == LDKAPIError_ChannelUnavailable); - LDKStr err_str = obj->channel_unavailable.err; - jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); - return err_conv; -} -uint64_t __attribute__((export_name("TS_LDKAPIError_IncompatibleShutdownScript_get_script"))) TS_LDKAPIError_IncompatibleShutdownScript_get_script(uint64_t ptr) { - LDKAPIError *obj = (LDKAPIError*)untag_ptr(ptr); - assert(obj->tag == LDKAPIError_IncompatibleShutdownScript); - LDKShutdownScript script_var = obj->incompatible_shutdown_script.script; - uint64_t script_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(script_var); - script_ref = tag_ptr(script_var.inner, false); - return script_ref; -} -static inline void CResult_NoneAPIErrorZ_get_ok(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ -CHECK(owner->result_ok); - return *owner->contents.result; -} -void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_ok"))) TS_CResult_NoneAPIErrorZ_get_ok(uint64_t owner) { - LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); - CResult_NoneAPIErrorZ_get_ok(owner_conv); -} - -static inline struct LDKAPIError CResult_NoneAPIErrorZ_get_err(LDKCResult_NoneAPIErrorZ *NONNULL_PTR owner){ -CHECK(!owner->result_ok); - return APIError_clone(&*owner->contents.err); -} -uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_get_err"))) TS_CResult_NoneAPIErrorZ_get_err(uint64_t owner) { - LDKCResult_NoneAPIErrorZ* owner_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(owner); - LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError"); - *ret_copy = CResult_NoneAPIErrorZ_get_err(owner_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) { - LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]); - } - return ret; -} -static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) { - LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen }; - for (size_t i = 0; i < ret.datalen; i++) { - ret.data[i] = APIError_clone(&orig->data[i]); - } - return ret; -} static inline struct LDKThirtyTwoBytes CResult__u832APIErrorZ_get_ok(LDKCResult__u832APIErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return ThirtyTwoBytes_clone(&*owner->contents.result); @@ -4690,6 +4825,49 @@ uint64_t __attribute__((export_name("TS_CResult__u832APIErrorZ_get_err"))) TS_C return ret_ref; } +uint32_t __attribute__((export_name("TS_LDKRecentPaymentDetails_ty_from_ptr"))) TS_LDKRecentPaymentDetails_ty_from_ptr(uint64_t ptr) { + LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr); + switch(obj->tag) { + case LDKRecentPaymentDetails_Pending: return 0; + case LDKRecentPaymentDetails_Fulfilled: return 1; + case LDKRecentPaymentDetails_Abandoned: return 2; + default: abort(); + } +} +int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_payment_hash"))) TS_LDKRecentPaymentDetails_Pending_get_payment_hash(uint64_t ptr) { + LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr); + assert(obj->tag == LDKRecentPaymentDetails_Pending); + int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_hash_arr->elems, obj->pending.payment_hash.data, 32); + return payment_hash_arr; +} +int64_t __attribute__((export_name("TS_LDKRecentPaymentDetails_Pending_get_total_msat"))) TS_LDKRecentPaymentDetails_Pending_get_total_msat(uint64_t ptr) { + LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr); + assert(obj->tag == LDKRecentPaymentDetails_Pending); + int64_t total_msat_conv = obj->pending.total_msat; + return total_msat_conv; +} +int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash"))) TS_LDKRecentPaymentDetails_Fulfilled_get_payment_hash(uint64_t ptr) { + LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr); + assert(obj->tag == LDKRecentPaymentDetails_Fulfilled); + int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_hash_arr->elems, obj->fulfilled.payment_hash.data, 32); + return payment_hash_arr; +} +int8_tArray __attribute__((export_name("TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash"))) TS_LDKRecentPaymentDetails_Abandoned_get_payment_hash(uint64_t ptr) { + LDKRecentPaymentDetails *obj = (LDKRecentPaymentDetails*)untag_ptr(ptr); + assert(obj->tag == LDKRecentPaymentDetails_Abandoned); + int8_tArray payment_hash_arr = init_int8_tArray(32, __LINE__); + memcpy(payment_hash_arr->elems, obj->abandoned.payment_hash.data, 32); + return payment_hash_arr; +} +static inline LDKCVec_RecentPaymentDetailsZ CVec_RecentPaymentDetailsZ_clone(const LDKCVec_RecentPaymentDetailsZ *orig) { + LDKCVec_RecentPaymentDetailsZ ret = { .data = MALLOC(sizeof(LDKRecentPaymentDetails) * orig->datalen, "LDKCVec_RecentPaymentDetailsZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = RecentPaymentDetails_clone(&orig->data[i]); + } + return ret; +} uint32_t __attribute__((export_name("TS_LDKPaymentSendFailure_ty_from_ptr"))) TS_LDKPaymentSendFailure_ty_from_ptr(uint64_t ptr) { LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)untag_ptr(ptr); switch(obj->tag) { @@ -4790,6 +4968,25 @@ uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_get_err return ret_ref; } +static inline void CResult_NoneRetryableSendFailureZ_get_ok(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return *owner->contents.result; +} +void __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_ok"))) TS_CResult_NoneRetryableSendFailureZ_get_ok(uint64_t owner) { + LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner); + CResult_NoneRetryableSendFailureZ_get_ok(owner_conv); +} + +static inline enum LDKRetryableSendFailure CResult_NoneRetryableSendFailureZ_get_err(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return RetryableSendFailure_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_get_err"))) TS_CResult_NoneRetryableSendFailureZ_get_err(uint64_t owner) { + LDKCResult_NoneRetryableSendFailureZ* owner_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(owner); + uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_NoneRetryableSendFailureZ_get_err(owner_conv)); + return ret_conv; +} + static inline struct LDKThirtyTwoBytes CResult_PaymentHashPaymentSendFailureZ_get_ok(LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return ThirtyTwoBytes_clone(&*owner->contents.result); @@ -4813,6 +5010,27 @@ uint64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ return ret_ref; } +static inline struct LDKThirtyTwoBytes CResult_PaymentHashRetryableSendFailureZ_get_ok(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return ThirtyTwoBytes_clone(&*owner->contents.result); +} +int8_tArray __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_ok(uint64_t owner) { + LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, CResult_PaymentHashRetryableSendFailureZ_get_ok(owner_conv).data, 32); + return ret_arr; +} + +static inline enum LDKRetryableSendFailure CResult_PaymentHashRetryableSendFailureZ_get_err(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return RetryableSendFailure_clone(&*owner->contents.err); +} +uint32_t __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_get_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_get_err(uint64_t owner) { + LDKCResult_PaymentHashRetryableSendFailureZ* owner_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(owner); + uint32_t ret_conv = LDKRetryableSendFailure_to_js(CResult_PaymentHashRetryableSendFailureZ_get_err(owner_conv)); + return ret_conv; +} + static inline struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentIdZ_get_a(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR owner){ return ThirtyTwoBytes_clone(&owner->a); } @@ -5127,14 +5345,15 @@ LDKChannelMonitorUpdateStatus watch_channel_LDKWatch_jcall(const void* this_arg, LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret); return ret_conv; } -LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) { +LDKChannelMonitorUpdateStatus update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate * update) { LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg; LDKOutPoint funding_txo_var = funding_txo; uint64_t funding_txo_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_txo_var); funding_txo_ref = tag_ptr(funding_txo_var.inner, funding_txo_var.is_owned); - LDKChannelMonitorUpdate update_var = update; + LDKChannelMonitorUpdate update_var = *update; uint64_t update_ref = 0; + update_var = ChannelMonitorUpdate_clone(&update_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); update_ref = tag_ptr(update_var.inner, update_var.is_owned); uint64_t ret = js_invoke_function_bbuuuu(j_calls->instance_ptr, 18, funding_txo_ref, update_ref, 0, 0, 0, 0); @@ -5216,8 +5435,8 @@ uint32_t __attribute__((export_name("TS_Watch_update_channel"))) TS_Watch_updat update_conv.inner = untag_ptr(update); update_conv.is_owned = ptr_is_owned(update); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv); - update_conv = ChannelMonitorUpdate_clone(&update_conv); - uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv)); + update_conv.is_owned = false; + uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, &update_conv)); return ret_conv; } @@ -5290,115 +5509,135 @@ void __attribute__((export_name("TS_BroadcasterInterface_broadcast_transaction" (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref); } -typedef struct LDKKeysInterface_JCalls { +typedef struct LDKEntropySource_JCalls { atomic_size_t refcnt; uint32_t instance_ptr; -} LDKKeysInterface_JCalls; -static void LDKKeysInterface_JCalls_free(void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +} LDKEntropySource_JCalls; +static void LDKEntropySource_JCalls_free(void* this_arg) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg; if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { FREE(j_calls); } } -LDKCResult_SecretKeyNoneZ get_node_secret_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - uint32_t recipient_conv = LDKRecipient_to_js(recipient); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, recipient_conv, 0, 0, 0, 0, 0); - void* ret_ptr = untag_ptr(ret); - CHECK_ACCESS(ret_ptr); - LDKCResult_SecretKeyNoneZ ret_conv = *(LDKCResult_SecretKeyNoneZ*)(ret_ptr); - FREE(untag_ptr(ret)); - return ret_conv; +LDKThirtyTwoBytes get_secure_random_bytes_LDKEntropySource_jcall(const void* this_arg) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) this_arg; + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 21, 0, 0, 0, 0, 0, 0); + LDKThirtyTwoBytes ret_ref; + CHECK(ret->arr_len == 32); + memcpy(ret_ref.data, ret->elems, 32); FREE(ret); + return ret_ref; +} +static void LDKEntropySource_JCalls_cloned(LDKEntropySource* new_obj) { + LDKEntropySource_JCalls *j_calls = (LDKEntropySource_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKEntropySource LDKEntropySource_init (JSValue o) { + LDKEntropySource_JCalls *calls = MALLOC(sizeof(LDKEntropySource_JCalls), "LDKEntropySource_JCalls"); + atomic_init(&calls->refcnt, 1); + calls->instance_ptr = o; + + LDKEntropySource ret = { + .this_arg = (void*) calls, + .get_secure_random_bytes = get_secure_random_bytes_LDKEntropySource_jcall, + .free = LDKEntropySource_JCalls_free, + }; + return ret; +} +uint64_t __attribute__((export_name("TS_LDKEntropySource_new"))) TS_LDKEntropySource_new(JSValue o) { + LDKEntropySource *res_ptr = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *res_ptr = LDKEntropySource_init(o); + return tag_ptr(res_ptr, true); +} +int8_tArray __attribute__((export_name("TS_EntropySource_get_secure_random_bytes"))) TS_EntropySource_get_secure_random_bytes(uint64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKEntropySource* this_arg_conv = (LDKEntropySource*)this_arg_ptr; + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32); + return ret_arr; +} + +uint32_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ty_from_ptr"))) TS_LDKUnsignedGossipMessage_ty_from_ptr(uint64_t ptr) { + LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr); + switch(obj->tag) { + case LDKUnsignedGossipMessage_ChannelAnnouncement: return 0; + case LDKUnsignedGossipMessage_ChannelUpdate: return 1; + case LDKUnsignedGossipMessage_NodeAnnouncement: return 2; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement"))) TS_LDKUnsignedGossipMessage_ChannelAnnouncement_get_channel_announcement(uint64_t ptr) { + LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr); + assert(obj->tag == LDKUnsignedGossipMessage_ChannelAnnouncement); + LDKUnsignedChannelAnnouncement channel_announcement_var = obj->channel_announcement; + uint64_t channel_announcement_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_announcement_var); + channel_announcement_ref = tag_ptr(channel_announcement_var.inner, false); + return channel_announcement_ref; +} +uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update"))) TS_LDKUnsignedGossipMessage_ChannelUpdate_get_channel_update(uint64_t ptr) { + LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr); + assert(obj->tag == LDKUnsignedGossipMessage_ChannelUpdate); + LDKUnsignedChannelUpdate channel_update_var = obj->channel_update; + uint64_t channel_update_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_update_var); + channel_update_ref = tag_ptr(channel_update_var.inner, false); + return channel_update_ref; +} +uint64_t __attribute__((export_name("TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement"))) TS_LDKUnsignedGossipMessage_NodeAnnouncement_get_node_announcement(uint64_t ptr) { + LDKUnsignedGossipMessage *obj = (LDKUnsignedGossipMessage*)untag_ptr(ptr); + assert(obj->tag == LDKUnsignedGossipMessage_NodeAnnouncement); + LDKUnsignedNodeAnnouncement node_announcement_var = obj->node_announcement; + uint64_t node_announcement_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(node_announcement_var); + node_announcement_ref = tag_ptr(node_announcement_var.inner, false); + return node_announcement_ref; +} +typedef struct LDKNodeSigner_JCalls { + atomic_size_t refcnt; + uint32_t instance_ptr; +} LDKNodeSigner_JCalls; +static void LDKNodeSigner_JCalls_free(void* this_arg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + FREE(j_calls); + } +} +LDKThirtyTwoBytes get_inbound_payment_key_material_LDKNodeSigner_jcall(const void* this_arg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg; + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, 0, 0, 0, 0, 0, 0); + LDKThirtyTwoBytes ret_ref; + CHECK(ret->arr_len == 32); + memcpy(ret_ref.data, ret->elems, 32); FREE(ret); + return ret_ref; } -LDKCResult_PublicKeyNoneZ get_node_id_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_PublicKeyNoneZ get_node_id_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg; uint32_t recipient_conv = LDKRecipient_to_js(recipient); - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 22, recipient_conv, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 23, recipient_conv, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_PublicKeyNoneZ ret_conv = *(LDKCResult_PublicKeyNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCResult_SharedSecretNoneZ ecdh_LDKKeysInterface_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_SharedSecretNoneZ ecdh_LDKNodeSigner_jcall(const void* this_arg, LDKRecipient recipient, LDKPublicKey other_key, LDKCOption_ScalarZ tweak) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg; uint32_t recipient_conv = LDKRecipient_to_js(recipient); int8_tArray other_key_arr = init_int8_tArray(33, __LINE__); memcpy(other_key_arr->elems, other_key.compressed_form, 33); LDKCOption_ScalarZ *tweak_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); *tweak_copy = tweak; uint64_t tweak_ref = tag_ptr(tweak_copy, true); - uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 23, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0); + uint64_t ret = js_invoke_function_uubuuu(j_calls->instance_ptr, 24, recipient_conv, (uint32_t)other_key_arr, tweak_ref, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_SharedSecretNoneZ ret_conv = *(LDKCResult_SharedSecretNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -LDKCVec_u8Z get_destination_script_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, 24, 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"); - memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret); - return ret_ref; -} -LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* this_arg) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, 0, 0, 0, 0, 0, 0); - LDKShutdownScript 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; -} -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; - 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); - FREE(untag_ptr(ret)); - return ret_conv; -} -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, 28, 0, 0, 0, 0, 0, 0); - LDKThirtyTwoBytes ret_ref; - CHECK(ret->arr_len == 32); - memcpy(ret_ref.data, ret->elems, 32); FREE(ret); - return ret_ref; -} -LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; - 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, 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) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; +LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKNodeSigner_jcall(const void* this_arg, LDKu8slice hrp_bytes, LDKCVec_U5Z invoice_data, LDKRecipient recipient) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_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); @@ -5412,77 +5651,74 @@ 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, 30, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, receipient_conv, 0, 0, 0); + uint32_t recipient_conv = LDKRecipient_to_js(recipient); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 25, (uint32_t)hrp_bytes_arr, (uint32_t)invoice_data_arr, recipient_conv, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -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, 31, 0, 0, 0, 0, 0, 0); - LDKThirtyTwoBytes ret_ref; - CHECK(ret->arr_len == 32); - memcpy(ret_ref.data, ret->elems, 32); FREE(ret); - return ret_ref; +LDKCResult_SignatureNoneZ sign_gossip_message_LDKNodeSigner_jcall(const void* this_arg, LDKUnsignedGossipMessage msg) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) this_arg; + LDKUnsignedGossipMessage *msg_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *msg_copy = msg; + uint64_t msg_ref = tag_ptr(msg_copy, true); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 26, msg_ref, 0, 0, 0, 0, 0); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(ret_ptr); + FREE(untag_ptr(ret)); + return ret_conv; } -static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) { - LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg; +static void LDKNodeSigner_JCalls_cloned(LDKNodeSigner* new_obj) { + LDKNodeSigner_JCalls *j_calls = (LDKNodeSigner_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); } -static inline LDKKeysInterface LDKKeysInterface_init (JSValue o) { - LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls"); +static inline LDKNodeSigner LDKNodeSigner_init (JSValue o) { + LDKNodeSigner_JCalls *calls = MALLOC(sizeof(LDKNodeSigner_JCalls), "LDKNodeSigner_JCalls"); atomic_init(&calls->refcnt, 1); calls->instance_ptr = o; - LDKKeysInterface ret = { + LDKNodeSigner ret = { .this_arg = (void*) calls, - .get_node_secret = get_node_secret_LDKKeysInterface_jcall, - .get_node_id = get_node_id_LDKKeysInterface_jcall, - .ecdh = ecdh_LDKKeysInterface_jcall, - .get_destination_script = get_destination_script_LDKKeysInterface_jcall, - .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_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, - .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall, - .free = LDKKeysInterface_JCalls_free, + .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKNodeSigner_jcall, + .get_node_id = get_node_id_LDKNodeSigner_jcall, + .ecdh = ecdh_LDKNodeSigner_jcall, + .sign_invoice = sign_invoice_LDKNodeSigner_jcall, + .sign_gossip_message = sign_gossip_message_LDKNodeSigner_jcall, + .free = LDKNodeSigner_JCalls_free, }; return ret; } -uint64_t __attribute__((export_name("TS_LDKKeysInterface_new"))) TS_LDKKeysInterface_new(JSValue o) { - LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *res_ptr = LDKKeysInterface_init(o); +uint64_t __attribute__((export_name("TS_LDKNodeSigner_new"))) TS_LDKNodeSigner_new(JSValue o) { + LDKNodeSigner *res_ptr = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *res_ptr = LDKNodeSigner_init(o); return tag_ptr(res_ptr, true); } -uint64_t __attribute__((export_name("TS_KeysInterface_get_node_secret"))) TS_KeysInterface_get_node_secret(uint64_t this_arg, uint32_t recipient) { +int8_tArray __attribute__((export_name("TS_NodeSigner_get_inbound_payment_key_material"))) TS_NodeSigner_get_inbound_payment_key_material(uint64_t this_arg) { 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; - LDKRecipient recipient_conv = LDKRecipient_from_js(recipient); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = (this_arg_conv->get_node_secret)(this_arg_conv->this_arg, recipient_conv); - return tag_ptr(ret_conv, true); + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32); + return ret_arr; } -uint64_t __attribute__((export_name("TS_KeysInterface_get_node_id"))) TS_KeysInterface_get_node_id(uint64_t this_arg, uint32_t recipient) { +uint64_t __attribute__((export_name("TS_NodeSigner_get_node_id"))) TS_NodeSigner_get_node_id(uint64_t this_arg, uint32_t recipient) { 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; + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; LDKRecipient recipient_conv = LDKRecipient_from_js(recipient); LDKCResult_PublicKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyNoneZ), "LDKCResult_PublicKeyNoneZ"); *ret_conv = (this_arg_conv->get_node_id)(this_arg_conv->this_arg, recipient_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_KeysInterface_ecdh"))) TS_KeysInterface_ecdh(uint64_t this_arg, uint32_t recipient, int8_tArray other_key, uint64_t tweak) { +uint64_t __attribute__((export_name("TS_NodeSigner_ecdh"))) TS_NodeSigner_ecdh(uint64_t this_arg, uint32_t recipient, int8_tArray other_key, uint64_t tweak) { 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; + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; LDKRecipient recipient_conv = LDKRecipient_from_js(recipient); LDKPublicKey other_key_ref; CHECK(other_key->arr_len == 33); @@ -5496,32 +5732,139 @@ uint64_t __attribute__((export_name("TS_KeysInterface_ecdh"))) TS_KeysInterface return tag_ptr(ret_conv, true); } -int8_tArray __attribute__((export_name("TS_KeysInterface_get_destination_script"))) TS_KeysInterface_get_destination_script(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_NodeSigner_sign_invoice"))) TS_NodeSigner_sign_invoice(uint64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, uint32_t recipient) { 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; - LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); - 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; + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + LDKu8slice hrp_bytes_ref; + hrp_bytes_ref.datalen = hrp_bytes->arr_len; + hrp_bytes_ref.data = hrp_bytes->elems; + 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"); + 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 }; + } + FREE(invoice_data); + LDKRecipient recipient_conv = LDKRecipient_from_js(recipient); + LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, recipient_conv); + FREE(hrp_bytes); + return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_KeysInterface_get_shutdown_scriptpubkey"))) TS_KeysInterface_get_shutdown_scriptpubkey(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_NodeSigner_sign_gossip_message"))) TS_NodeSigner_sign_gossip_message(uint64_t this_arg, uint64_t msg) { 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; - LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(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); + LDKNodeSigner* this_arg_conv = (LDKNodeSigner*)this_arg_ptr; + void* msg_ptr = untag_ptr(msg); + CHECK_ACCESS(msg_ptr); + LDKUnsignedGossipMessage msg_conv = *(LDKUnsignedGossipMessage*)(msg_ptr); + msg_conv = UnsignedGossipMessage_clone((LDKUnsignedGossipMessage*)untag_ptr(msg)); + LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ"); + *ret_conv = (this_arg_conv->sign_gossip_message)(this_arg_conv->this_arg, msg_conv); + return tag_ptr(ret_conv, true); +} + +typedef struct LDKSignerProvider_JCalls { + atomic_size_t refcnt; + uint32_t instance_ptr; +} LDKSignerProvider_JCalls; +static void LDKSignerProvider_JCalls_free(void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + FREE(j_calls); + } +} +LDKThirtyTwoBytes generate_channel_keys_id_LDKSignerProvider_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis, LDKU128 user_channel_id) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg; + jboolean inbound_conv = inbound; + int64_t channel_value_satoshis_conv = channel_value_satoshis; + 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, 27, 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; +} +LDKWriteableEcdsaChannelSigner derive_channel_signer_LDKSignerProvider_jcall(const void* this_arg, uint64_t channel_value_satoshis, LDKThirtyTwoBytes channel_keys_id) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_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, 28, channel_value_satoshis_conv, (uint32_t)channel_keys_id_arr, 0, 0, 0, 0); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKWriteableEcdsaChannelSigner ret_conv = *(LDKWriteableEcdsaChannelSigner*)(ret_ptr); + FREE(untag_ptr(ret)); + return ret_conv; +} +LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ read_chan_signer_LDKSignerProvider_jcall(const void* this_arg, LDKu8slice reader) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg; + 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, 29, (uint32_t)reader_arr, 0, 0, 0, 0, 0); + void* ret_ptr = untag_ptr(ret); + CHECK_ACCESS(ret_ptr); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ ret_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(ret_ptr); + FREE(untag_ptr(ret)); + return ret_conv; +} +LDKCVec_u8Z get_destination_script_LDKSignerProvider_jcall(const void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg; + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 30, 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"); + memcpy(ret_ref.data, ret->elems, ret_ref.datalen); FREE(ret); return ret_ref; } +LDKShutdownScript get_shutdown_scriptpubkey_LDKSignerProvider_jcall(const void* this_arg) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) this_arg; + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 31, 0, 0, 0, 0, 0, 0); + LDKShutdownScript 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 LDKSignerProvider_JCalls_cloned(LDKSignerProvider* new_obj) { + LDKSignerProvider_JCalls *j_calls = (LDKSignerProvider_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKSignerProvider LDKSignerProvider_init (JSValue o) { + LDKSignerProvider_JCalls *calls = MALLOC(sizeof(LDKSignerProvider_JCalls), "LDKSignerProvider_JCalls"); + atomic_init(&calls->refcnt, 1); + calls->instance_ptr = o; -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) { + LDKSignerProvider ret = { + .this_arg = (void*) calls, + .generate_channel_keys_id = generate_channel_keys_id_LDKSignerProvider_jcall, + .derive_channel_signer = derive_channel_signer_LDKSignerProvider_jcall, + .read_chan_signer = read_chan_signer_LDKSignerProvider_jcall, + .get_destination_script = get_destination_script_LDKSignerProvider_jcall, + .get_shutdown_scriptpubkey = get_shutdown_scriptpubkey_LDKSignerProvider_jcall, + .free = LDKSignerProvider_JCalls_free, + }; + return ret; +} +uint64_t __attribute__((export_name("TS_LDKSignerProvider_new"))) TS_LDKSignerProvider_new(JSValue o) { + LDKSignerProvider *res_ptr = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *res_ptr = LDKSignerProvider_init(o); + return tag_ptr(res_ptr, true); +} +int8_tArray __attribute__((export_name("TS_SignerProvider_generate_channel_keys_id"))) TS_SignerProvider_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; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)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); @@ -5530,74 +5873,51 @@ int8_tArray __attribute__((export_name("TS_KeysInterface_generate_channel_keys_ 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) { +uint64_t __attribute__((export_name("TS_SignerProvider_derive_channel_signer"))) TS_SignerProvider_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; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)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"); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); *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); } -int8_tArray __attribute__((export_name("TS_KeysInterface_get_secure_random_bytes"))) TS_KeysInterface_get_secure_random_bytes(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_SignerProvider_read_chan_signer"))) TS_SignerProvider_read_chan_signer(uint64_t this_arg, int8_tArray reader) { 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; - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data, 32); - return ret_arr; -} - -uint64_t __attribute__((export_name("TS_KeysInterface_read_chan_signer"))) TS_KeysInterface_read_chan_signer(uint64_t this_arg, int8_tArray reader) { - 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; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; LDKu8slice reader_ref; reader_ref.datalen = reader->arr_len; reader_ref.data = reader->elems; - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref); FREE(reader); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_KeysInterface_sign_invoice"))) TS_KeysInterface_sign_invoice(uint64_t this_arg, int8_tArray hrp_bytes, ptrArray invoice_data, uint32_t receipient) { +int8_tArray __attribute__((export_name("TS_SignerProvider_get_destination_script"))) TS_SignerProvider_get_destination_script(uint64_t this_arg) { 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; - LDKu8slice hrp_bytes_ref; - hrp_bytes_ref.datalen = hrp_bytes->arr_len; - hrp_bytes_ref.data = hrp_bytes->elems; - 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"); - 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 }; - } - FREE(invoice_data); - LDKRecipient receipient_conv = LDKRecipient_from_js(receipient); - LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ"); - *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, hrp_bytes_ref, invoice_data_constr, receipient_conv); - FREE(hrp_bytes); - return tag_ptr(ret_conv, true); + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; + LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg); + 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_KeysInterface_get_inbound_payment_key_material"))) TS_KeysInterface_get_inbound_payment_key_material(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_SignerProvider_get_shutdown_scriptpubkey"))) TS_SignerProvider_get_shutdown_scriptpubkey(uint64_t this_arg) { 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; - int8_tArray ret_arr = init_int8_tArray(32, __LINE__); - memcpy(ret_arr->elems, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32); - return ret_arr; + LDKSignerProvider* this_arg_conv = (LDKSignerProvider*)this_arg_ptr; + LDKShutdownScript ret_var = (this_arg_conv->get_shutdown_scriptpubkey)(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; } typedef struct LDKFeeEstimator_JCalls { @@ -5645,6 +5965,208 @@ int32_t __attribute__((export_name("TS_FeeEstimator_get_est_sat_per_1000_weight return ret_conv; } +typedef struct LDKRouter_JCalls { + atomic_size_t refcnt; + uint32_t instance_ptr; +} LDKRouter_JCalls; +static void LDKRouter_JCalls_free(void* this_arg) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + FREE(j_calls); + } +} +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * route_params, LDKCVec_ChannelDetailsZ * first_hops, const 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); + 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; + inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var); + 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_ububuu(j_calls->instance_ptr, 33, (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, const 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; + inflight_htlcs_var = InFlightHtlcs_clone(&inflight_htlcs_var); + 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, 34, (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); + FREE(untag_ptr(ret)); + return ret_conv; +} +static void LDKRouter_JCalls_cloned(LDKRouter* new_obj) { + LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKRouter LDKRouter_init (JSValue o) { + LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls"); + atomic_init(&calls->refcnt, 1); + calls->instance_ptr = o; + + LDKRouter ret = { + .this_arg = (void*) calls, + .find_route = find_route_LDKRouter_jcall, + .find_route_with_id = find_route_with_id_LDKRouter_jcall, + .free = LDKRouter_JCalls_free, + }; + return ret; +} +uint64_t __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) { + LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter"); + *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, 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; + 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.is_owned = false; + 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.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_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_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); +} + static inline struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner){ return ThirtyTwoBytes_clone(&owner->a); } @@ -5717,6 +6239,44 @@ uint64_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_get_e return ret_ref; } +uint32_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_ty_from_ptr"))) TS_LDKCOption_APIErrorZ_ty_from_ptr(uint64_t ptr) { + LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr); + switch(obj->tag) { + case LDKCOption_APIErrorZ_Some: return 0; + case LDKCOption_APIErrorZ_None: return 1; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKCOption_APIErrorZ_Some_get_some"))) TS_LDKCOption_APIErrorZ_Some_get_some(uint64_t ptr) { + LDKCOption_APIErrorZ *obj = (LDKCOption_APIErrorZ*)untag_ptr(ptr); + assert(obj->tag == LDKCOption_APIErrorZ_Some); + uint64_t some_ref = tag_ptr(&obj->some, false); + return some_ref; +} +static inline struct LDKCOption_APIErrorZ CResult_COption_APIErrorZDecodeErrorZ_get_ok(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(owner->result_ok); + return COption_APIErrorZ_clone(&*owner->contents.result); +} +uint64_t __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_ok(uint64_t owner) { + LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_ok(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline struct LDKDecodeError CResult_COption_APIErrorZDecodeErrorZ_get_err(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR owner){ +CHECK(!owner->result_ok); + return DecodeError_clone(&*owner->contents.err); +} +uint64_t __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_get_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_get_err(uint64_t owner) { + LDKCResult_COption_APIErrorZDecodeErrorZ* owner_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(owner); + LDKDecodeError *ret_copy = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError"); + *ret_copy = CResult_COption_APIErrorZDecodeErrorZ_get_err(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + static inline struct LDKOutPoint CResult_OutPointDecodeErrorZ_get_ok(LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR owner){ LDKOutPoint ret = *owner->contents.result; ret.is_owned = false; @@ -5755,17 +6315,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, 33, 0, 0, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 35, 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, 34, 0, 0, 0, 0, 0, 0); + jstring ret = (jstring)js_invoke_function_uuuuuu(j_calls->instance_ptr, 36, 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, 35, 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"); @@ -5868,8 +6428,7 @@ uint32_t __attribute__((export_name("TS_LDKPaymentError_ty_from_ptr"))) TS_LDKPa LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr); switch(obj->tag) { case LDKPaymentError_Invoice: return 0; - case LDKPaymentError_Routing: return 1; - case LDKPaymentError_Sending: return 2; + case LDKPaymentError_Sending: return 1; default: abort(); } } @@ -5880,20 +6439,11 @@ jstring __attribute__((export_name("TS_LDKPaymentError_Invoice_get_invoice"))) T jstring invoice_conv = str_ref_to_ts(invoice_str.chars, invoice_str.len); return invoice_conv; } -uint64_t __attribute__((export_name("TS_LDKPaymentError_Routing_get_routing"))) TS_LDKPaymentError_Routing_get_routing(uint64_t ptr) { - LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr); - assert(obj->tag == LDKPaymentError_Routing); - LDKLightningError routing_var = obj->routing; - uint64_t routing_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(routing_var); - routing_ref = tag_ptr(routing_var.inner, false); - return routing_ref; -} -uint64_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) { +uint32_t __attribute__((export_name("TS_LDKPaymentError_Sending_get_sending"))) TS_LDKPaymentError_Sending_get_sending(uint64_t ptr) { LDKPaymentError *obj = (LDKPaymentError*)untag_ptr(ptr); assert(obj->tag == LDKPaymentError_Sending); - uint64_t sending_ref = tag_ptr(&obj->sending, false); - return sending_ref; + uint32_t sending_conv = LDKRetryableSendFailure_to_js(obj->sending); + return sending_conv; } static inline struct LDKThirtyTwoBytes CResult_PaymentIdPaymentErrorZ_get_ok(LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); @@ -6395,11 +6945,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, 36, 0, 0, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 38, 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, 37, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 39, 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"); @@ -6501,6 +7051,34 @@ uint64_t __attribute__((export_name("TS_LDKCOption_NetAddressZ_Some_get_some"))) uint64_t some_ref = tag_ptr(&obj->some, false); return some_ref; } +static inline struct LDKPublicKey C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){ + return owner->a; +} +int8_tArray __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(uint64_t owner) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner); + int8_tArray ret_arr = init_int8_tArray(33, __LINE__); + memcpy(ret_arr->elems, C2Tuple_PublicKeyCOption_NetAddressZZ_get_a(owner_conv).compressed_form, 33); + return ret_arr; +} + +static inline struct LDKCOption_NetAddressZ C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR owner){ + return COption_NetAddressZ_clone(&owner->b); +} +uint64_t __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(uint64_t owner) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* owner_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(owner); + LDKCOption_NetAddressZ *ret_copy = MALLOC(sizeof(LDKCOption_NetAddressZ), "LDKCOption_NetAddressZ"); + *ret_copy = C2Tuple_PublicKeyCOption_NetAddressZZ_get_b(owner_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +static inline LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_clone(const LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ *orig) { + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(&orig->data[i]); + } + return ret; +} static inline struct LDKCVec_u8Z CResult_CVec_u8ZPeerHandleErrorZ_get_ok(LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR owner){ CHECK(owner->result_ok); return CVec_u8Z_clone(&*owner->contents.result); @@ -7949,6 +8527,13 @@ uint64_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErro return ret_ref; } +static inline LDKCVec_PhantomRouteHintsZ CVec_PhantomRouteHintsZ_clone(const LDKCVec_PhantomRouteHintsZ *orig) { + LDKCVec_PhantomRouteHintsZ ret = { .data = MALLOC(sizeof(LDKPhantomRouteHints) * orig->datalen, "LDKCVec_PhantomRouteHintsZ clone bytes"), .datalen = orig->datalen }; + for (size_t i = 0; i < ret.datalen; i++) { + ret.data[i] = PhantomRouteHints_clone(&orig->data[i]); + } + return ret; +} uint32_t __attribute__((export_name("TS_LDKSignOrCreationError_ty_from_ptr"))) TS_LDKSignOrCreationError_ty_from_ptr(uint64_t ptr) { LDKSignOrCreationError *obj = (LDKSignOrCreationError*)untag_ptr(ptr); switch(obj->tag) { @@ -8006,7 +8591,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, 38, (uint32_t)txid_arr, (uint32_t)script_pubkey_arr, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 40, (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; @@ -8014,7 +8599,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, 39, output_ref, 0, 0, 0, 0, 0); + js_invoke_function_buuuuu(j_calls->instance_ptr, 41, 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; @@ -8042,10 +8627,10 @@ void __attribute__((export_name("TS_Filter_register_tx"))) TS_Filter_register_t void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKFilter* this_arg_conv = (LDKFilter*)this_arg_ptr; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK(txid->arr_len == 32); memcpy(txid_arr, txid->elems, 32); FREE(txid); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; LDKu8slice script_pubkey_ref; script_pubkey_ref.datalen = script_pubkey->arr_len; script_pubkey_ref.data = script_pubkey->elems; @@ -8176,7 +8761,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, 40, 0, 0, 0, 0, 0, 0); + uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 42, 0, 0, 0, 0, 0, 0); LDKCVec_MessageSendEventZ ret_constr; ret_constr.datalen = ret->arr_len; if (ret_constr.datalen > 0) @@ -8249,7 +8834,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, 41, (uint32_t)peer_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 43, (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); @@ -8306,7 +8891,7 @@ void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) { 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); + js_invoke_function_buuuuu(j_calls->instance_ptr, 44, 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; @@ -8354,7 +8939,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, 43, tag_ptr(handler_ret, true), 0, 0, 0, 0, 0); + js_invoke_function_buuuuu(j_calls->instance_ptr, 45, 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; @@ -8418,7 +9003,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, 44, short_channel_id_conv, source_ref, target_ref, usage_ref, 0, 0); + return js_invoke_function_bbbbuu(j_calls->instance_ptr, 46, 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; @@ -8436,7 +9021,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, 45, (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 payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -8453,7 +9038,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, 46, (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); } void probe_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -8471,7 +9056,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, 47, (uint32_t)path_arr, short_channel_id_conv, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 49, (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; @@ -8488,11 +9073,11 @@ void probe_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { } FREE(path_var.data); - js_invoke_function_uuuuuu(j_calls->instance_ptr, 48, (uint32_t)path_arr, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 50, (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, 49, 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"); @@ -8667,7 +9252,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, 50, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 52, 0, 0, 0, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKScore ret_conv = *(LDKScore*)(ret_ptr); @@ -8721,7 +9306,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, 51, 0, 0, 0, 0, 0, 0); + int8_tArray ret = (int8_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 53, 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"); @@ -8780,7 +9365,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, 52, channel_manager_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 54, 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); @@ -8794,7 +9379,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, 53, network_graph_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 55, 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); @@ -8805,7 +9390,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, 54, ret_scorer, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 56, 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); @@ -8887,7 +9472,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, 55, 0, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 57, 0, 0, 0, 0, 0, 0); } static void LDKFutureCallback_JCalls_cloned(LDKFutureCallback* new_obj) { LDKFutureCallback_JCalls *j_calls = (LDKFutureCallback_JCalls*) new_obj->this_arg; @@ -8943,7 +9528,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, 56, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 58, (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; @@ -8951,14 +9536,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, 57, (uint32_t)block_arr, height_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 59, (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, 58, (uint32_t)header_arr, height_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 60, (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; @@ -8987,10 +9572,10 @@ void __attribute__((export_name("TS_Listen_filtered_block_connected"))) TS_List void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = txdata->arr_len; if (txdata_constr.datalen > 0) @@ -9025,10 +9610,10 @@ void __attribute__((export_name("TS_Listen_block_disconnected"))) TS_Listen_blo void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKListen* this_arg_conv = (LDKListen*)this_arg_ptr; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height); } @@ -9058,24 +9643,24 @@ 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, 59, (uint32_t)header_arr, (uint32_t)txdata_arr, height_conv, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 61, (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, 60, (uint32_t)txid_arr, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, (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, 61, (uint32_t)header_arr, height_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 63, (uint32_t)header_arr, height_conv, 0, 0, 0, 0); } LDKCVec_C2Tuple_TxidBlockHashZZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) { LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg; - uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 62, 0, 0, 0, 0, 0, 0); + uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 64, 0, 0, 0, 0, 0, 0); LDKCVec_C2Tuple_TxidBlockHashZZ ret_constr; ret_constr.datalen = ret->arr_len; if (ret_constr.datalen > 0) @@ -9122,10 +9707,10 @@ void __attribute__((export_name("TS_Confirm_transactions_confirmed"))) TS_Confi 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; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = txdata->arr_len; if (txdata_constr.datalen > 0) @@ -9149,10 +9734,10 @@ void __attribute__((export_name("TS_Confirm_transaction_unconfirmed"))) TS_Conf 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; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK(txid->arr_len == 32); memcpy(txid_arr, txid->elems, 32); FREE(txid); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref); } @@ -9160,10 +9745,10 @@ void __attribute__((export_name("TS_Confirm_best_block_updated"))) TS_Confirm_b 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; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height); } @@ -9210,19 +9795,18 @@ 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, 63, channel_id_ref, data_ref, update_id_ref, 0, 0, 0); + uint64_t ret = js_invoke_function_bbbuuu(j_calls->instance_ptr, 65, channel_id_ref, data_ref, update_id_ref, 0, 0, 0); LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret); return ret_conv; } -LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { +LDKChannelMonitorUpdateStatus update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint channel_id, LDKChannelMonitorUpdate update, const LDKChannelMonitor * data, LDKMonitorUpdateId update_id) { LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg; LDKOutPoint channel_id_var = channel_id; uint64_t channel_id_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_id_var); channel_id_ref = tag_ptr(channel_id_var.inner, channel_id_var.is_owned); - LDKChannelMonitorUpdate update_var = *update; + LDKChannelMonitorUpdate update_var = update; uint64_t update_ref = 0; - update_var = ChannelMonitorUpdate_clone(&update_var); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_var); update_ref = tag_ptr(update_var.inner, update_var.is_owned); LDKChannelMonitor data_var = *data; @@ -9234,7 +9818,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, 64, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0); + uint64_t ret = js_invoke_function_bbbbuu(j_calls->instance_ptr, 66, channel_id_ref, update_ref, data_ref, update_id_ref, 0, 0); LDKChannelMonitorUpdateStatus ret_conv = LDKChannelMonitorUpdateStatus_from_js(ret); return ret_conv; } @@ -9296,7 +9880,7 @@ uint32_t __attribute__((export_name("TS_Persist_update_persisted_channel"))) TS update_conv.inner = untag_ptr(update); update_conv.is_owned = ptr_is_owned(update); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_conv); - update_conv.is_owned = false; + update_conv = ChannelMonitorUpdate_clone(&update_conv); LDKChannelMonitor data_conv; data_conv.inner = untag_ptr(data); data_conv.is_owned = ptr_is_owned(data); @@ -9307,10 +9891,23 @@ uint32_t __attribute__((export_name("TS_Persist_update_persisted_channel"))) TS update_id_conv.is_owned = ptr_is_owned(update_id); CHECK_INNER_FIELD_ACCESS_OR_NULL(update_id_conv); update_id_conv = MonitorUpdateId_clone(&update_id_conv); - uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, &update_conv, &data_conv, update_id_conv)); + uint32_t ret_conv = LDKChannelMonitorUpdateStatus_to_js((this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, channel_id_conv, update_conv, &data_conv, update_id_conv)); return ret_conv; } +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) { + case LDKRetry_Attempts: return 0; + default: abort(); + } +} +uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) { + LDKRetry *obj = (LDKRetry*)untag_ptr(ptr); + assert(obj->tag == LDKRetry_Attempts); + uint32_t attempts_conv = obj->attempts; + return attempts_conv; +} typedef struct LDKChannelMessageHandler_JCalls { atomic_size_t refcnt; uint32_t instance_ptr; @@ -9322,35 +9919,27 @@ static void LDKChannelMessageHandler_JCalls_free(void* this_arg) { FREE(j_calls); } } -void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) { +void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKOpenChannel * msg) { 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); - LDKInitFeatures their_features_var = their_features; - uint64_t their_features_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKOpenChannel msg_var = *msg; uint64_t msg_ref = 0; 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, 65, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 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_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) { +void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAcceptChannel * msg) { 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); - LDKInitFeatures their_features_var = their_features; - uint64_t their_features_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKAcceptChannel msg_var = *msg; uint64_t msg_ref = 0; 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, 66, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 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_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9361,7 +9950,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, 67, (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_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9372,7 +9961,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, 68, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 70, (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; @@ -9383,23 +9972,18 @@ 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, 69, (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_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) { +void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) { 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); - LDKInitFeatures their_features_var = *their_features; - uint64_t their_features_ref = 0; - their_features_var = InitFeatures_clone(&their_features_var); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_var); - their_features_ref = tag_ptr(their_features_var.inner, their_features_var.is_owned); LDKShutdown msg_var = *msg; uint64_t msg_ref = 0; 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, 70, (uint32_t)their_node_id_arr, their_features_ref, msg_ref, 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_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9410,7 +9994,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, 71, (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_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9421,7 +10005,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, 72, (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_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9432,7 +10016,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, 73, (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_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9443,7 +10027,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, 74, (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_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; @@ -9454,7 +10038,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, 75, (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_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9465,7 +10049,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, 76, (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_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9476,7 +10060,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, 77, (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 handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) { LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg; @@ -9487,7 +10071,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, 78, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 80, (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; @@ -9498,16 +10082,15 @@ 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, 79, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 81, (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) { +void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) { 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, 80, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 82, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); } -LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) { +LDKCResult_NoneNoneZ peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg, bool inbound) { 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); @@ -9516,7 +10099,8 @@ 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, 81, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + jboolean inbound_conv = inbound; + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 83, (uint32_t)their_node_id_arr, msg_ref, inbound_conv, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr); @@ -9532,7 +10116,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, 82, (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); } 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; @@ -9543,7 +10127,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, 83, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 85, (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; @@ -9554,11 +10138,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, 84, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 86, (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, 85, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 87, 0, 0, 0, 0, 0, 0); LDKNodeFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -9569,7 +10153,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, 86, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 88, (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); @@ -9621,44 +10205,34 @@ uint64_t __attribute__((export_name("TS_LDKChannelMessageHandler_new"))) TS_LDK *res_ptr = LDKChannelMessageHandler_init(o, MessageSendEventsProvider); return tag_ptr(res_ptr, true); } -void __attribute__((export_name("TS_ChannelMessageHandler_handle_open_channel"))) TS_ChannelMessageHandler_handle_open_channel(uint64_t this_arg, int8_tArray their_node_id, uint64_t their_features, uint64_t msg) { +void __attribute__((export_name("TS_ChannelMessageHandler_handle_open_channel"))) TS_ChannelMessageHandler_handle_open_channel(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK(their_node_id->arr_len == 33); memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv = InitFeatures_clone(&their_features_conv); LDKOpenChannel msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -void __attribute__((export_name("TS_ChannelMessageHandler_handle_accept_channel"))) TS_ChannelMessageHandler_handle_accept_channel(uint64_t this_arg, int8_tArray their_node_id, uint64_t their_features, uint64_t msg) { +void __attribute__((export_name("TS_ChannelMessageHandler_handle_accept_channel"))) TS_ChannelMessageHandler_handle_accept_channel(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK(their_node_id->arr_len == 33); memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv = InitFeatures_clone(&their_features_conv); LDKAcceptChannel msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv); + (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } void __attribute__((export_name("TS_ChannelMessageHandler_handle_funding_created"))) TS_ChannelMessageHandler_handle_funding_created(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) { @@ -9706,24 +10280,19 @@ void __attribute__((export_name("TS_ChannelMessageHandler_handle_channel_ready" (this_arg_conv->handle_channel_ready)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -void __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t their_features, uint64_t msg) { +void __attribute__((export_name("TS_ChannelMessageHandler_handle_shutdown"))) TS_ChannelMessageHandler_handle_shutdown(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK(their_node_id->arr_len == 33); memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id); - LDKInitFeatures their_features_conv; - their_features_conv.inner = untag_ptr(their_features); - their_features_conv.is_owned = ptr_is_owned(their_features); - CHECK_INNER_FIELD_ACCESS_OR_NULL(their_features_conv); - their_features_conv.is_owned = false; LDKShutdown msg_conv; msg_conv.inner = untag_ptr(msg); msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv); + (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } void __attribute__((export_name("TS_ChannelMessageHandler_handle_closing_signed"))) TS_ChannelMessageHandler_handle_closing_signed(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) { @@ -9861,17 +10430,17 @@ void __attribute__((export_name("TS_ChannelMessageHandler_handle_announcement_s (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); } -void __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) { +void __attribute__((export_name("TS_ChannelMessageHandler_peer_disconnected"))) TS_ChannelMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK(their_node_id->arr_len == 33); memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id); - (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible); + (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref); } -uint64_t __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg) { +uint64_t __attribute__((export_name("TS_ChannelMessageHandler_peer_connected"))) TS_ChannelMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t msg, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg_ptr; @@ -9884,7 +10453,7 @@ uint64_t __attribute__((export_name("TS_ChannelMessageHandler_peer_connected")) CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv, inbound); return tag_ptr(ret_conv, true); } @@ -9976,7 +10545,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, 87, 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); @@ -9990,7 +10559,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, 88, msg_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 90, 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); @@ -10004,7 +10573,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, 89, msg_ref, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 91, 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); @@ -10014,25 +10583,27 @@ 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, 90, starting_point_conv, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 92, 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); FREE(untag_ptr(ret)); return ret_conv; } -LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point) { +LDKNodeAnnouncement get_next_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKNodeId starting_point) { 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, 91, (uint32_t)starting_point_arr, 0, 0, 0, 0, 0); + LDKNodeId starting_point_var = starting_point; + uint64_t starting_point_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_var); + starting_point_ref = tag_ptr(starting_point_var.inner, starting_point_var.is_owned); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 93, starting_point_ref, 0, 0, 0, 0, 0); LDKNodeAnnouncement 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; } -LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) { +LDKCResult_NoneNoneZ peer_connected_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) { 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); @@ -10041,7 +10612,8 @@ 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, 92, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0); + jboolean inbound_conv = inbound; + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 94, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr); @@ -10056,7 +10628,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, 93, (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); @@ -10071,7 +10643,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, 94, (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); @@ -10086,7 +10658,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, 95, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 97, (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); @@ -10101,16 +10673,20 @@ 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, 96, (uint32_t)their_node_id_arr, msg_ref, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 98, (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); FREE(untag_ptr(ret)); return ret_conv; } +bool processing_queue_high_LDKRoutingMessageHandler_jcall(const void* this_arg) { + LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg; + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 99, 0, 0, 0, 0, 0, 0); +} 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, 97, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 100, 0, 0, 0, 0, 0, 0); LDKNodeFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -10121,7 +10697,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, 98, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (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); @@ -10150,6 +10726,7 @@ static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JSValue o, .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall, .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall, .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall, + .processing_queue_high = processing_queue_high_LDKRoutingMessageHandler_jcall, .provided_node_features = provided_node_features_LDKRoutingMessageHandler_jcall, .provided_init_features = provided_init_features_LDKRoutingMessageHandler_jcall, .free = LDKRoutingMessageHandler_JCalls_free, @@ -10215,21 +10792,23 @@ uint64_t __attribute__((export_name("TS_RoutingMessageHandler_get_next_channel_ return ret_ref; } -uint64_t __attribute__((export_name("TS_RoutingMessageHandler_get_next_node_announcement"))) TS_RoutingMessageHandler_get_next_node_announcement(uint64_t this_arg, int8_tArray starting_point) { +uint64_t __attribute__((export_name("TS_RoutingMessageHandler_get_next_node_announcement"))) TS_RoutingMessageHandler_get_next_node_announcement(uint64_t this_arg, uint64_t starting_point) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; - LDKPublicKey starting_point_ref; - CHECK(starting_point->arr_len == 33); - memcpy(starting_point_ref.compressed_form, starting_point->elems, 33); FREE(starting_point); - LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_ref); + LDKNodeId starting_point_conv; + starting_point_conv.inner = untag_ptr(starting_point); + starting_point_conv.is_owned = ptr_is_owned(starting_point); + CHECK_INNER_FIELD_ACCESS_OR_NULL(starting_point_conv); + starting_point_conv = NodeId_clone(&starting_point_conv); + LDKNodeAnnouncement ret_var = (this_arg_conv->get_next_node_announcement)(this_arg_conv->this_arg, starting_point_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_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) { +uint64_t __attribute__((export_name("TS_RoutingMessageHandler_peer_connected"))) TS_RoutingMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; @@ -10242,7 +10821,7 @@ uint64_t __attribute__((export_name("TS_RoutingMessageHandler_peer_connected")) CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); init_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound); return tag_ptr(ret_conv, true); } @@ -10314,6 +10893,14 @@ uint64_t __attribute__((export_name("TS_RoutingMessageHandler_handle_query_shor return tag_ptr(ret_conv, true); } +jboolean __attribute__((export_name("TS_RoutingMessageHandler_processing_queue_high"))) TS_RoutingMessageHandler_processing_queue_high(uint64_t this_arg) { + void* this_arg_ptr = untag_ptr(this_arg); + if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } + LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg_ptr; + jboolean ret_conv = (this_arg_conv->processing_queue_high)(this_arg_conv->this_arg); + return ret_conv; +} + uint64_t __attribute__((export_name("TS_RoutingMessageHandler_provided_node_features"))) TS_RoutingMessageHandler_provided_node_features(uint64_t this_arg) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } @@ -10359,9 +10946,9 @@ 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, 99, (uint32_t)peer_node_id_arr, msg_ref, 0, 0, 0, 0); + js_invoke_function_ubuuuu(j_calls->instance_ptr, 102, (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) { +LDKCResult_NoneNoneZ peer_connected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init, bool inbound) { 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); @@ -10370,23 +10957,23 @@ 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, 100, (uint32_t)their_node_id_arr, init_ref, 0, 0, 0, 0); + jboolean inbound_conv = inbound; + uint64_t ret = js_invoke_function_ubuuuu(j_calls->instance_ptr, 103, (uint32_t)their_node_id_arr, init_ref, inbound_conv, 0, 0, 0); void* ret_ptr = untag_ptr(ret); CHECK_ACCESS(ret_ptr); LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(ret_ptr); FREE(untag_ptr(ret)); return ret_conv; } -void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) { +void peer_disconnected_LDKOnionMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id) { 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); - jboolean no_connection_possible_conv = no_connection_possible; - js_invoke_function_uuuuuu(j_calls->instance_ptr, 101, (uint32_t)their_node_id_arr, no_connection_possible_conv, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 104, (uint32_t)their_node_id_arr, 0, 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, 102, 0, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 105, 0, 0, 0, 0, 0, 0); LDKNodeFeatures ret_conv; ret_conv.inner = untag_ptr(ret); ret_conv.is_owned = ptr_is_owned(ret); @@ -10397,7 +10984,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, 103, (uint32_t)their_node_id_arr, 0, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 106, (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); @@ -10447,7 +11034,7 @@ void __attribute__((export_name("TS_OnionMessageHandler_handle_onion_message")) (this_arg_conv->handle_onion_message)(this_arg_conv->this_arg, peer_node_id_ref, &msg_conv); } -uint64_t __attribute__((export_name("TS_OnionMessageHandler_peer_connected"))) TS_OnionMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init) { +uint64_t __attribute__((export_name("TS_OnionMessageHandler_peer_connected"))) TS_OnionMessageHandler_peer_connected(uint64_t this_arg, int8_tArray their_node_id, uint64_t init, jboolean inbound) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr; @@ -10460,18 +11047,18 @@ uint64_t __attribute__((export_name("TS_OnionMessageHandler_peer_connected"))) CHECK_INNER_FIELD_ACCESS_OR_NULL(init_conv); init_conv.is_owned = false; LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); - *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv); + *ret_conv = (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &init_conv, inbound); return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) { +void __attribute__((export_name("TS_OnionMessageHandler_peer_disconnected"))) TS_OnionMessageHandler_peer_disconnected(uint64_t this_arg, int8_tArray their_node_id) { void* this_arg_ptr = untag_ptr(this_arg); if (ptr_is_owned(this_arg)) { CHECK_ACCESS(this_arg_ptr); } LDKOnionMessageHandler* this_arg_conv = (LDKOnionMessageHandler*)this_arg_ptr; LDKPublicKey their_node_id_ref; CHECK(their_node_id->arr_len == 33); memcpy(their_node_id_ref.compressed_form, their_node_id->elems, 33); FREE(their_node_id); - (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible); + (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref); } uint64_t __attribute__((export_name("TS_OnionMessageHandler_provided_node_features"))) TS_OnionMessageHandler_provided_node_features(uint64_t this_arg) { @@ -10515,7 +11102,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, 104, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_uuuuuu(j_calls->instance_ptr, 107, 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); @@ -10573,7 +11160,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, 105, 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, 108, 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); @@ -10582,7 +11169,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, 106, 0, 0, 0, 0, 0, 0); + uint64_tArray ret = (uint64_tArray)js_invoke_function_uuuuuu(j_calls->instance_ptr, 109, 0, 0, 0, 0, 0, 0); LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr; ret_constr.datalen = ret->arr_len; if (ret_constr.datalen > 0) @@ -10677,7 +11264,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, 107, tag_ptr(msg_ret, true), 0, 0, 0, 0, 0); + js_invoke_function_buuuuu(j_calls->instance_ptr, 110, 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; @@ -10685,7 +11272,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, 108, message_type_conv, (uint32_t)buffer_arr, 0, 0, 0, 0); + uint64_t ret = js_invoke_function_buuuuu(j_calls->instance_ptr, 111, 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); @@ -10757,21 +11344,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, 109, (uint32_t)data_arr, resume_read_conv, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 112, (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, 110, 0, 0, 0, 0, 0, 0); + js_invoke_function_uuuuuu(j_calls->instance_ptr, 113, 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, 111, tag_ptr(other_arg_clone, true), 0, 0, 0, 0, 0); + return js_invoke_function_buuuuu(j_calls->instance_ptr, 114, 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, 112, 0, 0, 0, 0, 0, 0); + return js_invoke_function_uuuuuu(j_calls->instance_ptr, 115, 0, 0, 0, 0, 0, 0); } static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) { LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg; @@ -10860,376 +11447,6 @@ int64_t __attribute__((export_name("TS_LDKEffectiveCapacity_Total_get_htlc_maxim int64_t htlc_maximum_msat_conv = obj->total.htlc_maximum_msat; return htlc_maximum_msat_conv; } -typedef struct LDKRouter_JCalls { - atomic_size_t refcnt; - uint32_t instance_ptr; -} LDKRouter_JCalls; -static void LDKRouter_JCalls_free(void* this_arg) { - LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; - if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { - FREE(j_calls); - } -} -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); - 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); - 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); - FREE(untag_ptr(ret)); - return ret_conv; -} -void notify_payment_path_failed_LDKRouter_jcall(const void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { - LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; - LDKCVec_RouteHopZ path_var = path; - uint64_tArray path_arr = NULL; - path_arr = init_uint64_tArray(path_var.datalen, __LINE__); - uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8); - for (size_t k = 0; k < path_var.datalen; k++) { - LDKRouteHop path_conv_10_var = path_var.data[k]; - uint64_t path_conv_10_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - path_arr_ptr[k] = path_conv_10_ref; - } - - FREE(path_var.data); - int64_t short_channel_id_conv = short_channel_id; - 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; - LDKCVec_RouteHopZ path_var = path; - uint64_tArray path_arr = NULL; - path_arr = init_uint64_tArray(path_var.datalen, __LINE__); - uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8); - for (size_t k = 0; k < path_var.datalen; k++) { - LDKRouteHop path_conv_10_var = path_var.data[k]; - uint64_t path_conv_10_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - path_arr_ptr[k] = path_conv_10_ref; - } - - FREE(path_var.data); - 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; - LDKCVec_RouteHopZ path_var = path; - uint64_tArray path_arr = NULL; - path_arr = init_uint64_tArray(path_var.datalen, __LINE__); - uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8); - for (size_t k = 0; k < path_var.datalen; k++) { - LDKRouteHop path_conv_10_var = path_var.data[k]; - uint64_t path_conv_10_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - path_arr_ptr[k] = path_conv_10_ref; - } - - FREE(path_var.data); - 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; - LDKCVec_RouteHopZ path_var = path; - uint64_tArray path_arr = NULL; - path_arr = init_uint64_tArray(path_var.datalen, __LINE__); - uint64_t *path_arr_ptr = (uint64_t*)(((uint8_t*)path_arr) + 8); - for (size_t k = 0; k < path_var.datalen; k++) { - LDKRouteHop path_conv_10_var = path_var.data[k]; - uint64_t path_conv_10_ref = 0; - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); - path_conv_10_ref = tag_ptr(path_conv_10_var.inner, path_conv_10_var.is_owned); - path_arr_ptr[k] = path_conv_10_ref; - } - - FREE(path_var.data); - int64_t short_channel_id_conv = short_channel_id; - 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; - atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); -} -static inline LDKRouter LDKRouter_init (JSValue o) { - LDKRouter_JCalls *calls = MALLOC(sizeof(LDKRouter_JCalls), "LDKRouter_JCalls"); - atomic_init(&calls->refcnt, 1); - calls->instance_ptr = 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, - .notify_payment_probe_failed = notify_payment_probe_failed_LDKRouter_jcall, - .free = LDKRouter_JCalls_free, - }; - return ret; -} -uint64_t __attribute__((export_name("TS_LDKRouter_new"))) TS_LDKRouter_new(JSValue o) { - LDKRouter *res_ptr = MALLOC(sizeof(LDKRouter), "LDKRouter"); - *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, 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; - 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); - 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_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); -} - -void __attribute__((export_name("TS_Router_notify_payment_path_failed"))) TS_Router_notify_payment_path_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_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; - LDKCVec_RouteHopZ path_constr; - path_constr.datalen = path->arr_len; - if (path_constr.datalen > 0) - path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - path_constr.data = NULL; - uint64_t* path_vals = path->elems; - for (size_t k = 0; k < path_constr.datalen; k++) { - uint64_t path_conv_10 = path_vals[k]; - LDKRouteHop path_conv_10_conv; - path_conv_10_conv.inner = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); - path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); - path_constr.data[k] = path_conv_10_conv; - } - FREE(path); - (this_arg_conv->notify_payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); -} - -void __attribute__((export_name("TS_Router_notify_payment_path_successful"))) TS_Router_notify_payment_path_successful(uint64_t this_arg, uint64_tArray path) { - 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; - LDKCVec_RouteHopZ path_constr; - path_constr.datalen = path->arr_len; - if (path_constr.datalen > 0) - path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - path_constr.data = NULL; - uint64_t* path_vals = path->elems; - for (size_t k = 0; k < path_constr.datalen; k++) { - uint64_t path_conv_10 = path_vals[k]; - LDKRouteHop path_conv_10_conv; - path_conv_10_conv.inner = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); - path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); - path_constr.data[k] = path_conv_10_conv; - } - FREE(path); - (this_arg_conv->notify_payment_path_successful)(this_arg_conv->this_arg, path_constr); -} - -void __attribute__((export_name("TS_Router_notify_payment_probe_successful"))) TS_Router_notify_payment_probe_successful(uint64_t this_arg, uint64_tArray path) { - 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; - LDKCVec_RouteHopZ path_constr; - path_constr.datalen = path->arr_len; - if (path_constr.datalen > 0) - path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - path_constr.data = NULL; - uint64_t* path_vals = path->elems; - for (size_t k = 0; k < path_constr.datalen; k++) { - uint64_t path_conv_10 = path_vals[k]; - LDKRouteHop path_conv_10_conv; - path_conv_10_conv.inner = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); - path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); - path_constr.data[k] = path_conv_10_conv; - } - FREE(path); - (this_arg_conv->notify_payment_probe_successful)(this_arg_conv->this_arg, path_constr); -} - -void __attribute__((export_name("TS_Router_notify_payment_probe_failed"))) TS_Router_notify_payment_probe_failed(uint64_t this_arg, uint64_tArray path, int64_t short_channel_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; - LDKCVec_RouteHopZ path_constr; - path_constr.datalen = path->arr_len; - if (path_constr.datalen > 0) - path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); - else - path_constr.data = NULL; - uint64_t* path_vals = path->elems; - for (size_t k = 0; k < path_constr.datalen; k++) { - uint64_t path_conv_10 = path_vals[k]; - LDKRouteHop path_conv_10_conv; - path_conv_10_conv.inner = untag_ptr(path_conv_10); - path_conv_10_conv.is_owned = ptr_is_owned(path_conv_10); - CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); - path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); - path_constr.data[k] = path_conv_10_conv; - } - FREE(path); - (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) { @@ -11268,6 +11485,33 @@ uint64_t __attribute__((export_name("TS_LDKOnionMessageContents_Custom_get_custo *custom_ret = CustomOnionMessageContents_clone(&obj->custom); return tag_ptr(custom_ret, true); } +uint32_t __attribute__((export_name("TS_LDKGossipSync_ty_from_ptr"))) TS_LDKGossipSync_ty_from_ptr(uint64_t ptr) { + LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr); + switch(obj->tag) { + case LDKGossipSync_P2P: return 0; + case LDKGossipSync_Rapid: return 1; + case LDKGossipSync_None: return 2; + default: abort(); + } +} +uint64_t __attribute__((export_name("TS_LDKGossipSync_P2P_get_p2p"))) TS_LDKGossipSync_P2P_get_p2p(uint64_t ptr) { + LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr); + assert(obj->tag == LDKGossipSync_P2P); + LDKP2PGossipSync p2p_var = obj->p2p; + uint64_t p2p_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(p2p_var); + p2p_ref = tag_ptr(p2p_var.inner, false); + return p2p_ref; +} +uint64_t __attribute__((export_name("TS_LDKGossipSync_Rapid_get_rapid"))) TS_LDKGossipSync_Rapid_get_rapid(uint64_t ptr) { + LDKGossipSync *obj = (LDKGossipSync*)untag_ptr(ptr); + assert(obj->tag == LDKGossipSync_Rapid); + LDKRapidGossipSync rapid_var = obj->rapid; + uint64_t rapid_ref = 0; + CHECK_INNER_FIELD_ACCESS_OR_NULL(rapid_var); + rapid_ref = tag_ptr(rapid_var.inner, false); + return rapid_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) { @@ -11305,264 +11549,6 @@ int8_tArray __attribute__((export_name("TS_LDKFallback_ScriptHash_get_script_has 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) { - case LDKRetry_Attempts: return 0; - default: abort(); - } -} -uint32_t __attribute__((export_name("TS_LDKRetry_Attempts_get_attempts"))) TS_LDKRetry_Attempts_get_attempts(uint64_t ptr) { - LDKRetry *obj = (LDKRetry*)untag_ptr(ptr); - assert(obj->tag == LDKRetry_Attempts); - uint32_t attempts_conv = obj->attempts; - return attempts_conv; -} jstring __attribute__((export_name("TS__ldk_get_compiled_version"))) TS__ldk_get_compiled_version() { LDKStr ret_str = _ldk_get_compiled_version(); jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len); @@ -11693,6 +11679,95 @@ void __attribute__((export_name("TS_Str_free"))) TS_Str_free(jstring _res) { Str_free(dummy); } +uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() { + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_ok(); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) { + void* e_ptr = untag_ptr(e); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)untag_ptr(e)); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) { + LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) { + LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig); + LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); + *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) { + LDKCVec_CResult_NoneAPIErrorZZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t w = 0; w < _res_constr.datalen; w++) { + uint64_t _res_conv_22 = _res_vals[w]; + void* _res_conv_22_ptr = untag_ptr(_res_conv_22); + CHECK_ACCESS(_res_conv_22_ptr); + LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr); + FREE(untag_ptr(_res_conv_22)); + _res_constr.data[w] = _res_conv_22_conv; + } + FREE(_res); + CVec_CResult_NoneAPIErrorZZ_free(_res_constr); +} + +void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) { + LDKCVec_APIErrorZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ 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]; + void* _res_conv_10_ptr = untag_ptr(_res_conv_10); + CHECK_ACCESS(_res_conv_10_ptr); + LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr); + FREE(untag_ptr(_res_conv_10)); + _res_constr.data[k] = _res_conv_10_conv; + } + FREE(_res); + CVec_APIErrorZ_free(_res_constr); +} + 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"); @@ -13394,6 +13469,153 @@ uint64_t __attribute__((export_name("TS_CResult_PaymentPurposeDecodeErrorZ_clon return tag_ptr(ret_conv, true); } +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); + LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr); + o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o)); + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_some(o_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() { + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_NetworkUpdateZ_free(_res_conv); +} + +static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) { + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) { + LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg); + int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) { + LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig); + LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); + *ret_copy = COption_NetworkUpdateZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_COption_PathFailureZ_some"))) TS_COption_PathFailureZ_some(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKPathFailure o_conv = *(LDKPathFailure*)(o_ptr); + o_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(o)); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_some(o_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_COption_PathFailureZ_none"))) TS_COption_PathFailureZ_none() { + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_COption_PathFailureZ_free"))) TS_COption_PathFailureZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_PathFailureZ _res_conv = *(LDKCOption_PathFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_PathFailureZ_free(_res_conv); +} + +static inline uint64_t COption_PathFailureZ_clone_ptr(LDKCOption_PathFailureZ *NONNULL_PTR arg) { + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_PathFailureZ_clone_ptr"))) TS_COption_PathFailureZ_clone_ptr(uint64_t arg) { + LDKCOption_PathFailureZ* arg_conv = (LDKCOption_PathFailureZ*)untag_ptr(arg); + int64_t ret_conv = COption_PathFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_PathFailureZ_clone"))) TS_COption_PathFailureZ_clone(uint64_t orig) { + LDKCOption_PathFailureZ* orig_conv = (LDKCOption_PathFailureZ*)untag_ptr(orig); + LDKCOption_PathFailureZ *ret_copy = MALLOC(sizeof(LDKCOption_PathFailureZ), "LDKCOption_PathFailureZ"); + *ret_copy = COption_PathFailureZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_ok(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_PathFailureZ o_conv = *(LDKCOption_PathFailureZ*)(o_ptr); + o_conv = COption_PathFailureZ_clone((LDKCOption_PathFailureZ*)untag_ptr(o)); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_err"))) TS_CResult_COption_PathFailureZDecodeErrorZ_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_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok"))) TS_CResult_COption_PathFailureZDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_COption_PathFailureZDecodeErrorZ* o_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_PathFailureZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_free"))) TS_CResult_COption_PathFailureZDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_PathFailureZDecodeErrorZ _res_conv = *(LDKCResult_COption_PathFailureZDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_COption_PathFailureZDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_COption_PathFailureZDecodeErrorZ* arg_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_COption_PathFailureZDecodeErrorZ_clone"))) TS_CResult_COption_PathFailureZDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_COption_PathFailureZDecodeErrorZ* orig_conv = (LDKCResult_COption_PathFailureZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = CResult_COption_PathFailureZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + uint64_t __attribute__((export_name("TS_COption_ClosureReasonZ_some"))) TS_COption_ClosureReasonZ_some(uint64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); @@ -13640,53 +13862,6 @@ uint64_t __attribute__((export_name("TS_COption_u128Z_clone"))) TS_COption_u128 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); - LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(o_ptr); - o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)untag_ptr(o)); - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_some(o_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -uint64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_none"))) TS_COption_NetworkUpdateZ_none() { - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_none(); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -void __attribute__((export_name("TS_COption_NetworkUpdateZ_free"))) TS_COption_NetworkUpdateZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(_res_ptr); - FREE(untag_ptr(_res)); - COption_NetworkUpdateZ_free(_res_conv); -} - -static inline uint64_t COption_NetworkUpdateZ_clone_ptr(LDKCOption_NetworkUpdateZ *NONNULL_PTR arg) { - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_clone(arg); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -int64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone_ptr"))) TS_COption_NetworkUpdateZ_clone_ptr(uint64_t arg) { - LDKCOption_NetworkUpdateZ* arg_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(arg); - int64_t ret_conv = COption_NetworkUpdateZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_COption_NetworkUpdateZ_clone"))) TS_COption_NetworkUpdateZ_clone(uint64_t orig) { - LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)untag_ptr(orig); - LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ"); - *ret_copy = COption_NetworkUpdateZ_clone(orig_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - void __attribute__((export_name("TS_CVec_SpendableOutputDescriptorZ_free"))) TS_CVec_SpendableOutputDescriptorZ_free(uint64_tArray _res) { LDKCVec_SpendableOutputDescriptorZ _res_constr; _res_constr.datalen = _res->arr_len; @@ -13827,56 +14002,6 @@ void __attribute__((export_name("TS_CVec_MessageSendEventZ_free"))) TS_CVec_Mes CVec_MessageSendEventZ_free(_res_constr); } -uint64_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_ok"))) TS_CResult_TxOutAccessErrorZ_ok(uint64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKTxOut o_conv = *(LDKTxOut*)(o_ptr); - o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o)); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_err"))) TS_CResult_TxOutAccessErrorZ_err(uint32_t e) { - LDKAccessError e_conv = LDKAccessError_from_js(e); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_is_ok"))) TS_CResult_TxOutAccessErrorZ_is_ok(uint64_t o) { - LDKCResult_TxOutAccessErrorZ* o_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_TxOutAccessErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_free"))) TS_CResult_TxOutAccessErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_TxOutAccessErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_TxOutAccessErrorZ_clone_ptr(LDKCResult_TxOutAccessErrorZ *NONNULL_PTR arg) { - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone_ptr"))) TS_CResult_TxOutAccessErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_TxOutAccessErrorZ* arg_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_TxOutAccessErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_TxOutAccessErrorZ_clone"))) TS_CResult_TxOutAccessErrorZ_clone(uint64_t orig) { - LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)untag_ptr(orig); - LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ"); - *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - static inline uint64_t C2Tuple_usizeTransactionZ_clone_ptr(LDKC2Tuple_usizeTransactionZ *NONNULL_PTR arg) { LDKC2Tuple_usizeTransactionZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ"); *ret_conv = C2Tuple_usizeTransactionZ_clone(arg); @@ -14225,6 +14350,131 @@ uint64_t __attribute__((export_name("TS_COption_C2Tuple_u64u64ZZ_clone"))) TS_C return ret_ref; } +static inline uint64_t C2Tuple_Z_clone_ptr(LDKC2Tuple_Z *NONNULL_PTR arg) { + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_C2Tuple_Z_clone_ptr"))) TS_C2Tuple_Z_clone_ptr(uint64_t arg) { + LDKC2Tuple_Z* arg_conv = (LDKC2Tuple_Z*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_Z_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_C2Tuple_Z_clone"))) TS_C2Tuple_Z_clone(uint64_t orig) { + LDKC2Tuple_Z* orig_conv = (LDKC2Tuple_Z*)untag_ptr(orig); + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_C2Tuple_Z_new"))) TS_C2Tuple_Z_new(int16_tArray a, int16_tArray b) { + LDKEightU16s a_ref; + CHECK(a->arr_len == 8); + memcpy(a_ref.data, a->elems, 8 * 2); FREE(a); + LDKEightU16s b_ref; + CHECK(b->arr_len == 8); + memcpy(b_ref.data, b->elems, 8 * 2); FREE(b); + LDKC2Tuple_Z* ret_conv = MALLOC(sizeof(LDKC2Tuple_Z), "LDKC2Tuple_Z"); + *ret_conv = C2Tuple_Z_new(a_ref, b_ref); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_C2Tuple_Z_free"))) TS_C2Tuple_Z_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_Z _res_conv = *(LDKC2Tuple_Z*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_Z_free(_res_conv); +} + +static inline uint64_t C2Tuple__u168_u168Z_clone_ptr(LDKC2Tuple__u168_u168Z *NONNULL_PTR arg) { + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone_ptr"))) TS_C2Tuple__u168_u168Z_clone_ptr(uint64_t arg) { + LDKC2Tuple__u168_u168Z* arg_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(arg); + int64_t ret_conv = C2Tuple__u168_u168Z_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_C2Tuple__u168_u168Z_clone"))) TS_C2Tuple__u168_u168Z_clone(uint64_t orig) { + LDKC2Tuple__u168_u168Z* orig_conv = (LDKC2Tuple__u168_u168Z*)untag_ptr(orig); + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_C2Tuple__u168_u168Z_new"))) TS_C2Tuple__u168_u168Z_new(int16_tArray a, int16_tArray b) { + LDKEightU16s a_ref; + CHECK(a->arr_len == 8); + memcpy(a_ref.data, a->elems, 8 * 2); FREE(a); + LDKEightU16s b_ref; + CHECK(b->arr_len == 8); + memcpy(b_ref.data, b->elems, 8 * 2); FREE(b); + LDKC2Tuple__u168_u168Z* ret_conv = MALLOC(sizeof(LDKC2Tuple__u168_u168Z), "LDKC2Tuple__u168_u168Z"); + *ret_conv = C2Tuple__u168_u168Z_new(a_ref, b_ref); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_C2Tuple__u168_u168Z_free"))) TS_C2Tuple__u168_u168Z_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple__u168_u168Z _res_conv = *(LDKC2Tuple__u168_u168Z*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple__u168_u168Z_free(_res_conv); +} + +uint64_t __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_some"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_some(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKC2Tuple__u168_u168Z o_conv = *(LDKC2Tuple__u168_u168Z*)(o_ptr); + o_conv = C2Tuple__u168_u168Z_clone((LDKC2Tuple__u168_u168Z*)untag_ptr(o)); + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_some(o_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_none"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_none() { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_free"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_C2Tuple_EightU16sEightU16sZZ _res_conv = *(LDKCOption_C2Tuple_EightU16sEightU16sZZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_C2Tuple_EightU16sEightU16sZZ_free(_res_conv); +} + +static inline uint64_t COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(LDKCOption_C2Tuple_EightU16sEightU16sZZ *NONNULL_PTR arg) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(uint64_t arg) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ* arg_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(arg); + int64_t ret_conv = COption_C2Tuple_EightU16sEightU16sZZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_C2Tuple_EightU16sEightU16sZZ_clone"))) TS_COption_C2Tuple_EightU16sEightU16sZZ_clone(uint64_t orig) { + LDKCOption_C2Tuple_EightU16sEightU16sZZ* orig_conv = (LDKCOption_C2Tuple_EightU16sEightU16sZZ*)untag_ptr(orig); + LDKCOption_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = COption_C2Tuple_EightU16sEightU16sZZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + void __attribute__((export_name("TS_CVec_NodeIdZ_free"))) TS_CVec_NodeIdZ_free(uint64_tArray _res) { LDKCVec_NodeIdZ _res_constr; _res_constr.datalen = _res->arr_len; @@ -14498,165 +14748,111 @@ uint64_t __attribute__((export_name("TS_CResult_InvoiceFeaturesDecodeErrorZ_clo return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) { - LDKChannelTypeFeatures 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 = ChannelTypeFeatures_clone(&o_conv); - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); - *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_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_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); - *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); - *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig); - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); - *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv); - 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; +uint64_t __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_ok(uint64_t o) { + LDKBlindedHopFeatures 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); + o_conv = BlindedHopFeatures_clone(&o_conv); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_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) { +uint64_t __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_err"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_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); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_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); +jboolean __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* o_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_OfferFeaturesDecodeErrorZ_free"))) TS_CResult_OfferFeaturesDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_free"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_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); + LDKCResult_BlindedHopFeaturesDecodeErrorZ _res_conv = *(LDKCResult_BlindedHopFeaturesDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_OfferFeaturesDecodeErrorZ_free(_res_conv); + CResult_BlindedHopFeaturesDecodeErrorZ_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); +static inline uint64_t CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_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); +int64_t __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* arg_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_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); +uint64_t __attribute__((export_name("TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone"))) TS_CResult_BlindedHopFeaturesDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_BlindedHopFeaturesDecodeErrorZ* orig_conv = (LDKCResult_BlindedHopFeaturesDecodeErrorZ*)untag_ptr(orig); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = CResult_BlindedHopFeaturesDecodeErrorZ_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; +uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint64_t o) { + LDKChannelTypeFeatures 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); + o_conv = ChannelTypeFeatures_clone(&o_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_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) { +uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_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); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_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); +jboolean __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_conv; } -void __attribute__((export_name("TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free"))) TS_CResult_InvoiceRequestFeaturesDecodeErrorZ_free(uint64_t _res) { +void __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_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); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr); FREE(untag_ptr(_res)); - CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res_conv); + CResult_ChannelTypeFeaturesDecodeErrorZ_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); +static inline uint64_t CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_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); +int64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* arg_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_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); +uint64_t __attribute__((export_name("TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* orig_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)untag_ptr(orig); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig_conv); return tag_ptr(ret_conv, true); } @@ -14767,34 +14963,34 @@ uint64_t __attribute__((export_name("TS_CResult_COption_NetworkUpdateZDecodeErr return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_COption_AccessZ_some"))) TS_COption_AccessZ_some(uint64_t o) { +uint64_t __attribute__((export_name("TS_COption_UtxoLookupZ_some"))) TS_COption_UtxoLookupZ_some(uint64_t o) { void* o_ptr = untag_ptr(o); CHECK_ACCESS(o_ptr); - LDKAccess o_conv = *(LDKAccess*)(o_ptr); - if (o_conv.free == LDKAccess_JCalls_free) { + LDKUtxoLookup o_conv = *(LDKUtxoLookup*)(o_ptr); + if (o_conv.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&o_conv); + LDKUtxoLookup_JCalls_cloned(&o_conv); } - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_some(o_conv); + LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ"); + *ret_copy = COption_UtxoLookupZ_some(o_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -uint64_t __attribute__((export_name("TS_COption_AccessZ_none"))) TS_COption_AccessZ_none() { - LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ"); - *ret_copy = COption_AccessZ_none(); +uint64_t __attribute__((export_name("TS_COption_UtxoLookupZ_none"))) TS_COption_UtxoLookupZ_none() { + LDKCOption_UtxoLookupZ *ret_copy = MALLOC(sizeof(LDKCOption_UtxoLookupZ), "LDKCOption_UtxoLookupZ"); + *ret_copy = COption_UtxoLookupZ_none(); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -void __attribute__((export_name("TS_COption_AccessZ_free"))) TS_COption_AccessZ_free(uint64_t _res) { +void __attribute__((export_name("TS_COption_UtxoLookupZ_free"))) TS_COption_UtxoLookupZ_free(uint64_t _res) { if (!ptr_is_owned(_res)) return; void* _res_ptr = untag_ptr(_res); CHECK_ACCESS(_res_ptr); - LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(_res_ptr); + LDKCOption_UtxoLookupZ _res_conv = *(LDKCOption_UtxoLookupZ*)(_res_ptr); FREE(untag_ptr(_res)); - COption_AccessZ_free(_res_conv); + COption_UtxoLookupZ_free(_res_conv); } uint64_t __attribute__((export_name("TS_CResult_boolLightningErrorZ_ok"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) { @@ -15760,142 +15956,6 @@ uint64_t __attribute__((export_name("TS_CResult_SignatureNoneZ_clone"))) TS_CRe return tag_ptr(ret_conv, true); } -static inline uint64_t C2Tuple_SignatureSignatureZ_clone_ptr(LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR arg) { - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone_ptr"))) TS_C2Tuple_SignatureSignatureZ_clone_ptr(uint64_t arg) { - LDKC2Tuple_SignatureSignatureZ* arg_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(arg); - int64_t ret_conv = C2Tuple_SignatureSignatureZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_clone"))) TS_C2Tuple_SignatureSignatureZ_clone(uint64_t orig) { - LDKC2Tuple_SignatureSignatureZ* orig_conv = (LDKC2Tuple_SignatureSignatureZ*)untag_ptr(orig); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_new"))) TS_C2Tuple_SignatureSignatureZ_new(int8_tArray a, int8_tArray b) { - LDKSignature a_ref; - CHECK(a->arr_len == 64); - memcpy(a_ref.compact_form, a->elems, 64); FREE(a); - LDKSignature b_ref; - CHECK(b->arr_len == 64); - memcpy(b_ref.compact_form, b->elems, 64); FREE(b); - LDKC2Tuple_SignatureSignatureZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_SignatureSignatureZ), "LDKC2Tuple_SignatureSignatureZ"); - *ret_conv = C2Tuple_SignatureSignatureZ_new(a_ref, b_ref); - return tag_ptr(ret_conv, true); -} - -void __attribute__((export_name("TS_C2Tuple_SignatureSignatureZ_free"))) TS_C2Tuple_SignatureSignatureZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKC2Tuple_SignatureSignatureZ _res_conv = *(LDKC2Tuple_SignatureSignatureZ*)(_res_ptr); - FREE(untag_ptr(_res)); - C2Tuple_SignatureSignatureZ_free(_res_conv); -} - -uint64_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_ok(uint64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKC2Tuple_SignatureSignatureZ o_conv = *(LDKC2Tuple_SignatureSignatureZ*)(o_ptr); - o_conv = C2Tuple_SignatureSignatureZ_clone((LDKC2Tuple_SignatureSignatureZ*)untag_ptr(o)); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_err() { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_err(); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(uint64_t o) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* o_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(o); - jboolean ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_C2Tuple_SignatureSignatureZNoneZ_free(_res_conv); -} - -static inline uint64_t CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR arg) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(uint64_t arg) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* arg_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(arg); - int64_t ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone"))) TS_CResult_C2Tuple_SignatureSignatureZNoneZ_clone(uint64_t orig) { - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureSignatureZNoneZ*)untag_ptr(orig); - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ), "LDKCResult_C2Tuple_SignatureSignatureZNoneZ"); - *ret_conv = CResult_C2Tuple_SignatureSignatureZNoneZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_ok"))) TS_CResult_SecretKeyNoneZ_ok(int8_tArray o) { - LDKSecretKey o_ref; - CHECK(o->arr_len == 32); - memcpy(o_ref.bytes, o->elems, 32); FREE(o); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_ok(o_ref); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_err"))) TS_CResult_SecretKeyNoneZ_err() { - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_err(); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_SecretKeyNoneZ_is_ok"))) TS_CResult_SecretKeyNoneZ_is_ok(uint64_t o) { - LDKCResult_SecretKeyNoneZ* o_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(o); - jboolean ret_conv = CResult_SecretKeyNoneZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_SecretKeyNoneZ_free"))) TS_CResult_SecretKeyNoneZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_SecretKeyNoneZ _res_conv = *(LDKCResult_SecretKeyNoneZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_SecretKeyNoneZ_free(_res_conv); -} - -static inline uint64_t CResult_SecretKeyNoneZ_clone_ptr(LDKCResult_SecretKeyNoneZ *NONNULL_PTR arg) { - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone_ptr"))) TS_CResult_SecretKeyNoneZ_clone_ptr(uint64_t arg) { - LDKCResult_SecretKeyNoneZ* arg_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SecretKeyNoneZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_SecretKeyNoneZ_clone"))) TS_CResult_SecretKeyNoneZ_clone(uint64_t orig) { - LDKCResult_SecretKeyNoneZ* orig_conv = (LDKCResult_SecretKeyNoneZ*)untag_ptr(orig); - LDKCResult_SecretKeyNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyNoneZ), "LDKCResult_SecretKeyNoneZ"); - *ret_conv = CResult_SecretKeyNoneZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - uint64_t __attribute__((export_name("TS_CResult_PublicKeyNoneZ_ok"))) TS_CResult_PublicKeyNoneZ_ok(int8_tArray o) { LDKPublicKey o_ref; CHECK(o->arr_len == 33); @@ -16019,62 +16079,6 @@ uint64_t __attribute__((export_name("TS_CResult_SharedSecretNoneZ_clone"))) TS_ return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_ok"))) TS_CResult_SignDecodeErrorZ_ok(uint64_t o) { - void* o_ptr = untag_ptr(o); - CHECK_ACCESS(o_ptr); - LDKSign o_conv = *(LDKSign*)(o_ptr); - if (o_conv.free == LDKSign_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKSign_JCalls_cloned(&o_conv); - } - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_err"))) TS_CResult_SignDecodeErrorZ_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_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_SignDecodeErrorZ_is_ok"))) TS_CResult_SignDecodeErrorZ_is_ok(uint64_t o) { - LDKCResult_SignDecodeErrorZ* o_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_SignDecodeErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_SignDecodeErrorZ_free"))) TS_CResult_SignDecodeErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_SignDecodeErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_SignDecodeErrorZ_clone_ptr(LDKCResult_SignDecodeErrorZ *NONNULL_PTR arg) { - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone_ptr"))) TS_CResult_SignDecodeErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_SignDecodeErrorZ* arg_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_SignDecodeErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_SignDecodeErrorZ_clone"))) TS_CResult_SignDecodeErrorZ_clone(uint64_t orig) { - LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)untag_ptr(orig); - LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ"); - *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - void __attribute__((export_name("TS_CVec_U5Z_free"))) TS_CVec_U5Z_free(ptrArray _res) { LDKCVec_U5Z _res_constr; _res_constr.datalen = _res->arr_len; @@ -16140,6 +16144,62 @@ uint64_t __attribute__((export_name("TS_CResult_RecoverableSignatureNoneZ_clone return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKWriteableEcdsaChannelSigner o_conv = *(LDKWriteableEcdsaChannelSigner*)(o_ptr); + if (o_conv.free == LDKWriteableEcdsaChannelSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKWriteableEcdsaChannelSigner_JCalls_cloned(&o_conv); + } + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_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_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* o_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res_conv = *(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* arg_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone"))) TS_CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* orig_conv = (LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ*)untag_ptr(orig); + LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ), "LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ"); + *ret_conv = CResult_WriteableEcdsaChannelSignerDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + void __attribute__((export_name("TS_CVec_u8Z_free"))) TS_CVec_u8Z_free(int8_tArray _res) { LDKCVec_u8Z _res_ref; _res_ref.datalen = _res->arr_len; @@ -16396,95 +16456,6 @@ uint64_t __attribute__((export_name("TS_COption_u16Z_clone"))) TS_COption_u16Z_ return ret_ref; } -uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_ok"))) TS_CResult_NoneAPIErrorZ_ok() { - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_ok(); - return tag_ptr(ret_conv, true); -} - -uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_err"))) TS_CResult_NoneAPIErrorZ_err(uint64_t e) { - void* e_ptr = untag_ptr(e); - CHECK_ACCESS(e_ptr); - LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); - e_conv = APIError_clone((LDKAPIError*)untag_ptr(e)); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_err(e_conv); - return tag_ptr(ret_conv, true); -} - -jboolean __attribute__((export_name("TS_CResult_NoneAPIErrorZ_is_ok"))) TS_CResult_NoneAPIErrorZ_is_ok(uint64_t o) { - LDKCResult_NoneAPIErrorZ* o_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(o); - jboolean ret_conv = CResult_NoneAPIErrorZ_is_ok(o_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_CResult_NoneAPIErrorZ_free"))) TS_CResult_NoneAPIErrorZ_free(uint64_t _res) { - if (!ptr_is_owned(_res)) return; - void* _res_ptr = untag_ptr(_res); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_ptr); - FREE(untag_ptr(_res)); - CResult_NoneAPIErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneAPIErrorZ_clone_ptr(LDKCResult_NoneAPIErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_clone(arg); - return tag_ptr(ret_conv, true); -} -int64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone_ptr"))) TS_CResult_NoneAPIErrorZ_clone_ptr(uint64_t arg) { - LDKCResult_NoneAPIErrorZ* arg_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(arg); - int64_t ret_conv = CResult_NoneAPIErrorZ_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_CResult_NoneAPIErrorZ_clone"))) TS_CResult_NoneAPIErrorZ_clone(uint64_t orig) { - LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)untag_ptr(orig); - LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ"); - *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv); - return tag_ptr(ret_conv, true); -} - -void __attribute__((export_name("TS_CVec_CResult_NoneAPIErrorZZ_free"))) TS_CVec_CResult_NoneAPIErrorZZ_free(uint64_tArray _res) { - LDKCVec_CResult_NoneAPIErrorZZ _res_constr; - _res_constr.datalen = _res->arr_len; - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - _res_constr.data = NULL; - uint64_t* _res_vals = _res->elems; - for (size_t w = 0; w < _res_constr.datalen; w++) { - uint64_t _res_conv_22 = _res_vals[w]; - void* _res_conv_22_ptr = untag_ptr(_res_conv_22); - CHECK_ACCESS(_res_conv_22_ptr); - LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(_res_conv_22_ptr); - FREE(untag_ptr(_res_conv_22)); - _res_constr.data[w] = _res_conv_22_conv; - } - FREE(_res); - CVec_CResult_NoneAPIErrorZZ_free(_res_constr); -} - -void __attribute__((export_name("TS_CVec_APIErrorZ_free"))) TS_CVec_APIErrorZ_free(uint64_tArray _res) { - LDKCVec_APIErrorZ _res_constr; - _res_constr.datalen = _res->arr_len; - if (_res_constr.datalen > 0) - _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ 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]; - void* _res_conv_10_ptr = untag_ptr(_res_conv_10); - CHECK_ACCESS(_res_conv_10_ptr); - LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(_res_conv_10_ptr); - FREE(untag_ptr(_res_conv_10)); - _res_constr.data[k] = _res_conv_10_conv; - } - FREE(_res); - CVec_APIErrorZ_free(_res_constr); -} - uint64_t __attribute__((export_name("TS_CResult__u832APIErrorZ_ok"))) TS_CResult__u832APIErrorZ_ok(int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK(o->arr_len == 32); @@ -16537,6 +16508,26 @@ uint64_t __attribute__((export_name("TS_CResult__u832APIErrorZ_clone"))) TS_CRe return tag_ptr(ret_conv, true); } +void __attribute__((export_name("TS_CVec_RecentPaymentDetailsZ_free"))) TS_CVec_RecentPaymentDetailsZ_free(uint64_tArray _res) { + LDKCVec_RecentPaymentDetailsZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRecentPaymentDetails), "LDKCVec_RecentPaymentDetailsZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t w = 0; w < _res_constr.datalen; w++) { + uint64_t _res_conv_22 = _res_vals[w]; + void* _res_conv_22_ptr = untag_ptr(_res_conv_22); + CHECK_ACCESS(_res_conv_22_ptr); + LDKRecentPaymentDetails _res_conv_22_conv = *(LDKRecentPaymentDetails*)(_res_conv_22_ptr); + FREE(untag_ptr(_res_conv_22)); + _res_constr.data[w] = _res_conv_22_conv; + } + FREE(_res); + CVec_RecentPaymentDetailsZ_free(_res_constr); +} + 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(); @@ -16586,6 +16577,52 @@ uint64_t __attribute__((export_name("TS_CResult_NonePaymentSendFailureZ_clone") return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_ok"))) TS_CResult_NoneRetryableSendFailureZ_ok() { + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_ok(); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_err"))) TS_CResult_NoneRetryableSendFailureZ_err(uint32_t e) { + LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_is_ok"))) TS_CResult_NoneRetryableSendFailureZ_is_ok(uint64_t o) { + LDKCResult_NoneRetryableSendFailureZ* o_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_NoneRetryableSendFailureZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_free"))) TS_CResult_NoneRetryableSendFailureZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_NoneRetryableSendFailureZ _res_conv = *(LDKCResult_NoneRetryableSendFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_NoneRetryableSendFailureZ_free(_res_conv); +} + +static inline uint64_t CResult_NoneRetryableSendFailureZ_clone_ptr(LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR arg) { + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone_ptr"))) TS_CResult_NoneRetryableSendFailureZ_clone_ptr(uint64_t arg) { + LDKCResult_NoneRetryableSendFailureZ* arg_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_NoneRetryableSendFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_NoneRetryableSendFailureZ_clone"))) TS_CResult_NoneRetryableSendFailureZ_clone(uint64_t orig) { + LDKCResult_NoneRetryableSendFailureZ* orig_conv = (LDKCResult_NoneRetryableSendFailureZ*)untag_ptr(orig); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = CResult_NoneRetryableSendFailureZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + uint64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ok"))) TS_CResult_PaymentHashPaymentSendFailureZ_ok(int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK(o->arr_len == 32); @@ -16638,6 +16675,55 @@ uint64_t __attribute__((export_name("TS_CResult_PaymentHashPaymentSendFailureZ_ return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(o->arr_len == 32); + memcpy(o_ref.data, o->elems, 32); FREE(o); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_ok(o_ref); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_err"))) TS_CResult_PaymentHashRetryableSendFailureZ_err(uint32_t e) { + LDKRetryableSendFailure e_conv = LDKRetryableSendFailure_from_js(e); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_is_ok"))) TS_CResult_PaymentHashRetryableSendFailureZ_is_ok(uint64_t o) { + LDKCResult_PaymentHashRetryableSendFailureZ* o_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(o); + jboolean ret_conv = CResult_PaymentHashRetryableSendFailureZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_free"))) TS_CResult_PaymentHashRetryableSendFailureZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentHashRetryableSendFailureZ _res_conv = *(LDKCResult_PaymentHashRetryableSendFailureZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_PaymentHashRetryableSendFailureZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentHashRetryableSendFailureZ_clone_ptr(LDKCResult_PaymentHashRetryableSendFailureZ *NONNULL_PTR arg) { + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone_ptr(uint64_t arg) { + LDKCResult_PaymentHashRetryableSendFailureZ* arg_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(arg); + int64_t ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_PaymentHashRetryableSendFailureZ_clone"))) TS_CResult_PaymentHashRetryableSendFailureZ_clone(uint64_t orig) { + LDKCResult_PaymentHashRetryableSendFailureZ* orig_conv = (LDKCResult_PaymentHashRetryableSendFailureZ*)untag_ptr(orig); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = CResult_PaymentHashRetryableSendFailureZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + static inline uint64_t C2Tuple_PaymentHashPaymentIdZ_clone_ptr(LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR arg) { LDKC2Tuple_PaymentHashPaymentIdZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentIdZ), "LDKC2Tuple_PaymentHashPaymentIdZ"); *ret_conv = C2Tuple_PaymentHashPaymentIdZ_clone(arg); @@ -17391,6 +17477,106 @@ uint64_t __attribute__((export_name("TS_CResult_ChannelConfigDecodeErrorZ_clone return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_COption_APIErrorZ_some"))) TS_COption_APIErrorZ_some(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKAPIError o_conv = *(LDKAPIError*)(o_ptr); + o_conv = APIError_clone((LDKAPIError*)untag_ptr(o)); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_some(o_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_COption_APIErrorZ_none"))) TS_COption_APIErrorZ_none() { + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_COption_APIErrorZ_free"))) TS_COption_APIErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCOption_APIErrorZ _res_conv = *(LDKCOption_APIErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + COption_APIErrorZ_free(_res_conv); +} + +static inline uint64_t COption_APIErrorZ_clone_ptr(LDKCOption_APIErrorZ *NONNULL_PTR arg) { + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_APIErrorZ_clone_ptr"))) TS_COption_APIErrorZ_clone_ptr(uint64_t arg) { + LDKCOption_APIErrorZ* arg_conv = (LDKCOption_APIErrorZ*)untag_ptr(arg); + int64_t ret_conv = COption_APIErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_APIErrorZ_clone"))) TS_COption_APIErrorZ_clone(uint64_t orig) { + LDKCOption_APIErrorZ* orig_conv = (LDKCOption_APIErrorZ*)untag_ptr(orig); + LDKCOption_APIErrorZ *ret_copy = MALLOC(sizeof(LDKCOption_APIErrorZ), "LDKCOption_APIErrorZ"); + *ret_copy = COption_APIErrorZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_ok(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKCOption_APIErrorZ o_conv = *(LDKCOption_APIErrorZ*)(o_ptr); + o_conv = COption_APIErrorZ_clone((LDKCOption_APIErrorZ*)untag_ptr(o)); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_err"))) TS_CResult_COption_APIErrorZDecodeErrorZ_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_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok"))) TS_CResult_COption_APIErrorZDecodeErrorZ_is_ok(uint64_t o) { + LDKCResult_COption_APIErrorZDecodeErrorZ* o_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_COption_APIErrorZDecodeErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_free"))) TS_CResult_COption_APIErrorZDecodeErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_COption_APIErrorZDecodeErrorZ _res_conv = *(LDKCResult_COption_APIErrorZDecodeErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_COption_APIErrorZDecodeErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR arg) { + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_COption_APIErrorZDecodeErrorZ* arg_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_COption_APIErrorZDecodeErrorZ_clone"))) TS_CResult_COption_APIErrorZDecodeErrorZ_clone(uint64_t orig) { + LDKCResult_COption_APIErrorZDecodeErrorZ* orig_conv = (LDKCResult_COption_APIErrorZDecodeErrorZ*)untag_ptr(orig); + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = CResult_COption_APIErrorZDecodeErrorZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + uint64_t __attribute__((export_name("TS_CResult_OutPointDecodeErrorZ_ok"))) TS_CResult_OutPointDecodeErrorZ_ok(uint64_t o) { LDKOutPoint o_conv; o_conv.inner = untag_ptr(o); @@ -18621,6 +18807,66 @@ uint64_t __attribute__((export_name("TS_COption_NetAddressZ_clone"))) TS_COptio return ret_ref; } +static inline uint64_t C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(LDKC2Tuple_PublicKeyCOption_NetAddressZZ *NONNULL_PTR arg) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(uint64_t arg) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* arg_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(arg); + int64_t ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_clone(uint64_t orig) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* orig_conv = (LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)untag_ptr(orig); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_clone(orig_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_new(int8_tArray a, uint64_t b) { + LDKPublicKey a_ref; + CHECK(a->arr_len == 33); + memcpy(a_ref.compressed_form, a->elems, 33); FREE(a); + void* b_ptr = untag_ptr(b); + CHECK_ACCESS(b_ptr); + LDKCOption_NetAddressZ b_conv = *(LDKCOption_NetAddressZ*)(b_ptr); + b_conv = COption_NetAddressZ_clone((LDKCOption_NetAddressZ*)untag_ptr(b)); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv = C2Tuple_PublicKeyCOption_NetAddressZZ_new(a_ref, b_conv); + return tag_ptr(ret_conv, true); +} + +void __attribute__((export_name("TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free"))) TS_C2Tuple_PublicKeyCOption_NetAddressZZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_ptr); + FREE(untag_ptr(_res)); + C2Tuple_PublicKeyCOption_NetAddressZZ_free(_res_conv); +} + +void __attribute__((export_name("TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free"))) TS_CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(uint64_tArray _res) { + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ 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_40 = _res_vals[o]; + void* _res_conv_40_ptr = untag_ptr(_res_conv_40); + CHECK_ACCESS(_res_conv_40_ptr); + LDKC2Tuple_PublicKeyCOption_NetAddressZZ _res_conv_40_conv = *(LDKC2Tuple_PublicKeyCOption_NetAddressZZ*)(_res_conv_40_ptr); + FREE(untag_ptr(_res_conv_40)); + _res_constr.data[o] = _res_conv_40_conv; + } + FREE(_res); + CVec_C2Tuple_PublicKeyCOption_NetAddressZZZ_free(_res_constr); +} + 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; @@ -18775,6 +19021,56 @@ uint64_t __attribute__((export_name("TS_CResult_boolPeerHandleErrorZ_clone"))) return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_ok(uint64_t o) { + void* o_ptr = untag_ptr(o); + CHECK_ACCESS(o_ptr); + LDKTxOut o_conv = *(LDKTxOut*)(o_ptr); + o_conv = TxOut_clone((LDKTxOut*)untag_ptr(o)); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_ok(o_conv); + return tag_ptr(ret_conv, true); +} + +uint64_t __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_err"))) TS_CResult_TxOutUtxoLookupErrorZ_err(uint32_t e) { + LDKUtxoLookupError e_conv = LDKUtxoLookupError_from_js(e); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_err(e_conv); + return tag_ptr(ret_conv, true); +} + +jboolean __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_is_ok"))) TS_CResult_TxOutUtxoLookupErrorZ_is_ok(uint64_t o) { + LDKCResult_TxOutUtxoLookupErrorZ* o_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(o); + jboolean ret_conv = CResult_TxOutUtxoLookupErrorZ_is_ok(o_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_free"))) TS_CResult_TxOutUtxoLookupErrorZ_free(uint64_t _res) { + if (!ptr_is_owned(_res)) return; + void* _res_ptr = untag_ptr(_res); + CHECK_ACCESS(_res_ptr); + LDKCResult_TxOutUtxoLookupErrorZ _res_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(_res_ptr); + FREE(untag_ptr(_res)); + CResult_TxOutUtxoLookupErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_TxOutUtxoLookupErrorZ_clone_ptr(LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR arg) { + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_clone(arg); + return tag_ptr(ret_conv, true); +} +int64_t __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr"))) TS_CResult_TxOutUtxoLookupErrorZ_clone_ptr(uint64_t arg) { + LDKCResult_TxOutUtxoLookupErrorZ* arg_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(arg); + int64_t ret_conv = CResult_TxOutUtxoLookupErrorZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_CResult_TxOutUtxoLookupErrorZ_clone"))) TS_CResult_TxOutUtxoLookupErrorZ_clone(uint64_t orig) { + LDKCResult_TxOutUtxoLookupErrorZ* orig_conv = (LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(orig); + LDKCResult_TxOutUtxoLookupErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutUtxoLookupErrorZ), "LDKCResult_TxOutUtxoLookupErrorZ"); + *ret_conv = CResult_TxOutUtxoLookupErrorZ_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(); @@ -21377,6 +21673,26 @@ uint64_t __attribute__((export_name("TS_CResult_GossipTimestampFilterDecodeErro return tag_ptr(ret_conv, true); } +void __attribute__((export_name("TS_CVec_PhantomRouteHintsZ_free"))) TS_CVec_PhantomRouteHintsZ_free(uint64_tArray _res) { + LDKCVec_PhantomRouteHintsZ _res_constr; + _res_constr.datalen = _res->arr_len; + if (_res_constr.datalen > 0) + _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + _res_constr.data = NULL; + uint64_t* _res_vals = _res->elems; + for (size_t t = 0; t < _res_constr.datalen; t++) { + uint64_t _res_conv_19 = _res_vals[t]; + LDKPhantomRouteHints _res_conv_19_conv; + _res_conv_19_conv.inner = untag_ptr(_res_conv_19); + _res_conv_19_conv.is_owned = ptr_is_owned(_res_conv_19); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_res_conv_19_conv); + _res_constr.data[t] = _res_conv_19_conv; + } + FREE(_res); + CVec_PhantomRouteHintsZ_free(_res_constr); +} + uint64_t __attribute__((export_name("TS_CResult_InvoiceSignOrCreationErrorZ_ok"))) TS_CResult_InvoiceSignOrCreationErrorZ_ok(uint64_t o) { LDKInvoice o_conv; o_conv.inner = untag_ptr(o); @@ -21661,6 +21977,13 @@ uint64_t __attribute__((export_name("TS_PaymentPurpose_spontaneous_payment"))) return ret_ref; } +jboolean __attribute__((export_name("TS_PaymentPurpose_eq"))) TS_PaymentPurpose_eq(uint64_t a, uint64_t b) { + LDKPaymentPurpose* a_conv = (LDKPaymentPurpose*)untag_ptr(a); + LDKPaymentPurpose* b_conv = (LDKPaymentPurpose*)untag_ptr(b); + jboolean ret_conv = PaymentPurpose_eq(a_conv, b_conv); + return ret_conv; +} + int8_tArray __attribute__((export_name("TS_PaymentPurpose_write"))) TS_PaymentPurpose_write(uint64_t obj) { LDKPaymentPurpose* obj_conv = (LDKPaymentPurpose*)untag_ptr(obj); LDKCVec_u8Z ret_var = PaymentPurpose_write(obj_conv); @@ -21680,6 +22003,83 @@ uint64_t __attribute__((export_name("TS_PaymentPurpose_read"))) TS_PaymentPurpo return tag_ptr(ret_conv, true); } +void __attribute__((export_name("TS_PathFailure_free"))) TS_PathFailure_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); + LDKPathFailure this_ptr_conv = *(LDKPathFailure*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + PathFailure_free(this_ptr_conv); +} + +static inline uint64_t PathFailure_clone_ptr(LDKPathFailure *NONNULL_PTR arg) { + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_PathFailure_clone_ptr"))) TS_PathFailure_clone_ptr(uint64_t arg) { + LDKPathFailure* arg_conv = (LDKPathFailure*)untag_ptr(arg); + int64_t ret_conv = PathFailure_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_PathFailure_clone"))) TS_PathFailure_clone(uint64_t orig) { + LDKPathFailure* orig_conv = (LDKPathFailure*)untag_ptr(orig); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_PathFailure_initial_send"))) TS_PathFailure_initial_send(uint64_t err) { + void* err_ptr = untag_ptr(err); + CHECK_ACCESS(err_ptr); + LDKAPIError err_conv = *(LDKAPIError*)(err_ptr); + err_conv = APIError_clone((LDKAPIError*)untag_ptr(err)); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_initial_send(err_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_PathFailure_on_path"))) TS_PathFailure_on_path(uint64_t network_update) { + void* network_update_ptr = untag_ptr(network_update); + CHECK_ACCESS(network_update_ptr); + LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr); + network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update)); + LDKPathFailure *ret_copy = MALLOC(sizeof(LDKPathFailure), "LDKPathFailure"); + *ret_copy = PathFailure_on_path(network_update_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +jboolean __attribute__((export_name("TS_PathFailure_eq"))) TS_PathFailure_eq(uint64_t a, uint64_t b) { + LDKPathFailure* a_conv = (LDKPathFailure*)untag_ptr(a); + LDKPathFailure* b_conv = (LDKPathFailure*)untag_ptr(b); + jboolean ret_conv = PathFailure_eq(a_conv, b_conv); + return ret_conv; +} + +int8_tArray __attribute__((export_name("TS_PathFailure_write"))) TS_PathFailure_write(uint64_t obj) { + LDKPathFailure* obj_conv = (LDKPathFailure*)untag_ptr(obj); + LDKCVec_u8Z ret_var = PathFailure_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_PathFailure_read"))) TS_PathFailure_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = ser->arr_len; + ser_ref.data = ser->elems; + LDKCResult_COption_PathFailureZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ), "LDKCResult_COption_PathFailureZDecodeErrorZ"); + *ret_conv = PathFailure_read(ser_ref); + FREE(ser); + return tag_ptr(ret_conv, true); +} + void __attribute__((export_name("TS_ClosureReason_free"))) TS_ClosureReason_free(uint64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -22038,17 +22438,17 @@ uint64_t __attribute__((export_name("TS_Event_payment_path_successful"))) TS_Ev return ret_ref; } -uint64_t __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, uint64_t network_update, jboolean all_paths_failed, uint64_tArray path, uint64_t short_channel_id, uint64_t retry) { +uint64_t __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_payment_path_failed(int8_tArray payment_id, int8_tArray payment_hash, jboolean payment_failed_permanently, uint64_t failure, uint64_tArray path, uint64_t short_channel_id, uint64_t retry) { LDKThirtyTwoBytes payment_id_ref; CHECK(payment_id->arr_len == 32); memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); LDKThirtyTwoBytes payment_hash_ref; CHECK(payment_hash->arr_len == 32); memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); - void* network_update_ptr = untag_ptr(network_update); - CHECK_ACCESS(network_update_ptr); - LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(network_update_ptr); - network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)untag_ptr(network_update)); + void* failure_ptr = untag_ptr(failure); + CHECK_ACCESS(failure_ptr); + LDKPathFailure failure_conv = *(LDKPathFailure*)(failure_ptr); + failure_conv = PathFailure_clone((LDKPathFailure*)untag_ptr(failure)); LDKCVec_RouteHopZ path_constr; path_constr.datalen = path->arr_len; if (path_constr.datalen > 0) @@ -22076,7 +22476,7 @@ uint64_t __attribute__((export_name("TS_Event_payment_path_failed"))) TS_Event_ CHECK_INNER_FIELD_ACCESS_OR_NULL(retry_conv); retry_conv = RouteParameters_clone(&retry_conv); LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); - *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, network_update_conv, all_paths_failed, path_constr, short_channel_id_conv, retry_conv); + *ret_copy = Event_payment_path_failed(payment_id_ref, payment_hash_ref, payment_failed_permanently, failure_conv, path_constr, short_channel_id_conv, retry_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -22290,6 +22690,13 @@ uint64_t __attribute__((export_name("TS_Event_htlchandling_failed"))) TS_Event_ return ret_ref; } +jboolean __attribute__((export_name("TS_Event_eq"))) TS_Event_eq(uint64_t a, uint64_t b) { + LDKEvent* a_conv = (LDKEvent*)untag_ptr(a); + LDKEvent* b_conv = (LDKEvent*)untag_ptr(b); + jboolean ret_conv = Event_eq(a_conv, b_conv); + return ret_conv; +} + int8_tArray __attribute__((export_name("TS_Event_write"))) TS_Event_write(uint64_t obj) { LDKEvent* obj_conv = (LDKEvent*)untag_ptr(obj); LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -22552,6 +22959,18 @@ uint64_t __attribute__((export_name("TS_MessageSendEvent_broadcast_channel_upda return ret_ref; } +uint64_t __attribute__((export_name("TS_MessageSendEvent_broadcast_node_announcement"))) TS_MessageSendEvent_broadcast_node_announcement(uint64_t msg) { + LDKNodeAnnouncement msg_conv; + msg_conv.inner = untag_ptr(msg); + msg_conv.is_owned = ptr_is_owned(msg); + CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); + msg_conv = NodeAnnouncement_clone(&msg_conv); + LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent"); + *ret_copy = MessageSendEvent_broadcast_node_announcement(msg_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_MessageSendEvent_send_channel_update"))) TS_MessageSendEvent_send_channel_update(int8_tArray node_id, uint64_t msg) { LDKPublicKey node_id_ref; CHECK(node_id->arr_len == 33); @@ -22764,6 +23183,25 @@ jboolean __attribute__((export_name("TS_APIError_eq"))) TS_APIError_eq(uint64_t return ret_conv; } +int8_tArray __attribute__((export_name("TS_APIError_write"))) TS_APIError_write(uint64_t obj) { + LDKAPIError* obj_conv = (LDKAPIError*)untag_ptr(obj); + LDKCVec_u8Z ret_var = APIError_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_APIError_read"))) TS_APIError_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = ser->arr_len; + ser_ref.data = ser->elems; + LDKCResult_COption_APIErrorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_APIErrorZDecodeErrorZ), "LDKCResult_COption_APIErrorZDecodeErrorZ"); + *ret_conv = APIError_read(ser_ref); + FREE(ser); + return tag_ptr(ret_conv, true); +} + void __attribute__((export_name("TS_BigSize_free"))) TS_BigSize_free(uint64_t this_obj) { LDKBigSize this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -22866,10 +23304,10 @@ uint64_t __attribute__((export_name("TS_sign"))) TS_sign(int8_tArray msg, int8_ LDKu8slice msg_ref; msg_ref.datalen = msg->arr_len; msg_ref.data = msg->elems; - unsigned char sk_arr[32]; + uint8_t sk_arr[32]; CHECK(sk->arr_len == 32); memcpy(sk_arr, sk->elems, 32); FREE(sk); - unsigned char (*sk_ref)[32] = &sk_arr; + uint8_t (*sk_ref)[32] = &sk_arr; LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ"); *ret_conv = sign(msg_ref, sk_ref); FREE(msg); @@ -24128,9 +24566,9 @@ jboolean __attribute__((export_name("TS_BestBlock_eq"))) TS_BestBlock_eq(uint64 return ret_conv; } -uint64_t __attribute__((export_name("TS_BestBlock_from_genesis"))) TS_BestBlock_from_genesis(uint32_t network) { +uint64_t __attribute__((export_name("TS_BestBlock_from_network"))) TS_BestBlock_from_network(uint32_t network) { LDKNetwork network_conv = LDKNetwork_from_js(network); - LDKBestBlock ret_var = BestBlock_from_genesis(network_conv); + LDKBestBlock ret_var = BestBlock_from_network(network_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); @@ -24169,31 +24607,6 @@ int32_t __attribute__((export_name("TS_BestBlock_height"))) TS_BestBlock_height return ret_conv; } -uint32_t __attribute__((export_name("TS_AccessError_clone"))) TS_AccessError_clone(uint64_t orig) { - LDKAccessError* orig_conv = (LDKAccessError*)untag_ptr(orig); - uint32_t ret_conv = LDKAccessError_to_js(AccessError_clone(orig_conv)); - return ret_conv; -} - -uint32_t __attribute__((export_name("TS_AccessError_unknown_chain"))) TS_AccessError_unknown_chain() { - uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_chain()); - return ret_conv; -} - -uint32_t __attribute__((export_name("TS_AccessError_unknown_tx"))) TS_AccessError_unknown_tx() { - uint32_t ret_conv = LDKAccessError_to_js(AccessError_unknown_tx()); - return ret_conv; -} - -void __attribute__((export_name("TS_Access_free"))) TS_Access_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); - LDKAccess this_ptr_conv = *(LDKAccess*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Access_free(this_ptr_conv); -} - void __attribute__((export_name("TS_Listen_free"))) TS_Listen_free(uint64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -25318,10 +25731,10 @@ uint64_tArray __attribute__((export_name("TS_ChannelMonitor_block_connected"))) 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; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = txdata->arr_len; if (txdata_constr.datalen > 0) @@ -25379,10 +25792,10 @@ void __attribute__((export_name("TS_ChannelMonitor_block_disconnected"))) TS_Ch 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; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -25413,10 +25826,10 @@ uint64_tArray __attribute__((export_name("TS_ChannelMonitor_transactions_confir 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; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr; txdata_constr.datalen = txdata->arr_len; if (txdata_constr.datalen > 0) @@ -25474,10 +25887,10 @@ void __attribute__((export_name("TS_ChannelMonitor_transaction_unconfirmed"))) 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; - unsigned char txid_arr[32]; + uint8_t txid_arr[32]; CHECK(txid->arr_len == 32); memcpy(txid_arr, txid->elems, 32); FREE(txid); - unsigned char (*txid_ref)[32] = &txid_arr; + uint8_t (*txid_ref)[32] = &txid_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -25508,10 +25921,10 @@ uint64_tArray __attribute__((export_name("TS_ChannelMonitor_best_block_updated" 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; - unsigned char header_arr[80]; + uint8_t header_arr[80]; CHECK(header->arr_len == 80); memcpy(header_arr, header->elems, 80); FREE(header); - unsigned char (*header_ref)[80] = &header_arr; + uint8_t (*header_ref)[80] = &header_arr; void* broadcaster_ptr = untag_ptr(broadcaster); CHECK_ACCESS(broadcaster_ptr); LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(broadcaster_ptr); @@ -25601,15 +26014,18 @@ uint64_tArray __attribute__((export_name("TS_ChannelMonitor_get_claimable_balan return ret_arr; } -uint64_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg) { +uint64_t __attribute__((export_name("TS_C2Tuple_BlockHashChannelMonitorZ_read"))) TS_C2Tuple_BlockHashChannelMonitorZ_read(int8_tArray ser, uint64_t arg_a, uint64_t arg_b) { LDKu8slice ser_ref; ser_ref.datalen = ser->arr_len; ser_ref.data = ser->elems; - void* arg_ptr = untag_ptr(arg); - if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); } - LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg_ptr; + void* arg_a_ptr = untag_ptr(arg_a); + if (ptr_is_owned(arg_a)) { CHECK_ACCESS(arg_a_ptr); } + LDKEntropySource* arg_a_conv = (LDKEntropySource*)arg_a_ptr; + void* arg_b_ptr = untag_ptr(arg_b); + if (ptr_is_owned(arg_b)) { CHECK_ACCESS(arg_b_ptr); } + LDKSignerProvider* arg_b_conv = (LDKSignerProvider*)arg_b_ptr; LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ"); - *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv); + *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_a_conv, arg_b_conv); FREE(ser); return tag_ptr(ret_conv, true); } @@ -26308,44 +26724,53 @@ uint64_t __attribute__((export_name("TS_SpendableOutputDescriptor_read"))) TS_S return tag_ptr(ret_conv, true); } -void __attribute__((export_name("TS_BaseSign_free"))) TS_BaseSign_free(uint64_t this_ptr) { +void __attribute__((export_name("TS_ChannelSigner_free"))) TS_ChannelSigner_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); - LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(this_ptr_ptr); + LDKChannelSigner this_ptr_conv = *(LDKChannelSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - BaseSign_free(this_ptr_conv); + ChannelSigner_free(this_ptr_conv); } -static inline uint64_t Sign_clone_ptr(LDKSign *NONNULL_PTR arg) { - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = Sign_clone(arg); +void __attribute__((export_name("TS_EcdsaChannelSigner_free"))) TS_EcdsaChannelSigner_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); + LDKEcdsaChannelSigner this_ptr_conv = *(LDKEcdsaChannelSigner*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + EcdsaChannelSigner_free(this_ptr_conv); +} + +static inline uint64_t WriteableEcdsaChannelSigner_clone_ptr(LDKWriteableEcdsaChannelSigner *NONNULL_PTR arg) { + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = WriteableEcdsaChannelSigner_clone(arg); return tag_ptr(ret_ret, true); } -int64_t __attribute__((export_name("TS_Sign_clone_ptr"))) TS_Sign_clone_ptr(uint64_t arg) { +int64_t __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone_ptr"))) TS_WriteableEcdsaChannelSigner_clone_ptr(uint64_t arg) { void* arg_ptr = untag_ptr(arg); if (ptr_is_owned(arg)) { CHECK_ACCESS(arg_ptr); } - LDKSign* arg_conv = (LDKSign*)arg_ptr; - int64_t ret_conv = Sign_clone_ptr(arg_conv); + LDKWriteableEcdsaChannelSigner* arg_conv = (LDKWriteableEcdsaChannelSigner*)arg_ptr; + int64_t ret_conv = WriteableEcdsaChannelSigner_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_Sign_clone"))) TS_Sign_clone(uint64_t orig) { +uint64_t __attribute__((export_name("TS_WriteableEcdsaChannelSigner_clone"))) TS_WriteableEcdsaChannelSigner_clone(uint64_t orig) { void* orig_ptr = untag_ptr(orig); if (ptr_is_owned(orig)) { CHECK_ACCESS(orig_ptr); } - LDKSign* orig_conv = (LDKSign*)orig_ptr; - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = Sign_clone(orig_conv); + LDKWriteableEcdsaChannelSigner* orig_conv = (LDKWriteableEcdsaChannelSigner*)orig_ptr; + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = WriteableEcdsaChannelSigner_clone(orig_conv); return tag_ptr(ret_ret, true); } -void __attribute__((export_name("TS_Sign_free"))) TS_Sign_free(uint64_t this_ptr) { +void __attribute__((export_name("TS_WriteableEcdsaChannelSigner_free"))) TS_WriteableEcdsaChannelSigner_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); - LDKSign this_ptr_conv = *(LDKSign*)(this_ptr_ptr); + LDKWriteableEcdsaChannelSigner this_ptr_conv = *(LDKWriteableEcdsaChannelSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - Sign_free(this_ptr_conv); + WriteableEcdsaChannelSigner_free(this_ptr_conv); } uint32_t __attribute__((export_name("TS_Recipient_clone"))) TS_Recipient_clone(uint64_t orig) { @@ -26364,13 +26789,31 @@ uint32_t __attribute__((export_name("TS_Recipient_phantom_node"))) TS_Recipient return ret_conv; } -void __attribute__((export_name("TS_KeysInterface_free"))) TS_KeysInterface_free(uint64_t this_ptr) { +void __attribute__((export_name("TS_EntropySource_free"))) TS_EntropySource_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); + LDKEntropySource this_ptr_conv = *(LDKEntropySource*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + EntropySource_free(this_ptr_conv); +} + +void __attribute__((export_name("TS_NodeSigner_free"))) TS_NodeSigner_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); - LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(this_ptr_ptr); + LDKNodeSigner this_ptr_conv = *(LDKNodeSigner*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - KeysInterface_free(this_ptr_conv); + NodeSigner_free(this_ptr_conv); +} + +void __attribute__((export_name("TS_SignerProvider_free"))) TS_SignerProvider_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); + LDKSignerProvider this_ptr_conv = *(LDKSignerProvider*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + SignerProvider_free(this_ptr_conv); } void __attribute__((export_name("TS_InMemorySigner_free"))) TS_InMemorySigner_free(uint64_t this_obj) { @@ -26549,10 +26992,7 @@ uint64_t __attribute__((export_name("TS_InMemorySigner_clone"))) TS_InMemorySig return ret_ref; } -uint64_t __attribute__((export_name("TS_InMemorySigner_new"))) TS_InMemorySigner_new(int8_tArray node_secret, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { - LDKSecretKey node_secret_ref; - CHECK(node_secret->arr_len == 32); - memcpy(node_secret_ref.bytes, node_secret->elems, 32); FREE(node_secret); +uint64_t __attribute__((export_name("TS_InMemorySigner_new"))) TS_InMemorySigner_new(int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int8_tArray channel_keys_id) { LDKSecretKey funding_key_ref; CHECK(funding_key->arr_len == 32); memcpy(funding_key_ref.bytes, funding_key->elems, 32); FREE(funding_key); @@ -26574,7 +27014,7 @@ uint64_t __attribute__((export_name("TS_InMemorySigner_new"))) TS_InMemorySigne 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); - LDKInMemorySigner ret_var = InMemorySigner_new(node_secret_ref, funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); + LDKInMemorySigner ret_var = InMemorySigner_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, channel_keys_id_ref); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -26702,25 +27142,36 @@ uint64_t __attribute__((export_name("TS_InMemorySigner_sign_dynamic_p2wsh_input return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_InMemorySigner_as_BaseSign"))) TS_InMemorySigner_as_BaseSign(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_InMemorySigner_as_ChannelSigner"))) TS_InMemorySigner_as_ChannelSigner(uint64_t this_arg) { + LDKInMemorySigner 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; + LDKChannelSigner* ret_ret = MALLOC(sizeof(LDKChannelSigner), "LDKChannelSigner"); + *ret_ret = InMemorySigner_as_ChannelSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +uint64_t __attribute__((export_name("TS_InMemorySigner_as_EcdsaChannelSigner"))) TS_InMemorySigner_as_EcdsaChannelSigner(uint64_t this_arg) { LDKInMemorySigner 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; - LDKBaseSign* ret_ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign"); - *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv); + LDKEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKEcdsaChannelSigner), "LDKEcdsaChannelSigner"); + *ret_ret = InMemorySigner_as_EcdsaChannelSigner(&this_arg_conv); return tag_ptr(ret_ret, true); } -uint64_t __attribute__((export_name("TS_InMemorySigner_as_Sign"))) TS_InMemorySigner_as_Sign(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_InMemorySigner_as_WriteableEcdsaChannelSigner"))) TS_InMemorySigner_as_WriteableEcdsaChannelSigner(uint64_t this_arg) { LDKInMemorySigner 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; - LDKSign* ret_ret = MALLOC(sizeof(LDKSign), "LDKSign"); - *ret_ret = InMemorySigner_as_Sign(&this_arg_conv); + LDKWriteableEcdsaChannelSigner* ret_ret = MALLOC(sizeof(LDKWriteableEcdsaChannelSigner), "LDKWriteableEcdsaChannelSigner"); + *ret_ret = InMemorySigner_as_WriteableEcdsaChannelSigner(&this_arg_conv); return tag_ptr(ret_ret, true); } @@ -26737,15 +27188,12 @@ int8_tArray __attribute__((export_name("TS_InMemorySigner_write"))) TS_InMemory return ret_arr; } -uint64_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser, int8_tArray arg) { +uint64_t __attribute__((export_name("TS_InMemorySigner_read"))) TS_InMemorySigner_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = ser->arr_len; ser_ref.data = ser->elems; - LDKSecretKey arg_ref; - CHECK(arg->arr_len == 32); - memcpy(arg_ref.bytes, arg->elems, 32); FREE(arg); LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ"); - *ret_conv = InMemorySigner_read(ser_ref, arg_ref); + *ret_conv = InMemorySigner_read(ser_ref); FREE(ser); return tag_ptr(ret_conv, true); } @@ -26759,10 +27207,10 @@ void __attribute__((export_name("TS_KeysManager_free"))) TS_KeysManager_free(ui } uint64_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) { - unsigned char seed_arr[32]; + uint8_t seed_arr[32]; CHECK(seed->arr_len == 32); memcpy(seed_arr, seed->elems, 32); FREE(seed); - unsigned char (*seed_ref)[32] = &seed_arr; + uint8_t (*seed_ref)[32] = &seed_arr; LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -26770,16 +27218,27 @@ uint64_t __attribute__((export_name("TS_KeysManager_new"))) TS_KeysManager_new( return ret_ref; } +int8_tArray __attribute__((export_name("TS_KeysManager_get_node_secret_key"))) TS_KeysManager_get_node_secret_key(uint64_t this_arg) { + LDKKeysManager 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; + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, KeysManager_get_node_secret_key(&this_arg_conv).bytes, 32); + return ret_arr; +} + uint64_t __attribute__((export_name("TS_KeysManager_derive_channel_keys"))) TS_KeysManager_derive_channel_keys(uint64_t this_arg, int64_t channel_value_satoshis, int8_tArray params) { LDKKeysManager 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; - unsigned char params_arr[32]; + uint8_t params_arr[32]; CHECK(params->arr_len == 32); memcpy(params_arr, params->elems, 32); FREE(params); - unsigned char (*params_ref)[32] = ¶ms_arr; + uint8_t (*params_ref)[32] = ¶ms_arr; LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -26834,14 +27293,36 @@ uint64_t __attribute__((export_name("TS_KeysManager_spend_spendable_outputs"))) return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_KeysManager_as_KeysInterface"))) TS_KeysManager_as_KeysInterface(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_KeysManager_as_EntropySource"))) TS_KeysManager_as_EntropySource(uint64_t this_arg) { + LDKKeysManager 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; + LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *ret_ret = KeysManager_as_EntropySource(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +uint64_t __attribute__((export_name("TS_KeysManager_as_NodeSigner"))) TS_KeysManager_as_NodeSigner(uint64_t this_arg) { + LDKKeysManager 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; + LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *ret_ret = KeysManager_as_NodeSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +uint64_t __attribute__((export_name("TS_KeysManager_as_SignerProvider"))) TS_KeysManager_as_SignerProvider(uint64_t this_arg) { LDKKeysManager 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; - LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv); + LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *ret_ret = KeysManager_as_SignerProvider(&this_arg_conv); return tag_ptr(ret_ret, true); } @@ -26853,26 +27334,48 @@ void __attribute__((export_name("TS_PhantomKeysManager_free"))) TS_PhantomKeysM PhantomKeysManager_free(this_obj_conv); } -uint64_t __attribute__((export_name("TS_PhantomKeysManager_as_KeysInterface"))) TS_PhantomKeysManager_as_KeysInterface(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_PhantomKeysManager_as_EntropySource"))) TS_PhantomKeysManager_as_EntropySource(uint64_t this_arg) { LDKPhantomKeysManager 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; - LDKKeysInterface* ret_ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface"); - *ret_ret = PhantomKeysManager_as_KeysInterface(&this_arg_conv); + LDKEntropySource* ret_ret = MALLOC(sizeof(LDKEntropySource), "LDKEntropySource"); + *ret_ret = PhantomKeysManager_as_EntropySource(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +uint64_t __attribute__((export_name("TS_PhantomKeysManager_as_NodeSigner"))) TS_PhantomKeysManager_as_NodeSigner(uint64_t this_arg) { + LDKPhantomKeysManager 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; + LDKNodeSigner* ret_ret = MALLOC(sizeof(LDKNodeSigner), "LDKNodeSigner"); + *ret_ret = PhantomKeysManager_as_NodeSigner(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +uint64_t __attribute__((export_name("TS_PhantomKeysManager_as_SignerProvider"))) TS_PhantomKeysManager_as_SignerProvider(uint64_t this_arg) { + LDKPhantomKeysManager 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; + LDKSignerProvider* ret_ret = MALLOC(sizeof(LDKSignerProvider), "LDKSignerProvider"); + *ret_ret = PhantomKeysManager_as_SignerProvider(&this_arg_conv); return tag_ptr(ret_ret, true); } uint64_t __attribute__((export_name("TS_PhantomKeysManager_new"))) TS_PhantomKeysManager_new(int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos, int8_tArray cross_node_seed) { - unsigned char seed_arr[32]; + uint8_t seed_arr[32]; CHECK(seed->arr_len == 32); memcpy(seed_arr, seed->elems, 32); FREE(seed); - unsigned char (*seed_ref)[32] = &seed_arr; - unsigned char cross_node_seed_arr[32]; + uint8_t (*seed_ref)[32] = &seed_arr; + uint8_t cross_node_seed_arr[32]; CHECK(cross_node_seed->arr_len == 32); memcpy(cross_node_seed_arr, cross_node_seed->elems, 32); FREE(cross_node_seed); - unsigned char (*cross_node_seed_ref)[32] = &cross_node_seed_arr; + uint8_t (*cross_node_seed_ref)[32] = &cross_node_seed_arr; LDKPhantomKeysManager ret_var = PhantomKeysManager_new(seed_ref, starting_time_secs, starting_time_nanos, cross_node_seed_ref); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -26933,10 +27436,10 @@ uint64_t __attribute__((export_name("TS_PhantomKeysManager_derive_channel_keys" 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; - unsigned char params_arr[32]; + uint8_t params_arr[32]; CHECK(params->arr_len == 32); memcpy(params_arr, params->elems, 32); FREE(params); - unsigned char (*params_ref)[32] = ¶ms_arr; + uint8_t (*params_ref)[32] = ¶ms_arr; LDKInMemorySigner ret_var = PhantomKeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -26944,6 +27447,49 @@ uint64_t __attribute__((export_name("TS_PhantomKeysManager_derive_channel_keys" return ret_ref; } +int8_tArray __attribute__((export_name("TS_PhantomKeysManager_get_node_secret_key"))) TS_PhantomKeysManager_get_node_secret_key(uint64_t this_arg) { + LDKPhantomKeysManager 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; + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, PhantomKeysManager_get_node_secret_key(&this_arg_conv).bytes, 32); + return ret_arr; +} + +int8_tArray __attribute__((export_name("TS_PhantomKeysManager_get_phantom_node_secret_key"))) TS_PhantomKeysManager_get_phantom_node_secret_key(uint64_t this_arg) { + LDKPhantomKeysManager 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; + int8_tArray ret_arr = init_int8_tArray(32, __LINE__); + memcpy(ret_arr->elems, PhantomKeysManager_get_phantom_node_secret_key(&this_arg_conv).bytes, 32); + return ret_arr; +} + +uint32_t __attribute__((export_name("TS_FailureCode_clone"))) TS_FailureCode_clone(uint64_t orig) { + LDKFailureCode* orig_conv = (LDKFailureCode*)untag_ptr(orig); + uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_clone(orig_conv)); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_FailureCode_temporary_node_failure"))) TS_FailureCode_temporary_node_failure() { + uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_temporary_node_failure()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_FailureCode_required_node_feature_missing"))) TS_FailureCode_required_node_feature_missing() { + uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_required_node_feature_missing()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_FailureCode_incorrect_or_unknown_payment_details"))) TS_FailureCode_incorrect_or_unknown_payment_details() { + uint32_t ret_conv = LDKFailureCode_to_js(FailureCode_incorrect_or_unknown_payment_details()); + return ret_conv; +} + void __attribute__((export_name("TS_ChannelManager_free"))) TS_ChannelManager_free(uint64_t this_obj) { LDKChannelManager this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -28048,125 +28594,61 @@ uint64_t __attribute__((export_name("TS_ChannelDetails_get_outbound_payment_sci return ret_ref; } -void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_free(uint64_t this_ptr) { +void __attribute__((export_name("TS_RecentPaymentDetails_free"))) TS_RecentPaymentDetails_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); - LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr); + LDKRecentPaymentDetails this_ptr_conv = *(LDKRecentPaymentDetails*)(this_ptr_ptr); FREE(untag_ptr(this_ptr)); - PaymentSendFailure_free(this_ptr_conv); + RecentPaymentDetails_free(this_ptr_conv); } -static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) { - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_clone(arg); +static inline uint64_t RecentPaymentDetails_clone_ptr(LDKRecentPaymentDetails *NONNULL_PTR arg) { + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_clone(arg); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -int64_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) { - LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg); - int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv); +int64_t __attribute__((export_name("TS_RecentPaymentDetails_clone_ptr"))) TS_RecentPaymentDetails_clone_ptr(uint64_t arg) { + LDKRecentPaymentDetails* arg_conv = (LDKRecentPaymentDetails*)untag_ptr(arg); + int64_t ret_conv = RecentPaymentDetails_clone_ptr(arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) { - LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_clone(orig_conv); +uint64_t __attribute__((export_name("TS_RecentPaymentDetails_clone"))) TS_RecentPaymentDetails_clone(uint64_t orig) { + LDKRecentPaymentDetails* orig_conv = (LDKRecentPaymentDetails*)untag_ptr(orig); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_clone(orig_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -uint64_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) { - void* a_ptr = untag_ptr(a); - CHECK_ACCESS(a_ptr); - LDKAPIError a_conv = *(LDKAPIError*)(a_ptr); - a_conv = APIError_clone((LDKAPIError*)untag_ptr(a)); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_parameter_error(a_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -uint64_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) { - LDKCVec_CResult_NoneAPIErrorZZ a_constr; - a_constr.datalen = a->arr_len; - if (a_constr.datalen > 0) - a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - a_constr.data = NULL; - uint64_t* a_vals = a->elems; - for (size_t w = 0; w < a_constr.datalen; w++) { - uint64_t a_conv_22 = a_vals[w]; - void* a_conv_22_ptr = untag_ptr(a_conv_22); - CHECK_ACCESS(a_conv_22_ptr); - LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr); - a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22)); - a_constr.data[w] = a_conv_22_conv; - } - FREE(a); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_path_parameter_error(a_constr); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -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) - a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); - else - a_constr.data = NULL; - uint64_t* a_vals = a->elems; - for (size_t k = 0; k < a_constr.datalen; k++) { - uint64_t a_conv_10 = a_vals[k]; - void* a_conv_10_ptr = untag_ptr(a_conv_10); - CHECK_ACCESS(a_conv_10_ptr); - LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr); - a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10)); - a_constr.data[k] = a_conv_10_conv; - } - FREE(a); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_all_failed_resend_safe(a_constr); +uint64_t __attribute__((export_name("TS_RecentPaymentDetails_pending"))) TS_RecentPaymentDetails_pending(int8_tArray payment_hash, int64_t total_msat) { + LDKThirtyTwoBytes payment_hash_ref; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_pending(payment_hash_ref, total_msat); 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 __attribute__((export_name("TS_RecentPaymentDetails_fulfilled"))) TS_RecentPaymentDetails_fulfilled(int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_hash_ref; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_fulfilled(payment_hash_ref); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -uint64_t __attribute__((export_name("TS_PaymentSendFailure_partial_failure"))) TS_PaymentSendFailure_partial_failure(uint64_tArray results, uint64_t failed_paths_retry, int8_tArray payment_id) { - LDKCVec_CResult_NoneAPIErrorZZ results_constr; - results_constr.datalen = results->arr_len; - if (results_constr.datalen > 0) - results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); - else - results_constr.data = NULL; - uint64_t* results_vals = results->elems; - for (size_t w = 0; w < results_constr.datalen; w++) { - uint64_t results_conv_22 = results_vals[w]; - void* results_conv_22_ptr = untag_ptr(results_conv_22); - CHECK_ACCESS(results_conv_22_ptr); - LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr); - results_constr.data[w] = results_conv_22_conv; - } - FREE(results); - LDKRouteParameters failed_paths_retry_conv; - failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry); - failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry); - CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv); - failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv); - LDKThirtyTwoBytes payment_id_ref; - CHECK(payment_id->arr_len == 32); - memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); - LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); - *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref); +uint64_t __attribute__((export_name("TS_RecentPaymentDetails_abandoned"))) TS_RecentPaymentDetails_abandoned(int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_hash_ref; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKRecentPaymentDetails *ret_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_copy = RecentPaymentDetails_abandoned(payment_hash_ref); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } @@ -28327,7 +28809,7 @@ uint64_t __attribute__((export_name("TS_PhantomRouteHints_clone"))) TS_PhantomR return ret_ref; } -uint64_t __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManager_new(uint64_t fee_est, uint64_t chain_monitor, uint64_t tx_broadcaster, uint64_t logger, uint64_t keys_manager, uint64_t config, uint64_t params) { +uint64_t __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManager_new(uint64_t fee_est, uint64_t chain_monitor, uint64_t tx_broadcaster, uint64_t router, uint64_t logger, uint64_t entropy_source, uint64_t node_signer, uint64_t signer_provider, uint64_t config, uint64_t params) { void* fee_est_ptr = untag_ptr(fee_est); CHECK_ACCESS(fee_est_ptr); LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(fee_est_ptr); @@ -28349,6 +28831,13 @@ uint64_t __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManage // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv); } + void* router_ptr = untag_ptr(router); + CHECK_ACCESS(router_ptr); + LDKRouter router_conv = *(LDKRouter*)(router_ptr); + if (router_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&router_conv); + } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -28356,12 +28845,26 @@ uint64_t __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManage // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - 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) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + void* signer_provider_ptr = untag_ptr(signer_provider); + CHECK_ACCESS(signer_provider_ptr); + LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr); + if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKSignerProvider_JCalls_cloned(&signer_provider_conv); } LDKUserConfig config_conv; config_conv.inner = untag_ptr(config); @@ -28373,7 +28876,7 @@ uint64_t __attribute__((export_name("TS_ChannelManager_new"))) TS_ChannelManage params_conv.is_owned = ptr_is_owned(params); CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); params_conv = ChainParameters_clone(¶ms_conv); - LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv); + LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, entropy_source_conv, node_signer_conv, signer_provider_conv, config_conv, params_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); @@ -28459,16 +28962,37 @@ uint64_tArray __attribute__((export_name("TS_ChannelManager_list_usable_channel return ret_arr; } +uint64_tArray __attribute__((export_name("TS_ChannelManager_list_recent_payments"))) TS_ChannelManager_list_recent_payments(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; + LDKCVec_RecentPaymentDetailsZ ret_var = ChannelManager_list_recent_payments(&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 w = 0; w < ret_var.datalen; w++) { + LDKRecentPaymentDetails *ret_conv_22_copy = MALLOC(sizeof(LDKRecentPaymentDetails), "LDKRecentPaymentDetails"); + *ret_conv_22_copy = ret_var.data[w]; + uint64_t ret_conv_22_ref = tag_ptr(ret_conv_22_copy, true); + ret_arr_ptr[w] = ret_conv_22_ref; + } + + FREE(ret_var.data); + return ret_arr; +} + uint64_t __attribute__((export_name("TS_ChannelManager_close_channel"))) TS_ChannelManager_close_channel(uint64_t this_arg, int8_tArray channel_id, int8_tArray counterparty_node_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; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK(channel_id->arr_len == 32); memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; 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); @@ -28483,10 +29007,10 @@ uint64_t __attribute__((export_name("TS_ChannelManager_close_channel_with_targe 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; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK(channel_id->arr_len == 32); memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; 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); @@ -28501,10 +29025,10 @@ uint64_t __attribute__((export_name("TS_ChannelManager_force_close_broadcasting 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; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK(channel_id->arr_len == 32); memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; 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); @@ -28519,10 +29043,10 @@ uint64_t __attribute__((export_name("TS_ChannelManager_force_close_without_broa 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; - unsigned char channel_id_arr[32]; + uint8_t channel_id_arr[32]; CHECK(channel_id->arr_len == 32); memcpy(channel_id_arr, channel_id->elems, 32); FREE(channel_id); - unsigned char (*channel_id_ref)[32] = &channel_id_arr; + uint8_t (*channel_id_ref)[32] = &channel_id_arr; 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); @@ -28574,22 +29098,32 @@ uint64_t __attribute__((export_name("TS_ChannelManager_send_payment"))) TS_Chan return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_ChannelManager_retry_payment"))) TS_ChannelManager_retry_payment(uint64_t this_arg, uint64_t route, int8_tArray payment_id) { +uint64_t __attribute__((export_name("TS_ChannelManager_send_payment_with_retry"))) TS_ChannelManager_send_payment_with_retry(uint64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) { 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; - 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 = ChannelManager_retry_payment(&this_arg_conv, &route_conv, payment_id_ref); + 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 = RouteParameters_clone(&route_params_conv); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKCResult_NoneRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneRetryableSendFailureZ), "LDKCResult_NoneRetryableSendFailureZ"); + *ret_conv = ChannelManager_send_payment_with_retry(&this_arg_conv, payment_hash_ref, payment_secret_ref, payment_id_ref, route_params_conv, retry_strategy_conv); return tag_ptr(ret_conv, true); } @@ -28627,6 +29161,32 @@ uint64_t __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_ChannelManager_send_spontaneous_payment_with_retry"))) TS_ChannelManager_send_spontaneous_payment_with_retry(uint64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_id, uint64_t route_params, uint64_t retry_strategy) { + 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 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); + 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 = RouteParameters_clone(&route_params_conv); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + LDKCResult_PaymentHashRetryableSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashRetryableSendFailureZ), "LDKCResult_PaymentHashRetryableSendFailureZ"); + *ret_conv = ChannelManager_send_spontaneous_payment_with_retry(&this_arg_conv, payment_preimage_ref, payment_id_ref, route_params_conv, retry_strategy_conv); + return tag_ptr(ret_conv, true); +} + uint64_t __attribute__((export_name("TS_ChannelManager_send_probe"))) TS_ChannelManager_send_probe(uint64_t this_arg, uint64_tArray hops) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -28661,10 +29221,10 @@ uint64_t __attribute__((export_name("TS_ChannelManager_funding_transaction_gene 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; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK(temporary_channel_id->arr_len == 32); memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; 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); @@ -28712,7 +29272,7 @@ 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) { +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); @@ -28721,15 +29281,15 @@ uint64_t __attribute__((export_name("TS_ChannelManager_forward_intercepted_htlc 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]; + uint8_t 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); + uint8_t (*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); + *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); } @@ -28771,13 +29331,27 @@ void __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards"))) TS_C 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; - unsigned char payment_hash_arr[32]; + uint8_t 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; + uint8_t (*payment_hash_ref)[32] = &payment_hash_arr; ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref); } +void __attribute__((export_name("TS_ChannelManager_fail_htlc_backwards_with_reason"))) TS_ChannelManager_fail_htlc_backwards_with_reason(uint64_t this_arg, int8_tArray payment_hash, uint32_t failure_code) { + 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; + uint8_t payment_hash_arr[32]; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_arr, payment_hash->elems, 32); FREE(payment_hash); + uint8_t (*payment_hash_ref)[32] = &payment_hash_arr; + LDKFailureCode failure_code_conv = LDKFailureCode_from_js(failure_code); + ChannelManager_fail_htlc_backwards_with_reason(&this_arg_conv, payment_hash_ref, failure_code_conv); +} + void __attribute__((export_name("TS_ChannelManager_claim_funds"))) TS_ChannelManager_claim_funds(uint64_t this_arg, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -28807,10 +29381,10 @@ uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel") 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; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK(temporary_channel_id->arr_len == 32); memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; 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); @@ -28828,10 +29402,10 @@ uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_f 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; - unsigned char temporary_channel_id_arr[32]; + uint8_t temporary_channel_id_arr[32]; CHECK(temporary_channel_id->arr_len == 32); memcpy(temporary_channel_id_arr, temporary_channel_id->elems, 32); FREE(temporary_channel_id); - unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; + uint8_t (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr; 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); @@ -28843,7 +29417,7 @@ uint64_t __attribute__((export_name("TS_ChannelManager_accept_inbound_channel_f return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment"))) TS_ChannelManager_create_inbound_payment(uint64_t this_arg, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs) { +uint64_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment"))) TS_ChannelManager_create_inbound_payment(uint64_t this_arg, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs, uint64_t min_final_cltv_expiry_delta) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -28853,8 +29427,12 @@ uint64_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment") CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); - *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } @@ -28873,7 +29451,7 @@ uint64_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_l return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash"))) TS_ChannelManager_create_inbound_payment_for_hash(uint64_t this_arg, int8_tArray payment_hash, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs) { +uint64_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_for_hash"))) TS_ChannelManager_create_inbound_payment_for_hash(uint64_t this_arg, int8_tArray payment_hash, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs, uint64_t min_final_cltv_expiry) { LDKChannelManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -28886,8 +29464,12 @@ uint64_t __attribute__((export_name("TS_ChannelManager_create_inbound_payment_f CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); + void* min_final_cltv_expiry_ptr = untag_ptr(min_final_cltv_expiry); + CHECK_ACCESS(min_final_cltv_expiry_ptr); + LDKCOption_u16Z min_final_cltv_expiry_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_ptr); + min_final_cltv_expiry_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry)); LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); - *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, min_final_cltv_expiry_conv); return tag_ptr(ret_conv, true); } @@ -29051,35 +29633,76 @@ uint64_t __attribute__((export_name("TS_ChannelManager_current_best_block"))) T return ret_ref; } -uint64_t __attribute__((export_name("TS_ChannelManager_as_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_ChannelManager_node_features"))) TS_ChannelManager_node_features(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; - LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); - *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv); - return tag_ptr(ret_ret, true); + LDKNodeFeatures ret_var = ChannelManager_node_features(&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_provided_node_features"))) TS_provided_node_features() { - LDKNodeFeatures ret_var = provided_node_features(); +uint64_t __attribute__((export_name("TS_ChannelManager_channel_features"))) TS_ChannelManager_channel_features(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; + LDKChannelFeatures ret_var = ChannelManager_channel_features(&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_provided_channel_features"))) TS_provided_channel_features() { - LDKChannelFeatures ret_var = provided_channel_features(); +uint64_t __attribute__((export_name("TS_ChannelManager_channel_type_features"))) TS_ChannelManager_channel_type_features(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; + LDKChannelTypeFeatures ret_var = ChannelManager_channel_type_features(&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_provided_init_features"))) TS_provided_init_features() { - LDKInitFeatures ret_var = provided_init_features(); +uint64_t __attribute__((export_name("TS_ChannelManager_init_features"))) TS_ChannelManager_init_features(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; + LDKInitFeatures ret_var = ChannelManager_init_features(&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_ChannelMessageHandler"))) TS_ChannelManager_as_ChannelMessageHandler(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; + LDKChannelMessageHandler* ret_ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler"); + *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv); + return tag_ptr(ret_ret, true); +} + +uint64_t __attribute__((export_name("TS_provided_init_features"))) TS_provided_init_features(uint64_t _config) { + LDKUserConfig _config_conv; + _config_conv.inner = untag_ptr(_config); + _config_conv.is_owned = ptr_is_owned(_config); + CHECK_INNER_FIELD_ACCESS_OR_NULL(_config_conv); + _config_conv.is_owned = false; + LDKInitFeatures ret_var = provided_init_features(&_config_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); @@ -29199,18 +29822,18 @@ void __attribute__((export_name("TS_ChannelManagerReadArgs_free"))) TS_ChannelM ChannelManagerReadArgs_free(this_obj_conv); } -uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_keys_manager"))) TS_ChannelManagerReadArgs_get_keys_manager(uint64_t this_ptr) { +uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_entropy_source"))) TS_ChannelManagerReadArgs_get_entropy_source(uint64_t this_ptr) { LDKChannelManagerReadArgs 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; // WARNING: This object doesn't live past this scope, needs clone! - uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv), false); + uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_entropy_source(&this_ptr_conv), false); return ret_ret; } -void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) TS_ChannelManagerReadArgs_set_keys_manager(uint64_t this_ptr, uint64_t val) { +void __attribute__((export_name("TS_ChannelManagerReadArgs_set_entropy_source"))) TS_ChannelManagerReadArgs_set_entropy_source(uint64_t this_ptr, uint64_t val) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); this_ptr_conv.is_owned = ptr_is_owned(this_ptr); @@ -29218,12 +29841,66 @@ void __attribute__((export_name("TS_ChannelManagerReadArgs_set_keys_manager"))) this_ptr_conv.is_owned = false; void* val_ptr = untag_ptr(val); CHECK_ACCESS(val_ptr); - LDKKeysInterface val_conv = *(LDKKeysInterface*)(val_ptr); - if (val_conv.free == LDKKeysInterface_JCalls_free) { + LDKEntropySource val_conv = *(LDKEntropySource*)(val_ptr); + if (val_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&val_conv); + LDKEntropySource_JCalls_cloned(&val_conv); } - ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv); + ChannelManagerReadArgs_set_entropy_source(&this_ptr_conv, val_conv); +} + +uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_node_signer"))) TS_ChannelManagerReadArgs_get_node_signer(uint64_t this_ptr) { + LDKChannelManagerReadArgs 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; + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_node_signer(&this_ptr_conv), false); + return ret_ret; +} + +void __attribute__((export_name("TS_ChannelManagerReadArgs_set_node_signer"))) TS_ChannelManagerReadArgs_set_node_signer(uint64_t this_ptr, uint64_t val) { + LDKChannelManagerReadArgs 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); + LDKNodeSigner val_conv = *(LDKNodeSigner*)(val_ptr); + if (val_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_node_signer(&this_ptr_conv, val_conv); +} + +uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_signer_provider"))) TS_ChannelManagerReadArgs_get_signer_provider(uint64_t this_ptr) { + LDKChannelManagerReadArgs 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; + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_signer_provider(&this_ptr_conv), false); + return ret_ret; +} + +void __attribute__((export_name("TS_ChannelManagerReadArgs_set_signer_provider"))) TS_ChannelManagerReadArgs_set_signer_provider(uint64_t this_ptr, uint64_t val) { + LDKChannelManagerReadArgs 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); + LDKSignerProvider val_conv = *(LDKSignerProvider*)(val_ptr); + if (val_conv.free == LDKSignerProvider_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKSignerProvider_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_signer_provider(&this_ptr_conv, val_conv); } uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_fee_estimator"))) TS_ChannelManagerReadArgs_get_fee_estimator(uint64_t this_ptr) { @@ -29307,6 +29984,33 @@ void __attribute__((export_name("TS_ChannelManagerReadArgs_set_tx_broadcaster") ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv); } +uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_router"))) TS_ChannelManagerReadArgs_get_router(uint64_t this_ptr) { + LDKChannelManagerReadArgs 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; + // WARNING: This object doesn't live past this scope, needs clone! + uint64_t ret_ret = tag_ptr(ChannelManagerReadArgs_get_router(&this_ptr_conv), false); + return ret_ret; +} + +void __attribute__((export_name("TS_ChannelManagerReadArgs_set_router"))) TS_ChannelManagerReadArgs_set_router(uint64_t this_ptr, uint64_t val) { + LDKChannelManagerReadArgs 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); + LDKRouter val_conv = *(LDKRouter*)(val_ptr); + if (val_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&val_conv); + } + ChannelManagerReadArgs_set_router(&this_ptr_conv, val_conv); +} + uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_get_logger"))) TS_ChannelManagerReadArgs_get_logger(uint64_t this_ptr) { LDKChannelManagerReadArgs this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); @@ -29361,13 +30065,27 @@ void __attribute__((export_name("TS_ChannelManagerReadArgs_set_default_config") ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv); } -uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_ChannelManagerReadArgs_new(uint64_t keys_manager, uint64_t fee_estimator, uint64_t chain_monitor, uint64_t tx_broadcaster, uint64_t logger, uint64_t default_config, uint64_tArray channel_monitors) { - 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) { +uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_ChannelManagerReadArgs_new(uint64_t entropy_source, uint64_t node_signer, uint64_t signer_provider, uint64_t fee_estimator, uint64_t chain_monitor, uint64_t tx_broadcaster, uint64_t router, uint64_t logger, uint64_t default_config, uint64_tArray channel_monitors) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + void* signer_provider_ptr = untag_ptr(signer_provider); + CHECK_ACCESS(signer_provider_ptr); + LDKSignerProvider signer_provider_conv = *(LDKSignerProvider*)(signer_provider_ptr); + if (signer_provider_conv.free == LDKSignerProvider_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKSignerProvider_JCalls_cloned(&signer_provider_conv); } void* fee_estimator_ptr = untag_ptr(fee_estimator); CHECK_ACCESS(fee_estimator_ptr); @@ -29390,6 +30108,13 @@ uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_Chann // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv); } + void* router_ptr = untag_ptr(router); + CHECK_ACCESS(router_ptr); + LDKRouter router_conv = *(LDKRouter*)(router_ptr); + if (router_conv.free == LDKRouter_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKRouter_JCalls_cloned(&router_conv); + } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -29419,7 +30144,7 @@ uint64_t __attribute__((export_name("TS_ChannelManagerReadArgs_new"))) TS_Chann channel_monitors_constr.data[q] = channel_monitors_conv_16_conv; } FREE(channel_monitors); - LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr); + LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(entropy_source_conv, node_signer_conv, signer_provider_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, router_conv, logger_conv, default_config_conv, channel_monitors_constr); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -29451,10 +30176,10 @@ void __attribute__((export_name("TS_ExpandedKey_free"))) TS_ExpandedKey_free(ui } uint64_t __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new(int8_tArray key_material) { - unsigned char key_material_arr[32]; + uint8_t key_material_arr[32]; CHECK(key_material->arr_len == 32); memcpy(key_material_arr, key_material->elems, 32); FREE(key_material); - unsigned char (*key_material_ref)[32] = &key_material_arr; + uint8_t (*key_material_ref)[32] = &key_material_arr; LDKExpandedKey ret_var = ExpandedKey_new(key_material_ref); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -29462,7 +30187,7 @@ uint64_t __attribute__((export_name("TS_ExpandedKey_new"))) TS_ExpandedKey_new( return ret_ref; } -uint64_t __attribute__((export_name("TS_create"))) TS_create(uint64_t keys, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs, uint64_t keys_manager, int64_t current_time) { +uint64_t __attribute__((export_name("TS_create"))) TS_create(uint64_t keys, uint64_t min_value_msat, int32_t invoice_expiry_delta_secs, uint64_t entropy_source, int64_t current_time, uint64_t min_final_cltv_expiry_delta) { LDKExpandedKey keys_conv; keys_conv.inner = untag_ptr(keys); keys_conv.is_owned = ptr_is_owned(keys); @@ -29472,15 +30197,19 @@ uint64_t __attribute__((export_name("TS_create"))) TS_create(uint64_t keys, uin CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(min_value_msat)); - 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; + void* entropy_source_ptr = untag_ptr(entropy_source); + if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); } + LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr; + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); - *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, keys_manager_conv, current_time); + *ret_conv = create(&keys_conv, min_value_msat_conv, invoice_expiry_delta_secs, entropy_source_conv, current_time, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_create_from_hash"))) TS_create_from_hash(uint64_t keys, uint64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time) { +uint64_t __attribute__((export_name("TS_create_from_hash"))) TS_create_from_hash(uint64_t keys, uint64_t min_value_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, int64_t current_time, uint64_t min_final_cltv_expiry_delta) { LDKExpandedKey keys_conv; keys_conv.inner = untag_ptr(keys); keys_conv.is_owned = ptr_is_owned(keys); @@ -29493,8 +30222,12 @@ uint64_t __attribute__((export_name("TS_create_from_hash"))) TS_create_from_has LDKThirtyTwoBytes payment_hash_ref; CHECK(payment_hash->arr_len == 32); memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); - *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time); + *ret_conv = create_from_hash(&keys_conv, min_value_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } @@ -33206,6 +33939,80 @@ uint64_t __attribute__((export_name("TS_NetAddress_read"))) TS_NetAddress_read( return tag_ptr(ret_conv, true); } +void __attribute__((export_name("TS_UnsignedGossipMessage_free"))) TS_UnsignedGossipMessage_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); + LDKUnsignedGossipMessage this_ptr_conv = *(LDKUnsignedGossipMessage*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UnsignedGossipMessage_free(this_ptr_conv); +} + +static inline uint64_t UnsignedGossipMessage_clone_ptr(LDKUnsignedGossipMessage *NONNULL_PTR arg) { + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_UnsignedGossipMessage_clone_ptr"))) TS_UnsignedGossipMessage_clone_ptr(uint64_t arg) { + LDKUnsignedGossipMessage* arg_conv = (LDKUnsignedGossipMessage*)untag_ptr(arg); + int64_t ret_conv = UnsignedGossipMessage_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_UnsignedGossipMessage_clone"))) TS_UnsignedGossipMessage_clone(uint64_t orig) { + LDKUnsignedGossipMessage* orig_conv = (LDKUnsignedGossipMessage*)untag_ptr(orig); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_UnsignedGossipMessage_channel_announcement"))) TS_UnsignedGossipMessage_channel_announcement(uint64_t a) { + LDKUnsignedChannelAnnouncement 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 = UnsignedChannelAnnouncement_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_channel_announcement(a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_UnsignedGossipMessage_channel_update"))) TS_UnsignedGossipMessage_channel_update(uint64_t a) { + LDKUnsignedChannelUpdate 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 = UnsignedChannelUpdate_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_channel_update(a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_UnsignedGossipMessage_node_announcement"))) TS_UnsignedGossipMessage_node_announcement(uint64_t a) { + LDKUnsignedNodeAnnouncement 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 = UnsignedNodeAnnouncement_clone(&a_conv); + LDKUnsignedGossipMessage *ret_copy = MALLOC(sizeof(LDKUnsignedGossipMessage), "LDKUnsignedGossipMessage"); + *ret_copy = UnsignedGossipMessage_node_announcement(a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +int8_tArray __attribute__((export_name("TS_UnsignedGossipMessage_write"))) TS_UnsignedGossipMessage_write(uint64_t obj) { + LDKUnsignedGossipMessage* obj_conv = (LDKUnsignedGossipMessage*)untag_ptr(obj); + LDKCVec_u8Z ret_var = UnsignedGossipMessage_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; +} + void __attribute__((export_name("TS_UnsignedNodeAnnouncement_free"))) TS_UnsignedNodeAnnouncement_free(uint64_t this_obj) { LDKUnsignedNodeAnnouncement this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -33260,27 +34067,31 @@ void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_timestamp"))) UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val); } -int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) { +uint64_t __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_node_id"))) TS_UnsignedNodeAnnouncement_get_node_id(uint64_t this_ptr) { LDKUnsignedNodeAnnouncement 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; - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form, 33); - return ret_arr; + LDKNodeId ret_var = UnsignedNodeAnnouncement_get_node_id(&this_ptr_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_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, int8_tArray val) { +void __attribute__((export_name("TS_UnsignedNodeAnnouncement_set_node_id"))) TS_UnsignedNodeAnnouncement_set_node_id(uint64_t this_ptr, uint64_t val) { LDKUnsignedNodeAnnouncement 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; - LDKPublicKey val_ref; - CHECK(val->arr_len == 33); - memcpy(val_ref.compressed_form, val->elems, 33); FREE(val); - UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_conv); } int8_tArray __attribute__((export_name("TS_UnsignedNodeAnnouncement_get_rgb"))) TS_UnsignedNodeAnnouncement_get_rgb(uint64_t this_ptr) { @@ -33616,96 +34427,112 @@ void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_short_chann UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val); } -int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) { +uint64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_1"))) TS_UnsignedChannelAnnouncement_get_node_id_1(uint64_t this_ptr) { LDKUnsignedChannelAnnouncement 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; - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form, 33); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_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_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, int8_tArray val) { +void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_1"))) TS_UnsignedChannelAnnouncement_set_node_id_1(uint64_t this_ptr, uint64_t val) { LDKUnsignedChannelAnnouncement 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; - LDKPublicKey val_ref; - CHECK(val->arr_len == 33); - memcpy(val_ref.compressed_form, val->elems, 33); FREE(val); - UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_conv); } -int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) { +uint64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_node_id_2"))) TS_UnsignedChannelAnnouncement_get_node_id_2(uint64_t this_ptr) { LDKUnsignedChannelAnnouncement 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; - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form, 33); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_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_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, int8_tArray val) { +void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_node_id_2"))) TS_UnsignedChannelAnnouncement_set_node_id_2(uint64_t this_ptr, uint64_t val) { LDKUnsignedChannelAnnouncement 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; - LDKPublicKey val_ref; - CHECK(val->arr_len == 33); - memcpy(val_ref.compressed_form, val->elems, 33); FREE(val); - UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_conv); } -int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) { +uint64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_1(uint64_t this_ptr) { LDKUnsignedChannelAnnouncement 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; - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form, 33); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_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_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, int8_tArray val) { +void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_1"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_1(uint64_t this_ptr, uint64_t val) { LDKUnsignedChannelAnnouncement 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; - LDKPublicKey val_ref; - CHECK(val->arr_len == 33); - memcpy(val_ref.compressed_form, val->elems, 33); FREE(val); - UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_conv); } -int8_tArray __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) { +uint64_t __attribute__((export_name("TS_UnsignedChannelAnnouncement_get_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_get_bitcoin_key_2(uint64_t this_ptr) { LDKUnsignedChannelAnnouncement 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; - int8_tArray ret_arr = init_int8_tArray(33, __LINE__); - memcpy(ret_arr->elems, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form, 33); - return ret_arr; + LDKNodeId ret_var = UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_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_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, int8_tArray val) { +void __attribute__((export_name("TS_UnsignedChannelAnnouncement_set_bitcoin_key_2"))) TS_UnsignedChannelAnnouncement_set_bitcoin_key_2(uint64_t this_ptr, uint64_t val) { LDKUnsignedChannelAnnouncement 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; - LDKPublicKey val_ref; - CHECK(val->arr_len == 33); - memcpy(val_ref.compressed_form, val->elems, 33); FREE(val); - UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref); + LDKNodeId val_conv; + val_conv.inner = untag_ptr(val); + val_conv.is_owned = ptr_is_owned(val); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = NodeId_clone(&val_conv); + UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_conv); } static inline uint64_t UnsignedChannelAnnouncement_clone_ptr(LDKUnsignedChannelAnnouncement *NONNULL_PTR arg) { @@ -36716,27 +37543,8 @@ void __attribute__((export_name("TS_PeerHandleError_free"))) TS_PeerHandleError PeerHandleError_free(this_obj_conv); } -jboolean __attribute__((export_name("TS_PeerHandleError_get_no_connection_possible"))) TS_PeerHandleError_get_no_connection_possible(uint64_t this_ptr) { - LDKPeerHandleError 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 = PeerHandleError_get_no_connection_possible(&this_ptr_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_PeerHandleError_set_no_connection_possible"))) TS_PeerHandleError_set_no_connection_possible(uint64_t this_ptr, jboolean val) { - LDKPeerHandleError 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; - PeerHandleError_set_no_connection_possible(&this_ptr_conv, val); -} - -uint64_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new(jboolean no_connection_possible_arg) { - LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg); +uint64_t __attribute__((export_name("TS_PeerHandleError_new"))) TS_PeerHandleError_new() { + LDKPeerHandleError ret_var = PeerHandleError_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); @@ -36781,20 +37589,17 @@ void __attribute__((export_name("TS_PeerManager_free"))) TS_PeerManager_free(ui PeerManager_free(this_obj_conv); } -uint64_t __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint64_t message_handler, int8_tArray our_node_secret, int32_t current_time, int8_tArray ephemeral_random_data, uint64_t logger, uint64_t custom_message_handler) { +uint64_t __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new(uint64_t message_handler, int32_t current_time, int8_tArray ephemeral_random_data, uint64_t logger, uint64_t custom_message_handler, uint64_t node_signer) { LDKMessageHandler message_handler_conv; message_handler_conv.inner = untag_ptr(message_handler); message_handler_conv.is_owned = ptr_is_owned(message_handler); CHECK_INNER_FIELD_ACCESS_OR_NULL(message_handler_conv); // WARNING: we need a move here but no clone is available for LDKMessageHandler - LDKSecretKey our_node_secret_ref; - CHECK(our_node_secret->arr_len == 32); - memcpy(our_node_secret_ref.bytes, our_node_secret->elems, 32); FREE(our_node_secret); - unsigned char ephemeral_random_data_arr[32]; + uint8_t ephemeral_random_data_arr[32]; CHECK(ephemeral_random_data->arr_len == 32); memcpy(ephemeral_random_data_arr, ephemeral_random_data->elems, 32); FREE(ephemeral_random_data); - unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr; + uint8_t (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr; void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -36809,27 +37614,34 @@ uint64_t __attribute__((export_name("TS_PeerManager_new"))) TS_PeerManager_new( // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv); } - LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv); + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + LDKPeerManager ret_var = PeerManager_new(message_handler_conv, current_time, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv, node_signer_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; } -ptrArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) { +uint64_tArray __attribute__((export_name("TS_PeerManager_get_peer_node_ids"))) TS_PeerManager_get_peer_node_ids(uint64_t this_arg) { LDKPeerManager 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_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&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(33, __LINE__); - memcpy(ret_conv_12_arr->elems, ret_var.data[m].compressed_form, 33); - ret_arr_ptr[m] = ret_conv_12_arr; + LDKCVec_C2Tuple_PublicKeyCOption_NetAddressZZZ ret_var = PeerManager_get_peer_node_ids(&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 o = 0; o < ret_var.datalen; o++) { + LDKC2Tuple_PublicKeyCOption_NetAddressZZ* ret_conv_40_conv = MALLOC(sizeof(LDKC2Tuple_PublicKeyCOption_NetAddressZZ), "LDKC2Tuple_PublicKeyCOption_NetAddressZZ"); + *ret_conv_40_conv = ret_var.data[o]; + ret_arr_ptr[o] = tag_ptr(ret_conv_40_conv, true); } FREE(ret_var.data); @@ -36934,7 +37746,7 @@ void __attribute__((export_name("TS_PeerManager_socket_disconnected"))) TS_Peer PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv); } -void __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) { +void __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_PeerManager_disconnect_by_node_id(uint64_t this_arg, int8_tArray node_id) { LDKPeerManager this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -36943,7 +37755,7 @@ void __attribute__((export_name("TS_PeerManager_disconnect_by_node_id"))) TS_Pe LDKPublicKey node_id_ref; CHECK(node_id->arr_len == 33); memcpy(node_id_ref.compressed_form, node_id->elems, 33); FREE(node_id); - PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible); + PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref); } void __attribute__((export_name("TS_PeerManager_disconnect_all_peers"))) TS_PeerManager_disconnect_all_peers(uint64_t this_arg) { @@ -37055,10 +37867,10 @@ uint64_t __attribute__((export_name("TS_HTLCClaim_from_witness"))) TS_HTLCClaim } 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]; + uint8_t commitment_seed_arr[32]; CHECK(commitment_seed->arr_len == 32); memcpy(commitment_seed_arr, commitment_seed->elems, 32); FREE(commitment_seed); - unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr; + uint8_t (*commitment_seed_ref)[32] = &commitment_seed_arr; int8_tArray ret_arr = init_int8_tArray(32, __LINE__); memcpy(ret_arr->elems, build_commitment_secret(commitment_seed_ref, idx).data, 32); return ret_arr; @@ -37193,10 +38005,10 @@ int8_tArray __attribute__((export_name("TS_derive_private_key"))) TS_derive_pri 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); - unsigned char base_secret_arr[32]; + uint8_t base_secret_arr[32]; 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; + uint8_t (*base_secret_ref)[32] = &base_secret_arr; 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; @@ -37215,14 +38027,14 @@ int8_tArray __attribute__((export_name("TS_derive_public_key"))) TS_derive_publ } 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]; + uint8_t 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); - unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr; - unsigned char countersignatory_revocation_base_secret_arr[32]; + uint8_t (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr; + uint8_t countersignatory_revocation_base_secret_arr[32]; 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; + uint8_t (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr; 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; @@ -37955,10 +38767,10 @@ int8_tArray __attribute__((export_name("TS_make_funding_redeemscript"))) TS_mak } 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]; + uint8_t commitment_txid_arr[32]; CHECK(commitment_txid->arr_len == 32); memcpy(commitment_txid_arr, commitment_txid->elems, 32); FREE(commitment_txid); - unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr; + uint8_t (*commitment_txid_ref)[32] = &commitment_txid_arr; LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = untag_ptr(htlc); htlc_conv.is_owned = ptr_is_owned(htlc); @@ -38825,10 +39637,10 @@ int8_tArray __attribute__((export_name("TS_BuiltCommitmentTransaction_sign"))) 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; - unsigned char funding_key_arr[32]; + uint8_t funding_key_arr[32]; CHECK(funding_key->arr_len == 32); memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key); - unsigned char (*funding_key_ref)[32] = &funding_key_arr; + uint8_t (*funding_key_ref)[32] = &funding_key_arr; LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = funding_redeemscript->arr_len; funding_redeemscript_ref.data = funding_redeemscript->elems; @@ -39037,10 +39849,10 @@ int8_tArray __attribute__((export_name("TS_TrustedClosingTransaction_sign"))) T 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; - unsigned char funding_key_arr[32]; + uint8_t funding_key_arr[32]; CHECK(funding_key->arr_len == 32); memcpy(funding_key_arr, funding_key->elems, 32); FREE(funding_key); - unsigned char (*funding_key_ref)[32] = &funding_key_arr; + uint8_t (*funding_key_ref)[32] = &funding_key_arr; LDKu8slice funding_redeemscript_ref; funding_redeemscript_ref.datalen = funding_redeemscript->arr_len; funding_redeemscript_ref.data = funding_redeemscript->elems; @@ -39251,10 +40063,10 @@ uint64_t __attribute__((export_name("TS_TrustedCommitmentTransaction_get_htlc_s 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; - unsigned char htlc_base_key_arr[32]; + uint8_t htlc_base_key_arr[32]; CHECK(htlc_base_key->arr_len == 32); memcpy(htlc_base_key_arr, htlc_base_key->elems, 32); FREE(htlc_base_key); - unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr; + uint8_t (*htlc_base_key_ref)[32] = &htlc_base_key_arr; LDKDirectedChannelTransactionParameters channel_parameters_conv; channel_parameters_conv.inner = untag_ptr(channel_parameters); channel_parameters_conv.is_owned = ptr_is_owned(channel_parameters); @@ -39366,6 +40178,36 @@ jboolean __attribute__((export_name("TS_InvoiceRequestFeatures_eq"))) TS_Invoic return ret_conv; } +jboolean __attribute__((export_name("TS_Bolt12InvoiceFeatures_eq"))) TS_Bolt12InvoiceFeatures_eq(uint64_t a, uint64_t b) { + LDKBolt12InvoiceFeatures 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; + LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_eq(&a_conv, &b_conv); + return ret_conv; +} + +jboolean __attribute__((export_name("TS_BlindedHopFeatures_eq"))) TS_BlindedHopFeatures_eq(uint64_t a, uint64_t b) { + LDKBlindedHopFeatures 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; + LDKBlindedHopFeatures 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 = BlindedHopFeatures_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); @@ -39561,6 +40403,66 @@ uint64_t __attribute__((export_name("TS_InvoiceRequestFeatures_clone"))) TS_Inv return ret_ref; } +static inline uint64_t Bolt12InvoiceFeatures_clone_ptr(LDKBolt12InvoiceFeatures *NONNULL_PTR arg) { + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_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_Bolt12InvoiceFeatures_clone_ptr"))) TS_Bolt12InvoiceFeatures_clone_ptr(uint64_t arg) { + LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_Bolt12InvoiceFeatures_clone"))) TS_Bolt12InvoiceFeatures_clone(uint64_t orig) { + LDKBolt12InvoiceFeatures 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; + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_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 BlindedHopFeatures_clone_ptr(LDKBlindedHopFeatures *NONNULL_PTR arg) { + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_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_BlindedHopFeatures_clone_ptr"))) TS_BlindedHopFeatures_clone_ptr(uint64_t arg) { + LDKBlindedHopFeatures 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 = BlindedHopFeatures_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_BlindedHopFeatures_clone"))) TS_BlindedHopFeatures_clone(uint64_t orig) { + LDKBlindedHopFeatures 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; + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_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; @@ -39639,6 +40541,22 @@ void __attribute__((export_name("TS_InvoiceRequestFeatures_free"))) TS_InvoiceR InvoiceRequestFeatures_free(this_obj_conv); } +void __attribute__((export_name("TS_Bolt12InvoiceFeatures_free"))) TS_Bolt12InvoiceFeatures_free(uint64_t this_obj) { + LDKBolt12InvoiceFeatures 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); + Bolt12InvoiceFeatures_free(this_obj_conv); +} + +void __attribute__((export_name("TS_BlindedHopFeatures_free"))) TS_BlindedHopFeatures_free(uint64_t this_obj) { + LDKBlindedHopFeatures 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); + BlindedHopFeatures_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); @@ -39755,6 +40673,42 @@ jboolean __attribute__((export_name("TS_InvoiceRequestFeatures_requires_unknown return ret_conv; } +uint64_t __attribute__((export_name("TS_Bolt12InvoiceFeatures_empty"))) TS_Bolt12InvoiceFeatures_empty() { + LDKBolt12InvoiceFeatures ret_var = Bolt12InvoiceFeatures_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_Bolt12InvoiceFeatures_requires_unknown_bits"))) TS_Bolt12InvoiceFeatures_requires_unknown_bits(uint64_t this_arg) { + LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_requires_unknown_bits(&this_arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_BlindedHopFeatures_empty"))) TS_BlindedHopFeatures_empty() { + LDKBlindedHopFeatures ret_var = BlindedHopFeatures_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_BlindedHopFeatures_requires_unknown_bits"))) TS_BlindedHopFeatures_requires_unknown_bits(uint64_t this_arg) { + LDKBlindedHopFeatures 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 = BlindedHopFeatures_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; @@ -39865,71 +40819,48 @@ uint64_t __attribute__((export_name("TS_InvoiceFeatures_read"))) TS_InvoiceFeat return tag_ptr(ret_conv, true); } -int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) { - LDKChannelTypeFeatures 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 = ChannelTypeFeatures_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_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = ser->arr_len; - ser_ref.data = ser->elems; - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); - *ret_conv = ChannelTypeFeatures_read(ser_ref); - FREE(ser); - return tag_ptr(ret_conv, true); -} - -int8_tArray __attribute__((export_name("TS_OfferFeatures_write"))) TS_OfferFeatures_write(uint64_t obj) { - LDKOfferFeatures obj_conv; +int8_tArray __attribute__((export_name("TS_BlindedHopFeatures_write"))) TS_BlindedHopFeatures_write(uint64_t obj) { + LDKBlindedHopFeatures 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); + LDKCVec_u8Z ret_var = BlindedHopFeatures_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) { +uint64_t __attribute__((export_name("TS_BlindedHopFeatures_read"))) TS_BlindedHopFeatures_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); + LDKCResult_BlindedHopFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ), "LDKCResult_BlindedHopFeaturesDecodeErrorZ"); + *ret_conv = BlindedHopFeatures_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; +int8_tArray __attribute__((export_name("TS_ChannelTypeFeatures_write"))) TS_ChannelTypeFeatures_write(uint64_t obj) { + LDKChannelTypeFeatures 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); + LDKCVec_u8Z ret_var = ChannelTypeFeatures_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) { +uint64_t __attribute__((export_name("TS_ChannelTypeFeatures_read"))) TS_ChannelTypeFeatures_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); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = ChannelTypeFeatures_read(ser_ref); FREE(ser); return tag_ptr(ret_conv, true); } @@ -40616,6 +41547,34 @@ jboolean __attribute__((export_name("TS_InvoiceFeatures_supports_basic_mpp"))) return ret_conv; } +void __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_optional"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_optional(uint64_t this_arg) { + LDKBolt12InvoiceFeatures 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; + Bolt12InvoiceFeatures_set_basic_mpp_optional(&this_arg_conv); +} + +void __attribute__((export_name("TS_Bolt12InvoiceFeatures_set_basic_mpp_required"))) TS_Bolt12InvoiceFeatures_set_basic_mpp_required(uint64_t this_arg) { + LDKBolt12InvoiceFeatures 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; + Bolt12InvoiceFeatures_set_basic_mpp_required(&this_arg_conv); +} + +jboolean __attribute__((export_name("TS_Bolt12InvoiceFeatures_supports_basic_mpp"))) TS_Bolt12InvoiceFeatures_supports_basic_mpp(uint64_t this_arg) { + LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_supports_basic_mpp(&this_arg_conv); + return ret_conv; +} + jboolean __attribute__((export_name("TS_InitFeatures_requires_basic_mpp"))) TS_InitFeatures_requires_basic_mpp(uint64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -40646,6 +41605,16 @@ jboolean __attribute__((export_name("TS_InvoiceFeatures_requires_basic_mpp"))) return ret_conv; } +jboolean __attribute__((export_name("TS_Bolt12InvoiceFeatures_requires_basic_mpp"))) TS_Bolt12InvoiceFeatures_requires_basic_mpp(uint64_t this_arg) { + LDKBolt12InvoiceFeatures 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 = Bolt12InvoiceFeatures_requires_basic_mpp(&this_arg_conv); + return ret_conv; +} + void __attribute__((export_name("TS_InitFeatures_set_wumbo_optional"))) TS_InitFeatures_set_wumbo_optional(uint64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -40722,6 +41691,120 @@ jboolean __attribute__((export_name("TS_NodeFeatures_requires_wumbo"))) TS_Node return ret_conv; } +void __attribute__((export_name("TS_InitFeatures_set_anchors_zero_fee_htlc_tx_optional"))) TS_InitFeatures_set_anchors_zero_fee_htlc_tx_optional(uint64_t this_arg) { + LDKInitFeatures 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; + InitFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +void __attribute__((export_name("TS_InitFeatures_set_anchors_zero_fee_htlc_tx_required"))) TS_InitFeatures_set_anchors_zero_fee_htlc_tx_required(uint64_t this_arg) { + LDKInitFeatures 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; + InitFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +jboolean __attribute__((export_name("TS_InitFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) { + LDKInitFeatures 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 = InitFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional"))) TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(uint64_t this_arg) { + LDKNodeFeatures 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; + NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +void __attribute__((export_name("TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_required"))) TS_NodeFeatures_set_anchors_zero_fee_htlc_tx_required(uint64_t this_arg) { + LDKNodeFeatures 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; + NodeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +jboolean __attribute__((export_name("TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) { + LDKNodeFeatures 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 = NodeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional"))) TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(uint64_t this_arg) { + LDKChannelTypeFeatures 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; + ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(&this_arg_conv); +} + +void __attribute__((export_name("TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required"))) TS_ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(uint64_t this_arg) { + LDKChannelTypeFeatures 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; + ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(&this_arg_conv); +} + +jboolean __attribute__((export_name("TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(uint64_t this_arg) { + LDKChannelTypeFeatures 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 = ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +jboolean __attribute__((export_name("TS_InitFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_InitFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) { + LDKInitFeatures 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 = InitFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +jboolean __attribute__((export_name("TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_NodeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) { + LDKNodeFeatures 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 = NodeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + +jboolean __attribute__((export_name("TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx"))) TS_ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(uint64_t this_arg) { + LDKChannelTypeFeatures 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 = ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(&this_arg_conv); + return ret_conv; +} + void __attribute__((export_name("TS_InitFeatures_set_shutdown_any_segwit_optional"))) TS_InitFeatures_set_shutdown_any_segwit_optional(uint64_t this_arg) { LDKInitFeatures this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -41368,10 +42451,10 @@ uint64_t __attribute__((export_name("TS_ShutdownScript_read"))) TS_ShutdownScri } uint64_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_ShutdownScript_new_p2wpkh(int8_tArray pubkey_hash) { - unsigned char pubkey_hash_arr[20]; + uint8_t pubkey_hash_arr[20]; CHECK(pubkey_hash->arr_len == 20); memcpy(pubkey_hash_arr, pubkey_hash->elems, 20); FREE(pubkey_hash); - unsigned char (*pubkey_hash_ref)[20] = &pubkey_hash_arr; + uint8_t (*pubkey_hash_ref)[20] = &pubkey_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wpkh(pubkey_hash_ref); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -41380,10 +42463,10 @@ uint64_t __attribute__((export_name("TS_ShutdownScript_new_p2wpkh"))) TS_Shutdo } uint64_t __attribute__((export_name("TS_ShutdownScript_new_p2wsh"))) TS_ShutdownScript_new_p2wsh(int8_tArray script_hash) { - unsigned char script_hash_arr[32]; + uint8_t script_hash_arr[32]; CHECK(script_hash->arr_len == 32); memcpy(script_hash_arr, script_hash->elems, 32); FREE(script_hash); - unsigned char (*script_hash_ref)[32] = &script_hash_arr; + uint8_t (*script_hash_ref)[32] = &script_hash_arr; LDKShutdownScript ret_var = ShutdownScript_new_p2wsh(script_hash_ref); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); @@ -41441,6 +42524,199 @@ jboolean __attribute__((export_name("TS_ShutdownScript_is_compatible"))) TS_Shu return ret_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); + CHECK_ACCESS(this_ptr_ptr); + LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + Retry_free(this_ptr_conv); +} + +static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) { + LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg); + int64_t ret_conv = Retry_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) { + LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig); + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) { + LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); + *ret_copy = Retry_attempts(a); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +jboolean __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) { + LDKRetry* a_conv = (LDKRetry*)untag_ptr(a); + LDKRetry* b_conv = (LDKRetry*)untag_ptr(b); + jboolean ret_conv = Retry_eq(a_conv, b_conv); + return ret_conv; +} + +int64_t __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) { + LDKRetry* o_conv = (LDKRetry*)untag_ptr(o); + int64_t ret_conv = Retry_hash(o_conv); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_RetryableSendFailure_clone"))) TS_RetryableSendFailure_clone(uint64_t orig) { + LDKRetryableSendFailure* orig_conv = (LDKRetryableSendFailure*)untag_ptr(orig); + uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_clone(orig_conv)); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_RetryableSendFailure_payment_expired"))) TS_RetryableSendFailure_payment_expired() { + uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_payment_expired()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_RetryableSendFailure_route_not_found"))) TS_RetryableSendFailure_route_not_found() { + uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_route_not_found()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_RetryableSendFailure_duplicate_payment"))) TS_RetryableSendFailure_duplicate_payment() { + uint32_t ret_conv = LDKRetryableSendFailure_to_js(RetryableSendFailure_duplicate_payment()); + return ret_conv; +} + +void __attribute__((export_name("TS_PaymentSendFailure_free"))) TS_PaymentSendFailure_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); + LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + PaymentSendFailure_free(this_ptr_conv); +} + +static inline uint64_t PaymentSendFailure_clone_ptr(LDKPaymentSendFailure *NONNULL_PTR arg) { + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_PaymentSendFailure_clone_ptr"))) TS_PaymentSendFailure_clone_ptr(uint64_t arg) { + LDKPaymentSendFailure* arg_conv = (LDKPaymentSendFailure*)untag_ptr(arg); + int64_t ret_conv = PaymentSendFailure_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_PaymentSendFailure_clone"))) TS_PaymentSendFailure_clone(uint64_t orig) { + LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)untag_ptr(orig); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_PaymentSendFailure_parameter_error"))) TS_PaymentSendFailure_parameter_error(uint64_t a) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKAPIError a_conv = *(LDKAPIError*)(a_ptr); + a_conv = APIError_clone((LDKAPIError*)untag_ptr(a)); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_parameter_error(a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_PaymentSendFailure_path_parameter_error"))) TS_PaymentSendFailure_path_parameter_error(uint64_tArray a) { + LDKCVec_CResult_NoneAPIErrorZZ a_constr; + a_constr.datalen = a->arr_len; + if (a_constr.datalen > 0) + a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + a_constr.data = NULL; + uint64_t* a_vals = a->elems; + for (size_t w = 0; w < a_constr.datalen; w++) { + uint64_t a_conv_22 = a_vals[w]; + void* a_conv_22_ptr = untag_ptr(a_conv_22); + CHECK_ACCESS(a_conv_22_ptr); + LDKCResult_NoneAPIErrorZ a_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(a_conv_22_ptr); + a_conv_22_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)untag_ptr(a_conv_22)); + a_constr.data[w] = a_conv_22_conv; + } + FREE(a); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_path_parameter_error(a_constr); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +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) + a_constr.data = MALLOC(a_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements"); + else + a_constr.data = NULL; + uint64_t* a_vals = a->elems; + for (size_t k = 0; k < a_constr.datalen; k++) { + uint64_t a_conv_10 = a_vals[k]; + void* a_conv_10_ptr = untag_ptr(a_conv_10); + CHECK_ACCESS(a_conv_10_ptr); + LDKAPIError a_conv_10_conv = *(LDKAPIError*)(a_conv_10_ptr); + a_conv_10_conv = APIError_clone((LDKAPIError*)untag_ptr(a_conv_10)); + a_constr.data[k] = a_conv_10_conv; + } + FREE(a); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *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; +} + +uint64_t __attribute__((export_name("TS_PaymentSendFailure_partial_failure"))) TS_PaymentSendFailure_partial_failure(uint64_tArray results, uint64_t failed_paths_retry, int8_tArray payment_id) { + LDKCVec_CResult_NoneAPIErrorZZ results_constr; + results_constr.datalen = results->arr_len; + if (results_constr.datalen > 0) + results_constr.data = MALLOC(results_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements"); + else + results_constr.data = NULL; + uint64_t* results_vals = results->elems; + for (size_t w = 0; w < results_constr.datalen; w++) { + uint64_t results_conv_22 = results_vals[w]; + void* results_conv_22_ptr = untag_ptr(results_conv_22); + CHECK_ACCESS(results_conv_22_ptr); + LDKCResult_NoneAPIErrorZ results_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(results_conv_22_ptr); + results_constr.data[w] = results_conv_22_conv; + } + FREE(results); + LDKRouteParameters failed_paths_retry_conv; + failed_paths_retry_conv.inner = untag_ptr(failed_paths_retry); + failed_paths_retry_conv.is_owned = ptr_is_owned(failed_paths_retry); + CHECK_INNER_FIELD_ACCESS_OR_NULL(failed_paths_retry_conv); + failed_paths_retry_conv = RouteParameters_clone(&failed_paths_retry_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK(payment_id->arr_len == 32); + memcpy(payment_id_ref.data, payment_id->elems, 32); FREE(payment_id); + LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure"); + *ret_copy = PaymentSendFailure_partial_failure(results_constr, failed_paths_retry_conv, payment_id_ref); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + void __attribute__((export_name("TS_CustomMessageReader_free"))) TS_CustomMessageReader_free(uint64_t this_ptr) { if (!ptr_is_owned(this_ptr)) return; void* this_ptr_ptr = untag_ptr(this_ptr); @@ -41481,6 +42757,168 @@ void __attribute__((export_name("TS_Type_free"))) TS_Type_free(uint64_t this_pt Type_free(this_ptr_conv); } +uint32_t __attribute__((export_name("TS_UtxoLookupError_clone"))) TS_UtxoLookupError_clone(uint64_t orig) { + LDKUtxoLookupError* orig_conv = (LDKUtxoLookupError*)untag_ptr(orig); + uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_clone(orig_conv)); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_UtxoLookupError_unknown_chain"))) TS_UtxoLookupError_unknown_chain() { + uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_chain()); + return ret_conv; +} + +uint32_t __attribute__((export_name("TS_UtxoLookupError_unknown_tx"))) TS_UtxoLookupError_unknown_tx() { + uint32_t ret_conv = LDKUtxoLookupError_to_js(UtxoLookupError_unknown_tx()); + return ret_conv; +} + +void __attribute__((export_name("TS_UtxoResult_free"))) TS_UtxoResult_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); + LDKUtxoResult this_ptr_conv = *(LDKUtxoResult*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UtxoResult_free(this_ptr_conv); +} + +static inline uint64_t UtxoResult_clone_ptr(LDKUtxoResult *NONNULL_PTR arg) { + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_UtxoResult_clone_ptr"))) TS_UtxoResult_clone_ptr(uint64_t arg) { + LDKUtxoResult* arg_conv = (LDKUtxoResult*)untag_ptr(arg); + int64_t ret_conv = UtxoResult_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_UtxoResult_clone"))) TS_UtxoResult_clone(uint64_t orig) { + LDKUtxoResult* orig_conv = (LDKUtxoResult*)untag_ptr(orig); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_UtxoResult_sync"))) TS_UtxoResult_sync(uint64_t a) { + void* a_ptr = untag_ptr(a); + CHECK_ACCESS(a_ptr); + LDKCResult_TxOutUtxoLookupErrorZ a_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(a_ptr); + a_conv = CResult_TxOutUtxoLookupErrorZ_clone((LDKCResult_TxOutUtxoLookupErrorZ*)untag_ptr(a)); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_sync(a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_UtxoResult_async"))) TS_UtxoResult_async(uint64_t a) { + LDKUtxoFuture 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 = UtxoFuture_clone(&a_conv); + LDKUtxoResult *ret_copy = MALLOC(sizeof(LDKUtxoResult), "LDKUtxoResult"); + *ret_copy = UtxoResult_async(a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +void __attribute__((export_name("TS_UtxoLookup_free"))) TS_UtxoLookup_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); + LDKUtxoLookup this_ptr_conv = *(LDKUtxoLookup*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + UtxoLookup_free(this_ptr_conv); +} + +void __attribute__((export_name("TS_UtxoFuture_free"))) TS_UtxoFuture_free(uint64_t this_obj) { + LDKUtxoFuture 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); + UtxoFuture_free(this_obj_conv); +} + +static inline uint64_t UtxoFuture_clone_ptr(LDKUtxoFuture *NONNULL_PTR arg) { + LDKUtxoFuture ret_var = UtxoFuture_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_UtxoFuture_clone_ptr"))) TS_UtxoFuture_clone_ptr(uint64_t arg) { + LDKUtxoFuture 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 = UtxoFuture_clone_ptr(&arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_UtxoFuture_clone"))) TS_UtxoFuture_clone(uint64_t orig) { + LDKUtxoFuture 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; + LDKUtxoFuture ret_var = UtxoFuture_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_UtxoFuture_new"))) TS_UtxoFuture_new() { + LDKUtxoFuture ret_var = UtxoFuture_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; +} + +void __attribute__((export_name("TS_UtxoFuture_resolve_without_forwarding"))) TS_UtxoFuture_resolve_without_forwarding(uint64_t this_arg, uint64_t graph, uint64_t result) { + LDKUtxoFuture 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; + LDKNetworkGraph graph_conv; + graph_conv.inner = untag_ptr(graph); + graph_conv.is_owned = ptr_is_owned(graph); + CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv); + graph_conv.is_owned = false; + void* result_ptr = untag_ptr(result); + CHECK_ACCESS(result_ptr); + LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr); + UtxoFuture_resolve_without_forwarding(&this_arg_conv, &graph_conv, result_conv); +} + +void __attribute__((export_name("TS_UtxoFuture_resolve"))) TS_UtxoFuture_resolve(uint64_t this_arg, uint64_t graph, uint64_t gossip, uint64_t result) { + LDKUtxoFuture 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; + LDKNetworkGraph graph_conv; + graph_conv.inner = untag_ptr(graph); + graph_conv.is_owned = ptr_is_owned(graph); + CHECK_INNER_FIELD_ACCESS_OR_NULL(graph_conv); + graph_conv.is_owned = false; + LDKP2PGossipSync gossip_conv; + gossip_conv.inner = untag_ptr(gossip); + gossip_conv.is_owned = ptr_is_owned(gossip); + CHECK_INNER_FIELD_ACCESS_OR_NULL(gossip_conv); + gossip_conv.is_owned = false; + void* result_ptr = untag_ptr(result); + CHECK_ACCESS(result_ptr); + LDKCResult_TxOutUtxoLookupErrorZ result_conv = *(LDKCResult_TxOutUtxoLookupErrorZ*)(result_ptr); + UtxoFuture_resolve(&this_arg_conv, &graph_conv, &gossip_conv, result_conv); +} + void __attribute__((export_name("TS_NodeId_free"))) TS_NodeId_free(uint64_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -41683,21 +43121,21 @@ void __attribute__((export_name("TS_P2PGossipSync_free"))) TS_P2PGossipSync_fre P2PGossipSync_free(this_obj_conv); } -uint64_t __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t chain_access, uint64_t logger) { +uint64_t __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_new(uint64_t network_graph, uint64_t utxo_lookup, uint64_t logger) { 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* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } void* logger_ptr = untag_ptr(logger); @@ -41707,31 +43145,31 @@ uint64_t __attribute__((export_name("TS_P2PGossipSync_new"))) TS_P2PGossipSync_ // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, chain_access_conv, logger_conv); + LDKP2PGossipSync ret_var = P2PGossipSync_new(&network_graph_conv, utxo_lookup_conv, logger_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_P2PGossipSync_add_chain_access"))) TS_P2PGossipSync_add_chain_access(uint64_t this_arg, uint64_t chain_access) { +void __attribute__((export_name("TS_P2PGossipSync_add_utxo_lookup"))) TS_P2PGossipSync_add_utxo_lookup(uint64_t this_arg, uint64_t utxo_lookup) { LDKP2PGossipSync 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; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } - P2PGossipSync_add_chain_access(&this_arg_conv, chain_access_conv); + P2PGossipSync_add_utxo_lookup(&this_arg_conv, utxo_lookup_conv); } void __attribute__((export_name("TS_NetworkGraph_handle_network_update"))) TS_NetworkGraph_handle_network_update(uint64_t this_arg, uint64_t network_update) { @@ -43004,33 +44442,6 @@ void __attribute__((export_name("TS_NodeInfo_set_channels"))) TS_NodeInfo_set_c NodeInfo_set_channels(&this_ptr_conv, val_constr); } -uint64_t __attribute__((export_name("TS_NodeInfo_get_lowest_inbound_channel_fees"))) TS_NodeInfo_get_lowest_inbound_channel_fees(uint64_t this_ptr) { - LDKNodeInfo 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; - LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_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_NodeInfo_set_lowest_inbound_channel_fees"))) TS_NodeInfo_set_lowest_inbound_channel_fees(uint64_t this_ptr, uint64_t val) { - LDKNodeInfo 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; - LDKRoutingFees val_conv; - val_conv.inner = untag_ptr(val); - val_conv.is_owned = ptr_is_owned(val); - CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); - val_conv = RoutingFees_clone(&val_conv); - NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv); -} - uint64_t __attribute__((export_name("TS_NodeInfo_get_announcement_info"))) TS_NodeInfo_get_announcement_info(uint64_t this_ptr) { LDKNodeInfo this_ptr_conv; this_ptr_conv.inner = untag_ptr(this_ptr); @@ -43058,7 +44469,7 @@ void __attribute__((export_name("TS_NodeInfo_set_announcement_info"))) TS_NodeI NodeInfo_set_announcement_info(&this_ptr_conv, val_conv); } -uint64_t __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t lowest_inbound_channel_fees_arg, uint64_t announcement_info_arg) { +uint64_t __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_tArray channels_arg, uint64_t announcement_info_arg) { LDKCVec_u64Z channels_arg_constr; channels_arg_constr.datalen = channels_arg->arr_len; if (channels_arg_constr.datalen > 0) @@ -43071,17 +44482,12 @@ uint64_t __attribute__((export_name("TS_NodeInfo_new"))) TS_NodeInfo_new(int64_ channels_arg_constr.data[i] = channels_arg_conv_8; } FREE(channels_arg); - LDKRoutingFees lowest_inbound_channel_fees_arg_conv; - lowest_inbound_channel_fees_arg_conv.inner = untag_ptr(lowest_inbound_channel_fees_arg); - lowest_inbound_channel_fees_arg_conv.is_owned = ptr_is_owned(lowest_inbound_channel_fees_arg); - CHECK_INNER_FIELD_ACCESS_OR_NULL(lowest_inbound_channel_fees_arg_conv); - lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv); LDKNodeAnnouncementInfo announcement_info_arg_conv; announcement_info_arg_conv.inner = untag_ptr(announcement_info_arg); announcement_info_arg_conv.is_owned = ptr_is_owned(announcement_info_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_info_arg_conv); announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv); - LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv); + LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, announcement_info_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); @@ -43186,10 +44592,8 @@ uint64_t __attribute__((export_name("TS_NetworkGraph_read"))) TS_NetworkGraph_r return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(int8_tArray genesis_hash, uint64_t logger) { - LDKThirtyTwoBytes genesis_hash_ref; - CHECK(genesis_hash->arr_len == 32); - memcpy(genesis_hash_ref.data, genesis_hash->elems, 32); FREE(genesis_hash); +uint64_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_new(uint32_t network, uint64_t logger) { + LDKNetwork network_conv = LDKNetwork_from_js(network); void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); LDKLogger logger_conv = *(LDKLogger*)(logger_ptr); @@ -43197,7 +44601,7 @@ uint64_t __attribute__((export_name("TS_NetworkGraph_new"))) TS_NetworkGraph_ne // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref, logger_conv); + LDKNetworkGraph ret_var = NetworkGraph_new(network_conv, logger_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); @@ -43270,7 +44674,7 @@ uint64_t __attribute__((export_name("TS_NetworkGraph_update_node_from_unsigned_ return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_announcement"))) TS_NetworkGraph_update_channel_from_announcement(uint64_t this_arg, uint64_t msg, uint64_t chain_access) { +uint64_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_announcement"))) TS_NetworkGraph_update_channel_from_announcement(uint64_t this_arg, uint64_t msg, uint64_t utxo_lookup) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -43281,23 +44685,23 @@ uint64_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_announ msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_unsigned_announcement"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint64_t this_arg, uint64_t msg, uint64_t chain_access) { +uint64_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_unsigned_announcement"))) TS_NetworkGraph_update_channel_from_unsigned_announcement(uint64_t this_arg, uint64_t msg, uint64_t utxo_lookup) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); this_arg_conv.is_owned = ptr_is_owned(this_arg); @@ -43308,19 +44712,19 @@ uint64_t __attribute__((export_name("TS_NetworkGraph_update_channel_from_unsign msg_conv.is_owned = ptr_is_owned(msg); CHECK_INNER_FIELD_ACCESS_OR_NULL(msg_conv); msg_conv.is_owned = false; - void* chain_access_ptr = untag_ptr(chain_access); - CHECK_ACCESS(chain_access_ptr); - LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(chain_access_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_AccessZ - if (chain_access_conv.tag == LDKCOption_AccessZ_Some) { + void* utxo_lookup_ptr = untag_ptr(utxo_lookup); + CHECK_ACCESS(utxo_lookup_ptr); + LDKCOption_UtxoLookupZ utxo_lookup_conv = *(LDKCOption_UtxoLookupZ*)(utxo_lookup_ptr); + // WARNING: we may need a move here but no clone is available for LDKCOption_UtxoLookupZ + if (utxo_lookup_conv.tag == LDKCOption_UtxoLookupZ_Some) { // Manually implement clone for Java trait instances - if (chain_access_conv.some.free == LDKAccess_JCalls_free) { + if (utxo_lookup_conv.some.free == LDKUtxoLookup_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKAccess_JCalls_cloned(&chain_access_conv.some); + LDKUtxoLookup_JCalls_cloned(&utxo_lookup_conv.some); } } LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ"); - *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv); + *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, utxo_lookup_conv); return tag_ptr(ret_conv, true); } @@ -43573,8 +44977,8 @@ uint64_t __attribute__((export_name("TS_ScorerAccountingForInFlightHtlcs_new")) 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); + inflight_htlcs_conv.is_owned = false; + 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); @@ -44235,32 +45639,13 @@ void __attribute__((export_name("TS_RouteParameters_set_final_value_msat"))) TS RouteParameters_set_final_value_msat(&this_ptr_conv, val); } -int32_t __attribute__((export_name("TS_RouteParameters_get_final_cltv_expiry_delta"))) TS_RouteParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) { - LDKRouteParameters 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; - int32_t ret_conv = RouteParameters_get_final_cltv_expiry_delta(&this_ptr_conv); - return ret_conv; -} - -void __attribute__((export_name("TS_RouteParameters_set_final_cltv_expiry_delta"))) TS_RouteParameters_set_final_cltv_expiry_delta(uint64_t this_ptr, int32_t val) { - LDKRouteParameters 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; - RouteParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val); -} - -uint64_t __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg, int32_t final_cltv_expiry_delta_arg) { +uint64_t __attribute__((export_name("TS_RouteParameters_new"))) TS_RouteParameters_new(uint64_t payment_params_arg, int64_t final_value_msat_arg) { LDKPaymentParameters payment_params_arg_conv; payment_params_arg_conv.inner = untag_ptr(payment_params_arg); payment_params_arg_conv.is_owned = ptr_is_owned(payment_params_arg); CHECK_INNER_FIELD_ACCESS_OR_NULL(payment_params_arg_conv); payment_params_arg_conv = PaymentParameters_clone(&payment_params_arg_conv); - LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_arg, final_cltv_expiry_delta_arg); + LDKRouteParameters ret_var = RouteParameters_new(payment_params_arg_conv, final_value_msat_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); @@ -44297,6 +45682,21 @@ uint64_t __attribute__((export_name("TS_RouteParameters_clone"))) TS_RouteParam return ret_ref; } +jboolean __attribute__((export_name("TS_RouteParameters_eq"))) TS_RouteParameters_eq(uint64_t a, uint64_t b) { + LDKRouteParameters 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; + LDKRouteParameters 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 = RouteParameters_eq(&a_conv, &b_conv); + return ret_conv; +} + int8_tArray __attribute__((export_name("TS_RouteParameters_write"))) TS_RouteParameters_write(uint64_t obj) { LDKRouteParameters obj_conv; obj_conv.inner = untag_ptr(obj); @@ -44548,7 +45948,26 @@ void __attribute__((export_name("TS_PaymentParameters_set_previously_failed_cha PaymentParameters_set_previously_failed_channels(&this_ptr_conv, val_constr); } -uint64_t __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(int8_tArray payee_pubkey_arg, uint64_t features_arg, uint64_tArray route_hints_arg, uint64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg) { +int32_t __attribute__((export_name("TS_PaymentParameters_get_final_cltv_expiry_delta"))) TS_PaymentParameters_get_final_cltv_expiry_delta(uint64_t this_ptr) { + LDKPaymentParameters 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; + int32_t ret_conv = PaymentParameters_get_final_cltv_expiry_delta(&this_ptr_conv); + return ret_conv; +} + +void __attribute__((export_name("TS_PaymentParameters_set_final_cltv_expiry_delta"))) TS_PaymentParameters_set_final_cltv_expiry_delta(uint64_t this_ptr, int32_t val) { + LDKPaymentParameters 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; + PaymentParameters_set_final_cltv_expiry_delta(&this_ptr_conv, val); +} + +uint64_t __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentParameters_new(int8_tArray payee_pubkey_arg, uint64_t features_arg, uint64_tArray route_hints_arg, uint64_t expiry_time_arg, int32_t max_total_cltv_expiry_delta_arg, int8_t max_path_count_arg, int8_t max_channel_saturation_power_of_half_arg, int64_tArray previously_failed_channels_arg, int32_t final_cltv_expiry_delta_arg) { LDKPublicKey payee_pubkey_arg_ref; CHECK(payee_pubkey_arg->arr_len == 33); memcpy(payee_pubkey_arg_ref.compressed_form, payee_pubkey_arg->elems, 33); FREE(payee_pubkey_arg); @@ -44590,7 +46009,7 @@ uint64_t __attribute__((export_name("TS_PaymentParameters_new"))) TS_PaymentPar previously_failed_channels_arg_constr.data[i] = previously_failed_channels_arg_conv_8; } FREE(previously_failed_channels_arg); - LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr); + LDKPaymentParameters ret_var = PaymentParameters_new(payee_pubkey_arg_ref, features_arg_conv, route_hints_arg_constr, expiry_time_arg_conv, max_total_cltv_expiry_delta_arg, max_path_count_arg, max_channel_saturation_power_of_half_arg, previously_failed_channels_arg_constr, final_cltv_expiry_delta_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); @@ -44665,32 +46084,32 @@ int8_tArray __attribute__((export_name("TS_PaymentParameters_write"))) TS_Payme return ret_arr; } -uint64_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser) { +uint64_t __attribute__((export_name("TS_PaymentParameters_read"))) TS_PaymentParameters_read(int8_tArray ser, int32_t arg) { LDKu8slice ser_ref; ser_ref.datalen = ser->arr_len; ser_ref.data = ser->elems; LDKCResult_PaymentParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentParametersDecodeErrorZ), "LDKCResult_PaymentParametersDecodeErrorZ"); - *ret_conv = PaymentParameters_read(ser_ref); + *ret_conv = PaymentParameters_read(ser_ref, arg); FREE(ser); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey) { +uint64_t __attribute__((export_name("TS_PaymentParameters_from_node_id"))) TS_PaymentParameters_from_node_id(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) { LDKPublicKey payee_pubkey_ref; CHECK(payee_pubkey->arr_len == 33); memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey); - LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref); + LDKPaymentParameters ret_var = PaymentParameters_from_node_id(payee_pubkey_ref, final_cltv_expiry_delta); 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_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey) { +uint64_t __attribute__((export_name("TS_PaymentParameters_for_keysend"))) TS_PaymentParameters_for_keysend(int8_tArray payee_pubkey, int32_t final_cltv_expiry_delta) { LDKPublicKey payee_pubkey_ref; CHECK(payee_pubkey->arr_len == 33); memcpy(payee_pubkey_ref.compressed_form, payee_pubkey->elems, 33); FREE(payee_pubkey); - LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref); + LDKPaymentParameters ret_var = PaymentParameters_for_keysend(payee_pubkey_ref, final_cltv_expiry_delta); uint64_t ret_ref = 0; CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); ret_ref = tag_ptr(ret_var.inner, ret_var.is_owned); @@ -45149,10 +46568,10 @@ uint64_t __attribute__((export_name("TS_find_route"))) TS_find_route(int8_tArra void* scorer_ptr = untag_ptr(scorer); if (ptr_is_owned(scorer)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; - unsigned char random_seed_bytes_arr[32]; + uint8_t random_seed_bytes_arr[32]; CHECK(random_seed_bytes->arr_len == 32); memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes); - unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; + uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); *ret_conv = find_route(our_node_pubkey_ref, &route_params_conv, &network_graph_conv, first_hops_ptr, logger_conv, scorer_conv, random_seed_bytes_ref); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } @@ -45195,10 +46614,10 @@ uint64_t __attribute__((export_name("TS_build_route_from_hops"))) TS_build_rout // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - unsigned char random_seed_bytes_arr[32]; + uint8_t random_seed_bytes_arr[32]; CHECK(random_seed_bytes->arr_len == 32); memcpy(random_seed_bytes_arr, random_seed_bytes->elems, 32); FREE(random_seed_bytes); - unsigned char (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; + uint8_t (*random_seed_bytes_ref)[32] = &random_seed_bytes_arr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); *ret_conv = build_route_from_hops(our_node_pubkey_ref, hops_constr, &route_params_conv, &network_graph_conv, logger_conv, random_seed_bytes_ref); return tag_ptr(ret_conv, true); @@ -45801,6 +47220,23 @@ uint64_t __attribute__((export_name("TS_ProbabilisticScorer_estimated_channel_l return ret_ref; } +uint64_t __attribute__((export_name("TS_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities"))) TS_ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(uint64_t this_arg, int64_t scid, uint64_t target) { + LDKProbabilisticScorer 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 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_C2Tuple_EightU16sEightU16sZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_EightU16sEightU16sZZ), "LDKCOption_C2Tuple_EightU16sEightU16sZZ"); + *ret_copy = ProbabilisticScorer_historical_estimated_channel_liquidity_probabilities(&this_arg_conv, scid, &target_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + void __attribute__((export_name("TS_ProbabilisticScorer_add_banned"))) TS_ProbabilisticScorer_add_banned(uint64_t this_arg, uint64_t node_id) { LDKProbabilisticScorer this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -46027,7 +47463,7 @@ uint64_t __attribute__((export_name("TS_BlindedHop_clone"))) TS_BlindedHop_clon return ret_ref; } -uint64_t __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(ptrArray node_pks, uint64_t keys_manager) { +uint64_t __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new(ptrArray node_pks, uint64_t entropy_source) { LDKCVec_PublicKeyZ node_pks_constr; node_pks_constr.datalen = node_pks->arr_len; if (node_pks_constr.datalen > 0) @@ -46043,11 +47479,11 @@ uint64_t __attribute__((export_name("TS_BlindedPath_new"))) TS_BlindedPath_new( node_pks_constr.data[m] = node_pks_conv_12_ref; } FREE(node_pks); - 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; + void* entropy_source_ptr = untag_ptr(entropy_source); + if (ptr_is_owned(entropy_source)) { CHECK_ACCESS(entropy_source_ptr); } + LDKEntropySource* entropy_source_conv = (LDKEntropySource*)entropy_source_ptr; LDKCResult_BlindedPathNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_BlindedPathNoneZ), "LDKCResult_BlindedPathNoneZ"); - *ret_conv = BlindedPath_new(node_pks_constr, keys_manager_conv); + *ret_conv = BlindedPath_new(node_pks_constr, entropy_source_conv); return tag_ptr(ret_conv, true); } @@ -46258,13 +47694,20 @@ void __attribute__((export_name("TS_CustomOnionMessageHandler_free"))) TS_Custo CustomOnionMessageHandler_free(this_ptr_conv); } -uint64_t __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t keys_manager, uint64_t logger, uint64_t custom_handler) { - 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) { +uint64_t __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenger_new(uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint64_t custom_handler) { + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -46280,7 +47723,7 @@ uint64_t __attribute__((export_name("TS_OnionMessenger_new"))) TS_OnionMessenge // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKCustomOnionMessageHandler_JCalls_cloned(&custom_handler_conv); } - LDKOnionMessenger ret_var = OnionMessenger_new(keys_manager_conv, logger_conv, custom_handler_conv); + LDKOnionMessenger ret_var = OnionMessenger_new(entropy_source_conv, node_signer_conv, logger_conv, custom_handler_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); @@ -46422,6 +47865,46 @@ void __attribute__((export_name("TS_CustomOnionMessageContents_free"))) TS_Cust CustomOnionMessageContents_free(this_ptr_conv); } +void __attribute__((export_name("TS_GossipSync_free"))) TS_GossipSync_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); + LDKGossipSync this_ptr_conv = *(LDKGossipSync*)(this_ptr_ptr); + FREE(untag_ptr(this_ptr)); + GossipSync_free(this_ptr_conv); +} + +uint64_t __attribute__((export_name("TS_GossipSync_p2_p"))) TS_GossipSync_p2_p(uint64_t a) { + LDKP2PGossipSync 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; + LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync"); + *ret_copy = GossipSync_p2_p(&a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_GossipSync_rapid"))) TS_GossipSync_rapid(uint64_t a) { + LDKRapidGossipSync 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; + LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync"); + *ret_copy = GossipSync_rapid(&a_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + +uint64_t __attribute__((export_name("TS_GossipSync_none"))) TS_GossipSync_none() { + LDKGossipSync *ret_copy = MALLOC(sizeof(LDKGossipSync), "LDKGossipSync"); + *ret_copy = GossipSync_none(); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + void __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync_free(uint64_t this_obj) { LDKRapidGossipSync this_obj_conv; this_obj_conv.inner = untag_ptr(this_obj); @@ -46430,13 +47913,20 @@ void __attribute__((export_name("TS_RapidGossipSync_free"))) TS_RapidGossipSync RapidGossipSync_free(this_obj_conv); } -uint64_t __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph) { +uint64_t __attribute__((export_name("TS_RapidGossipSync_new"))) TS_RapidGossipSync_new(uint64_t network_graph, uint64_t logger) { 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; - LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv); + 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); + } + LDKRapidGossipSync ret_var = RapidGossipSync_new(&network_graph_conv, logger_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); @@ -46458,6 +47948,25 @@ uint64_t __attribute__((export_name("TS_RapidGossipSync_update_network_graph")) return tag_ptr(ret_conv, true); } +uint64_t __attribute__((export_name("TS_RapidGossipSync_update_network_graph_no_std"))) TS_RapidGossipSync_update_network_graph_no_std(uint64_t this_arg, int8_tArray update_data, uint64_t current_time_unix) { + LDKRapidGossipSync 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; + LDKu8slice update_data_ref; + update_data_ref.datalen = update_data->arr_len; + update_data_ref.data = update_data->elems; + void* current_time_unix_ptr = untag_ptr(current_time_unix); + CHECK_ACCESS(current_time_unix_ptr); + LDKCOption_u64Z current_time_unix_conv = *(LDKCOption_u64Z*)(current_time_unix_ptr); + current_time_unix_conv = COption_u64Z_clone((LDKCOption_u64Z*)untag_ptr(current_time_unix)); + LDKCResult_u32GraphSyncErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_u32GraphSyncErrorZ), "LDKCResult_u32GraphSyncErrorZ"); + *ret_conv = RapidGossipSync_update_network_graph_no_std(&this_arg_conv, update_data_ref, current_time_unix_conv); + FREE(update_data); + return tag_ptr(ret_conv, true); +} + jboolean __attribute__((export_name("TS_RapidGossipSync_is_initial_sync_complete"))) TS_RapidGossipSync_is_initial_sync_complete(uint64_t this_arg) { LDKRapidGossipSync this_arg_conv; this_arg_conv.inner = untag_ptr(this_arg); @@ -47489,93 +48998,93 @@ jboolean __attribute__((export_name("TS_ExpiryTime_eq"))) TS_ExpiryTime_eq(uint return ret_conv; } -void __attribute__((export_name("TS_MinFinalCltvExpiry_free"))) TS_MinFinalCltvExpiry_free(uint64_t this_obj) { - LDKMinFinalCltvExpiry this_obj_conv; +void __attribute__((export_name("TS_MinFinalCltvExpiryDelta_free"))) TS_MinFinalCltvExpiryDelta_free(uint64_t this_obj) { + LDKMinFinalCltvExpiryDelta 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); - MinFinalCltvExpiry_free(this_obj_conv); + MinFinalCltvExpiryDelta_free(this_obj_conv); } -int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_get_a"))) TS_MinFinalCltvExpiry_get_a(uint64_t this_ptr) { - LDKMinFinalCltvExpiry this_ptr_conv; +int64_t __attribute__((export_name("TS_MinFinalCltvExpiryDelta_get_a"))) TS_MinFinalCltvExpiryDelta_get_a(uint64_t this_ptr) { + LDKMinFinalCltvExpiryDelta 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 = MinFinalCltvExpiry_get_a(&this_ptr_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_get_a(&this_ptr_conv); return ret_conv; } -void __attribute__((export_name("TS_MinFinalCltvExpiry_set_a"))) TS_MinFinalCltvExpiry_set_a(uint64_t this_ptr, int64_t val) { - LDKMinFinalCltvExpiry this_ptr_conv; +void __attribute__((export_name("TS_MinFinalCltvExpiryDelta_set_a"))) TS_MinFinalCltvExpiryDelta_set_a(uint64_t this_ptr, int64_t val) { + LDKMinFinalCltvExpiryDelta 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; - MinFinalCltvExpiry_set_a(&this_ptr_conv, val); + MinFinalCltvExpiryDelta_set_a(&this_ptr_conv, val); } -uint64_t __attribute__((export_name("TS_MinFinalCltvExpiry_new"))) TS_MinFinalCltvExpiry_new(int64_t a_arg) { - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_new(a_arg); +uint64_t __attribute__((export_name("TS_MinFinalCltvExpiryDelta_new"))) TS_MinFinalCltvExpiryDelta_new(int64_t a_arg) { + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_new(a_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; } -static inline uint64_t MinFinalCltvExpiry_clone_ptr(LDKMinFinalCltvExpiry *NONNULL_PTR arg) { - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(arg); +static inline uint64_t MinFinalCltvExpiryDelta_clone_ptr(LDKMinFinalCltvExpiryDelta *NONNULL_PTR arg) { + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_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_MinFinalCltvExpiry_clone_ptr"))) TS_MinFinalCltvExpiry_clone_ptr(uint64_t arg) { - LDKMinFinalCltvExpiry arg_conv; +int64_t __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone_ptr"))) TS_MinFinalCltvExpiryDelta_clone_ptr(uint64_t arg) { + LDKMinFinalCltvExpiryDelta 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 = MinFinalCltvExpiry_clone_ptr(&arg_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_clone_ptr(&arg_conv); return ret_conv; } -uint64_t __attribute__((export_name("TS_MinFinalCltvExpiry_clone"))) TS_MinFinalCltvExpiry_clone(uint64_t orig) { - LDKMinFinalCltvExpiry orig_conv; +uint64_t __attribute__((export_name("TS_MinFinalCltvExpiryDelta_clone"))) TS_MinFinalCltvExpiryDelta_clone(uint64_t orig) { + LDKMinFinalCltvExpiryDelta 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; - LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv); + LDKMinFinalCltvExpiryDelta ret_var = MinFinalCltvExpiryDelta_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; } -int64_t __attribute__((export_name("TS_MinFinalCltvExpiry_hash"))) TS_MinFinalCltvExpiry_hash(uint64_t o) { - LDKMinFinalCltvExpiry o_conv; +int64_t __attribute__((export_name("TS_MinFinalCltvExpiryDelta_hash"))) TS_MinFinalCltvExpiryDelta_hash(uint64_t o) { + LDKMinFinalCltvExpiryDelta 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.is_owned = false; - int64_t ret_conv = MinFinalCltvExpiry_hash(&o_conv); + int64_t ret_conv = MinFinalCltvExpiryDelta_hash(&o_conv); return ret_conv; } -jboolean __attribute__((export_name("TS_MinFinalCltvExpiry_eq"))) TS_MinFinalCltvExpiry_eq(uint64_t a, uint64_t b) { - LDKMinFinalCltvExpiry a_conv; +jboolean __attribute__((export_name("TS_MinFinalCltvExpiryDelta_eq"))) TS_MinFinalCltvExpiryDelta_eq(uint64_t a, uint64_t b) { + LDKMinFinalCltvExpiryDelta 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; - LDKMinFinalCltvExpiry b_conv; + LDKMinFinalCltvExpiryDelta 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 = MinFinalCltvExpiry_eq(&a_conv, &b_conv); + jboolean ret_conv = MinFinalCltvExpiryDelta_eq(&a_conv, &b_conv); return ret_conv; } @@ -47924,13 +49433,13 @@ uint64_t __attribute__((export_name("TS_RawInvoice_expiry_time"))) TS_RawInvoic return ret_ref; } -uint64_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry"))) TS_RawInvoice_min_final_cltv_expiry(uint64_t this_arg) { +uint64_t __attribute__((export_name("TS_RawInvoice_min_final_cltv_expiry_delta"))) TS_RawInvoice_min_final_cltv_expiry_delta(uint64_t this_arg) { LDKRawInvoice 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; - LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv); + LDKMinFinalCltvExpiryDelta ret_var = RawInvoice_min_final_cltv_expiry_delta(&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); @@ -48159,13 +49668,13 @@ jboolean __attribute__((export_name("TS_Invoice_would_expire"))) TS_Invoice_wou return ret_conv; } -int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry"))) TS_Invoice_min_final_cltv_expiry(uint64_t this_arg) { +int64_t __attribute__((export_name("TS_Invoice_min_final_cltv_expiry_delta"))) TS_Invoice_min_final_cltv_expiry_delta(uint64_t this_arg) { LDKInvoice 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 = Invoice_min_final_cltv_expiry(&this_arg_conv); + int64_t ret_conv = Invoice_min_final_cltv_expiry_delta(&this_arg_conv); return ret_conv; } @@ -48345,6 +49854,11 @@ uint32_t __attribute__((export_name("TS_CreationError_missing_route_hints"))) T return ret_conv; } +uint32_t __attribute__((export_name("TS_CreationError_min_final_cltv_expiry_delta_too_short"))) TS_CreationError_min_final_cltv_expiry_delta_too_short() { + uint32_t ret_conv = LDKCreationError_to_js(CreationError_min_final_cltv_expiry_delta_too_short()); + return ret_conv; +} + jboolean __attribute__((export_name("TS_CreationError_eq"))) TS_CreationError_eq(uint64_t a, uint64_t b) { LDKCreationError* a_conv = (LDKCreationError*)untag_ptr(a); LDKCreationError* b_conv = (LDKCreationError*)untag_ptr(b); @@ -48490,70 +50004,90 @@ jstring __attribute__((export_name("TS_SignOrCreationError_to_str"))) TS_SignOr return ret_conv; } -void __attribute__((export_name("TS_InvoicePayer_free"))) TS_InvoicePayer_free(uint64_t this_obj) { - LDKInvoicePayer 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); - InvoicePayer_free(this_obj_conv); -} - -void __attribute__((export_name("TS_Payer_free"))) TS_Payer_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); - LDKPayer this_ptr_conv = *(LDKPayer*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Payer_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); - CHECK_ACCESS(this_ptr_ptr); - LDKRetry this_ptr_conv = *(LDKRetry*)(this_ptr_ptr); - FREE(untag_ptr(this_ptr)); - Retry_free(this_ptr_conv); -} - -static inline uint64_t Retry_clone_ptr(LDKRetry *NONNULL_PTR arg) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_clone(arg); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} -int64_t __attribute__((export_name("TS_Retry_clone_ptr"))) TS_Retry_clone_ptr(uint64_t arg) { - LDKRetry* arg_conv = (LDKRetry*)untag_ptr(arg); - int64_t ret_conv = Retry_clone_ptr(arg_conv); - return ret_conv; -} - -uint64_t __attribute__((export_name("TS_Retry_clone"))) TS_Retry_clone(uint64_t orig) { - LDKRetry* orig_conv = (LDKRetry*)untag_ptr(orig); - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_clone(orig_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +uint64_t __attribute__((export_name("TS_pay_invoice"))) TS_pay_invoice(uint64_t invoice, uint64_t retry_strategy, uint64_t channelmanager) { + 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; + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + 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; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = pay_invoice(&invoice_conv, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_Retry_attempts"))) TS_Retry_attempts(uint32_t a) { - LDKRetry *ret_copy = MALLOC(sizeof(LDKRetry), "LDKRetry"); - *ret_copy = Retry_attempts(a); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; +uint64_t __attribute__((export_name("TS_pay_invoice_with_id"))) TS_pay_invoice_with_id(uint64_t invoice, int8_tArray payment_id, uint64_t retry_strategy, uint64_t channelmanager) { + 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); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + 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; + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = pay_invoice_with_id(&invoice_conv, payment_id_ref, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -jboolean __attribute__((export_name("TS_Retry_eq"))) TS_Retry_eq(uint64_t a, uint64_t b) { - LDKRetry* a_conv = (LDKRetry*)untag_ptr(a); - LDKRetry* b_conv = (LDKRetry*)untag_ptr(b); - jboolean ret_conv = Retry_eq(a_conv, b_conv); - return ret_conv; +uint64_t __attribute__((export_name("TS_pay_zero_value_invoice"))) TS_pay_zero_value_invoice(uint64_t invoice, int64_t amount_msats, uint64_t retry_strategy, uint64_t channelmanager) { + 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; + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + 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; + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = pay_zero_value_invoice(&invoice_conv, amount_msats, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } -int64_t __attribute__((export_name("TS_Retry_hash"))) TS_Retry_hash(uint64_t o) { - LDKRetry* o_conv = (LDKRetry*)untag_ptr(o); - int64_t ret_conv = Retry_hash(o_conv); - return ret_conv; +uint64_t __attribute__((export_name("TS_pay_zero_value_invoice_with_id"))) TS_pay_zero_value_invoice_with_id(uint64_t invoice, int64_t amount_msats, int8_tArray payment_id, uint64_t retry_strategy, uint64_t channelmanager) { + 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); + void* retry_strategy_ptr = untag_ptr(retry_strategy); + CHECK_ACCESS(retry_strategy_ptr); + LDKRetry retry_strategy_conv = *(LDKRetry*)(retry_strategy_ptr); + retry_strategy_conv = Retry_clone((LDKRetry*)untag_ptr(retry_strategy)); + 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; + LDKCResult_NonePaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentErrorZ), "LDKCResult_NonePaymentErrorZ"); + *ret_conv = pay_zero_value_invoice_with_id(&invoice_conv, amount_msats, payment_id_ref, retry_strategy_conv, &channelmanager_conv); + return tag_ptr(ret_conv, true); } void __attribute__((export_name("TS_PaymentError_free"))) TS_PaymentError_free(uint64_t this_ptr) { @@ -48593,43 +50127,53 @@ uint64_t __attribute__((export_name("TS_PaymentError_invoice"))) TS_PaymentErro return ret_ref; } -uint64_t __attribute__((export_name("TS_PaymentError_routing"))) TS_PaymentError_routing(uint64_t a) { - LDKLightningError 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 = LightningError_clone(&a_conv); - LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); - *ret_copy = PaymentError_routing(a_conv); - uint64_t ret_ref = tag_ptr(ret_copy, true); - return ret_ref; -} - -uint64_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint64_t a) { - void* a_ptr = untag_ptr(a); - CHECK_ACCESS(a_ptr); - LDKPaymentSendFailure a_conv = *(LDKPaymentSendFailure*)(a_ptr); - a_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)untag_ptr(a)); +uint64_t __attribute__((export_name("TS_PaymentError_sending"))) TS_PaymentError_sending(uint32_t a) { + LDKRetryableSendFailure a_conv = LDKRetryableSendFailure_from_js(a); LDKPaymentError *ret_copy = MALLOC(sizeof(LDKPaymentError), "LDKPaymentError"); *ret_copy = PaymentError_sending(a_conv); uint64_t ret_ref = tag_ptr(ret_copy, true); return ret_ref; } -uint64_t __attribute__((export_name("TS_InvoicePayer_new"))) TS_InvoicePayer_new(uint64_t payer, uint64_t router, uint64_t logger, uint64_t event_handler, uint64_t retry) { - void* payer_ptr = untag_ptr(payer); - CHECK_ACCESS(payer_ptr); - LDKPayer payer_conv = *(LDKPayer*)(payer_ptr); - if (payer_conv.free == LDKPayer_JCalls_free) { +uint64_t __attribute__((export_name("TS_create_phantom_invoice"))) TS_create_phantom_invoice(uint64_t amt_msat, int8_tArray payment_hash, jstring description, int32_t invoice_expiry_delta_secs, uint64_tArray phantom_route_hints, uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint32_t network, uint64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) { + 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)); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(payment_hash->arr_len == 32); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKStr description_conv = str_ref_to_owned_c(description); + LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr; + phantom_route_hints_constr.datalen = phantom_route_hints->arr_len; + if (phantom_route_hints_constr.datalen > 0) + phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + phantom_route_hints_constr.data = NULL; + uint64_t* phantom_route_hints_vals = phantom_route_hints->elems; + for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) { + uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t]; + LDKPhantomRouteHints phantom_route_hints_conv_19_conv; + phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19); + phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19); + CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv); + phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv); + phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; + } + FREE(phantom_route_hints); + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKPayer_JCalls_cloned(&payer_conv); + LDKEntropySource_JCalls_cloned(&entropy_source_conv); } - void* router_ptr = untag_ptr(router); - CHECK_ACCESS(router_ptr); - LDKRouter router_conv = *(LDKRouter*)(router_ptr); - if (router_conv.free == LDKRouter_JCalls_free) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKRouter_JCalls_cloned(&router_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -48638,167 +50182,89 @@ uint64_t __attribute__((export_name("TS_InvoicePayer_new"))) TS_InvoicePayer_ne // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKLogger_JCalls_cloned(&logger_conv); } - void* event_handler_ptr = untag_ptr(event_handler); - CHECK_ACCESS(event_handler_ptr); - LDKEventHandler event_handler_conv = *(LDKEventHandler*)(event_handler_ptr); - if (event_handler_conv.free == LDKEventHandler_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKEventHandler_JCalls_cloned(&event_handler_conv); - } - void* retry_ptr = untag_ptr(retry); - CHECK_ACCESS(retry_ptr); - LDKRetry retry_conv = *(LDKRetry*)(retry_ptr); - retry_conv = Retry_clone((LDKRetry*)untag_ptr(retry)); - LDKInvoicePayer ret_var = InvoicePayer_new(payer_conv, router_conv, logger_conv, event_handler_conv, retry_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_InvoicePayer_pay_invoice"))) TS_InvoicePayer_pay_invoice(uint64_t this_arg, uint64_t invoice) { - 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; - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_invoice(&this_arg_conv, &invoice_conv); - 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); - 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; - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_zero_value_invoice(&this_arg_conv, &invoice_conv, amount_msats); - 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); - 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); - LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); - *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta); - 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); + LDKCurrency network_conv = LDKCurrency_from_js(network); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_phantom_invoice(amt_msat_conv, payment_hash_ref, description_conv, invoice_expiry_delta_secs, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch); 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); - 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; - unsigned char payment_hash_arr[32]; +uint64_t __attribute__((export_name("TS_create_phantom_invoice_with_description_hash"))) TS_create_phantom_invoice_with_description_hash(uint64_t amt_msat, int8_tArray payment_hash, int32_t invoice_expiry_delta_secs, uint64_t description_hash, uint64_tArray phantom_route_hints, uint64_t entropy_source, uint64_t node_signer, uint64_t logger, uint32_t network, uint64_t min_final_cltv_expiry_delta, int64_t duration_since_epoch) { + 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)); + LDKThirtyTwoBytes payment_hash_ref; 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; - InvoicePayer_remove_cached_payment(&this_arg_conv, payment_hash_ref); -} - -uint64_t __attribute__((export_name("TS_InvoicePayer_as_EventHandler"))) TS_InvoicePayer_as_EventHandler(uint64_t this_arg) { - 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; - LDKEventHandler* ret_ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler"); - *ret_ret = InvoicePayer_as_EventHandler(&this_arg_conv); - return tag_ptr(ret_ret, true); + memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + LDKSha256 description_hash_conv; + description_hash_conv.inner = untag_ptr(description_hash); + description_hash_conv.is_owned = ptr_is_owned(description_hash); + CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); + description_hash_conv = Sha256_clone(&description_hash_conv); + LDKCVec_PhantomRouteHintsZ phantom_route_hints_constr; + phantom_route_hints_constr.datalen = phantom_route_hints->arr_len; + if (phantom_route_hints_constr.datalen > 0) + phantom_route_hints_constr.data = MALLOC(phantom_route_hints_constr.datalen * sizeof(LDKPhantomRouteHints), "LDKCVec_PhantomRouteHintsZ Elements"); + else + phantom_route_hints_constr.data = NULL; + uint64_t* phantom_route_hints_vals = phantom_route_hints->elems; + for (size_t t = 0; t < phantom_route_hints_constr.datalen; t++) { + uint64_t phantom_route_hints_conv_19 = phantom_route_hints_vals[t]; + LDKPhantomRouteHints phantom_route_hints_conv_19_conv; + phantom_route_hints_conv_19_conv.inner = untag_ptr(phantom_route_hints_conv_19); + phantom_route_hints_conv_19_conv.is_owned = ptr_is_owned(phantom_route_hints_conv_19); + CHECK_INNER_FIELD_ACCESS_OR_NULL(phantom_route_hints_conv_19_conv); + phantom_route_hints_conv_19_conv = PhantomRouteHints_clone(&phantom_route_hints_conv_19_conv); + phantom_route_hints_constr.data[t] = phantom_route_hints_conv_19_conv; + } + FREE(phantom_route_hints); + void* entropy_source_ptr = untag_ptr(entropy_source); + CHECK_ACCESS(entropy_source_ptr); + LDKEntropySource entropy_source_conv = *(LDKEntropySource*)(entropy_source_ptr); + if (entropy_source_conv.free == LDKEntropySource_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKEntropySource_JCalls_cloned(&entropy_source_conv); + } + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKNodeSigner_JCalls_cloned(&node_signer_conv); + } + 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); + } + LDKCurrency network_conv = LDKCurrency_from_js(network); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); + LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); + *ret_conv = create_phantom_invoice_with_description_hash(amt_msat_conv, payment_hash_ref, invoice_expiry_delta_secs, description_hash_conv, phantom_route_hints_constr, entropy_source_conv, node_signer_conv, logger_conv, network_conv, min_final_cltv_expiry_delta_conv, duration_since_epoch); + 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) { +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 node_signer, 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, uint64_t min_final_cltv_expiry_delta) { 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) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -48817,23 +50283,27 @@ uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_with description_hash_conv.is_owned = ptr_is_owned(description_hash); CHECK_INNER_FIELD_ACCESS_OR_NULL(description_hash_conv); description_hash_conv = Sha256_clone(&description_hash_conv); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_hash_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_and_duration_since_epoch"))) TS_create_invoice_from_channelmanager_and_duration_since_epoch(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) { +uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_and_duration_since_epoch"))) TS_create_invoice_from_channelmanager_and_duration_since_epoch(uint64_t channelmanager, uint64_t node_signer, uint64_t logger, uint32_t network, uint64_t amt_msat, jstring description, int64_t duration_since_epoch, int32_t invoice_expiry_delta_secs, uint64_t min_final_cltv_expiry_delta) { 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) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -48848,23 +50318,27 @@ uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_and_ 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); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ"); - *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, keys_manager_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs); + *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -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) { +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 node_signer, 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, uint64_t min_final_cltv_expiry_delta) { 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) { + void* node_signer_ptr = untag_ptr(node_signer); + CHECK_ACCESS(node_signer_ptr); + LDKNodeSigner node_signer_conv = *(LDKNodeSigner*)(node_signer_ptr); + if (node_signer_conv.free == LDKNodeSigner_JCalls_free) { // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKKeysInterface_JCalls_cloned(&keys_manager_conv); + LDKNodeSigner_JCalls_cloned(&node_signer_conv); } void* logger_ptr = untag_ptr(logger); CHECK_ACCESS(logger_ptr); @@ -48882,22 +50356,15 @@ uint64_t __attribute__((export_name("TS_create_invoice_from_channelmanager_and_ LDKThirtyTwoBytes payment_hash_ref; CHECK(payment_hash->arr_len == 32); memcpy(payment_hash_ref.data, payment_hash->elems, 32); FREE(payment_hash); + void* min_final_cltv_expiry_delta_ptr = untag_ptr(min_final_cltv_expiry_delta); + CHECK_ACCESS(min_final_cltv_expiry_delta_ptr); + LDKCOption_u16Z min_final_cltv_expiry_delta_conv = *(LDKCOption_u16Z*)(min_final_cltv_expiry_delta_ptr); + min_final_cltv_expiry_delta_conv = COption_u16Z_clone((LDKCOption_u16Z*)untag_ptr(min_final_cltv_expiry_delta)); 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); + *ret_conv = create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(&channelmanager_conv, node_signer_conv, logger_conv, network_conv, amt_msat_conv, description_conv, duration_since_epoch, invoice_expiry_delta_secs, payment_hash_ref, min_final_cltv_expiry_delta_conv); return tag_ptr(ret_conv, true); } -uint64_t __attribute__((export_name("TS_ChannelManager_as_Payer"))) TS_ChannelManager_as_Payer(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; - LDKPayer* ret_ret = MALLOC(sizeof(LDKPayer), "LDKPayer"); - *ret_ret = ChannelManager_as_Payer(&this_arg_conv); - return tag_ptr(ret_ret, true); -} - uint64_t __attribute__((export_name("TS_SiPrefix_from_str"))) TS_SiPrefix_from_str(jstring s) { LDKStr s_conv = str_ref_to_owned_c(s); LDKCResult_SiPrefixParseErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixParseErrorZ), "LDKCResult_SiPrefixParseErrorZ");