Module

Contract.PlutusData

This module that defines query functionality to get PlutusData from DatumHash.

#getDatumByHash

getDatumByHash :: DataHash -> Contract (Maybe PlutusData)

Retrieve the full resolved datum associated to a given datum hash.

#getDatumsByHashes

getDatumsByHashes :: Array DataHash -> Contract (Map DataHash PlutusData)

Retrieve full resolved datums associated with given datum hashes. The resulting Map will only contain datums that have been successfully resolved.

#getDatumsByHashesWithErrors

getDatumsByHashesWithErrors :: Array DataHash -> Contract (Map DataHash (Either String PlutusData))

Retrieve full resolved datums associated with given datum hashes. Errors are returned per datum.

#unitDatum

unitDatum :: Warn (Text "Deprecated: unitDatum. use Cardano.Types.PlutusData.unit") => PlutusData

#unitRedeemer

unitRedeemer :: Warn (Text "Deprecated: unitRedeemer. use Cardano.Types.RedeemerDatum.unit") => RedeemerDatum

#Datum

type Datum = PlutusData

DEPRECATED. Use Cardano.Types.PlutusData

#Redeemer

type Redeemer = RedeemerDatum

DEPRECATED. Use Contract.PlutusData.RedeemerDatum

Re-exports from Cardano.FromData

#FromDataArgs

class FromDataArgs :: Type -> Symbol -> Type -> Constraintclass FromDataArgs t c a  where

Members

Instances

#FromDataArgsRL

class FromDataArgsRL :: Type -> Symbol -> RowList Type -> Row Type -> Constraintclass FromDataArgsRL t constr list row | t constr list -> row where

A helper typeclass to implement FromDataArgs for records. Adapted from https://github.com/purescript/purescript-quickcheck/blob/v7.1.0/src/Test/QuickCheck/Arbitrary.purs#L247

The second argument is a symbol which represents the name of a record constructor.

The third argument to the class is a RowList.

Members

Instances

#FromDataWithSchema

class FromDataWithSchema t a  where

Replacement for 'FromDataWithIndex'. This converts a type into its Plutus Data representation with the help of a Plutus Data Schema (see TypeLevel.DataSchema) We cannot require that the first type argument 't' is an instance of 'HasPlutusSchema' but in practice instances of this class must have a 't' with a 'HasPlutusSchema' instance as well.

Members

Instances

#genericFromData

genericFromData :: forall (t :: Type) (rep :: Type). Generic t rep => FromDataWithSchema t rep => PlutusData -> Maybe t

Re-exports from Cardano.Plutus.DataSchema

#PSchema

data PSchema :: forall (k :: Type). k -> Typedata PSchema k

A kind (never exists as a term). This is the kind of @PCons@ and @PNil@.

#PNil

data PNil :: forall (k :: Type). PSchema kdata PNil

Listlike constructors for the PSchema kind.

Instances

#PCons

data PCons :: forall (k :: Type). Field k -> PSchema k -> PSchema kdata PCons t0 t1

Instances

#MkIxK_

type MkIxK_ :: forall k1. k1 -> Nat -> IxK k1type MkIxK_ k n = MkIxK n k

Syntactic sugar which allows us to represent MkIxK as a type operator

#MkIxK

data MkIxK :: forall (k :: Type). Nat -> k -> IxK kdata MkIxK t0 t1

A data type of Kind (IxK k n) for some k and n

Instances

#MkField_

type MkField_ :: forall (f :: Type -> Type) (k :: Type). Symbol -> f k -> Field ktype MkField_ lbl ixty = MkField lbl ixty

Type synonym used to represent MkField as a type operator.

#MkField

data MkField :: forall (k :: Type) (f :: Type -> Type). Symbol -> f k -> Field kdata MkField t0 t1

A data type of Kind (Field k)

Instances

#IxK

data IxK :: forall (k :: Type). k -> Typedata IxK k

Indexed kind. A kind representing a type @k@ indexed by a type level natural number @n@.

#Id

data Id :: forall (k :: Type). k -> Typedata Id k

FooB {fooo :: Bool, foo :: Bool} A type level Identity "functor kind". This is mainly used to overload the ':=' type operator.

#I

data I :: forall (k :: Type). k -> Id kdata I t0

Instances

#Field

data Field :: forall (k :: Type). k -> Typedata Field k

A kind which is used to represent pairs of Symbols and IxKs. A fancy type level tuple, more or less.

#ApPCons

type ApPCons :: forall (k :: Type). Field k -> PSchema k -> PSchema ktype ApPCons x xs = PCons x xs

Type synonym which is used to provide syntatic sugar to PCons. You can think of :+ as a type level version of : for PSchema

#AllUnique2

class AllUnique2 :: forall (k :: Type). RowListI (RowList k) -> Constraintclass AllUnique2 rList 

A class which ensures that the Nat indices of the RowListI are unique & that the Symbol labels of both the RowListI and RowList in a RowListI (RowList k) all contain unique labels (relative to their "level", i.e., two record arguments of different constructors can have overlapping labels, but constructor names cannot overlap, nor can two labels or indices of the same record)

Instances

#HasPlutusSchema

class HasPlutusSchema :: Type -> PlutusSchema -> Constraintclass HasPlutusSchema t schema | t -> schema

A class used to associate types with a Plutus Data Schema. The fundeps should guarantee that only one schema can exist for each type. This allows us to make the compiler select the schema associated with a particular type.

#PlutusSchemaToRowListI

#SchemaToRowList

class SchemaToRowList :: forall (k :: Type). PSchema k -> RowList k -> Constraintclass SchemaToRowList schema list | schema -> list

Helper type classes used to convert a PlutusSchema to a RowListI (RowList k). Should not need to be used outside of this module.

Instances

#ValidPlutusSchema

class ValidPlutusSchema :: PlutusSchema -> RowListI (RowList Type) -> Constraintclass (PlutusSchemaToRowListI schema list, AllUnique2 list) <= ValidPlutusSchema schema list | schema -> list

The class which validates a Plutus Schema. To make use of genericFromData / genericToData, a type must have an associated Plutus Data schema which satisfies this constraint.

Instances

#type (@@)

Operator alias for Cardano.Plutus.DataSchema.MkIxK_ (right-associative / precedence 9)

#type (:=)

Operator alias for Cardano.Plutus.DataSchema.MkField_ (right-associative / precedence 8)

#type (:+)

Operator alias for Cardano.Plutus.DataSchema.ApPCons (right-associative / precedence 0)

Re-exports from Cardano.ToData

#ToData

class ToData a  where

Classes

Members

Instances

#ToDataArgs

class ToDataArgs :: Type -> Symbol -> Type -> Constraintclass (IsSymbol constr) <= ToDataArgs t constr a  where

As explained in https://harry.garrood.me/blog/write-your-own-generics/ this is just a neat pattern that flattens a skewed Product of Products

Members

Instances

#ToDataArgsRL

class ToDataArgsRL :: forall (k :: Type). Type -> Symbol -> RowList k -> Row Type -> Constraintclass (ToDataArgsRLHelper t constr list row) <= ToDataArgsRL t constr list row | t constr list -> row where

A helper typeclass to implement ToDataArgs for records. Adapted from https://github.com/purescript/purescript-quickcheck/blob/v7.1.0/src/Test/QuickCheck/Arbitrary.purs#L247

The Symbol argument represents the name of a constructor. To account for Sum types where multiple variants of the sum have records with the same name, we have to know the name of the constructor (at the type level). See TypeLevel.DataSchema for a more in depth explanation.

Members

Instances

#ToDataArgsRLHelper

class ToDataArgsRLHelper :: forall (k :: Type). Type -> Symbol -> RowList k -> Row Type -> Constraintclass ToDataArgsRLHelper t constr list row | t constr list -> row where

A helper class used to implement ToDataArgsRL. This mainly exists for performance / ergonomic reasons; specifically, it allows us to only sort once (and not have to worry about maintaing the correct order as we go, which reduces the potential for errors)

Members

Instances

#ToDataWithSchema

class ToDataWithSchema t a  where

A class which converts a type to its PlutusData representation with the help of a generated or user-defined Plutus Data Schema (see TypeLevel.DataSchema.purs). We cannot express the constraint that the first type argument have an instance of @HasPlutusSchema@ with a superclass, but in practice every instance of this class will have an instance of that class as well.

Members

Instances

#genericToData

genericToData :: forall (t :: Type) (rep :: Type). Generic t rep => ToDataWithSchema t rep => t -> PlutusData

Re-exports from Cardano.Types

Re-exports from Cardano.Types.OutputDatum

Re-exports from Ctl.Internal.Types.RedeemerDatum

#RedeemerDatum

newtype RedeemerDatum

Redeemer without ExUnits, tag or index - just a plain wrapper over PlutusData

Constructors

Instances

Modules