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

PlutusLedgerApi.V1.Data.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.

Instances

Instances details
DefaultUni ()) #

type Rep ScriptPurpose # 
Instance details

Defined in PlutusLedgerApi.V1.Data.Contexts

type Rep ScriptPurpose = D1 ('MetaData "ScriptPurpose" "PlutusLedgerApi.V1.Data.Contexts" "plutus-ledger-api-1.60.0.0-inplace" 'True) (C1 ('MetaCons "ScriptPurpose_6989586621680161933" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinData)))

matchScriptPurpose :: forall r. ScriptPurpose -> (CurrencySymbol -> r) -> (TxOutRef -> r) -> (StakingCredential -> r) -> (DCert -> r) -> r #

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. -- editorconfig-checker-disable-file

Constructors

TxId 

Instances

Instances details
DefaultUni ()) #

type Rep TxId # 
Instance details

Defined in PlutusLedgerApi.V1.Data.Tx

type Rep TxId = D1 ('MetaData "TxId" "PlutusLedgerApi.V1.Data.Tx" "plutus-ledger-api-1.60.0.0-inplace" 'True) (C1 ('MetaCons "TxId" 'PrefixI 'True) (S1 ('MetaSel ('Just "getTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinByteString)))

data TxOut #

A transaction output, consisting of a target address (Address), a value (Value), and optionally a datum hash (DatumHash).

Instances

Instances details
DefaultUni ()) #

type Rep TxOut # 
Instance details

Defined in PlutusLedgerApi.V1.Data.Tx

type Rep TxOut = D1 ('MetaData "TxOut" "PlutusLedgerApi.V1.Data.Tx" "plutus-ledger-api-1.60.0.0-inplace" 'True) (C1 ('MetaCons "TxOut_6989586621680121571" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinData)))

pattern TxOut :: Address -> Value -> Maybe DatumHash -> TxOut #

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.

Instances

Instances details
DefaultUni ()) #

type Rep TxInInfo # 
Instance details

Defined in PlutusLedgerApi.V1.Data.Contexts

type Rep TxInInfo = D1 ('MetaData "TxInInfo" "PlutusLedgerApi.V1.Data.Contexts" "plutus-ledger-api-1.60.0.0-inplace" 'True) (C1 ('MetaCons "TxInInfo_6989586621680160945" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinData)))

pattern TxInInfo :: TxOutRef -> TxOut -> TxInInfo #

matchTxInInfo :: forall r. TxInInfo -> (TxOutRef -> TxOut -> r) -> r #

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).

findContinuingOutputs :: ScriptContext -> List Integer #

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

getContinuingOutputs :: ScriptContext -> List TxOut #

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

Validator functions

pubKeyOutputsAt :: PubKeyHash -> TxInfo -> List 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.