X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FHolderCommitmentTransaction.mts;h=306b135a820949be44b5ef9a8dab9d5d9d3afc11;hb=13cdf8bde340072288b39a5e29f0946d3e095ad4;hp=02b96435586cae719b3aeafc46bd02c934959bb5;hpb=9dd77adc1df59cdcceb68a6d38683b2f8f390201;p=ldk-java diff --git a/ts/structs/HolderCommitmentTransaction.mts b/ts/structs/HolderCommitmentTransaction.mts index 02b96435..306b135a 100644 --- a/ts/structs/HolderCommitmentTransaction.mts +++ b/ts/structs/HolderCommitmentTransaction.mts @@ -66,6 +66,9 @@ import { Result_PaymentPurposeDecodeErrorZ } from '../structs/Result_PaymentPurp import { ClosureReason } from '../structs/ClosureReason.mjs'; import { Option_ClosureReasonZ } from '../structs/Option_ClosureReasonZ.mjs'; import { Result_COption_ClosureReasonZDecodeErrorZ } from '../structs/Result_COption_ClosureReasonZDecodeErrorZ.mjs'; +import { HTLCDestination } from '../structs/HTLCDestination.mjs'; +import { Option_HTLCDestinationZ } from '../structs/Option_HTLCDestinationZ.mjs'; +import { Result_COption_HTLCDestinationZDecodeErrorZ } from '../structs/Result_COption_HTLCDestinationZDecodeErrorZ.mjs'; import { ChannelUpdate } from '../structs/ChannelUpdate.mjs'; import { NetworkUpdate } from '../structs/NetworkUpdate.mjs'; import { Option_NetworkUpdateZ } from '../structs/Option_NetworkUpdateZ.mjs'; @@ -103,10 +106,13 @@ import { TwoTuple_usizeTransactionZ } from '../structs/TwoTuple_usizeTransaction import { Result_NoneChannelMonitorUpdateErrZ } from '../structs/Result_NoneChannelMonitorUpdateErrZ.mjs'; import { HTLCUpdate } from '../structs/HTLCUpdate.mjs'; import { MonitorEvent } from '../structs/MonitorEvent.mjs'; -import { TwoTuple_OutPointCVec_MonitorEventZZ } from '../structs/TwoTuple_OutPointCVec_MonitorEventZZ.mjs'; +import { ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ } from '../structs/ThreeTuple_OutPointCVec_MonitorEventZPublicKeyZ.mjs'; import { Option_C2Tuple_usizeTransactionZZ } from '../structs/Option_C2Tuple_usizeTransactionZZ.mjs'; import { FixedPenaltyScorer } from '../structs/FixedPenaltyScorer.mjs'; import { Result_FixedPenaltyScorerDecodeErrorZ } from '../structs/Result_FixedPenaltyScorerDecodeErrorZ.mjs'; +import { TwoTuple_u64u64Z } from '../structs/TwoTuple_u64u64Z.mjs'; +import { Option_C2Tuple_u64u64ZZ } from '../structs/Option_C2Tuple_u64u64ZZ.mjs'; +import { NodeId } from '../structs/NodeId.mjs'; import { Record } from '../structs/Record.mjs'; import { Logger, LoggerInterface } from '../structs/Logger.mjs'; import { NetworkGraph } from '../structs/NetworkGraph.mjs'; @@ -121,7 +127,6 @@ import { Result_NodeFeaturesDecodeErrorZ } from '../structs/Result_NodeFeaturesD import { InvoiceFeatures } from '../structs/InvoiceFeatures.mjs'; import { Result_InvoiceFeaturesDecodeErrorZ } from '../structs/Result_InvoiceFeaturesDecodeErrorZ.mjs'; import { Result_ChannelTypeFeaturesDecodeErrorZ } from '../structs/Result_ChannelTypeFeaturesDecodeErrorZ.mjs'; -import { NodeId } from '../structs/NodeId.mjs'; import { Result_NodeIdDecodeErrorZ } from '../structs/Result_NodeIdDecodeErrorZ.mjs'; import { Result_COption_NetworkUpdateZDecodeErrorZ } from '../structs/Result_COption_NetworkUpdateZDecodeErrorZ.mjs'; import { Access, AccessInterface } from '../structs/Access.mjs'; @@ -135,9 +140,12 @@ import { ChannelInfo } from '../structs/ChannelInfo.mjs'; import { Result_ChannelInfoDecodeErrorZ } from '../structs/Result_ChannelInfoDecodeErrorZ.mjs'; import { RoutingFees } from '../structs/RoutingFees.mjs'; import { Result_RoutingFeesDecodeErrorZ } from '../structs/Result_RoutingFeesDecodeErrorZ.mjs'; +import { Hostname } from '../structs/Hostname.mjs'; import { NetAddress } from '../structs/NetAddress.mjs'; import { NodeAnnouncementInfo } from '../structs/NodeAnnouncementInfo.mjs'; import { Result_NodeAnnouncementInfoDecodeErrorZ } from '../structs/Result_NodeAnnouncementInfoDecodeErrorZ.mjs'; +import { NodeAlias } from '../structs/NodeAlias.mjs'; +import { Result_NodeAliasDecodeErrorZ } from '../structs/Result_NodeAliasDecodeErrorZ.mjs'; import { NodeInfo } from '../structs/NodeInfo.mjs'; import { Result_NodeInfoDecodeErrorZ } from '../structs/Result_NodeInfoDecodeErrorZ.mjs'; import { Result_NetworkGraphDecodeErrorZ } from '../structs/Result_NetworkGraphDecodeErrorZ.mjs'; @@ -355,7 +363,7 @@ import * as bindings from '../bindings.mjs' */ export class HolderCommitmentTransaction extends CommonBase { /* @internal */ - public constructor(_dummy: object, ptr: number) { + public constructor(_dummy: object, ptr: bigint) { super(ptr, bindings.HolderCommitmentTransaction_free); } @@ -375,6 +383,24 @@ export class HolderCommitmentTransaction extends CommonBase { bindings.HolderCommitmentTransaction_set_counterparty_sig(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(val, 64))); } + /** + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * + * Returns a copy of the field. + */ + public get_counterparty_htlc_sigs(): Uint8Array[] { + const ret: number = bindings.HolderCommitmentTransaction_get_counterparty_htlc_sigs(this.ptr); + 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++) { + const ret_conv_12: number = bindings.getU32ArrayElem(ret, m); + const ret_conv_12_conv: Uint8Array = bindings.decodeUint8Array(ret_conv_12); + ret_conv_12_arr[m] = ret_conv_12_conv; + } + bindings.freeWasmMemory(ret) + return ret_conv_12_arr; + } + /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ @@ -382,8 +408,8 @@ export class HolderCommitmentTransaction extends CommonBase { bindings.HolderCommitmentTransaction_set_counterparty_htlc_sigs(this.ptr, bindings.encodeUint32Array(val != null ? val.map(val_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(val_conv_12, 64))) : null)); } - public clone_ptr(): number { - const ret: number = bindings.HolderCommitmentTransaction_clone_ptr(this.ptr); + public clone_ptr(): bigint { + const ret: bigint = bindings.HolderCommitmentTransaction_clone_ptr(this.ptr); return ret; } @@ -391,7 +417,7 @@ export class HolderCommitmentTransaction extends CommonBase { * Creates a copy of the HolderCommitmentTransaction */ public clone(): HolderCommitmentTransaction { - const ret: number = bindings.HolderCommitmentTransaction_clone(this.ptr); + const ret: bigint = bindings.HolderCommitmentTransaction_clone(this.ptr); const ret_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, ret); CommonBase.add_ref_from(ret_hu_conv, this); return ret_hu_conv; @@ -410,7 +436,7 @@ export class HolderCommitmentTransaction extends CommonBase { * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write */ public static constructor_read(ser: Uint8Array): Result_HolderCommitmentTransactionDecodeErrorZ { - const ret: number = bindings.HolderCommitmentTransaction_read(bindings.encodeUint8Array(ser)); + const ret: bigint = bindings.HolderCommitmentTransaction_read(bindings.encodeUint8Array(ser)); const ret_hu_conv: Result_HolderCommitmentTransactionDecodeErrorZ = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -420,9 +446,10 @@ export class HolderCommitmentTransaction extends CommonBase { * The funding keys are used to figure out which signature should go first when building the transaction for broadcast. */ public static constructor_new(commitment_tx: CommitmentTransaction, counterparty_sig: Uint8Array, counterparty_htlc_sigs: Uint8Array[], holder_funding_key: Uint8Array, counterparty_funding_key: Uint8Array): HolderCommitmentTransaction { - const ret: number = bindings.HolderCommitmentTransaction_new(commitment_tx == null ? 0 : CommonBase.get_ptr_of(commitment_tx) & ~1, bindings.encodeUint8Array(bindings.check_arr_len(counterparty_sig, 64)), bindings.encodeUint32Array(counterparty_htlc_sigs != null ? counterparty_htlc_sigs.map(counterparty_htlc_sigs_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(counterparty_htlc_sigs_conv_12, 64))) : null), bindings.encodeUint8Array(bindings.check_arr_len(holder_funding_key, 33)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_funding_key, 33))); + const ret: bigint = bindings.HolderCommitmentTransaction_new(commitment_tx == null ? 0n : CommonBase.get_ptr_of(commitment_tx), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_sig, 64)), bindings.encodeUint32Array(counterparty_htlc_sigs != null ? counterparty_htlc_sigs.map(counterparty_htlc_sigs_conv_12 => bindings.encodeUint8Array(bindings.check_arr_len(counterparty_htlc_sigs_conv_12, 64))) : null), bindings.encodeUint8Array(bindings.check_arr_len(holder_funding_key, 33)), bindings.encodeUint8Array(bindings.check_arr_len(counterparty_funding_key, 33))); const ret_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, ret); CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv); + CommonBase.add_ref_from(ret_hu_conv, commitment_tx); return ret_hu_conv; }