| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PlutusLedgerApi.V2.Contexts
Synopsis
- data TxInfo = TxInfo {
- txInfoInputs :: [TxInInfo]
- txInfoReferenceInputs :: [TxInInfo]
- txInfoOutputs :: [TxOut]
- txInfoFee :: Value
- txInfoMint :: Value
- txInfoDCert :: [DCert]
- txInfoWdrl :: Map StakingCredential Integer
- txInfoValidRange :: POSIXTimeRange
- txInfoSignatories :: [PubKeyHash]
- txInfoRedeemers :: Map ScriptPurpose Redeemer
- txInfoData :: Map 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.
Constructors
| TxInfo | |
Fields
| |
Instances
data ScriptContext Source #
The context that the currently-executing script can access.
Constructors
| ScriptContext | |
Fields
| |
Instances
| Generic ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Associated Types
Methods from :: ScriptContext -> Rep ScriptContext x Source # to :: Rep ScriptContext x -> ScriptContext Source # | |||||
| Show ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts | |||||
| Eq ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods (==) :: ScriptContext -> ScriptContext -> Bool Source # (/=) :: ScriptContext -> ScriptContext -> Bool Source # | |||||
| FromData ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods | |||||
| ToData ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods | |||||
| UnsafeFromData ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods | |||||
| Pretty ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts | |||||
| (HasSchemaDefinition TxInfo referencedTypes, HasSchemaDefinition ScriptPurpose referencedTypes) => HasBlueprintSchema ScriptContext referencedTypes Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods schema :: Schema referencedTypes | |||||
| Lift DefaultUni ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods lift :: ScriptContext -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ()) | |||||
| Typeable DefaultUni ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods typeRep :: Proxy ScriptContext -> RTCompile DefaultUni fun (Type TyName DefaultUni ()) | |||||
| type Rep ScriptContext Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts type Rep ScriptContext = D1 ('MetaData "ScriptContext" "PlutusLedgerApi.V2.Contexts" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" '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
| Generic ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Associated Types
Methods from :: ScriptPurpose -> Rep ScriptPurpose x Source # to :: Rep ScriptPurpose x -> ScriptPurpose Source # | |||||
| Show ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts | |||||
| Eq ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods (==) :: ScriptPurpose -> ScriptPurpose -> Bool Source # (/=) :: ScriptPurpose -> ScriptPurpose -> Bool Source # | |||||
| Ord ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods compare :: ScriptPurpose -> ScriptPurpose -> Ordering Source # (<) :: ScriptPurpose -> ScriptPurpose -> Bool Source # (<=) :: ScriptPurpose -> ScriptPurpose -> Bool Source # (>) :: ScriptPurpose -> ScriptPurpose -> Bool Source # (>=) :: ScriptPurpose -> ScriptPurpose -> Bool Source # max :: ScriptPurpose -> ScriptPurpose -> ScriptPurpose Source # min :: ScriptPurpose -> ScriptPurpose -> ScriptPurpose Source # | |||||
| HasBlueprintDefinition ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Associated Types
Methods definitionId :: DefinitionId | |||||
| Eq ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods (==) :: ScriptPurpose -> ScriptPurpose -> Bool | |||||
| FromData ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods | |||||
| ToData ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods | |||||
| UnsafeFromData ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods | |||||
| Pretty ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts | |||||
| (HasSchemaDefinition CurrencySymbol referencedTypes, HasSchemaDefinition TxOutRef referencedTypes, HasSchemaDefinition StakingCredential referencedTypes, HasSchemaDefinition DCert referencedTypes) => HasBlueprintSchema ScriptPurpose referencedTypes Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods schema :: Schema referencedTypes | |||||
| Lift DefaultUni ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods lift :: ScriptPurpose -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ()) | |||||
| Typeable DefaultUni ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts Methods typeRep :: Proxy ScriptPurpose -> RTCompile DefaultUni fun (Type TyName DefaultUni ()) | |||||
| type Rep ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts type Rep ScriptPurpose = D1 ('MetaData "ScriptPurpose" "PlutusLedgerApi.V1.Contexts" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'False) ((C1 ('MetaCons "Minting" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CurrencySymbol)) :+: C1 ('MetaCons "Spending" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxOutRef))) :+: (C1 ('MetaCons "Rewarding" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 StakingCredential)) :+: C1 ('MetaCons "Certifying" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DCert)))) | |||||
| type Unroll ScriptPurpose Source # | |||||
Defined in PlutusLedgerApi.V1.Contexts type Unroll ScriptPurpose = Insert ScriptPurpose (GUnroll (IfStuckRep (RepIsStuckError ScriptPurpose :: Type -> Type) (Rep 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.
Constructors
| TxId | |
Fields | |
Instances
| IsString TxId Source # | from hex encoding | ||||
Defined in PlutusLedgerApi.V1.Tx Methods fromString :: String -> TxId Source # | |||||
| Generic TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Associated Types
| |||||
| Show TxId Source # | using hex encoding | ||||
| NFData TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| Eq TxId Source # | |||||
| Ord TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| HasBlueprintDefinition TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Associated Types
Methods definitionId :: DefinitionId | |||||
| Eq TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| FromData TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods fromBuiltinData :: BuiltinData -> Maybe TxId # | |||||
| ToData TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods toBuiltinData :: TxId -> BuiltinData # | |||||
| UnsafeFromData TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods | |||||
| Ord TxId Source # | |||||
| Pretty TxId Source # | using hex encoding | ||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| HasSchemaDefinition BuiltinByteString referencedTypes => HasBlueprintSchema TxId referencedTypes Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods schema :: Schema referencedTypes | |||||
| Lift DefaultUni TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| Typeable DefaultUni TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| type Rep TxId Source # | |||||
Defined in PlutusLedgerApi.V1.Tx type Rep TxId = D1 ('MetaData "TxId" "PlutusLedgerApi.V1.Tx" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'True) (C1 ('MetaCons "TxId" 'PrefixI 'True) (S1 ('MetaSel ('Just "getTxId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinByteString))) | |||||
| type Unroll TxId Source # | |||||
A transaction output, consisting of a target address, a value, optionally a datum/datum hash, and optionally a reference script.
Constructors
| TxOut | |
Fields | |
Instances
| Generic TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx Associated Types
| |||||
| Show TxOut Source # | |||||
| NFData TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx | |||||
| Eq TxOut Source # | |||||
| HasBlueprintDefinition TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx Associated Types
Methods definitionId :: DefinitionId | |||||
| Eq TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx | |||||
| FromData TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx Methods fromBuiltinData :: BuiltinData -> Maybe TxOut # | |||||
| ToData TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx Methods toBuiltinData :: TxOut -> BuiltinData # | |||||
| UnsafeFromData TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx Methods | |||||
| Pretty TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx | |||||
| (HasSchemaDefinition Address referencedTypes, HasSchemaDefinition Value referencedTypes, HasSchemaDefinition OutputDatum referencedTypes, HasSchemaDefinition (Maybe ScriptHash) referencedTypes) => HasBlueprintSchema TxOut referencedTypes Source # | |||||
Defined in PlutusLedgerApi.V2.Tx Methods schema :: Schema referencedTypes | |||||
| Lift DefaultUni TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx | |||||
| Typeable DefaultUni TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx | |||||
| type Rep TxOut Source # | |||||
Defined in PlutusLedgerApi.V2.Tx type Rep TxOut = D1 ('MetaData "TxOut" "PlutusLedgerApi.V2.Tx" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" '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 "txOutDatum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OutputDatum) :*: S1 ('MetaSel ('Just "txOutReferenceScript") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ScriptHash))))) | |||||
| type Unroll TxOut Source # | |||||
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.
Constructors
| TxOutRef | |
Fields
| |
Instances
| Generic TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Associated Types
| |||||
| Show TxOutRef Source # | |||||
| NFData TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| Eq TxOutRef Source # | |||||
| Ord TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| HasBlueprintDefinition TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Associated Types
Methods definitionId :: DefinitionId | |||||
| Eq TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| FromData TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods fromBuiltinData :: BuiltinData -> Maybe TxOutRef # | |||||
| ToData TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods toBuiltinData :: TxOutRef -> BuiltinData # | |||||
| UnsafeFromData TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods | |||||
| Pretty TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| (HasSchemaDefinition TxId referencedTypes, HasSchemaDefinition Integer referencedTypes) => HasBlueprintSchema TxOutRef referencedTypes Source # | |||||
Defined in PlutusLedgerApi.V1.Tx Methods schema :: Schema referencedTypes | |||||
| Lift DefaultUni TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| Typeable DefaultUni TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx | |||||
| type Rep TxOutRef Source # | |||||
Defined in PlutusLedgerApi.V1.Tx type Rep TxOutRef = D1 ('MetaData "TxOutRef" "PlutusLedgerApi.V1.Tx" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'False) (C1 ('MetaCons "TxOutRef" 'PrefixI 'True) (S1 ('MetaSel ('Just "txOutRefId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxId) :*: S1 ('MetaSel ('Just "txOutRefIdx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer))) | |||||
| type Unroll TxOutRef Source # | |||||
An input of a pending transaction.
Constructors
| TxInInfo | |
Fields | |
Instances
| Generic TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Associated Types
| |||||
| Show TxInInfo Source # | |||||
| Eq TxInInfo Source # | |||||
| HasBlueprintDefinition TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Associated Types
Methods definitionId :: DefinitionId | |||||
| Eq TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts | |||||
| FromData TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods fromBuiltinData :: BuiltinData -> Maybe TxInInfo # | |||||
| ToData TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods toBuiltinData :: TxInInfo -> BuiltinData # | |||||
| UnsafeFromData TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods | |||||
| Pretty TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts | |||||
| (HasSchemaDefinition TxOutRef referencedTypes, HasSchemaDefinition TxOut referencedTypes) => HasBlueprintSchema TxInInfo referencedTypes Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts Methods schema :: Schema referencedTypes | |||||
| Lift DefaultUni TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts | |||||
| Typeable DefaultUni TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts | |||||
| type Rep TxInInfo Source # | |||||
Defined in PlutusLedgerApi.V2.Contexts type Rep TxInInfo = D1 ('MetaData "TxInInfo" "PlutusLedgerApi.V2.Contexts" "plutus-ledger-api-1.60.0.0-G1HmqwHNllaA7AnJNjAfhP" 'False) (C1 ('MetaCons "TxInInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "txInInfoOutRef") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxOutRef) :*: S1 ('MetaSel ('Just "txInInfoResolved") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxOut))) | |||||
| type Unroll TxInInfo Source # | |||||
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 #
Find the indices of all the outputs that pay to the same script address 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.