hydra-plutus-0.19.0: Hydra Plutus Contracts
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.ScriptContext

Description

A custom ScriptContext and TxInfo which only "decodes" the fields we need.

Synopsis

Tx info

data TxInfo Source #

Constructors

TxInfo 

Fields

  • txInfoInputs :: [TxInInfo]

    Transaction inputs; cannot be an empty list

  • txInfoReferenceInputs :: BuiltinData

    Transaction reference inputs

  • txInfoOutputs :: [TxOut]

    Transaction outputs

  • txInfoFee :: Value

    The fee paid by this transaction.

  • txInfoMint :: Value

    The Value minted by this transaction.

  • txInfoDCert :: BuiltinData

    Digests of certificates included in this transaction

  • txInfoWdrl :: BuiltinData

    Withdrawals

  • txInfoValidRange :: BuiltinData

    The valid range for the transaction.

  • txInfoSignatories :: [PubKeyHash]

    Signatures provided with the transaction, attested that they all signed the tx

  • txInfoRedeemers :: BuiltinData

    A table of redeemers attached to the transaction

  • txInfoData :: Map DatumHash Datum

    The lookup table of datums attached to the transaction

  • txInfoId :: BuiltinData

    Hash of the pending transaction body (i.e. transaction excluding witnesses)

Instances

Instances details
FromData TxInfo Source # 
Instance details

Defined in Hydra.ScriptContext

Methods

fromBuiltinData :: BuiltinData -> Maybe TxInfo

ToData TxInfo Source # 
Instance details

Defined in Hydra.ScriptContext

Methods

toBuiltinData :: TxInfo -> BuiltinData

UnsafeFromData TxInfo Source # 
Instance details

Defined in Hydra.ScriptContext

Methods

unsafeFromBuiltinData :: BuiltinData -> TxInfo

Script context

data ScriptContext Source #

The context that the currently-executing script can access.

Constructors

ScriptContext 

Fields

Instances

Instances details
FromData ScriptContext Source # 
Instance details

Defined in Hydra.ScriptContext

Methods

fromBuiltinData :: BuiltinData -> Maybe ScriptContext

ToData ScriptContext Source # 
Instance details

Defined in Hydra.ScriptContext

Methods

toBuiltinData :: ScriptContext -> BuiltinData

UnsafeFromData ScriptContext Source # 
Instance details

Defined in Hydra.ScriptContext

Methods

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.