From 44e2b3520205dadcda0d34de8addc7a0b7ea7362 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 1 Jun 2023 20:22:45 +0000 Subject: [PATCH] [TS] Update auto-generated bindings --- ts/bindings.c | 22 ++++++++++++++++++- ts/bindings.c.body | 22 ++++++++++++++++++- ts/bindings.mts | 18 +++++++++++++++ ts/structs/BlindedPath.mts | 2 +- ts/structs/BuiltCommitmentTransaction.mts | 2 +- ts/structs/ChainMonitor.mts | 2 +- ts/structs/ChannelManager.mts | 2 +- ts/structs/ChannelManagerReadArgs.mts | 18 +++++++-------- ts/structs/ChannelMonitor.mts | 18 +++++++-------- ts/structs/CustomMessageHandler.mts | 2 +- ts/structs/CustomOnionMessageHandler.mts | 2 +- ts/structs/DefaultRouter.mts | 2 +- ts/structs/EventsProvider.mts | 2 +- ts/structs/Future.mts | 2 +- ts/structs/InMemorySigner.mts | 2 +- ts/structs/LockableScore.mts | 2 +- ts/structs/MessageHandler.mts | 8 +++---- ts/structs/MultiThreadedLockableScore.mts | 2 +- ts/structs/NetworkGraph.mts | 4 ++-- ts/structs/OnionMessageContents.mts | 2 +- ts/structs/OnionMessenger.mts | 2 +- .../Option_CustomOnionMessageContentsZ.mts | 2 +- ts/structs/Option_FilterZ.mts | 2 +- ts/structs/Option_ScalarZ.mts | 16 ++++++++++++++ ts/structs/Option_TypeZ.mts | 2 +- ts/structs/Option_UtxoLookupZ.mts | 2 +- ts/structs/P2PGossipSync.mts | 2 +- ts/structs/PeerManager.mts | 12 +++++----- ts/structs/Persister.mts | 2 +- ts/structs/ProbabilisticScorer.mts | 4 ++-- ts/structs/RapidGossipSync.mts | 2 +- .../Result_NetworkGraphDecodeErrorZ.mts | 2 +- ...Result_ProbabilisticScorerDecodeErrorZ.mts | 2 +- ...riteableEcdsaChannelSignerDecodeErrorZ.mts | 2 +- .../ScorerAccountingForInFlightHtlcs.mts | 2 +- ts/structs/SignerProvider.mts | 2 +- ts/structs/TrustedCommitmentTransaction.mts | 2 +- .../TwoTuple_BlockHashChannelManagerZ.mts | 2 +- ts/structs/TwoTuple_PublicKeyTypeZ.mts | 2 +- ts/structs/UtilMethods.mts | 20 ++++++++--------- 40 files changed, 147 insertions(+), 73 deletions(-) diff --git a/ts/bindings.c b/ts/bindings.c index d357a2cf..3ae6cade 100644 --- a/ts/bindings.c +++ b/ts/bindings.c @@ -5920,7 +5920,7 @@ uint64_t __attribute__((export_name("TS_NodeSigner_ecdh"))) TS_NodeSigner_ecdh( void* tweak_ptr = untag_ptr(tweak); CHECK_ACCESS(tweak_ptr); LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ + tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak)); LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); return tag_ptr(ret_conv, true); @@ -16621,6 +16621,26 @@ void __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ COption_ScalarZ_free(_res_conv); } +static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) { + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_ScalarZ_clone_ptr"))) TS_COption_ScalarZ_clone_ptr(uint64_t arg) { + LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg); + int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_ScalarZ_clone"))) TS_COption_ScalarZ_clone(uint64_t orig) { + LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig); + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK(o->arr_len == 32); diff --git a/ts/bindings.c.body b/ts/bindings.c.body index 13b1d657..87eba6a8 100644 --- a/ts/bindings.c.body +++ b/ts/bindings.c.body @@ -5918,7 +5918,7 @@ uint64_t __attribute__((export_name("TS_NodeSigner_ecdh"))) TS_NodeSigner_ecdh( void* tweak_ptr = untag_ptr(tweak); CHECK_ACCESS(tweak_ptr); LDKCOption_ScalarZ tweak_conv = *(LDKCOption_ScalarZ*)(tweak_ptr); - // WARNING: we may need a move here but no clone is available for LDKCOption_ScalarZ + tweak_conv = COption_ScalarZ_clone((LDKCOption_ScalarZ*)untag_ptr(tweak)); LDKCResult_SharedSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SharedSecretNoneZ), "LDKCResult_SharedSecretNoneZ"); *ret_conv = (this_arg_conv->ecdh)(this_arg_conv->this_arg, recipient_conv, other_key_ref, tweak_conv); return tag_ptr(ret_conv, true); @@ -16619,6 +16619,26 @@ void __attribute__((export_name("TS_COption_ScalarZ_free"))) TS_COption_ScalarZ COption_ScalarZ_free(_res_conv); } +static inline uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg) { + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(arg); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} +int64_t __attribute__((export_name("TS_COption_ScalarZ_clone_ptr"))) TS_COption_ScalarZ_clone_ptr(uint64_t arg) { + LDKCOption_ScalarZ* arg_conv = (LDKCOption_ScalarZ*)untag_ptr(arg); + int64_t ret_conv = COption_ScalarZ_clone_ptr(arg_conv); + return ret_conv; +} + +uint64_t __attribute__((export_name("TS_COption_ScalarZ_clone"))) TS_COption_ScalarZ_clone(uint64_t orig) { + LDKCOption_ScalarZ* orig_conv = (LDKCOption_ScalarZ*)untag_ptr(orig); + LDKCOption_ScalarZ *ret_copy = MALLOC(sizeof(LDKCOption_ScalarZ), "LDKCOption_ScalarZ"); + *ret_copy = COption_ScalarZ_clone(orig_conv); + uint64_t ret_ref = tag_ptr(ret_copy, true); + return ret_ref; +} + uint64_t __attribute__((export_name("TS_CResult_SharedSecretNoneZ_ok"))) TS_CResult_SharedSecretNoneZ_ok(int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK(o->arr_len == 32); diff --git a/ts/bindings.mts b/ts/bindings.mts index 00440c9d..68d39042 100644 --- a/ts/bindings.mts +++ b/ts/bindings.mts @@ -12909,6 +12909,24 @@ export function COption_ScalarZ_free(_res: bigint): void { } const nativeResponseValue = wasm.TS_COption_ScalarZ_free(_res); // debug statements here +} + // uint64_t COption_ScalarZ_clone_ptr(LDKCOption_ScalarZ *NONNULL_PTR arg); +/* @internal */ +export function COption_ScalarZ_clone_ptr(arg: bigint): bigint { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.TS_COption_ScalarZ_clone_ptr(arg); + return nativeResponseValue; +} + // struct LDKCOption_ScalarZ COption_ScalarZ_clone(const struct LDKCOption_ScalarZ *NONNULL_PTR orig); +/* @internal */ +export function COption_ScalarZ_clone(orig: bigint): bigint { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.TS_COption_ScalarZ_clone(orig); + return nativeResponseValue; } // struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o); /* @internal */ diff --git a/ts/structs/BlindedPath.mts b/ts/structs/BlindedPath.mts index 8ae7ec75..660d8ec2 100644 --- a/ts/structs/BlindedPath.mts +++ b/ts/structs/BlindedPath.mts @@ -487,7 +487,7 @@ export class BlindedPath extends CommonBase { * Errors if less than two hops are provided or if `node_pk`(s) are invalid. */ public static constructor_new_for_message(node_pks: Uint8Array[], entropy_source: EntropySource): Result_BlindedPathNoneZ { - const ret: bigint = bindings.BlindedPath_new_for_message(bindings.encodeUint32Array(node_pks != null ? node_pks.map(node_pks_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(node_pks_conv_12, 33))) : null), entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source)); + const ret: bigint = bindings.BlindedPath_new_for_message(bindings.encodeUint32Array(node_pks != null ? node_pks.map(node_pks_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(node_pks_conv_12, 33))) : null), CommonBase.get_ptr_of(entropy_source)); const ret_hu_conv: Result_BlindedPathNoneZ = Result_BlindedPathNoneZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, entropy_source); return ret_hu_conv; diff --git a/ts/structs/BuiltCommitmentTransaction.mts b/ts/structs/BuiltCommitmentTransaction.mts index ae479503..c1818972 100644 --- a/ts/structs/BuiltCommitmentTransaction.mts +++ b/ts/structs/BuiltCommitmentTransaction.mts @@ -550,7 +550,7 @@ export class BuiltCommitmentTransaction extends CommonBase { * Signs the holder commitment transaction because we are about to broadcast it. */ public sign_holder_commitment(funding_key: Uint8Array, funding_redeemscript: Uint8Array, channel_value_satoshis: bigint, entropy_source: EntropySource): Uint8Array { - const ret: number = bindings.BuiltCommitmentTransaction_sign_holder_commitment(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(funding_key, 32)), bindings.encodeUint8Array(funding_redeemscript), channel_value_satoshis, entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source)); + const ret: number = bindings.BuiltCommitmentTransaction_sign_holder_commitment(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(funding_key, 32)), bindings.encodeUint8Array(funding_redeemscript), channel_value_satoshis, CommonBase.get_ptr_of(entropy_source)); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); CommonBase.add_ref_from(this, entropy_source); return ret_conv; diff --git a/ts/structs/ChainMonitor.mts b/ts/structs/ChainMonitor.mts index 21d62917..976f7f95 100644 --- a/ts/structs/ChainMonitor.mts +++ b/ts/structs/ChainMonitor.mts @@ -470,7 +470,7 @@ export class ChainMonitor extends CommonBase { * transactions relevant to the watched channels. */ public static constructor_new(chain_source: Option_FilterZ, broadcaster: BroadcasterInterface, logger: Logger, feeest: FeeEstimator, persister: Persist): ChainMonitor { - const ret: bigint = bindings.ChainMonitor_new(CommonBase.get_ptr_of(chain_source), broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), logger == null ? 0n : CommonBase.get_ptr_of(logger), feeest == null ? 0n : CommonBase.get_ptr_of(feeest), persister == null ? 0n : CommonBase.get_ptr_of(persister)); + const ret: bigint = bindings.ChainMonitor_new(CommonBase.get_ptr_of(chain_source), CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(logger), CommonBase.get_ptr_of(feeest), CommonBase.get_ptr_of(persister)); const ret_hu_conv: ChainMonitor = new ChainMonitor(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, chain_source); diff --git a/ts/structs/ChannelManager.mts b/ts/structs/ChannelManager.mts index fffe30ef..d2bf80d6 100644 --- a/ts/structs/ChannelManager.mts +++ b/ts/structs/ChannelManager.mts @@ -514,7 +514,7 @@ export class ChannelManager extends CommonBase { * [`params.best_block.block_hash`]: chain::BestBlock::block_hash */ public static constructor_new(fee_est: FeeEstimator, chain_monitor: Watch, tx_broadcaster: BroadcasterInterface, router: Router, logger: Logger, entropy_source: EntropySource, node_signer: NodeSigner, signer_provider: SignerProvider, config: UserConfig, params: ChainParameters): ChannelManager { - const ret: bigint = bindings.ChannelManager_new(fee_est == null ? 0n : CommonBase.get_ptr_of(fee_est), chain_monitor == null ? 0n : CommonBase.get_ptr_of(chain_monitor), tx_broadcaster == null ? 0n : CommonBase.get_ptr_of(tx_broadcaster), router == null ? 0n : CommonBase.get_ptr_of(router), logger == null ? 0n : CommonBase.get_ptr_of(logger), entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), signer_provider == null ? 0n : CommonBase.get_ptr_of(signer_provider), config == null ? 0n : CommonBase.get_ptr_of(config), params == null ? 0n : CommonBase.get_ptr_of(params)); + const ret: bigint = bindings.ChannelManager_new(CommonBase.get_ptr_of(fee_est), CommonBase.get_ptr_of(chain_monitor), CommonBase.get_ptr_of(tx_broadcaster), CommonBase.get_ptr_of(router), CommonBase.get_ptr_of(logger), CommonBase.get_ptr_of(entropy_source), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(signer_provider), config == null ? 0n : CommonBase.get_ptr_of(config), params == null ? 0n : CommonBase.get_ptr_of(params)); const ret_hu_conv: ChannelManager = new ChannelManager(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, fee_est); diff --git a/ts/structs/ChannelManagerReadArgs.mts b/ts/structs/ChannelManagerReadArgs.mts index cdabbbf5..cc327ff3 100644 --- a/ts/structs/ChannelManagerReadArgs.mts +++ b/ts/structs/ChannelManagerReadArgs.mts @@ -490,7 +490,7 @@ export class ChannelManagerReadArgs extends CommonBase { * A cryptographically secure source of entropy. */ public set_entropy_source(val: EntropySource): void { - bindings.ChannelManagerReadArgs_set_entropy_source(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_entropy_source(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -508,7 +508,7 @@ export class ChannelManagerReadArgs extends CommonBase { * A signer that is able to perform node-scoped cryptographic operations. */ public set_node_signer(val: NodeSigner): void { - bindings.ChannelManagerReadArgs_set_node_signer(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_node_signer(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -530,7 +530,7 @@ export class ChannelManagerReadArgs extends CommonBase { * signing data. */ public set_signer_provider(val: SignerProvider): void { - bindings.ChannelManagerReadArgs_set_signer_provider(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_signer_provider(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -552,7 +552,7 @@ export class ChannelManagerReadArgs extends CommonBase { * No calls to the FeeEstimator will be made during deserialization. */ public set_fee_estimator(val: FeeEstimator): void { - bindings.ChannelManagerReadArgs_set_fee_estimator(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_fee_estimator(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -578,7 +578,7 @@ export class ChannelManagerReadArgs extends CommonBase { * chain::Watch after deserializing this ChannelManager. */ public set_chain_monitor(val: Watch): void { - bindings.ChannelManagerReadArgs_set_chain_monitor(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_chain_monitor(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -600,7 +600,7 @@ export class ChannelManagerReadArgs extends CommonBase { * force-closed during deserialization. */ public set_tx_broadcaster(val: BroadcasterInterface): void { - bindings.ChannelManagerReadArgs_set_tx_broadcaster(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_tx_broadcaster(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -624,7 +624,7 @@ export class ChannelManagerReadArgs extends CommonBase { * No calls to the router will be made during deserialization. */ public set_router(val: Router): void { - bindings.ChannelManagerReadArgs_set_router(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_router(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -644,7 +644,7 @@ export class ChannelManagerReadArgs extends CommonBase { * deserialization. */ public set_logger(val: Logger): void { - bindings.ChannelManagerReadArgs_set_logger(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.ChannelManagerReadArgs_set_logger(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -674,7 +674,7 @@ export class ChannelManagerReadArgs extends CommonBase { * populate a HashMap directly from C. */ public static constructor_new(entropy_source: EntropySource, node_signer: NodeSigner, signer_provider: SignerProvider, fee_estimator: FeeEstimator, chain_monitor: Watch, tx_broadcaster: BroadcasterInterface, router: Router, logger: Logger, default_config: UserConfig, channel_monitors: ChannelMonitor[]): ChannelManagerReadArgs { - const ret: bigint = bindings.ChannelManagerReadArgs_new(entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), signer_provider == null ? 0n : CommonBase.get_ptr_of(signer_provider), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), chain_monitor == null ? 0n : CommonBase.get_ptr_of(chain_monitor), tx_broadcaster == null ? 0n : CommonBase.get_ptr_of(tx_broadcaster), router == null ? 0n : CommonBase.get_ptr_of(router), logger == null ? 0n : CommonBase.get_ptr_of(logger), default_config == null ? 0n : CommonBase.get_ptr_of(default_config), bindings.encodeUint64Array(channel_monitors != null ? channel_monitors.map(channel_monitors_conv_16 => channel_monitors_conv_16 == null ? 0n : CommonBase.get_ptr_of(channel_monitors_conv_16)) : null)); + const ret: bigint = bindings.ChannelManagerReadArgs_new(CommonBase.get_ptr_of(entropy_source), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(signer_provider), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(chain_monitor), CommonBase.get_ptr_of(tx_broadcaster), CommonBase.get_ptr_of(router), CommonBase.get_ptr_of(logger), default_config == null ? 0n : CommonBase.get_ptr_of(default_config), bindings.encodeUint64Array(channel_monitors != null ? channel_monitors.map(channel_monitors_conv_16 => channel_monitors_conv_16 == null ? 0n : CommonBase.get_ptr_of(channel_monitors_conv_16)) : null)); const ret_hu_conv: ChannelManagerReadArgs = new ChannelManagerReadArgs(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, entropy_source); diff --git a/ts/structs/ChannelMonitor.mts b/ts/structs/ChannelMonitor.mts index d91243de..19b048b1 100644 --- a/ts/structs/ChannelMonitor.mts +++ b/ts/structs/ChannelMonitor.mts @@ -491,7 +491,7 @@ export class ChannelMonitor extends CommonBase { * panics if the given update is not the next update by update_id. */ public update_monitor(updates: ChannelMonitorUpdate, broadcaster: BroadcasterInterface, fee_estimator: FeeEstimator, logger: Logger): Result_NoneNoneZ { - const ret: bigint = bindings.ChannelMonitor_update_monitor(this.ptr, updates == null ? 0n : CommonBase.get_ptr_of(updates), broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: bigint = bindings.ChannelMonitor_update_monitor(this.ptr, updates == null ? 0n : CommonBase.get_ptr_of(updates), CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(logger)); const ret_hu_conv: Result_NoneNoneZ = Result_NoneNoneZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, updates); CommonBase.add_ref_from(this, broadcaster); @@ -543,7 +543,7 @@ export class ChannelMonitor extends CommonBase { * have been registered. */ public load_outputs_to_watch(filter: Filter): void { - bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, filter == null ? 0n : CommonBase.get_ptr_of(filter)); + bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, CommonBase.get_ptr_of(filter)); CommonBase.add_ref_from(this, filter); } @@ -621,7 +621,7 @@ export class ChannelMonitor extends CommonBase { * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure */ public get_latest_holder_commitment_txn(logger: Logger): Uint8Array[] { - const ret: number = bindings.ChannelMonitor_get_latest_holder_commitment_txn(this.ptr, logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: number = bindings.ChannelMonitor_get_latest_holder_commitment_txn(this.ptr, CommonBase.get_ptr_of(logger)); const ret_conv_12_len: number = bindings.getArrayLength(ret); const ret_conv_12_arr: Uint8Array[] = new Array(ret_conv_12_len).fill(null); for (var m = 0; m < ret_conv_12_len; m++) { @@ -648,7 +648,7 @@ export class ChannelMonitor extends CommonBase { * [`get_outputs_to_watch`]: #method.get_outputs_to_watch */ public block_connected(header: Uint8Array, txdata: TwoTuple_usizeTransactionZ[], height: number, broadcaster: BroadcasterInterface, fee_estimator: FeeEstimator, logger: Logger): TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] { - const ret: number = bindings.ChannelMonitor_block_connected(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), bindings.encodeUint64Array(txdata != null ? txdata.map(txdata_conv_28 => txdata_conv_28 != null ? CommonBase.get_ptr_of(txdata_conv_28) : 0n) : null), height, broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: number = bindings.ChannelMonitor_block_connected(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), bindings.encodeUint64Array(txdata != null ? txdata.map(txdata_conv_28 => txdata_conv_28 != null ? CommonBase.get_ptr_of(txdata_conv_28) : 0n) : null), height, CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(logger)); const ret_conv_39_len: number = bindings.getArrayLength(ret); const ret_conv_39_arr: TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] = new Array(ret_conv_39_len).fill(null); for (var n = 0; n < ret_conv_39_len; n++) { @@ -669,7 +669,7 @@ export class ChannelMonitor extends CommonBase { * appropriately. */ public block_disconnected(header: Uint8Array, height: number, broadcaster: BroadcasterInterface, fee_estimator: FeeEstimator, logger: Logger): void { - bindings.ChannelMonitor_block_disconnected(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), height, broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + bindings.ChannelMonitor_block_disconnected(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), height, CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(logger)); CommonBase.add_ref_from(this, broadcaster); CommonBase.add_ref_from(this, fee_estimator); CommonBase.add_ref_from(this, logger); @@ -685,7 +685,7 @@ export class ChannelMonitor extends CommonBase { * [`block_connected`]: Self::block_connected */ public transactions_confirmed(header: Uint8Array, txdata: TwoTuple_usizeTransactionZ[], height: number, broadcaster: BroadcasterInterface, fee_estimator: FeeEstimator, logger: Logger): TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] { - const ret: number = bindings.ChannelMonitor_transactions_confirmed(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), bindings.encodeUint64Array(txdata != null ? txdata.map(txdata_conv_28 => txdata_conv_28 != null ? CommonBase.get_ptr_of(txdata_conv_28) : 0n) : null), height, broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: number = bindings.ChannelMonitor_transactions_confirmed(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), bindings.encodeUint64Array(txdata != null ? txdata.map(txdata_conv_28 => txdata_conv_28 != null ? CommonBase.get_ptr_of(txdata_conv_28) : 0n) : null), height, CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(logger)); const ret_conv_39_len: number = bindings.getArrayLength(ret); const ret_conv_39_arr: TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] = new Array(ret_conv_39_len).fill(null); for (var n = 0; n < ret_conv_39_len; n++) { @@ -710,7 +710,7 @@ export class ChannelMonitor extends CommonBase { * [`block_disconnected`]: Self::block_disconnected */ public transaction_unconfirmed(txid: Uint8Array, broadcaster: BroadcasterInterface, fee_estimator: FeeEstimator, logger: Logger): void { - bindings.ChannelMonitor_transaction_unconfirmed(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(txid, 32)), broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + bindings.ChannelMonitor_transaction_unconfirmed(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(txid, 32)), CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(logger)); CommonBase.add_ref_from(this, broadcaster); CommonBase.add_ref_from(this, fee_estimator); CommonBase.add_ref_from(this, logger); @@ -726,7 +726,7 @@ export class ChannelMonitor extends CommonBase { * [`block_connected`]: Self::block_connected */ public best_block_updated(header: Uint8Array, height: number, broadcaster: BroadcasterInterface, fee_estimator: FeeEstimator, logger: Logger): TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] { - const ret: number = bindings.ChannelMonitor_best_block_updated(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), height, broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: number = bindings.ChannelMonitor_best_block_updated(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(header, 80)), height, CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(logger)); const ret_conv_39_len: number = bindings.getArrayLength(ret); const ret_conv_39_arr: TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] = new Array(ret_conv_39_len).fill(null); for (var n = 0; n < ret_conv_39_len; n++) { @@ -778,7 +778,7 @@ export class ChannelMonitor extends CommonBase { * connections, like on mobile. */ public rebroadcast_pending_claims(broadcaster: BroadcasterInterface, fee_estimator: FeeEstimator, logger: Logger): void { - bindings.ChannelMonitor_rebroadcast_pending_claims(this.ptr, broadcaster == null ? 0n : CommonBase.get_ptr_of(broadcaster), fee_estimator == null ? 0n : CommonBase.get_ptr_of(fee_estimator), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + bindings.ChannelMonitor_rebroadcast_pending_claims(this.ptr, CommonBase.get_ptr_of(broadcaster), CommonBase.get_ptr_of(fee_estimator), CommonBase.get_ptr_of(logger)); CommonBase.add_ref_from(this, broadcaster); CommonBase.add_ref_from(this, fee_estimator); CommonBase.add_ref_from(this, logger); diff --git a/ts/structs/CustomMessageHandler.mts b/ts/structs/CustomMessageHandler.mts index cfcb5b50..1ef53252 100644 --- a/ts/structs/CustomMessageHandler.mts +++ b/ts/structs/CustomMessageHandler.mts @@ -513,7 +513,7 @@ export class CustomMessageHandler extends CommonBase { * to send. */ public handle_custom_message(msg: Type, sender_node_id: Uint8Array): Result_NoneLightningErrorZ { - const ret: bigint = bindings.CustomMessageHandler_handle_custom_message(this.ptr, msg == null ? 0n : CommonBase.get_ptr_of(msg), bindings.encodeUint8Array(bindings.check_arr_len(sender_node_id, 33))); + const ret: bigint = bindings.CustomMessageHandler_handle_custom_message(this.ptr, CommonBase.get_ptr_of(msg), bindings.encodeUint8Array(bindings.check_arr_len(sender_node_id, 33))); const ret_hu_conv: Result_NoneLightningErrorZ = Result_NoneLightningErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, msg); return ret_hu_conv; diff --git a/ts/structs/CustomOnionMessageHandler.mts b/ts/structs/CustomOnionMessageHandler.mts index d1ed2219..d75cf896 100644 --- a/ts/structs/CustomOnionMessageHandler.mts +++ b/ts/structs/CustomOnionMessageHandler.mts @@ -506,7 +506,7 @@ export class CustomOnionMessageHandler extends CommonBase { * Called with the custom message that was received. */ public handle_custom_message(msg: CustomOnionMessageContents): void { - bindings.CustomOnionMessageHandler_handle_custom_message(this.ptr, msg == null ? 0n : CommonBase.get_ptr_of(msg)); + bindings.CustomOnionMessageHandler_handle_custom_message(this.ptr, CommonBase.get_ptr_of(msg)); CommonBase.add_ref_from(this, msg); } diff --git a/ts/structs/DefaultRouter.mts b/ts/structs/DefaultRouter.mts index 9588fc82..d6fbb65b 100644 --- a/ts/structs/DefaultRouter.mts +++ b/ts/structs/DefaultRouter.mts @@ -449,7 +449,7 @@ export class DefaultRouter extends CommonBase { * Creates a new router. */ public static constructor_new(network_graph: NetworkGraph, logger: Logger, random_seed_bytes: Uint8Array, scorer: LockableScore): DefaultRouter { - const ret: bigint = bindings.DefaultRouter_new(network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), logger == null ? 0n : CommonBase.get_ptr_of(logger), bindings.encodeUint8Array(bindings.check_arr_len(random_seed_bytes, 32)), scorer == null ? 0n : CommonBase.get_ptr_of(scorer)); + const ret: bigint = bindings.DefaultRouter_new(network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), CommonBase.get_ptr_of(logger), bindings.encodeUint8Array(bindings.check_arr_len(random_seed_bytes, 32)), CommonBase.get_ptr_of(scorer)); const ret_hu_conv: DefaultRouter = new DefaultRouter(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, network_graph); diff --git a/ts/structs/EventsProvider.mts b/ts/structs/EventsProvider.mts index 9ae7274f..70765c6e 100644 --- a/ts/structs/EventsProvider.mts +++ b/ts/structs/EventsProvider.mts @@ -526,7 +526,7 @@ export class EventsProvider extends CommonBase { * See the trait-level documentation for requirements. */ public process_pending_events(handler: EventHandler): void { - bindings.EventsProvider_process_pending_events(this.ptr, handler == null ? 0n : CommonBase.get_ptr_of(handler)); + bindings.EventsProvider_process_pending_events(this.ptr, CommonBase.get_ptr_of(handler)); CommonBase.add_ref_from(this, handler); } diff --git a/ts/structs/Future.mts b/ts/structs/Future.mts index ea757c68..2543184f 100644 --- a/ts/structs/Future.mts +++ b/ts/structs/Future.mts @@ -467,7 +467,7 @@ export class Future extends CommonBase { * completed, the callback will be called immediately. */ public register_callback_fn(callback: FutureCallback): void { - bindings.Future_register_callback_fn(this.ptr, callback == null ? 0n : CommonBase.get_ptr_of(callback)); + bindings.Future_register_callback_fn(this.ptr, CommonBase.get_ptr_of(callback)); CommonBase.add_ref_from(this, callback); } diff --git a/ts/structs/InMemorySigner.mts b/ts/structs/InMemorySigner.mts index 8df8e9b8..1553dc70 100644 --- a/ts/structs/InMemorySigner.mts +++ b/ts/structs/InMemorySigner.mts @@ -745,7 +745,7 @@ export class InMemorySigner extends CommonBase { * Read a InMemorySigner from a byte array, created by InMemorySigner_write */ public static constructor_read(ser: Uint8Array, arg: EntropySource): Result_InMemorySignerDecodeErrorZ { - const ret: bigint = bindings.InMemorySigner_read(bindings.encodeUint8Array(ser), arg == null ? 0n : CommonBase.get_ptr_of(arg)); + const ret: bigint = bindings.InMemorySigner_read(bindings.encodeUint8Array(ser), CommonBase.get_ptr_of(arg)); const ret_hu_conv: Result_InMemorySignerDecodeErrorZ = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, arg); return ret_hu_conv; diff --git a/ts/structs/LockableScore.mts b/ts/structs/LockableScore.mts index 2c952672..7d39a67c 100644 --- a/ts/structs/LockableScore.mts +++ b/ts/structs/LockableScore.mts @@ -478,7 +478,7 @@ export class LockableScore extends CommonBase { let structImplementation = { lock (): bigint { const ret: Score = arg.lock(); - const result: bigint = ret == null ? 0n : CommonBase.get_ptr_of(ret); + const result: bigint = CommonBase.get_ptr_of(ret); CommonBase.add_ref_from(impl_holder.held, ret); return result; }, diff --git a/ts/structs/MessageHandler.mts b/ts/structs/MessageHandler.mts index 70dfcc07..194f296f 100644 --- a/ts/structs/MessageHandler.mts +++ b/ts/structs/MessageHandler.mts @@ -465,7 +465,7 @@ export class MessageHandler extends CommonBase { * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ public set_chan_handler(val: ChannelMessageHandler): void { - bindings.MessageHandler_set_chan_handler(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.MessageHandler_set_chan_handler(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -489,7 +489,7 @@ export class MessageHandler extends CommonBase { * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ public set_route_handler(val: RoutingMessageHandler): void { - bindings.MessageHandler_set_route_handler(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.MessageHandler_set_route_handler(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -509,7 +509,7 @@ export class MessageHandler extends CommonBase { * [`IgnoringMessageHandler`]. */ public set_onion_message_handler(val: OnionMessageHandler): void { - bindings.MessageHandler_set_onion_message_handler(this.ptr, val == null ? 0n : CommonBase.get_ptr_of(val)); + bindings.MessageHandler_set_onion_message_handler(this.ptr, CommonBase.get_ptr_of(val)); CommonBase.add_ref_from(this, val); } @@ -517,7 +517,7 @@ export class MessageHandler extends CommonBase { * Constructs a new MessageHandler given each field */ public static constructor_new(chan_handler_arg: ChannelMessageHandler, route_handler_arg: RoutingMessageHandler, onion_message_handler_arg: OnionMessageHandler): MessageHandler { - const ret: bigint = bindings.MessageHandler_new(chan_handler_arg == null ? 0n : CommonBase.get_ptr_of(chan_handler_arg), route_handler_arg == null ? 0n : CommonBase.get_ptr_of(route_handler_arg), onion_message_handler_arg == null ? 0n : CommonBase.get_ptr_of(onion_message_handler_arg)); + const ret: bigint = bindings.MessageHandler_new(CommonBase.get_ptr_of(chan_handler_arg), CommonBase.get_ptr_of(route_handler_arg), CommonBase.get_ptr_of(onion_message_handler_arg)); const ret_hu_conv: MessageHandler = new MessageHandler(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, chan_handler_arg); diff --git a/ts/structs/MultiThreadedLockableScore.mts b/ts/structs/MultiThreadedLockableScore.mts index 3f282a56..9d78ecab 100644 --- a/ts/structs/MultiThreadedLockableScore.mts +++ b/ts/structs/MultiThreadedLockableScore.mts @@ -480,7 +480,7 @@ export class MultiThreadedLockableScore extends CommonBase { * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. */ public static constructor_new(score: Score): MultiThreadedLockableScore { - const ret: bigint = bindings.MultiThreadedLockableScore_new(score == null ? 0n : CommonBase.get_ptr_of(score)); + const ret: bigint = bindings.MultiThreadedLockableScore_new(CommonBase.get_ptr_of(score)); const ret_hu_conv: MultiThreadedLockableScore = new MultiThreadedLockableScore(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, score); diff --git a/ts/structs/NetworkGraph.mts b/ts/structs/NetworkGraph.mts index f4cb414d..021d2a28 100644 --- a/ts/structs/NetworkGraph.mts +++ b/ts/structs/NetworkGraph.mts @@ -467,7 +467,7 @@ export class NetworkGraph extends CommonBase { * Read a NetworkGraph from a byte array, created by NetworkGraph_write */ public static constructor_read(ser: Uint8Array, arg: Logger): Result_NetworkGraphDecodeErrorZ { - const ret: bigint = bindings.NetworkGraph_read(bindings.encodeUint8Array(ser), arg == null ? 0n : CommonBase.get_ptr_of(arg)); + const ret: bigint = bindings.NetworkGraph_read(bindings.encodeUint8Array(ser), CommonBase.get_ptr_of(arg)); const ret_hu_conv: Result_NetworkGraphDecodeErrorZ = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, arg); return ret_hu_conv; @@ -477,7 +477,7 @@ export class NetworkGraph extends CommonBase { * Creates a new, empty, network graph. */ public static constructor_new(network: Network, logger: Logger): NetworkGraph { - const ret: bigint = bindings.NetworkGraph_new(network, logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: bigint = bindings.NetworkGraph_new(network, CommonBase.get_ptr_of(logger)); const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, logger); diff --git a/ts/structs/OnionMessageContents.mts b/ts/structs/OnionMessageContents.mts index 81b40417..d146a183 100644 --- a/ts/structs/OnionMessageContents.mts +++ b/ts/structs/OnionMessageContents.mts @@ -470,7 +470,7 @@ export class OnionMessageContents extends CommonBase { * Utility method to constructs a new Custom-variant OnionMessageContents */ public static constructor_custom(a: CustomOnionMessageContents): OnionMessageContents { - const ret: bigint = bindings.OnionMessageContents_custom(a == null ? 0n : CommonBase.get_ptr_of(a)); + const ret: bigint = bindings.OnionMessageContents_custom(CommonBase.get_ptr_of(a)); const ret_hu_conv: OnionMessageContents = OnionMessageContents.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, a); diff --git a/ts/structs/OnionMessenger.mts b/ts/structs/OnionMessenger.mts index d39533ad..75872a8d 100644 --- a/ts/structs/OnionMessenger.mts +++ b/ts/structs/OnionMessenger.mts @@ -522,7 +522,7 @@ export class OnionMessenger extends CommonBase { * their respective handlers. */ public static constructor_new(entropy_source: EntropySource, node_signer: NodeSigner, logger: Logger, custom_handler: CustomOnionMessageHandler): OnionMessenger { - const ret: bigint = bindings.OnionMessenger_new(entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), logger == null ? 0n : CommonBase.get_ptr_of(logger), custom_handler == null ? 0n : CommonBase.get_ptr_of(custom_handler)); + const ret: bigint = bindings.OnionMessenger_new(CommonBase.get_ptr_of(entropy_source), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(logger), CommonBase.get_ptr_of(custom_handler)); const ret_hu_conv: OnionMessenger = new OnionMessenger(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, entropy_source); diff --git a/ts/structs/Option_CustomOnionMessageContentsZ.mts b/ts/structs/Option_CustomOnionMessageContentsZ.mts index 5792d75c..afc6b982 100644 --- a/ts/structs/Option_CustomOnionMessageContentsZ.mts +++ b/ts/structs/Option_CustomOnionMessageContentsZ.mts @@ -455,7 +455,7 @@ export class Option_CustomOnionMessageContentsZ extends CommonBase { * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents */ public static constructor_some(o: CustomOnionMessageContents): Option_CustomOnionMessageContentsZ { - const ret: bigint = bindings.COption_CustomOnionMessageContentsZ_some(o == null ? 0n : CommonBase.get_ptr_of(o)); + const ret: bigint = bindings.COption_CustomOnionMessageContentsZ_some(CommonBase.get_ptr_of(o)); const ret_hu_conv: Option_CustomOnionMessageContentsZ = Option_CustomOnionMessageContentsZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, o); diff --git a/ts/structs/Option_FilterZ.mts b/ts/structs/Option_FilterZ.mts index d3a05cab..15868a50 100644 --- a/ts/structs/Option_FilterZ.mts +++ b/ts/structs/Option_FilterZ.mts @@ -455,7 +455,7 @@ export class Option_FilterZ extends CommonBase { * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter */ public static constructor_some(o: Filter): Option_FilterZ { - const ret: bigint = bindings.COption_FilterZ_some(o == null ? 0n : CommonBase.get_ptr_of(o)); + const ret: bigint = bindings.COption_FilterZ_some(CommonBase.get_ptr_of(o)); const ret_hu_conv: Option_FilterZ = Option_FilterZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, o); diff --git a/ts/structs/Option_ScalarZ.mts b/ts/structs/Option_ScalarZ.mts index 0d62930b..921f6f00 100644 --- a/ts/structs/Option_ScalarZ.mts +++ b/ts/structs/Option_ScalarZ.mts @@ -472,6 +472,22 @@ export class Option_ScalarZ extends CommonBase { return ret_hu_conv; } + public clone_ptr(): bigint { + const ret: bigint = bindings.COption_ScalarZ_clone_ptr(this.ptr); + return ret; + } + + /** + * Creates a new COption_ScalarZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public clone(): Option_ScalarZ { + const ret: bigint = bindings.COption_ScalarZ_clone(this.ptr); + const ret_hu_conv: Option_ScalarZ = Option_ScalarZ.constr_from_ptr(ret); + CommonBase.add_ref_from(ret_hu_conv, this); + return ret_hu_conv; + } + } /** A Option_ScalarZ of type Some */ export class Option_ScalarZ_Some extends Option_ScalarZ { diff --git a/ts/structs/Option_TypeZ.mts b/ts/structs/Option_TypeZ.mts index c2d20648..f7e0fcf3 100644 --- a/ts/structs/Option_TypeZ.mts +++ b/ts/structs/Option_TypeZ.mts @@ -455,7 +455,7 @@ export class Option_TypeZ extends CommonBase { * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type */ public static constructor_some(o: Type): Option_TypeZ { - const ret: bigint = bindings.COption_TypeZ_some(o == null ? 0n : CommonBase.get_ptr_of(o)); + const ret: bigint = bindings.COption_TypeZ_some(CommonBase.get_ptr_of(o)); const ret_hu_conv: Option_TypeZ = Option_TypeZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, o); diff --git a/ts/structs/Option_UtxoLookupZ.mts b/ts/structs/Option_UtxoLookupZ.mts index eab1f8c3..83ca6d12 100644 --- a/ts/structs/Option_UtxoLookupZ.mts +++ b/ts/structs/Option_UtxoLookupZ.mts @@ -455,7 +455,7 @@ export class Option_UtxoLookupZ extends CommonBase { * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup */ public static constructor_some(o: UtxoLookup): Option_UtxoLookupZ { - const ret: bigint = bindings.COption_UtxoLookupZ_some(o == null ? 0n : CommonBase.get_ptr_of(o)); + const ret: bigint = bindings.COption_UtxoLookupZ_some(CommonBase.get_ptr_of(o)); const ret_hu_conv: Option_UtxoLookupZ = Option_UtxoLookupZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, o); diff --git a/ts/structs/P2PGossipSync.mts b/ts/structs/P2PGossipSync.mts index 2e980a11..362415d8 100644 --- a/ts/structs/P2PGossipSync.mts +++ b/ts/structs/P2PGossipSync.mts @@ -456,7 +456,7 @@ export class P2PGossipSync extends CommonBase { * correct, and the announcement is signed with channel owners' keys. */ public static constructor_new(network_graph: NetworkGraph, utxo_lookup: Option_UtxoLookupZ, logger: Logger): P2PGossipSync { - const ret: bigint = bindings.P2PGossipSync_new(network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), CommonBase.get_ptr_of(utxo_lookup), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: bigint = bindings.P2PGossipSync_new(network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), CommonBase.get_ptr_of(utxo_lookup), CommonBase.get_ptr_of(logger)); const ret_hu_conv: P2PGossipSync = new P2PGossipSync(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, network_graph); diff --git a/ts/structs/PeerManager.mts b/ts/structs/PeerManager.mts index 03ca6ad9..d0437763 100644 --- a/ts/structs/PeerManager.mts +++ b/ts/structs/PeerManager.mts @@ -475,7 +475,7 @@ export class PeerManager extends CommonBase { * minute should suffice. */ public static constructor_new(message_handler_chan_handler_arg: ChannelMessageHandler, message_handler_route_handler_arg: RoutingMessageHandler, message_handler_onion_message_handler_arg: OnionMessageHandler, current_time: number, ephemeral_random_data: Uint8Array, logger: Logger, custom_message_handler: CustomMessageHandler, node_signer: NodeSigner): PeerManager { - const ret: bigint = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0n : CommonBase.get_ptr_of(message_handler_chan_handler_arg), message_handler_route_handler_arg == null ? 0n : CommonBase.get_ptr_of(message_handler_route_handler_arg), message_handler_onion_message_handler_arg == null ? 0n : CommonBase.get_ptr_of(message_handler_onion_message_handler_arg)), current_time, bindings.encodeUint8Array(bindings.check_arr_len(ephemeral_random_data, 32)), logger == null ? 0n : CommonBase.get_ptr_of(logger), custom_message_handler == null ? 0n : CommonBase.get_ptr_of(custom_message_handler), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer)); + const ret: bigint = bindings.PeerManager_new(bindings.MessageHandler_new(CommonBase.get_ptr_of(message_handler_chan_handler_arg), CommonBase.get_ptr_of(message_handler_route_handler_arg), CommonBase.get_ptr_of(message_handler_onion_message_handler_arg)), current_time, bindings.encodeUint8Array(bindings.check_arr_len(ephemeral_random_data, 32)), CommonBase.get_ptr_of(logger), CommonBase.get_ptr_of(custom_message_handler), CommonBase.get_ptr_of(node_signer)); const ret_hu_conv: PeerManager = new PeerManager(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, message_handler_chan_handler_arg); @@ -531,7 +531,7 @@ export class PeerManager extends CommonBase { * [`socket_disconnected`]: PeerManager::socket_disconnected */ public new_outbound_connection(their_node_id: Uint8Array, descriptor: SocketDescriptor, remote_network_address: Option_NetAddressZ): Result_CVec_u8ZPeerHandleErrorZ { - const ret: bigint = bindings.PeerManager_new_outbound_connection(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), descriptor == null ? 0n : CommonBase.get_ptr_of(descriptor), CommonBase.get_ptr_of(remote_network_address)); + const ret: bigint = bindings.PeerManager_new_outbound_connection(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(their_node_id, 33)), CommonBase.get_ptr_of(descriptor), CommonBase.get_ptr_of(remote_network_address)); const ret_hu_conv: Result_CVec_u8ZPeerHandleErrorZ = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, descriptor); CommonBase.add_ref_from(this, remote_network_address); @@ -556,7 +556,7 @@ export class PeerManager extends CommonBase { * [`socket_disconnected`]: PeerManager::socket_disconnected */ public new_inbound_connection(descriptor: SocketDescriptor, remote_network_address: Option_NetAddressZ): Result_NonePeerHandleErrorZ { - const ret: bigint = bindings.PeerManager_new_inbound_connection(this.ptr, descriptor == null ? 0n : CommonBase.get_ptr_of(descriptor), CommonBase.get_ptr_of(remote_network_address)); + const ret: bigint = bindings.PeerManager_new_inbound_connection(this.ptr, CommonBase.get_ptr_of(descriptor), CommonBase.get_ptr_of(remote_network_address)); const ret_hu_conv: Result_NonePeerHandleErrorZ = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, descriptor); CommonBase.add_ref_from(this, remote_network_address); @@ -578,7 +578,7 @@ export class PeerManager extends CommonBase { * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail */ public write_buffer_space_avail(descriptor: SocketDescriptor): Result_NonePeerHandleErrorZ { - const ret: bigint = bindings.PeerManager_write_buffer_space_avail(this.ptr, descriptor == null ? 0n : CommonBase.get_ptr_of(descriptor)); + const ret: bigint = bindings.PeerManager_write_buffer_space_avail(this.ptr, CommonBase.get_ptr_of(descriptor)); const ret_hu_conv: Result_NonePeerHandleErrorZ = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -603,7 +603,7 @@ export class PeerManager extends CommonBase { * [`process_events`]: PeerManager::process_events */ public read_event(peer_descriptor: SocketDescriptor, data: Uint8Array): Result_boolPeerHandleErrorZ { - const ret: bigint = bindings.PeerManager_read_event(this.ptr, peer_descriptor == null ? 0n : CommonBase.get_ptr_of(peer_descriptor), bindings.encodeUint8Array(data)); + const ret: bigint = bindings.PeerManager_read_event(this.ptr, CommonBase.get_ptr_of(peer_descriptor), bindings.encodeUint8Array(data)); const ret_hu_conv: Result_boolPeerHandleErrorZ = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -635,7 +635,7 @@ export class PeerManager extends CommonBase { * Indicates that the given socket descriptor's connection is now closed. */ public socket_disconnected(descriptor: SocketDescriptor): void { - bindings.PeerManager_socket_disconnected(this.ptr, descriptor == null ? 0n : CommonBase.get_ptr_of(descriptor)); + bindings.PeerManager_socket_disconnected(this.ptr, CommonBase.get_ptr_of(descriptor)); } /** diff --git a/ts/structs/Persister.mts b/ts/structs/Persister.mts index 9614d0f9..dac356b4 100644 --- a/ts/structs/Persister.mts +++ b/ts/structs/Persister.mts @@ -527,7 +527,7 @@ export class Persister extends CommonBase { * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. */ public persist_scorer(scorer: WriteableScore): Result_NoneErrorZ { - const ret: bigint = bindings.Persister_persist_scorer(this.ptr, scorer == null ? 0n : CommonBase.get_ptr_of(scorer)); + const ret: bigint = bindings.Persister_persist_scorer(this.ptr, CommonBase.get_ptr_of(scorer)); const ret_hu_conv: Result_NoneErrorZ = Result_NoneErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, scorer); return ret_hu_conv; diff --git a/ts/structs/ProbabilisticScorer.mts b/ts/structs/ProbabilisticScorer.mts index c82b2f46..19697dab 100644 --- a/ts/structs/ProbabilisticScorer.mts +++ b/ts/structs/ProbabilisticScorer.mts @@ -485,7 +485,7 @@ export class ProbabilisticScorer extends CommonBase { * through a network graph. */ public static constructor_new(params: ProbabilisticScoringParameters, network_graph: NetworkGraph, logger: Logger): ProbabilisticScorer { - const ret: bigint = bindings.ProbabilisticScorer_new(params == null ? 0n : CommonBase.get_ptr_of(params), network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: bigint = bindings.ProbabilisticScorer_new(params == null ? 0n : CommonBase.get_ptr_of(params), network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), CommonBase.get_ptr_of(logger)); const ret_hu_conv: ProbabilisticScorer = new ProbabilisticScorer(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, params); @@ -611,7 +611,7 @@ export class ProbabilisticScorer extends CommonBase { * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write */ public static constructor_read(ser: Uint8Array, arg_a: ProbabilisticScoringParameters, arg_b: NetworkGraph, arg_c: Logger): Result_ProbabilisticScorerDecodeErrorZ { - const ret: bigint = bindings.ProbabilisticScorer_read(bindings.encodeUint8Array(ser), arg_a == null ? 0n : CommonBase.get_ptr_of(arg_a), arg_b == null ? 0n : CommonBase.get_ptr_of(arg_b), arg_c == null ? 0n : CommonBase.get_ptr_of(arg_c)); + const ret: bigint = bindings.ProbabilisticScorer_read(bindings.encodeUint8Array(ser), arg_a == null ? 0n : CommonBase.get_ptr_of(arg_a), arg_b == null ? 0n : CommonBase.get_ptr_of(arg_b), CommonBase.get_ptr_of(arg_c)); const ret_hu_conv: Result_ProbabilisticScorerDecodeErrorZ = Result_ProbabilisticScorerDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, arg_a); CommonBase.add_ref_from(ret_hu_conv, arg_b); diff --git a/ts/structs/RapidGossipSync.mts b/ts/structs/RapidGossipSync.mts index 6f17e760..974df8a7 100644 --- a/ts/structs/RapidGossipSync.mts +++ b/ts/structs/RapidGossipSync.mts @@ -453,7 +453,7 @@ export class RapidGossipSync extends CommonBase { * Instantiate a new [`RapidGossipSync`] instance. */ public static constructor_new(network_graph: NetworkGraph, logger: Logger): RapidGossipSync { - const ret: bigint = bindings.RapidGossipSync_new(network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), logger == null ? 0n : CommonBase.get_ptr_of(logger)); + const ret: bigint = bindings.RapidGossipSync_new(network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), CommonBase.get_ptr_of(logger)); const ret_hu_conv: RapidGossipSync = new RapidGossipSync(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, network_graph); diff --git a/ts/structs/Result_NetworkGraphDecodeErrorZ.mts b/ts/structs/Result_NetworkGraphDecodeErrorZ.mts index af3f3343..654a0613 100644 --- a/ts/structs/Result_NetworkGraphDecodeErrorZ.mts +++ b/ts/structs/Result_NetworkGraphDecodeErrorZ.mts @@ -453,7 +453,7 @@ export class Result_NetworkGraphDecodeErrorZ extends CommonBase { * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. */ public static constructor_ok(o_network: Network, o_logger: Logger): Result_NetworkGraphDecodeErrorZ { - const ret: bigint = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(o_network, o_logger == null ? 0n : CommonBase.get_ptr_of(o_logger))); + const ret: bigint = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(o_network, CommonBase.get_ptr_of(o_logger))); const ret_hu_conv: Result_NetworkGraphDecodeErrorZ = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, o_logger); return ret_hu_conv; diff --git a/ts/structs/Result_ProbabilisticScorerDecodeErrorZ.mts b/ts/structs/Result_ProbabilisticScorerDecodeErrorZ.mts index 294fa365..077864a9 100644 --- a/ts/structs/Result_ProbabilisticScorerDecodeErrorZ.mts +++ b/ts/structs/Result_ProbabilisticScorerDecodeErrorZ.mts @@ -453,7 +453,7 @@ export class Result_ProbabilisticScorerDecodeErrorZ extends CommonBase { * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. */ public static constructor_ok(o_params: ProbabilisticScoringParameters, o_network_graph: NetworkGraph, o_logger: Logger): Result_ProbabilisticScorerDecodeErrorZ { - const ret: bigint = bindings.CResult_ProbabilisticScorerDecodeErrorZ_ok(bindings.ProbabilisticScorer_new(o_params == null ? 0n : CommonBase.get_ptr_of(o_params), o_network_graph == null ? 0n : CommonBase.get_ptr_of(o_network_graph), o_logger == null ? 0n : CommonBase.get_ptr_of(o_logger))); + const ret: bigint = bindings.CResult_ProbabilisticScorerDecodeErrorZ_ok(bindings.ProbabilisticScorer_new(o_params == null ? 0n : CommonBase.get_ptr_of(o_params), o_network_graph == null ? 0n : CommonBase.get_ptr_of(o_network_graph), CommonBase.get_ptr_of(o_logger))); const ret_hu_conv: Result_ProbabilisticScorerDecodeErrorZ = Result_ProbabilisticScorerDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, o_params); CommonBase.add_ref_from(ret_hu_conv, o_network_graph); diff --git a/ts/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.mts b/ts/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.mts index 57866478..727c8a43 100644 --- a/ts/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.mts +++ b/ts/structs/Result_WriteableEcdsaChannelSignerDecodeErrorZ.mts @@ -453,7 +453,7 @@ export class Result_WriteableEcdsaChannelSignerDecodeErrorZ extends CommonBase { * Creates a new CResult_WriteableEcdsaChannelSignerDecodeErrorZ in the success state. */ public static constructor_ok(o: WriteableEcdsaChannelSigner): Result_WriteableEcdsaChannelSignerDecodeErrorZ { - const ret: bigint = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(o == null ? 0n : CommonBase.get_ptr_of(o)); + const ret: bigint = bindings.CResult_WriteableEcdsaChannelSignerDecodeErrorZ_ok(CommonBase.get_ptr_of(o)); const ret_hu_conv: Result_WriteableEcdsaChannelSignerDecodeErrorZ = Result_WriteableEcdsaChannelSignerDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, o); return ret_hu_conv; diff --git a/ts/structs/ScorerAccountingForInFlightHtlcs.mts b/ts/structs/ScorerAccountingForInFlightHtlcs.mts index 5342e118..7d07123f 100644 --- a/ts/structs/ScorerAccountingForInFlightHtlcs.mts +++ b/ts/structs/ScorerAccountingForInFlightHtlcs.mts @@ -454,7 +454,7 @@ export class ScorerAccountingForInFlightHtlcs extends CommonBase { * Initialize a new `ScorerAccountingForInFlightHtlcs`. */ public static constructor_new(scorer: Score, inflight_htlcs: InFlightHtlcs): ScorerAccountingForInFlightHtlcs { - const ret: bigint = bindings.ScorerAccountingForInFlightHtlcs_new(scorer == null ? 0n : CommonBase.get_ptr_of(scorer), inflight_htlcs == null ? 0n : CommonBase.get_ptr_of(inflight_htlcs)); + const ret: bigint = bindings.ScorerAccountingForInFlightHtlcs_new(CommonBase.get_ptr_of(scorer), inflight_htlcs == null ? 0n : CommonBase.get_ptr_of(inflight_htlcs)); const ret_hu_conv: ScorerAccountingForInFlightHtlcs = new ScorerAccountingForInFlightHtlcs(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, scorer); diff --git a/ts/structs/SignerProvider.mts b/ts/structs/SignerProvider.mts index 589265bf..bef7d721 100644 --- a/ts/structs/SignerProvider.mts +++ b/ts/structs/SignerProvider.mts @@ -518,7 +518,7 @@ export class SignerProvider extends CommonBase { derive_channel_signer (channel_value_satoshis: bigint, channel_keys_id: number): bigint { const channel_keys_id_conv: Uint8Array = bindings.decodeUint8Array(channel_keys_id); const ret: WriteableEcdsaChannelSigner = arg.derive_channel_signer(channel_value_satoshis, channel_keys_id_conv); - const result: bigint = ret == null ? 0n : ret.clone_ptr(); + const result: bigint = ret.clone_ptr(); CommonBase.add_ref_from(impl_holder.held, ret); return result; }, diff --git a/ts/structs/TrustedCommitmentTransaction.mts b/ts/structs/TrustedCommitmentTransaction.mts index c82844c3..11d024c6 100644 --- a/ts/structs/TrustedCommitmentTransaction.mts +++ b/ts/structs/TrustedCommitmentTransaction.mts @@ -496,7 +496,7 @@ export class TrustedCommitmentTransaction extends CommonBase { * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. */ public get_htlc_sigs(htlc_base_key: Uint8Array, channel_parameters: DirectedChannelTransactionParameters, entropy_source: EntropySource): Result_CVec_SignatureZNoneZ { - const ret: bigint = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(htlc_base_key, 32)), channel_parameters == null ? 0n : CommonBase.get_ptr_of(channel_parameters), entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source)); + const ret: bigint = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(htlc_base_key, 32)), channel_parameters == null ? 0n : CommonBase.get_ptr_of(channel_parameters), CommonBase.get_ptr_of(entropy_source)); const ret_hu_conv: Result_CVec_SignatureZNoneZ = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret); CommonBase.add_ref_from(this, channel_parameters); CommonBase.add_ref_from(this, entropy_source); diff --git a/ts/structs/TwoTuple_BlockHashChannelManagerZ.mts b/ts/structs/TwoTuple_BlockHashChannelManagerZ.mts index 04087c1a..2bf55516 100644 --- a/ts/structs/TwoTuple_BlockHashChannelManagerZ.mts +++ b/ts/structs/TwoTuple_BlockHashChannelManagerZ.mts @@ -468,7 +468,7 @@ export class TwoTuple_BlockHashChannelManagerZ extends CommonBase { * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. */ public static constructor_new(a: Uint8Array, b_fee_est: FeeEstimator, b_chain_monitor: Watch, b_tx_broadcaster: BroadcasterInterface, b_router: Router, b_logger: Logger, b_entropy_source: EntropySource, b_node_signer: NodeSigner, b_signer_provider: SignerProvider, b_config: UserConfig, b_params: ChainParameters): TwoTuple_BlockHashChannelManagerZ { - const ret: bigint = bindings.C2Tuple_BlockHashChannelManagerZ_new(bindings.encodeUint8Array(bindings.check_arr_len(a, 32)), bindings.ChannelManager_new(b_fee_est == null ? 0n : CommonBase.get_ptr_of(b_fee_est), b_chain_monitor == null ? 0n : CommonBase.get_ptr_of(b_chain_monitor), b_tx_broadcaster == null ? 0n : CommonBase.get_ptr_of(b_tx_broadcaster), b_router == null ? 0n : CommonBase.get_ptr_of(b_router), b_logger == null ? 0n : CommonBase.get_ptr_of(b_logger), b_entropy_source == null ? 0n : CommonBase.get_ptr_of(b_entropy_source), b_node_signer == null ? 0n : CommonBase.get_ptr_of(b_node_signer), b_signer_provider == null ? 0n : CommonBase.get_ptr_of(b_signer_provider), b_config == null ? 0n : CommonBase.get_ptr_of(b_config), b_params == null ? 0n : CommonBase.get_ptr_of(b_params))); + const ret: bigint = bindings.C2Tuple_BlockHashChannelManagerZ_new(bindings.encodeUint8Array(bindings.check_arr_len(a, 32)), bindings.ChannelManager_new(CommonBase.get_ptr_of(b_fee_est), CommonBase.get_ptr_of(b_chain_monitor), CommonBase.get_ptr_of(b_tx_broadcaster), CommonBase.get_ptr_of(b_router), CommonBase.get_ptr_of(b_logger), CommonBase.get_ptr_of(b_entropy_source), CommonBase.get_ptr_of(b_node_signer), CommonBase.get_ptr_of(b_signer_provider), b_config == null ? 0n : CommonBase.get_ptr_of(b_config), b_params == null ? 0n : CommonBase.get_ptr_of(b_params))); const ret_hu_conv: TwoTuple_BlockHashChannelManagerZ = new TwoTuple_BlockHashChannelManagerZ(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, b_fee_est); diff --git a/ts/structs/TwoTuple_PublicKeyTypeZ.mts b/ts/structs/TwoTuple_PublicKeyTypeZ.mts index 7d0f6e55..749fc6a4 100644 --- a/ts/structs/TwoTuple_PublicKeyTypeZ.mts +++ b/ts/structs/TwoTuple_PublicKeyTypeZ.mts @@ -484,7 +484,7 @@ export class TwoTuple_PublicKeyTypeZ extends CommonBase { * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. */ public static constructor_new(a: Uint8Array, b: Type): TwoTuple_PublicKeyTypeZ { - const ret: bigint = bindings.C2Tuple_PublicKeyTypeZ_new(bindings.encodeUint8Array(bindings.check_arr_len(a, 33)), b == null ? 0n : CommonBase.get_ptr_of(b)); + const ret: bigint = bindings.C2Tuple_PublicKeyTypeZ_new(bindings.encodeUint8Array(bindings.check_arr_len(a, 33)), CommonBase.get_ptr_of(b)); const ret_hu_conv: TwoTuple_PublicKeyTypeZ = new TwoTuple_PublicKeyTypeZ(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); CommonBase.add_ref_from(ret_hu_conv, b); diff --git a/ts/structs/UtilMethods.mts b/ts/structs/UtilMethods.mts index 65a395af..82216634 100644 --- a/ts/structs/UtilMethods.mts +++ b/ts/structs/UtilMethods.mts @@ -532,7 +532,7 @@ export class UtilMethods extends CommonBase { * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write */ public static constructor_C2Tuple_BlockHashChannelMonitorZ_read(ser: Uint8Array, arg_a: EntropySource, arg_b: SignerProvider): Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - const ret: bigint = bindings.C2Tuple_BlockHashChannelMonitorZ_read(bindings.encodeUint8Array(ser), arg_a == null ? 0n : CommonBase.get_ptr_of(arg_a), arg_b == null ? 0n : CommonBase.get_ptr_of(arg_b)); + const ret: bigint = bindings.C2Tuple_BlockHashChannelMonitorZ_read(bindings.encodeUint8Array(ser), CommonBase.get_ptr_of(arg_a), CommonBase.get_ptr_of(arg_b)); const ret_hu_conv: Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, arg_a); CommonBase.add_ref_from(ret_hu_conv, arg_b); @@ -555,7 +555,7 @@ export class UtilMethods extends CommonBase { * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write */ public static constructor_C2Tuple_BlockHashChannelManagerZ_read(ser: Uint8Array, arg_entropy_source: EntropySource, arg_node_signer: NodeSigner, arg_signer_provider: SignerProvider, arg_fee_estimator: FeeEstimator, arg_chain_monitor: Watch, arg_tx_broadcaster: BroadcasterInterface, arg_router: Router, arg_logger: Logger, arg_default_config: UserConfig, arg_channel_monitors: ChannelMonitor[]): Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { - const ret: bigint = bindings.C2Tuple_BlockHashChannelManagerZ_read(bindings.encodeUint8Array(ser), bindings.ChannelManagerReadArgs_new(arg_entropy_source == null ? 0n : CommonBase.get_ptr_of(arg_entropy_source), arg_node_signer == null ? 0n : CommonBase.get_ptr_of(arg_node_signer), arg_signer_provider == null ? 0n : CommonBase.get_ptr_of(arg_signer_provider), arg_fee_estimator == null ? 0n : CommonBase.get_ptr_of(arg_fee_estimator), arg_chain_monitor == null ? 0n : CommonBase.get_ptr_of(arg_chain_monitor), arg_tx_broadcaster == null ? 0n : CommonBase.get_ptr_of(arg_tx_broadcaster), arg_router == null ? 0n : CommonBase.get_ptr_of(arg_router), arg_logger == null ? 0n : CommonBase.get_ptr_of(arg_logger), arg_default_config == null ? 0n : CommonBase.get_ptr_of(arg_default_config), bindings.encodeUint64Array(arg_channel_monitors != null ? arg_channel_monitors.map(arg_channel_monitors_conv_16 => arg_channel_monitors_conv_16 == null ? 0n : CommonBase.get_ptr_of(arg_channel_monitors_conv_16)) : null))); + const ret: bigint = bindings.C2Tuple_BlockHashChannelManagerZ_read(bindings.encodeUint8Array(ser), bindings.ChannelManagerReadArgs_new(CommonBase.get_ptr_of(arg_entropy_source), CommonBase.get_ptr_of(arg_node_signer), CommonBase.get_ptr_of(arg_signer_provider), CommonBase.get_ptr_of(arg_fee_estimator), CommonBase.get_ptr_of(arg_chain_monitor), CommonBase.get_ptr_of(arg_tx_broadcaster), CommonBase.get_ptr_of(arg_router), CommonBase.get_ptr_of(arg_logger), arg_default_config == null ? 0n : CommonBase.get_ptr_of(arg_default_config), bindings.encodeUint64Array(arg_channel_monitors != null ? arg_channel_monitors.map(arg_channel_monitors_conv_16 => arg_channel_monitors_conv_16 == null ? 0n : CommonBase.get_ptr_of(arg_channel_monitors_conv_16)) : null))); const ret_hu_conv: Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, arg_entropy_source); CommonBase.add_ref_from(ret_hu_conv, arg_node_signer); @@ -588,7 +588,7 @@ export class UtilMethods extends CommonBase { * [`NodeSigner::get_inbound_payment_key_material`]: crate::chain::keysinterface::NodeSigner::get_inbound_payment_key_material */ public static constructor_create(keys: ExpandedKey, min_value_msat: Option_u64Z, invoice_expiry_delta_secs: number, entropy_source: EntropySource, current_time: bigint, min_final_cltv_expiry_delta: Option_u16Z): Result_C2Tuple_PaymentHashPaymentSecretZNoneZ { - const ret: bigint = bindings.create(keys == null ? 0n : CommonBase.get_ptr_of(keys), CommonBase.get_ptr_of(min_value_msat), invoice_expiry_delta_secs, entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source), current_time, CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); + const ret: bigint = bindings.create(keys == null ? 0n : CommonBase.get_ptr_of(keys), CommonBase.get_ptr_of(min_value_msat), invoice_expiry_delta_secs, CommonBase.get_ptr_of(entropy_source), current_time, CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); const ret_hu_conv: Result_C2Tuple_PaymentHashPaymentSecretZNoneZ = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, keys); CommonBase.add_ref_from(ret_hu_conv, min_value_msat); @@ -861,7 +861,7 @@ export class UtilMethods extends CommonBase { * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ public static constructor_find_route(our_node_pubkey: Uint8Array, route_params: RouteParameters, network_graph: NetworkGraph, first_hops: ChannelDetails[]|null, logger: Logger, scorer: Score, random_seed_bytes: Uint8Array): Result_RouteLightningErrorZ { - const ret: bigint = bindings.find_route(bindings.encodeUint8Array(bindings.check_arr_len(our_node_pubkey, 33)), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), bindings.encodeUint64Array(first_hops != null ? first_hops.map(first_hops_conv_16 => first_hops_conv_16 == null ? 0n : CommonBase.get_ptr_of(first_hops_conv_16)) : null), logger == null ? 0n : CommonBase.get_ptr_of(logger), scorer == null ? 0n : CommonBase.get_ptr_of(scorer), bindings.encodeUint8Array(bindings.check_arr_len(random_seed_bytes, 32))); + const ret: bigint = bindings.find_route(bindings.encodeUint8Array(bindings.check_arr_len(our_node_pubkey, 33)), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), bindings.encodeUint64Array(first_hops != null ? first_hops.map(first_hops_conv_16 => first_hops_conv_16 == null ? 0n : CommonBase.get_ptr_of(first_hops_conv_16)) : null), CommonBase.get_ptr_of(logger), CommonBase.get_ptr_of(scorer), bindings.encodeUint8Array(bindings.check_arr_len(random_seed_bytes, 32))); const ret_hu_conv: Result_RouteLightningErrorZ = Result_RouteLightningErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, route_params); CommonBase.add_ref_from(ret_hu_conv, network_graph); @@ -878,7 +878,7 @@ export class UtilMethods extends CommonBase { * Re-uses logic from `find_route`, so the restrictions described there also apply here. */ public static constructor_build_route_from_hops(our_node_pubkey: Uint8Array, hops: Uint8Array[], route_params: RouteParameters, network_graph: NetworkGraph, logger: Logger, random_seed_bytes: Uint8Array): Result_RouteLightningErrorZ { - const ret: bigint = bindings.build_route_from_hops(bindings.encodeUint8Array(bindings.check_arr_len(our_node_pubkey, 33)), bindings.encodeUint32Array(hops != null ? hops.map(hops_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(hops_conv_12, 33))) : null), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), logger == null ? 0n : CommonBase.get_ptr_of(logger), bindings.encodeUint8Array(bindings.check_arr_len(random_seed_bytes, 32))); + const ret: bigint = bindings.build_route_from_hops(bindings.encodeUint8Array(bindings.check_arr_len(our_node_pubkey, 33)), bindings.encodeUint32Array(hops != null ? hops.map(hops_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(hops_conv_12, 33))) : null), route_params == null ? 0n : CommonBase.get_ptr_of(route_params), network_graph == null ? 0n : CommonBase.get_ptr_of(network_graph), CommonBase.get_ptr_of(logger), bindings.encodeUint8Array(bindings.check_arr_len(random_seed_bytes, 32))); const ret_hu_conv: Result_RouteLightningErrorZ = Result_RouteLightningErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, route_params); CommonBase.add_ref_from(ret_hu_conv, network_graph); @@ -1047,7 +1047,7 @@ export class UtilMethods extends CommonBase { * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ public static constructor_create_phantom_invoice(amt_msat: Option_u64Z, payment_hash: Uint8Array|null, description: string, invoice_expiry_delta_secs: number, phantom_route_hints: PhantomRouteHints[], entropy_source: EntropySource, node_signer: NodeSigner, logger: Logger, network: Currency, min_final_cltv_expiry_delta: Option_u16Z, duration_since_epoch: bigint): Result_InvoiceSignOrCreationErrorZ { - const ret: bigint = bindings.create_phantom_invoice(CommonBase.get_ptr_of(amt_msat), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeString(description), invoice_expiry_delta_secs, bindings.encodeUint64Array(phantom_route_hints != null ? phantom_route_hints.map(phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0n : CommonBase.get_ptr_of(phantom_route_hints_conv_19)) : null), entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), logger == null ? 0n : CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(min_final_cltv_expiry_delta), duration_since_epoch); + const ret: bigint = bindings.create_phantom_invoice(CommonBase.get_ptr_of(amt_msat), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), bindings.encodeString(description), invoice_expiry_delta_secs, bindings.encodeUint64Array(phantom_route_hints != null ? phantom_route_hints.map(phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0n : CommonBase.get_ptr_of(phantom_route_hints_conv_19)) : null), CommonBase.get_ptr_of(entropy_source), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(min_final_cltv_expiry_delta), duration_since_epoch); const ret_hu_conv: Result_InvoiceSignOrCreationErrorZ = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, amt_msat); phantom_route_hints.forEach((phantom_route_hints_conv_19: PhantomRouteHints) => { CommonBase.add_ref_from(ret_hu_conv, phantom_route_hints_conv_19); }); @@ -1099,7 +1099,7 @@ export class UtilMethods extends CommonBase { * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ public static constructor_create_phantom_invoice_with_description_hash(amt_msat: Option_u64Z, payment_hash: Uint8Array|null, invoice_expiry_delta_secs: number, description_hash: Sha256, phantom_route_hints: PhantomRouteHints[], entropy_source: EntropySource, node_signer: NodeSigner, logger: Logger, network: Currency, min_final_cltv_expiry_delta: Option_u16Z, duration_since_epoch: bigint): Result_InvoiceSignOrCreationErrorZ { - const ret: bigint = bindings.create_phantom_invoice_with_description_hash(CommonBase.get_ptr_of(amt_msat), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), invoice_expiry_delta_secs, description_hash == null ? 0n : CommonBase.get_ptr_of(description_hash), bindings.encodeUint64Array(phantom_route_hints != null ? phantom_route_hints.map(phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0n : CommonBase.get_ptr_of(phantom_route_hints_conv_19)) : null), entropy_source == null ? 0n : CommonBase.get_ptr_of(entropy_source), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), logger == null ? 0n : CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(min_final_cltv_expiry_delta), duration_since_epoch); + const ret: bigint = bindings.create_phantom_invoice_with_description_hash(CommonBase.get_ptr_of(amt_msat), bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), invoice_expiry_delta_secs, description_hash == null ? 0n : CommonBase.get_ptr_of(description_hash), bindings.encodeUint64Array(phantom_route_hints != null ? phantom_route_hints.map(phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0n : CommonBase.get_ptr_of(phantom_route_hints_conv_19)) : null), CommonBase.get_ptr_of(entropy_source), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(min_final_cltv_expiry_delta), duration_since_epoch); const ret_hu_conv: Result_InvoiceSignOrCreationErrorZ = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, amt_msat); CommonBase.add_ref_from(ret_hu_conv, description_hash); @@ -1117,7 +1117,7 @@ export class UtilMethods extends CommonBase { * available and the current time is supplied by the caller. */ public static constructor_create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager: ChannelManager, node_signer: NodeSigner, logger: Logger, network: Currency, amt_msat: Option_u64Z, description_hash: Sha256, duration_since_epoch: bigint, invoice_expiry_delta_secs: number, min_final_cltv_expiry_delta: Option_u16Z): Result_InvoiceSignOrCreationErrorZ { - const ret: bigint = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), logger == null ? 0n : CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(amt_msat), description_hash == null ? 0n : CommonBase.get_ptr_of(description_hash), duration_since_epoch, invoice_expiry_delta_secs, CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); + const ret: bigint = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(amt_msat), description_hash == null ? 0n : CommonBase.get_ptr_of(description_hash), duration_since_epoch, invoice_expiry_delta_secs, CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); const ret_hu_conv: Result_InvoiceSignOrCreationErrorZ = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, channelmanager); CommonBase.add_ref_from(ret_hu_conv, node_signer); @@ -1134,7 +1134,7 @@ export class UtilMethods extends CommonBase { * available and the current time is supplied by the caller. */ public static constructor_create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager: ChannelManager, node_signer: NodeSigner, logger: Logger, network: Currency, amt_msat: Option_u64Z, description: string, duration_since_epoch: bigint, invoice_expiry_delta_secs: number, min_final_cltv_expiry_delta: Option_u16Z): Result_InvoiceSignOrCreationErrorZ { - const ret: bigint = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), logger == null ? 0n : CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(amt_msat), bindings.encodeString(description), duration_since_epoch, invoice_expiry_delta_secs, CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); + const ret: bigint = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(amt_msat), bindings.encodeString(description), duration_since_epoch, invoice_expiry_delta_secs, CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); const ret_hu_conv: Result_InvoiceSignOrCreationErrorZ = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, channelmanager); CommonBase.add_ref_from(ret_hu_conv, node_signer); @@ -1151,7 +1151,7 @@ export class UtilMethods extends CommonBase { * the payment hash is also involved outside the scope of lightning. */ public static constructor_create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager: ChannelManager, node_signer: NodeSigner, logger: Logger, network: Currency, amt_msat: Option_u64Z, description: string, duration_since_epoch: bigint, invoice_expiry_delta_secs: number, payment_hash: Uint8Array, min_final_cltv_expiry_delta: Option_u16Z): Result_InvoiceSignOrCreationErrorZ { - const ret: bigint = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), node_signer == null ? 0n : CommonBase.get_ptr_of(node_signer), logger == null ? 0n : CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(amt_msat), bindings.encodeString(description), duration_since_epoch, invoice_expiry_delta_secs, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); + const ret: bigint = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0n : CommonBase.get_ptr_of(channelmanager), CommonBase.get_ptr_of(node_signer), CommonBase.get_ptr_of(logger), network, CommonBase.get_ptr_of(amt_msat), bindings.encodeString(description), duration_since_epoch, invoice_expiry_delta_secs, bindings.encodeUint8Array(bindings.check_arr_len(payment_hash, 32)), CommonBase.get_ptr_of(min_final_cltv_expiry_delta)); const ret_hu_conv: Result_InvoiceSignOrCreationErrorZ = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); CommonBase.add_ref_from(ret_hu_conv, channelmanager); CommonBase.add_ref_from(ret_hu_conv, node_signer); -- 2.39.5