plutus-pab-1.2.0.0
Safe HaskellNone
LanguageHaskell2010

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

Methods

(==) :: Builtin a -> Builtin a -> Bool Source #

(/=) :: Builtin a -> Builtin a -> Bool Source #

Generic (Builtin a) Source # 
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

Associated Types

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

Methods

from :: Builtin a -> Rep (Builtin a) x Source #

to :: Rep (Builtin a) x -> Builtin a Source #

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

Defined in Plutus.PAB.Effects.Contract.Builtin

Methods

declareNamedSchema :: Proxy (Builtin t) -> Declare (Definitions Schema) NamedSchema

PABContract (Builtin a) Source # 
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

Associated Types

type ContractDef (Builtin a) Source #

type State (Builtin a) Source #

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-LtxAAjtTYeqGloVmBPlsYv" 'False) (C1 ('MetaCons "Builtin" 'PrefixI 'False) (U1 :: Type -> Type))
type ContractDef (Builtin a) Source # 
Instance details

Defined in Plutus.PAB.Effects.Contract.Builtin

type ContractDef (Builtin a) = a
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".

Constructors

BuiltinHandler 

Fields

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 ... #

Equations

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

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

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 EmptySchema = Empty :: Row a #

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

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