plutus-ledger-api-0.1.0.0: Interface to the Plutus ledger for the Cardano ledger.
Safe HaskellNone
LanguageHaskell2010

Plutus.V1.Ledger.Contexts

Synopsis

Pending transactions and related types

data TxInfo Source #

A pending transaction. This is the view as seen by validator scripts, so some details are stripped out.

Constructors

TxInfo 

Fields

Instances

Instances details
Eq TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Show TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Generic TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Associated Types

type Rep TxInfo :: Type -> Type Source #

Pretty TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Methods

pretty :: TxInfo -> Doc ann Source #

prettyList :: [TxInfo] -> Doc ann Source #

ToData TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

FromData TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

UnsafeFromData TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Eq TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Methods

(==) :: TxInfo -> TxInfo -> Bool Source #

Lift DefaultUni TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Typeable DefaultUni TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

type Rep TxInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

data ScriptContext Source #

Instances

Instances details
Eq ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Show ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Generic ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Associated Types

type Rep ScriptContext :: Type -> Type Source #

Pretty ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

ToData ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

FromData ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

UnsafeFromData ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Eq ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Lift DefaultUni ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Typeable DefaultUni ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

type Rep ScriptContext Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

type Rep ScriptContext = D1 ('MetaData "ScriptContext" "Plutus.V1.Ledger.Contexts" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "ScriptContext" 'PrefixI 'True) (S1 ('MetaSel ('Just "scriptContextTxInfo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxInfo) :*: S1 ('MetaSel ('Just "scriptContextPurpose") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ScriptPurpose)))

data ScriptPurpose Source #

Purpose of the script that is currently running

Instances

Instances details
Eq ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Show ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Generic ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Associated Types

type Rep ScriptPurpose :: Type -> Type Source #

Pretty ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

ToData ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

FromData ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

UnsafeFromData ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Eq ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Lift DefaultUni ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Typeable DefaultUni ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

type Rep ScriptPurpose Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

data TxOut Source #

A transaction output, consisting of a target address, a value, and optionally a datum hash.

Instances

Instances details
Eq TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: TxOut -> TxOut -> Bool Source #

(/=) :: TxOut -> TxOut -> Bool Source #

Show TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxOut :: Type -> Type Source #

Methods

from :: TxOut -> Rep TxOut x Source #

to :: Rep TxOut x -> TxOut Source #

ToJSON TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: TxOut -> () Source #

Pretty TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

pretty :: TxOut -> Doc ann Source #

prettyList :: [TxOut] -> Doc ann Source #

ToData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

UnsafeFromData TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Eq TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: TxOut -> TxOut -> Bool Source #

Serialise TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Lift DefaultUni TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Typeable DefaultUni TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOut Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOut = D1 ('MetaData "TxOut" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxOut" 'PrefixI 'True) (S1 ('MetaSel ('Just "txOutAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Address) :*: (S1 ('MetaSel ('Just "txOutValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value) :*: S1 ('MetaSel ('Just "txOutDatumHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe DatumHash)))))

data TxOutRef Source #

A reference to a transaction output. This is a pair of a transaction reference, and an index indicating which of the outputs of that transaction we are referring to.

Constructors

TxOutRef 

Fields

Instances

Instances details
Eq TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Ord TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Show TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Generic TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Associated Types

type Rep TxOutRef :: Type -> Type Source #

ToJSON TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

ToJSONKey TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSON TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromJSONKey TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

NFData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

rnf :: TxOutRef -> () Source #

Pretty TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

pretty :: TxOutRef -> Doc ann Source #

prettyList :: [TxOutRef] -> Doc ann Source #

ToData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

FromData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

UnsafeFromData TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Eq TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Methods

(==) :: TxOutRef -> TxOutRef -> Bool Source #

Serialise TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Lift DefaultUni TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

Typeable DefaultUni TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOutRef Source # 
Instance details

Defined in Plutus.V1.Ledger.Tx

type Rep TxOutRef = D1 ('MetaData "TxOutRef" "Plutus.V1.Ledger.Tx" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxOutRef" 'PrefixI 'True) (S1 ('MetaSel ('Just "txOutRefId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId) :*: S1 ('MetaSel ('Just "txOutRefIdx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

data TxInInfo Source #

An input of a pending transaction.

Instances

Instances details
Eq TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Show TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Generic TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Associated Types

type Rep TxInInfo :: Type -> Type Source #

Pretty TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Methods

pretty :: TxInInfo -> Doc ann Source #

prettyList :: [TxInInfo] -> Doc ann Source #

ToData TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

FromData TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

UnsafeFromData TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Eq TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Methods

(==) :: TxInInfo -> TxInInfo -> Bool Source #

Lift DefaultUni TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

Typeable DefaultUni TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

type Rep TxInInfo Source # 
Instance details

Defined in Plutus.V1.Ledger.Contexts

type Rep TxInInfo = D1 ('MetaData "TxInInfo" "Plutus.V1.Ledger.Contexts" "plutus-ledger-api-0.1.0.0-6XBf4FRRdNK1B20rg7kZGy" 'False) (C1 ('MetaCons "TxInInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "txInInfoOutRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxOutRef) :*: S1 ('MetaSel ('Just "txInInfoResolved") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxOut)))

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.

Hashes (see note [Hashes in validator scripts])

Validator functions

Signatures

txSignedBy :: TxInfo -> PubKeyHash -> Bool Source #

Check if a transaction was signed by the given public key.

Transactions

pubKeyOutput :: TxOut -> Maybe PubKeyHash Source #

Get the public key hash that locks the transaction output, if any.

scriptOutputsAt :: ValidatorHash -> TxInfo -> [(DatumHash, Value)] Source #

Get the list of TxOut outputs of the pending transaction at a given script address.

pubKeyOutputsAt :: PubKeyHash -> TxInfo -> [Value] Source #

Get the values paid to a public key address by a pending transaction.

valueLockedBy :: TxInfo -> ValidatorHash -> Value Source #

Get the total value locked by the given validator in this transaction.

valuePaidTo :: TxInfo -> PubKeyHash -> Value Source #

Get the total value paid to a public key address by a pending transaction.

adaLockedBy :: TxInfo -> ValidatorHash -> Ada Source #

Get the total amount of Ada locked by the given validator in this transaction.

signsTransaction :: Signature -> PubKey -> TxInfo -> Bool Source #

Check if the provided signature is the result of signing the pending transaction (without witnesses) with the given public key.

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)

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.

ownHashes :: ScriptContext -> (ValidatorHash, DatumHash) Source #

Get the validator and datum hashes of the output that is curently being validated

ownHash :: ScriptContext -> ValidatorHash Source #

Get the hash of the validator script that is currently being validated.