X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=ts%2Fstructs%2FTrustedClosingTransaction.mts;h=5a9c6a4007455891e65282e87412899eb8fda23a;hp=2a64d9d7888c07a4466db256f384f9d75ef5241f;hb=c629a01650402c8e2f9b9db8ced9ed63ce687727;hpb=d1d0121c000b713c10fd0bedd249eb8dda2e4db7 diff --git a/ts/structs/TrustedClosingTransaction.mts b/ts/structs/TrustedClosingTransaction.mts index 2a64d9d7..5a9c6a40 100644 --- a/ts/structs/TrustedClosingTransaction.mts +++ b/ts/structs/TrustedClosingTransaction.mts @@ -281,24 +281,44 @@ import CommonBase from './CommonBase.mjs'; import * as bindings from '../bindings.mjs' +/** + * A wrapper on ClosingTransaction indicating that the built bitcoin + * transaction is trusted. + * + * See trust() and verify() functions on CommitmentTransaction. + * + * This structure implements Deref. + */ export class TrustedClosingTransaction extends CommonBase { /* @internal */ public constructor(_dummy: object, ptr: number) { super(ptr, bindings.TrustedClosingTransaction_free); } + /** + * The pre-built Bitcoin commitment transaction + */ public built_transaction(): Uint8Array { const ret: number = bindings.TrustedClosingTransaction_built_transaction(this.ptr); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); return ret_conv; } + /** + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. + */ public get_sighash_all(funding_redeemscript: Uint8Array, channel_value_satoshis: bigint): Uint8Array { const ret: number = bindings.TrustedClosingTransaction_get_sighash_all(this.ptr, bindings.encodeUint8Array(funding_redeemscript), channel_value_satoshis); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret); return ret_conv; } + /** + * Sign a transaction, either because we are counter-signing the counterparty's transaction or + * because we are about to broadcast a holder transaction. + */ public sign(funding_key: Uint8Array, funding_redeemscript: Uint8Array, channel_value_satoshis: bigint): Uint8Array { const ret: number = bindings.TrustedClosingTransaction_sign(this.ptr, bindings.encodeUint8Array(bindings.check_arr_len(funding_key, 32)), bindings.encodeUint8Array(funding_redeemscript), channel_value_satoshis); const ret_conv: Uint8Array = bindings.decodeUint8Array(ret);