X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FTrustedCommitmentTransaction.mts;h=7c27f4a5fe6b1665c6ebe33deaa231a1beab050c;hp=6cda7b97e776d30f08173e7199cba6747d897379;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hpb=d1d0121c000b713c10fd0bedd249eb8dda2e4db7 diff --git a/ts/structs/TrustedCommitmentTransaction.mts b/ts/structs/TrustedCommitmentTransaction.mts index 6cda7b97..7c27f4a5 100644 --- a/ts/structs/TrustedCommitmentTransaction.mts +++ b/ts/structs/TrustedCommitmentTransaction.mts @@ -281,18 +281,32 @@ import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' +/** + * A wrapper on CommitmentTransaction indicating that the derived fields (the built bitcoin + * transaction and the transaction creation keys) are trusted. + * + * See trust() and verify() functions on CommitmentTransaction. + * + * This structure implements Deref. + */ export class TrustedCommitmentTransaction extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { super(ptr, bindings.TrustedCommitmentTransaction_free); } + /** + * The transaction ID of the built Bitcoin transaction + */ public txid(): Uint8Array { const ret: number = bindings.TrustedCommitmentTransaction_txid(this.ptr); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); return ret_conv; } + /** + * The pre-built Bitcoin commitment transaction + */ public built_transaction(): BuiltCommitmentTransaction { const ret: number = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr); const ret_hu_conv: BuiltCommitmentTransaction = new BuiltCommitmentTransaction(null, ret); @@ -300,6 +314,9 @@ export class TrustedCommitmentTransaction extends CommonBase { return ret_hu_conv; } + /** + * The pre-calculated transaction creation public keys. + */ public keys(): TxCreationKeys { const ret: number = bindings.TrustedCommitmentTransaction_keys(this.ptr); const ret_hu_conv: TxCreationKeys = new TxCreationKeys(null, ret); @@ -307,11 +324,20 @@ export class TrustedCommitmentTransaction extends CommonBase { return ret_hu_conv; } + /** + * Should anchors be used. + */ public opt_anchors(): boolean { const ret: boolean = bindings.TrustedCommitmentTransaction_opt_anchors(this.ptr); return ret; } + /** + * Get a signature for each HTLC which was included in the commitment transaction (ie for + * which HTLCOutputInCommitment::transaction_output_index.is_some()). + * + * The returned Vec has one entry for each HTLC, and in the same order. + */ public get_htlc_sigs(htlc_base_key: Uint8Array, channel_parameters: DirectedChannelTransactionParameters): Result_CVec_SignatureZNoneZ { const ret: number = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(htlc_base_key, 32)), channel_parameters == null ? 0 : CommonBase.get_ptr_of(channel_parameters) & ~1); const ret_hu_conv: Result_CVec_SignatureZNoneZ = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);