sdk.txbuilder.addreferenceinput
Home > @blaze-cardano/sdk > TxBuilder > addReferenceInput
TxBuilder.addReferenceInput() method
Adds a reference input to the transaction. Reference inputs are used to refer to outputs from previous transactions without spending them, allowing scripts to read their data. This can be useful for various contract logic, such as checking the state of a datum without consuming the UTxO that holds it.
Signature:
addReferenceInput(utxo: TransactionUnspentOutput): TxBuilder;
Parameters
Parameter |
Type |
Description |
---|---|---|
utxo |
The unspent transaction output to add as a reference input. |
Returns:
{TxBuilder} The same transaction builder
Exceptions
{Error} If the input to be added is already present in the list of reference inputs, to prevent duplicates.