From 4b1d97239c9daf67d2c2521989629fbe8b8e6fe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Salvador=20Mag=C3=A1n=20Valero?= Date: Wed, 30 Aug 2023 17:04:05 +0200 Subject: [PATCH] feat: add setTxRefInputs method --- .../src/transaction/transaction.service.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/module/src/transaction/transaction.service.ts b/packages/module/src/transaction/transaction.service.ts index 2b453adc9..30cebaef0 100644 --- a/packages/module/src/transaction/transaction.service.ts +++ b/packages/module/src/transaction/transaction.service.ts @@ -547,6 +547,22 @@ export class Transaction { return this; } + /** + * Sets the reference inputs for the transaction. + * + * @param {UTxO[]} inputs The reference inputs to set. + * @returns {Transaction} The transaction. + */ + setTxRefInputs(inputs: UTxO[]): Transaction { + inputs + .map((input) => toTxUnspentOutput(input)) + .forEach((utxo) => { + this._txBuilder.add_reference_input(utxo.input()) + }); + + return this; + } + withdrawRewards(rewardAddress: string, lovelace: string): Transaction { const address = toRewardAddress(rewardAddress);