Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A custom ScriptContext and TxInfo which only "decodes" the fields we need.
Synopsis
- data TxInfo = TxInfo {
- txInfoInputs :: [TxInInfo]
- txInfoReferenceInputs :: BuiltinData
- txInfoOutputs :: [TxOut]
- txInfoFee :: Value
- txInfoMint :: Value
- txInfoDCert :: BuiltinData
- txInfoWdrl :: BuiltinData
- txInfoValidRange :: BuiltinData
- txInfoSignatories :: [PubKeyHash]
- txInfoRedeemers :: BuiltinData
- txInfoData :: Map DatumHash Datum
- txInfoId :: BuiltinData
- data ScriptContext = ScriptContext {
- scriptContextTxInfo :: TxInfo
- scriptContextPurpose :: ScriptPurpose
- scriptOutputsAt :: ScriptHash -> TxInfo -> [(OutputDatum, Value)]
- valueLockedBy :: TxInfo -> ScriptHash -> Value
- findOwnInput :: ScriptContext -> Maybe TxInInfo
- findDatum :: DatumHash -> TxInfo -> Maybe Datum
- findTxInByTxOutRef :: TxOutRef -> TxInfo -> Maybe TxInInfo
- ownCurrencySymbol :: ScriptContext -> CurrencySymbol
Tx info
TxInfo | |
|
Instances
FromData TxInfo Source # | |
Defined in Hydra.ScriptContext fromBuiltinData :: BuiltinData -> Maybe TxInfo | |
ToData TxInfo Source # | |
Defined in Hydra.ScriptContext toBuiltinData :: TxInfo -> BuiltinData | |
UnsafeFromData TxInfo Source # | |
Defined in Hydra.ScriptContext unsafeFromBuiltinData :: BuiltinData -> TxInfo |
Script context
data ScriptContext Source #
The context that the currently-executing script can access.
ScriptContext | |
|
Instances
FromData ScriptContext Source # | |
Defined in Hydra.ScriptContext fromBuiltinData :: BuiltinData -> Maybe ScriptContext | |
ToData ScriptContext Source # | |
Defined in Hydra.ScriptContext toBuiltinData :: ScriptContext -> BuiltinData | |
UnsafeFromData ScriptContext Source # | |
Defined in Hydra.ScriptContext unsafeFromBuiltinData :: BuiltinData -> ScriptContext |
Utilities
scriptOutputsAt :: ScriptHash -> TxInfo -> [(OutputDatum, Value)] Source #
Get the list of TxOut
outputs of the pending transaction at
a given script address.
valueLockedBy :: TxInfo -> ScriptHash -> Value Source #
Get the total value locked by the given validator in this transaction.
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
findTxInByTxOutRef :: TxOutRef -> TxInfo -> Maybe TxInInfo Source #
Given a UTXO reference and a transaction (TxInfo
), resolve it to one of the transaction's inputs (TxInInfo
).
ownCurrencySymbol :: ScriptContext -> CurrencySymbol Source #
The CurrencySymbol
of the current validator script.