Helios API/ API Reference/ Classes/
TxOutput
Represents a transaction output that is used when building a transaction.
Hierarchy
-
↳
TxOutput
Index
Constructors
constructor
• new TxOutput(address
, value
, datum?
, refScript?
)
Constructs a TxOutput
instance using an Address
, a Value
, an optional Datum
, and optional UplcProgram
reference script.
Parameters
Name | Type |
---|---|
address | Address |
value | Value |
datum? | null | Datum |
refScript? | null | UplcProgram |
Overrides
Accessors
address
• get
address(): Address
Get the Address
to which the TxOutput
will be sent.
Returns
datum
• get
datum(): null
| Datum
Get the optional Datum
associated with the TxOutput
.
Returns
null
| Datum
refScript
• get
refScript(): null
| UplcProgram
Returns
null
| UplcProgram
value
• get
value(): Value
Get the Value
contained in the TxOutput
.
Returns
Methods
calcMinLovelace
▸ calcMinLovelace(networkParams
): bigint
Each UTxO must contain some minimum quantity of lovelace to avoid that the blockchain is used for data storage.
Parameters
Name | Type |
---|---|
networkParams | NetworkParams |
Returns
bigint
correctLovelace
▸ correctLovelace(networkParams
, updater?
): void
Makes sure the TxOutput
contains the minimum quantity of lovelace.
The network requires this to avoid the creation of unusable dust UTxOs.
Optionally an update function can be specified that allows mutating the datum of the TxOutput
to account for an increase of the lovelace quantity contained in the value.
Parameters
Name | Type |
---|---|
networkParams | NetworkParams |
updater? | null | (output : TxOutput ) => void |
Returns
void
dump
▸ dump(): any
Returns
any
getDatumData
▸ getDatumData(): UplcData
Returns
setAddress
▸ setAddress(addr
): void
Mutation is handy when correctin the quantity of lovelace in a utxo
Parameters
Name | Type |
---|---|
addr | Address |
Returns
void
setDatum
▸ setDatum(datum
): void
Mutation is handy when correctin the quantity of lovelace in a utxo
Parameters
Name | Type |
---|---|
datum | Datum |
Returns
void
setValue
▸ setValue(val
): void
Mutation is handy when correcting the quantity of lovelace in a utxo
Parameters
Name | Type |
---|---|
val | Value |
Returns
void
toCbor
▸ toCbor(): number
[]
Returns
number
[]
Inherited from
toCborHex
▸ toCborHex(): string
Returns
string
Inherited from
toData
▸ toData(): ConstrData
Returns
fromCbor
▸ Static
fromCbor(bytes
): TxOutput
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
fromUplcData
▸ Static
fromUplcData(data
): TxOutput
Parameters
Name | Type |
---|---|
data | UplcData |