plutus-pab-1.2.0.0
Safe Haskell None
Language Haskell2010

Plutus.PAB.Effects.Contract.Builtin

Synopsis

Documentation

data Builtin a Source #

Contracts that are built into the PAB (ie. compiled with it) and receive an initial value of type a .

We have a dummy constructor so that we can convert this datatype in Purescript with '(equal * (genericShow * mkSumType)) (Proxy @(Builtin A))'.

Instances

Instances details
Eq ( Builtin a) Source #
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

Generic ( Builtin a) Source #
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

Associated Types

type Rep ( Builtin a) :: Type -> Type Source #

ToSchema t => ToSchema ( Builtin t) Source #
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

PABContract ( Builtin a) Source #
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

Methods

serialisableState :: Proxy ( Builtin a) -> State ( Builtin a) -> ContractResponse Value Value PABResp PABReq Source #

type Rep ( Builtin a) Source #
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

type Rep ( Builtin a) = D1 (' MetaData "Builtin" "Plutus.PAB.Effects.Contract.Builtin" "plutus-pab-1.2.0.0-CtfsFiD4ohhEkbPm9mkCAB" ' False ) ( C1 (' MetaCons "Builtin" ' PrefixI ' False ) ( U1 :: Type -> Type ))
type ContractDef ( Builtin a) Source #
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

type State ( Builtin a) Source #
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

type ContractConstraints w schema error = ( Monoid w, Forall (Output schema) ToJSON , Forall (Input schema) ToJSON , Forall (Input schema) FromJSON , ToJSON error, ToJSON w, FromJSON w, AllUniqueLabels (Input schema)) Source #

data SomeBuiltin where Source #

Plutus contract with all parameters existentially quantified. Can be any contract that satisfies the ContractConstraints .

Constructors

SomeBuiltin :: forall contract w schema error a. ( ContractConstraints w schema error, IsContract contract) => contract w schema error a -> SomeBuiltin

data SomeBuiltinState a where Source #

Constructors

SomeBuiltinState

Fields

  • :: forall a w schema error b. ContractConstraints w schema error
  • => ContractInstanceStateInternal w schema error b

    Internal state

  • -> w

    Observable state (stored separately)

  • -> SomeBuiltinState a

newtype BuiltinHandler a Source #

Defined in order to prevent type errors like: "Couldn't match type effs with effs1 ".

handleBuiltin :: HasDefinitions a => BuiltinHandler a Source #

Handle the ContractEffect for a builtin contract type with parameter a .

Extracting schemas from contracts

type family (l :: Row k) .\\ (r :: Row k) :: Row k where ... infixl 6 Source #

Type level Row difference. That is, l .\\ r is the row remaining after removing any matching elements of r from l .

Equations

(' R l :: Row a) .\\ (' R r :: Row a) = ' R (Diff l r)

type family (l :: Row k) .\/ (r :: Row k) :: Row k where ... infixl 6 Source #

The minimum join of the two rows.

Equations

(x :: Row k) .\/ (' R ('[] :: [ LT k]) :: Row k) = x
(' R ('[] :: [ LT k]) :: Row k) .\/ (y :: Row k) = y
(' R l :: Row a) .\/ (' R r :: Row a) = ' R (MinJoinR l r)

type Empty = ' R ('[] :: [ LT a]) Source #

Type level version of empty

getResponse :: forall a. SomeBuiltinState a -> ContractResponse Value Value PABResp PABReq Source #

fromResponse :: forall a effs. ( Member ( LogMsg ( PABMultiAgentMsg ( Builtin a))) effs, Member ( Error PABError ) effs) => ContractInstanceId -> SomeBuiltin -> ContractResponse Value Value PABResp PABReq -> Eff effs ( SomeBuiltinState a) Source #

Reconstruct a state from a serialised response by replaying back the actions.

class HasDefinitions a where Source #

Allows contract type a to specify its available contract definitions. Also, for each contract type, we specify its contract function and its schemas.

Methods

getDefinitions Source #

Arguments

:: [a]

Available contract definitions for a contract type a

getContract Source #

Arguments

:: a
-> SomeBuiltin

The actual contract function of contract type a