Helios API/ API Reference/ Classes/

TxOutput

Represents a transaction output that is used when building a transaction.

Hierarchy

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

NameType
addressAddress
valueValue
datum?null | Datum
refScript?null | UplcProgram

Overrides

CborData.constructor

Accessors

address

get address(): Address

Get the Address to which the TxOutput will be sent.

Returns

Address

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

Value

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

NameType
networkParamsNetworkParams

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

NameType
networkParamsNetworkParams
updater?null | (output: TxOutput) => void

Returns

void

dump

dump(): any

Returns

any

getDatumData

getDatumData(): UplcData

Returns

UplcData

setAddress

setAddress(addr): void

Mutation is handy when correctin the quantity of lovelace in a utxo

Parameters

NameType
addrAddress

Returns

void

setDatum

setDatum(datum): void

Mutation is handy when correctin the quantity of lovelace in a utxo

Parameters

NameType
datumDatum

Returns

void

setValue

setValue(val): void

Mutation is handy when correcting the quantity of lovelace in a utxo

Parameters

NameType
valValue

Returns

void

toCbor

toCbor(): number[]

Returns

number[]

Inherited from

CborData.toCbor

toCborHex

toCborHex(): string

Returns

string

Inherited from

CborData.toCborHex

toData

toData(): ConstrData

Returns

ConstrData

fromCbor

Static fromCbor(bytes): TxOutput

Parameters

NameType
bytesnumber[]

Returns

TxOutput

fromUplcData

Static fromUplcData(data): TxOutput

Parameters

NameType
dataUplcData

Returns

TxOutput