Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data TxInfo = TxInfo {
- txInfoInputs :: [TxInInfo]
- txInfoOutputs :: [TxOut]
- txInfoFee :: Value
- txInfoMint :: Value
- txInfoDCert :: [DCert]
- txInfoWdrl :: [(StakingCredential, Integer)]
- txInfoValidRange :: POSIXTimeRange
- txInfoSignatories :: [PubKeyHash]
- txInfoData :: [(DatumHash, Datum)]
- txInfoId :: TxId
- data ScriptContext = ScriptContext {}
- data ScriptPurpose
- newtype TxId = TxId {}
- data TxOut = TxOut {}
- data TxOutRef = TxOutRef {
- txOutRefId :: TxId
- txOutRefIdx :: Integer
- data TxInInfo = TxInInfo {}
- findOwnInput :: ScriptContext -> Maybe TxInInfo
- findDatum :: DatumHash -> TxInfo -> Maybe Datum
- findDatumHash :: Datum -> TxInfo -> Maybe DatumHash
- findTxInByTxOutRef :: TxOutRef -> TxInfo -> Maybe TxInInfo
- findContinuingOutputs :: ScriptContext -> [Integer]
- getContinuingOutputs :: ScriptContext -> [TxOut]
- pubKeyOutputsAt :: PubKeyHash -> TxInfo -> [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.
TxInfo | |
|
Instances
data ScriptContext Source #
The context that the currently-executing script can access.
ScriptContext | |
|
Instances
data ScriptPurpose Source #
Purpose of the script that is currently running
Instances
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.
Instances
A transaction output, consisting of a target address (Address
), a value (Value
),
and optionally a datum hash (DatumHash
).
Instances
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.
TxOutRef | |
|
Instances
An input of a pending transaction.
Instances
findOwnInput :: ScriptContext -> Maybe TxInInfo Source #
Find the input currently being validated.
findDatum :: DatumHash -> TxInfo -> Maybe Datum Source #
Find the data corresponding to a data hash, if there is one
findDatumHash :: Datum -> TxInfo -> Maybe DatumHash Source #
Find the hash of a datum, if it is part of the pending transaction's hashes
findContinuingOutputs :: ScriptContext -> [Integer] Source #
Finds all the outputs that pay to the same script address that we are currently spending from, if any.
getContinuingOutputs :: ScriptContext -> [TxOut] Source #
Get all the outputs that pay to the same script address we are currently spending from, if any.
Validator functions
pubKeyOutputsAt :: PubKeyHash -> TxInfo -> [Value] Source #
Get the values paid to a public key address by a pending transaction.
valuePaidTo :: TxInfo -> PubKeyHash -> Value Source #
Get the total value paid to a public key address by a pending transaction.
spendsOutput :: TxInfo -> TxId -> Integer -> Bool Source #
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 Source #
Check if a transaction was signed by the given public key.
valueSpent :: TxInfo -> Value Source #
Get the total value of inputs spent by this transaction.
valueProduced :: TxInfo -> Value Source #
Get the total value of outputs produced by this transaction.
ownCurrencySymbol :: ScriptContext -> CurrencySymbol Source #
The CurrencySymbol
of the current validator script.