| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusLedgerApi.V1.Data.Contexts
Synopsis
- data TxInfo
- pattern TxInfo :: List Value
- valuePaidTo :: TxInfo -> PubKeyHash -> Value
- spendsOutput :: TxInfo -> TxId -> Integer -> Bool
- txSignedBy :: TxInfo -> PubKeyHash -> Bool
- valueSpent :: TxInfo -> Value
- valueProduced :: TxInfo -> Value
- ownCurrencySymbol :: ScriptContext -> CurrencySymbol
Pending transactions and related types
A pending transaction. This is the view as seen by validator scripts, so some details are stripped out.
Instances
| DefaultUni ()) # | |
| type Rep ScriptPurpose # | |
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 #
pattern Minting :: CurrencySymbol -> ScriptPurpose #
pattern Spending :: TxOutRef -> ScriptPurpose #
pattern Rewarding :: StakingCredential -> ScriptPurpose #
pattern Certifying :: DCert -> ScriptPurpose #
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 | |
Fields | |
Instances
| DefaultUni ()) # | |
| type Rep TxId # | |
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))) | |
A transaction output, consisting of a target address (Address), a value (Value),
and optionally a datum hash (DatumHash).
Instances
| DefaultUni ()) # | |
| type Rep TxOut # | |
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))) | |
txOutAddress :: TxOut -> Address #
txOutValue :: TxOut -> Value #
txOutDatumHash :: TxOut -> Maybe DatumHash #
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
| DefaultUni ()) # | |
| type Rep TxInInfo # | |
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))) | |
matchTxInInfo :: forall r. TxInInfo -> (TxOutRef -> TxOut -> r) -> r #
txInInfoOutRef :: TxInInfo -> TxOutRef #
txInInfoResolved :: TxInInfo -> TxOut #
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
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.