plutus-script-utils-1.2.0.0: Helper/utility functions for writing Plutus scripts.
Safe HaskellNone
LanguageHaskell2010

Plutus.Script.Utils.Scripts

Description

This module contains functions related to versioning scripts and BuiltinData, or more specifially, Datums and Redeemers. These functions do not depend on a particular version of Plutus.

Synopsis

Plutus language versioning

data Language #

Constructors

PlutusV1 
PlutusV2 

Instances

Instances details
Bounded Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Enum Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Eq Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Ord Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Show Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Ix Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Generic Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Associated Types

type Rep Language :: Type -> Type Source #

NFData Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Methods

rnf :: Language -> () Source #

Serialise Language 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

encode :: Language -> Encoding

decode :: Decoder s Language

encodeList :: [Language] -> Encoding

decodeList :: Decoder s [Language]

Pretty Language 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

pretty :: Language -> Doc ann

prettyList :: [Language] -> Doc ann

NoThunks Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Methods

noThunks :: Context -> Language -> IO (Maybe ThunkInfo)

wNoThunks :: Context -> Language -> IO (Maybe ThunkInfo)

showTypeOf :: Proxy Language -> String

FromCBOR Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Methods

fromCBOR :: Decoder s Language

label :: Proxy Language -> Text

ToCBOR Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

Methods

toCBOR :: Language -> Encoding

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Language -> Size

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Language] -> Size

type Rep Language 
Instance details

Defined in Cardano.Ledger.Alonzo.Language

type Rep Language = D1 ('MetaData "Language" "Cardano.Ledger.Alonzo.Language" "cardano-ledger-alonzo-0.1.0.0-9kQ50A9XcYDHq5wCBkTOc6" 'False) (C1 ('MetaCons "PlutusV1" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PlutusV2" 'PrefixI 'False) (U1 :: Type -> Type))

data Versioned script Source #

A script of some kind with its Plutus language version

Constructors

Versioned 

Fields

Instances

Instances details
Functor Versioned Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

fmap :: (a -> b) -> Versioned a -> Versioned b Source #

(<$) :: a -> Versioned b -> Versioned a Source #

Eq script => Eq (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

(==) :: Versioned script -> Versioned script -> Bool Source #

(/=) :: Versioned script -> Versioned script -> Bool Source #

Ord script => Ord (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

compare :: Versioned script -> Versioned script -> Ordering Source #

(<) :: Versioned script -> Versioned script -> Bool Source #

(<=) :: Versioned script -> Versioned script -> Bool Source #

(>) :: Versioned script -> Versioned script -> Bool Source #

(>=) :: Versioned script -> Versioned script -> Bool Source #

max :: Versioned script -> Versioned script -> Versioned script Source #

min :: Versioned script -> Versioned script -> Versioned script Source #

Show script => Show (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

showsPrec :: Int -> Versioned script -> ShowS Source #

show :: Versioned script -> String Source #

showList :: [Versioned script] -> ShowS Source #

Generic (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Associated Types

type Rep (Versioned script) :: Type -> Type Source #

Methods

from :: Versioned script -> Rep (Versioned script) x Source #

to :: Rep (Versioned script) x -> Versioned script Source #

Serialise script => Serialise (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

encode :: Versioned script -> Encoding

decode :: Decoder s (Versioned script)

encodeList :: [Versioned script] -> Encoding

decodeList :: Decoder s [Versioned script]

FromJSON script => FromJSON (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

parseJSON :: Value -> Parser (Versioned script)

parseJSONList :: Value -> Parser [Versioned script]

ToJSON script => ToJSON (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

toJSON :: Versioned script -> Value

toEncoding :: Versioned script -> Encoding

toJSONList :: [Versioned script] -> Value

toEncodingList :: [Versioned script] -> Encoding

Pretty script => Pretty (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

Methods

pretty :: Versioned script -> Doc ann

prettyList :: [Versioned script] -> Doc ann

type Rep (Versioned script) Source # 
Instance details

Defined in Plutus.Script.Utils.Scripts

type Rep (Versioned script) = D1 ('MetaData "Versioned" "Plutus.Script.Utils.Scripts" "plutus-script-utils-1.2.0.0-5TpLCy32WGLK5IaOxcwe9j" 'False) (C1 ('MetaCons "Versioned" 'PrefixI 'True) (S1 ('MetaSel ('Just "unversioned") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 script) :*: S1 ('MetaSel ('Just "version") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Language)))

Script hashing

scriptHash :: Versioned Script -> ScriptHash Source #

Hash a Versioned Script

Script utilities

scriptCurrencySymbol :: Versioned MintingPolicy -> CurrencySymbol Source #

The CurrencySymbol of a MintingPolicy.

Script data hashes

data Datum #

Instances

Instances details
Eq Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

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

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

Ord Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Associated Types

type Rep Datum :: Type -> Type Source #

Methods

from :: Datum -> Rep Datum x Source #

to :: Rep Datum x -> Datum Source #

NFData Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

rnf :: Datum -> () Source #

Eq Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

(==) :: Datum -> Datum -> Bool

FromData Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

fromBuiltinData :: BuiltinData -> Maybe Datum

Pretty Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

pretty :: Datum -> Doc ann

prettyList :: [Datum] -> Doc ann

ToData Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

toBuiltinData :: Datum -> BuiltinData

UnsafeFromData Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

unsafeFromBuiltinData :: BuiltinData -> Datum

Lift DefaultUni Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

lift :: Datum -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ())

Typeable DefaultUni Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

typeRep :: Proxy Datum -> RTCompile DefaultUni fun (Type TyName DefaultUni ())

type Rep Datum 
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Datum = D1 ('MetaData "Datum" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-6EvbyJiK8IAAVEtnIJDu5Z" 'True) (C1 ('MetaCons "Datum" 'PrefixI 'True) (S1 ('MetaSel ('Just "getDatum") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinData)))

data DatumHash #

Instances

Instances details
Eq DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Associated Types

type Rep DatumHash :: Type -> Type Source #

NFData DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

rnf :: DatumHash -> () Source #

Eq DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

(==) :: DatumHash -> DatumHash -> Bool

FromData DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

fromBuiltinData :: BuiltinData -> Maybe DatumHash

Ord DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

pretty :: DatumHash -> Doc ann

prettyList :: [DatumHash] -> Doc ann

ToData DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

toBuiltinData :: DatumHash -> BuiltinData

UnsafeFromData DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

unsafeFromBuiltinData :: BuiltinData -> DatumHash

Lift DefaultUni DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

lift :: DatumHash -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ())

Typeable DefaultUni DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

typeRep :: Proxy DatumHash -> RTCompile DefaultUni fun (Type TyName DefaultUni ())

type Rep DatumHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep DatumHash = D1 ('MetaData "DatumHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-6EvbyJiK8IAAVEtnIJDu5Z" 'True) (C1 ('MetaCons "DatumHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinByteString)))

data Redeemer #

Instances

Instances details
Eq Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Associated Types

type Rep Redeemer :: Type -> Type Source #

NFData Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

rnf :: Redeemer -> () Source #

Eq Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

(==) :: Redeemer -> Redeemer -> Bool

FromData Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

fromBuiltinData :: BuiltinData -> Maybe Redeemer

Pretty Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

pretty :: Redeemer -> Doc ann

prettyList :: [Redeemer] -> Doc ann

ToData Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

toBuiltinData :: Redeemer -> BuiltinData

UnsafeFromData Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

unsafeFromBuiltinData :: BuiltinData -> Redeemer

Lift DefaultUni Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

lift :: Redeemer -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ())

Typeable DefaultUni Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

typeRep :: Proxy Redeemer -> RTCompile DefaultUni fun (Type TyName DefaultUni ())

type Rep Redeemer 
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep Redeemer = D1 ('MetaData "Redeemer" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-6EvbyJiK8IAAVEtnIJDu5Z" 'True) (C1 ('MetaCons "Redeemer" 'PrefixI 'True) (S1 ('MetaSel ('Just "getRedeemer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinData)))

data RedeemerHash #

Instances

Instances details
Eq RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Ord RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Show RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

IsString RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Generic RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Associated Types

type Rep RedeemerHash :: Type -> Type Source #

NFData RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

rnf :: RedeemerHash -> () Source #

Eq RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

FromData RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

fromBuiltinData :: BuiltinData -> Maybe RedeemerHash

Ord RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Pretty RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

pretty :: RedeemerHash -> Doc ann

prettyList :: [RedeemerHash] -> Doc ann

ToData RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

toBuiltinData :: RedeemerHash -> BuiltinData

UnsafeFromData RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

unsafeFromBuiltinData :: BuiltinData -> RedeemerHash

Lift DefaultUni RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

lift :: RedeemerHash -> RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ())

Typeable DefaultUni RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

Methods

typeRep :: Proxy RedeemerHash -> RTCompile DefaultUni fun (Type TyName DefaultUni ())

type Rep RedeemerHash 
Instance details

Defined in Plutus.V1.Ledger.Scripts

type Rep RedeemerHash = D1 ('MetaData "RedeemerHash" "Plutus.V1.Ledger.Scripts" "plutus-ledger-api-1.0.0.1-6EvbyJiK8IAAVEtnIJDu5Z" 'True) (C1 ('MetaCons "RedeemerHash" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BuiltinByteString)))

datumHash :: Datum -> DatumHash Source #

Hash a 'PV1.Datum builtin data.

dataHash :: BuiltinData -> BuiltinByteString Source #

Hash a BuiltinData

Orphan instances

Serialise Language Source # 
Instance details

Methods

encode :: Language -> Encoding

decode :: Decoder s Language

encodeList :: [Language] -> Encoding

decodeList :: Decoder s [Language]

Pretty Language Source # 
Instance details

Methods

pretty :: Language -> Doc ann

prettyList :: [Language] -> Doc ann