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);
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);
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);