+ /**
+ * Gets the counterparty's initial commitment transaction. The returned commitment
+ * transaction is unsigned. This is intended to be called during the initial persistence of
+ * the monitor (inside an implementation of [`Persist::persist_new_channel`]), to allow for
+ * watchtowers in the persistence pipeline to have enough data to form justice transactions.
+ *
+ * This is similar to [`Self::counterparty_commitment_txs_from_update`], except
+ * that for the initial commitment transaction, we don't have a corresponding update.
+ *
+ * This will only return `Some` for channel monitors that have been created after upgrading
+ * to LDK 0.0.117+.
+ *
+ * [`Persist::persist_new_channel`]: crate::chain::chainmonitor::Persist::persist_new_channel
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ public initial_counterparty_commitment_tx(): CommitmentTransaction {
+ const ret: bigint = bindings.ChannelMonitor_initial_counterparty_commitment_tx(this.ptr);
+ const ret_hu_conv: CommitmentTransaction = new CommitmentTransaction(null, ret);
+ CommonBase.add_ref_from(ret_hu_conv, this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Gets all of the counterparty commitment transactions provided by the given update. This
+ * may be empty if the update doesn't include any new counterparty commitments. Returned
+ * commitment transactions are unsigned.
+ *
+ * This is provided so that watchtower clients in the persistence pipeline are able to build
+ * justice transactions for each counterparty commitment upon each update. It's intended to be
+ * used within an implementation of [`Persist::update_persisted_channel`], which is provided
+ * with a monitor and an update. Once revoked, signing a justice transaction can be done using
+ * [`Self::sign_to_local_justice_tx`].
+ *
+ * It is expected that a watchtower client may use this method to retrieve the latest counterparty
+ * commitment transaction(s), and then hold the necessary data until a later update in which
+ * the monitor has been updated with the corresponding revocation data, at which point the
+ * monitor can sign the justice transaction.
+ *
+ * This will only return a non-empty list for monitor updates that have been created after
+ * upgrading to LDK 0.0.117+. Note that no restriction lies on the monitors themselves, which
+ * may have been created prior to upgrading.
+ *
+ * [`Persist::update_persisted_channel`]: crate::chain::chainmonitor::Persist::update_persisted_channel
+ */
+ public counterparty_commitment_txs_from_update(update: ChannelMonitorUpdate): CommitmentTransaction[] {
+ const ret: number = bindings.ChannelMonitor_counterparty_commitment_txs_from_update(this.ptr, update == null ? 0n : CommonBase.get_ptr_of(update));
+ const ret_conv_23_len: number = bindings.getArrayLength(ret);
+ const ret_conv_23_arr: CommitmentTransaction[] = new Array(ret_conv_23_len).fill(null);
+ for (var x = 0; x < ret_conv_23_len; x++) {
+ const ret_conv_23: bigint = bindings.getU64ArrayElem(ret, x);
+ const ret_conv_23_hu_conv: CommitmentTransaction = new CommitmentTransaction(null, ret_conv_23);
+ CommonBase.add_ref_from(ret_conv_23_hu_conv, this);
+ ret_conv_23_arr[x] = ret_conv_23_hu_conv;
+ }
+ bindings.freeWasmMemory(ret)
+ CommonBase.add_ref_from(this, update);
+ return ret_conv_23_arr;
+ }
+
+ /**
+ * Wrapper around [`EcdsaChannelSigner::sign_justice_revoked_output`] to make
+ * signing the justice transaction easier for implementors of
+ * [`chain::chainmonitor::Persist`]. On success this method returns the provided transaction
+ * signing the input at `input_idx`. This method will only produce a valid signature for
+ * a transaction spending the `to_local` output of a commitment transaction, i.e. this cannot
+ * be used for revoked HTLC outputs.
+ *
+ * `Value` is the value of the output being spent by the input at `input_idx`, committed
+ * in the BIP 143 signature.
+ *
+ * This method will only succeed if this monitor has received the revocation secret for the
+ * provided `commitment_number`. If a commitment number is provided that does not correspond
+ * to the commitment transaction being revoked, this will return a signed transaction, but
+ * the signature will not be valid.
+ *
+ * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::EcdsaChannelSigner::sign_justice_revoked_output
+ * [`Persist`]: crate::chain::chainmonitor::Persist
+ */
+ public sign_to_local_justice_tx(justice_tx: Uint8Array, input_idx: number, value: bigint, commitment_number: bigint): Result_TransactionNoneZ {
+ const ret: bigint = bindings.ChannelMonitor_sign_to_local_justice_tx(this.ptr, bindings.encodeUint8Array(justice_tx), input_idx, value, commitment_number);
+ const ret_hu_conv: Result_TransactionNoneZ = Result_TransactionNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+