plutus-ledger-api-1.60.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusLedgerApi.V2.Contexts

Synopsis

Pending transactions and related types

data TxInfo #

A pending transaction. This is the view as seen by validator scripts, so some details are stripped out.

Constructors

TxInfo 

Fields

newtype TxId #

A transaction ID, i.e. the hash of a transaction. Hashed with BLAKE2b-256. 32 byte.

This is a simple type without any validation, use with caution. You may want to add checks for its invariants. See the Shelley ledger specification.

Constructors

TxId 

Instances

Instances details
RepIsStuckError TxId :: Type -> Type) (Rep TxId)))

data TxOut #

A transaction output, consisting of a target address, a value, optionally a datum/datum hash, and optionally a reference script.

data TxOutRef #

A reference to a transaction output. This is a pair of a transaction ID (TxId), and an index indicating which of the outputs of that transaction we are referring to.

Constructors

TxOutRef 

Fields

findOwnInput :: ScriptContext -> Maybe TxInInfo #

Find the input currently being validated.

findDatum :: DatumHash -> TxInfo -> Maybe Datum #

Find the data corresponding to a data hash, if there is one

findDatumHash :: Datum -> TxInfo -> Maybe DatumHash #

Find the hash of a datum, if it is part of the pending transaction's hashes

findTxInByTxOutRef :: TxOutRef -> TxInfo -> Maybe TxInInfo #

Given a UTXO reference and a transaction (TxInfo), resolve it to one of the transaction's inputs (TxInInfo). Note: this only searches the true transaction inputs and not the referenced transaction inputs.

findContinuingOutputs :: ScriptContext -> [Integer] #

Find the indices of all the outputs that pay to the same script address we are currently spending from, if any.

getContinuingOutputs :: ScriptContext -> [TxOut] #

Get all the outputs that pay to the same script address we are currently spending from, if any.

Validator functions

pubKeyOutputsAt :: PubKeyHash -> TxInfo -> [Value] #

Get the values paid to a public key address by a pending transaction.

valuePaidTo :: TxInfo -> PubKeyHash -> Value #

Get the total value paid to a public key address by a pending transaction.

spendsOutput :: TxInfo -> TxId -> Integer -> Bool #

Check if the pending transaction spends a specific transaction output (identified by the hash of a transaction and an index into that transactions' outputs)

txSignedBy :: TxInfo -> PubKeyHash -> Bool #

Check if a transaction was signed by the given public key.

valueSpent :: TxInfo -> Value #

Get the total value of inputs spent by this transaction.

valueProduced :: TxInfo -> Value #

Get the total value of outputs produced by this transaction.

ownCurrencySymbol :: ScriptContext -> CurrencySymbol #

The CurrencySymbol of the current validator script.