TxInfo

scalus.ledger.api.v3.TxInfo
See theTxInfo companion class
object TxInfo

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
TxInfo.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete fields

lazy val sirDeps: List[SIRModuleWithDeps]
lazy val sirModule: Module

Extensions

Extensions

extension (self: TxInfo)
def findOwnDatum(datumHash: DatumHash): Option[Datum]

Finds a datum in this transaction's outputs or datum lookup map by its hash.

Finds a datum in this transaction's outputs or datum lookup map by its hash.

Value parameters

datumHash

the hash of the datum to search for

Attributes

Returns

Some(Datum) if the datum is found in either transaction outputs or datum lookup map, None otherwise

Example
val txInfo = TxInfo(...)
val datumHash = DatumHash(...)
val maybeDatum = txInfo.findOwnDatum(datumHash)
// Returns Some(Datum) if the datumHash exists in txInfo.data or txInfo.outputs
// Returns None if the datumHash is not found

Finds a transaction input in this transaction's inputs by its output reference.

Finds a transaction input in this transaction's inputs by its output reference.

Value parameters

outRef

the transaction output reference to search for

Attributes

Returns

Some(TxInInfo) if the input is found, None otherwise

Example
val txInfo = TxInfo(...)
val outRef = TxOutRef(txId, 0)
val maybeInput = txInfo.findOwnInput(outRef)
// Returns Some(TxInInfo) if the outRef exists in txInfo.inputs
// Returns None if the outRef is not found

Finds all transaction outputs that are locked by a specific validator script.

Finds all transaction outputs that are locked by a specific validator script.

Value parameters

scriptHash

the hash of the validator script to search for

Attributes

Returns

List of transaction outputs that are locked by the given validator script

Example
val txInfo = TxInfo(...)
val validatorHash = ValidatorHash(...)
val scriptOutputs = txInfo.findOwnScriptOutputs(validatorHash)
// Returns List[TxOut] containing all outputs locked by the validator script
// Returns empty List if no matching outputs are found