From ce7d1ee7a689ccc66605d9781ef81932e6e2a6de Mon Sep 17 00:00:00 2001 From: Tomasz Slabon Date: Tue, 3 Oct 2023 15:36:43 +0200 Subject: [PATCH] Variable rename and docstring update --- typescript/src/deposit-sweep.ts | 2 +- typescript/src/deposit.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/typescript/src/deposit-sweep.ts b/typescript/src/deposit-sweep.ts index 0627382d7..7c68008eb 100644 --- a/typescript/src/deposit-sweep.ts +++ b/typescript/src/deposit-sweep.ts @@ -114,7 +114,7 @@ export async function submitDepositSweepTransaction( * @dev The caller is responsible for ensuring the provided UTXOs are correctly * formed, can be spent by the wallet and their combined value is greater * then the fee. - * @param bitcoinNetwork - The target Bitcoin network (mainnet or testnet). + * @param bitcoinNetwork - The target Bitcoin network. * @param fee - Transaction fee to be subtracted from the sum of the UTXOs' * values. * @param walletPrivateKey - Bitcoin private key of the wallet in WIF format. diff --git a/typescript/src/deposit.ts b/typescript/src/deposit.ts index 38f50eda1..f21731fb9 100644 --- a/typescript/src/deposit.ts +++ b/typescript/src/deposit.ts @@ -136,7 +136,7 @@ export type DepositRevealedEvent = Deposit & { * @returns The outcome consisting of: * - the deposit transaction hash, * - the deposit UTXO produced by this transaction. - * @dev UTXOs are selected for transaction funding based on their types. UTXOs + * @dev UTXOs are selected for transaction funding based on their types. UTXOs * with unsupported types are skipped. The selection process stops once * the sum of the chosen UTXOs meets the required funding amount. * Be aware that the function will attempt to broadcast the transaction, @@ -192,19 +192,20 @@ export async function submitDepositTransaction( /** * Assembles a Bitcoin P2(W)SH deposit transaction. - * @param bitcoinNetwork - The target Bitcoin network (mainnet or testnet). + * @param bitcoinNetwork - The target Bitcoin network. * @param deposit - Details of the deposit. * @param depositorPrivateKey - Bitcoin private key of the depositor. * @param witness - If true, a witness (P2WSH) transaction will be created. * Otherwise, a legacy P2SH transaction will be made. - * @param utxos - UTXOs that should be used as transaction inputs. + * @param inputUtxos - UTXOs to be used for funding the deposit transaction. So + * far only P2WPKH UTXO inputs are supported. * @param fee - Transaction fee to be subtracted from the sum of the UTXOs' * values. * @returns The outcome consisting of: * - the deposit transaction hash, * - the deposit UTXO produced by this transaction. * - the deposit transaction in the raw format -* @dev UTXOs are selected for transaction funding based on their types. UTXOs + * @dev UTXOs are selected for transaction funding based on their types. UTXOs * with unsupported types are skipped. The selection process stops once * the sum of the chosen UTXOs meets the required funding amount. * @throws {Error} When the sum of the selected UTXOs is insufficient to cover @@ -215,7 +216,7 @@ export async function assembleDepositTransaction( deposit: Deposit, depositorPrivateKey: string, witness: boolean, - utxos: (UnspentTransactionOutput & RawTransaction)[], + inputUtxos: (UnspentTransactionOutput & RawTransaction)[], fee: BigNumber ): Promise<{ transactionHash: TransactionHash @@ -235,7 +236,7 @@ export async function assembleDepositTransaction( const totalExpenses = deposit.amount.add(fee) let totalInputValue = BigNumber.from(0) - for (const utxo of utxos) { + for (const utxo of inputUtxos) { const previousOutput = Transaction.fromHex(utxo.transactionHex).outs[ utxo.outputIndex ]