plutus-contract-1.2.0.0
Safe HaskellNone
LanguageHaskell2010

Plutus.Trace.Emulator.Types

Synopsis

Documentation

data EmulatorMessage Source #

Messages sent to, and received by, threads in the emulator.

Constructors

NewSlot [Block] Slot

A new slot has begun and some blocks were added.

EndpointCall ThreadId EndpointDescription Value

Call to an endpoint

Freeze

Tell the contract instance to freeze itself (see note [Freeze and Thaw])

ContractInstanceStateRequest ThreadId

Request for the current state of a contract instance

ContractInstanceStateResponse Value

Response to a contract instance state request

type EmulatorAgentThreadEffs effs = LogMsg ContractInstanceLog ': EmulatedWalletEffects' (Yield (AgentSystemCall EmulatorMessage) (Maybe EmulatorMessage) ': (Reader ThreadId ': effs)) Source #

Effects available to emulator agent threads. Includes emulated wallet effects and effects related to threading / waiting for messages.

type EmulatedWalletEffects' effs = WalletEffect ': (Error WalletAPIError ': (NodeClientEffect ': (ChainIndexQueryEffect ': (LogObserve (LogMessage Text) ': (LogMsg RequestHandlerLogMsg ': (LogMsg TxBalanceMsg ': (LogMsg Text ': effs))))))) Source #

Effects that are used to handle requests by contract instances. In the emulator these effects are handled by MultiAgent. In the PAB they are handled by the actual walletnodechain index, mediated by the PAB runtime.

data ContractInstanceTag Source #

A user-defined tag for a contract instance. Used to find the instance's log messages in the emulator log.

Instances

Instances details
Eq ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Ord ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Show ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

IsString ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Generic ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Associated Types

type Rep ContractInstanceTag :: Type -> Type Source #

FromJSON ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

parseJSON :: Value -> Parser ContractInstanceTag

parseJSONList :: Value -> Parser [ContractInstanceTag]

ToJSON ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

pretty :: ContractInstanceTag -> Doc ann

prettyList :: [ContractInstanceTag] -> Doc ann

type Rep ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceTag = D1 ('MetaData "ContractInstanceTag" "Plutus.Trace.Emulator.Types" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) (C1 ('MetaCons "ContractInstanceTag" 'PrefixI 'True) (S1 ('MetaSel ('Just "unContractInstanceTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "shortContractInstanceTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

walletInstanceTag :: Wallet -> ContractInstanceTag Source #

The ContractInstanceTag for the contract instance of a wallet. See note [Wallet contract instances]

data ContractHandle w s e Source #

A reference to a running contract in the emulator.

type ContractConstraints s = (Forall (Output s) Unconstrained1, Forall (Input s) Unconstrained1, AllUniqueLabels (Input s), AllUniqueLabels (Output s), Forall (Input s) FromJSON, Forall (Input s) ToJSON, Forall (Output s) FromJSON, Forall (Output s) ToJSON) Source #

Instance state

data ContractInstanceState w (s :: Row *) e a Source #

The state of a running contract instance with schema s and error type e Serialisable to JSON.

Constructors

ContractInstanceState 

Fields

Instances

Instances details
Generic (ContractInstanceState w s e a) Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Associated Types

type Rep (ContractInstanceState w s e a) :: Type -> Type Source #

(FromJSON e, FromJSON a, FromJSON w) => FromJSON (ContractInstanceState w s e a) Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

parseJSON :: Value -> Parser (ContractInstanceState w s e a)

parseJSONList :: Value -> Parser [ContractInstanceState w s e a]

(ToJSON e, ToJSON a, ToJSON w) => ToJSON (ContractInstanceState w s e a) Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

toJSON :: ContractInstanceState w s e a -> Value

toEncoding :: ContractInstanceState w s e a -> Encoding

toJSONList :: [ContractInstanceState w s e a] -> Value

toEncodingList :: [ContractInstanceState w s e a] -> Encoding

type Rep (ContractInstanceState w s e a) Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep (ContractInstanceState w s e a) = D1 ('MetaData "ContractInstanceState" "Plutus.Trace.Emulator.Types" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) (C1 ('MetaCons "ContractInstanceState" 'PrefixI 'True) (S1 ('MetaSel ('Just "instContractState") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ResumableResult w e PABResp PABReq a)) :*: (S1 ('MetaSel ('Just "instEvents") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq (Response PABResp))) :*: S1 ('MetaSel ('Just "instHandlersHistory") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Seq [Request PABReq])))))

data ContractInstanceStateInternal w (s :: Row *) e a Source #

State of the contract instance, internal to the contract instance thread. It contains both the serialisable state of the contract instance and the non-serialisable continuations in SuspendedContract.

emptyInstanceState :: forall w (s :: Row *) e a. Monoid w => Contract w s e a -> ContractInstanceStateInternal w s e a Source #

toInstanceState :: ContractInstanceStateInternal w (s :: Row *) e a -> ContractInstanceState w s e a Source #

Extract the serialisable ContractInstanceState from the ContractInstanceStateInternal. We need to do this when we want to send the instance state to another thread.

Logging

data ContractInstanceLog Source #

Instances

Instances details
Eq ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Show ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Generic ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Associated Types

type Rep ContractInstanceLog :: Type -> Type Source #

FromJSON ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

parseJSON :: Value -> Parser ContractInstanceLog

parseJSONList :: Value -> Parser [ContractInstanceLog]

ToJSON ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

pretty :: ContractInstanceLog -> Doc ann

prettyList :: [ContractInstanceLog] -> Doc ann

type Rep ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceLog = D1 ('MetaData "ContractInstanceLog" "Plutus.Trace.Emulator.Types" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) (C1 ('MetaCons "ContractInstanceLog" 'PrefixI 'True) (S1 ('MetaSel ('Just "_cilMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractInstanceMsg) :*: (S1 ('MetaSel ('Just "_cilId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractInstanceId) :*: S1 ('MetaSel ('Just "_cilTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractInstanceTag))))

data EmulatorRuntimeError Source #

Instances

Instances details
Eq EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Show EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Generic EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Associated Types

type Rep EmulatorRuntimeError :: Type -> Type Source #

FromJSON EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

parseJSON :: Value -> Parser EmulatorRuntimeError

parseJSONList :: Value -> Parser [EmulatorRuntimeError]

ToJSON EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

pretty :: EmulatorRuntimeError -> Doc ann

prettyList :: [EmulatorRuntimeError] -> Doc ann

type Rep EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

data ContractInstanceMsg Source #

Log messages produced by contract instances

Instances

Instances details
Eq ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Show ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Generic ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Associated Types

type Rep ContractInstanceMsg :: Type -> Type Source #

FromJSON ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

parseJSON :: Value -> Parser ContractInstanceMsg

parseJSONList :: Value -> Parser [ContractInstanceMsg]

ToJSON ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

pretty :: ContractInstanceMsg -> Doc ann

prettyList :: [ContractInstanceMsg] -> Doc ann

type Rep ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceMsg = D1 ('MetaData "ContractInstanceMsg" "Plutus.Trace.Emulator.Types" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) ((((C1 ('MetaCons "Started" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "StoppedNoError" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "StoppedWithError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "ReceiveEndpointCall" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EndpointDescription) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)))) :+: ((C1 ('MetaCons "ReceiveEndpointCallSuccess" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ReceiveEndpointCallFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NotificationError))) :+: (C1 ('MetaCons "NoRequestsHandled" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "HandledRequest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Response Value)))))) :+: (((C1 ('MetaCons "CurrentRequests" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Request Value])) :+: C1 ('MetaCons "InstErr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EmulatorRuntimeError))) :+: (C1 ('MetaCons "ContractLog" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)) :+: C1 ('MetaCons "SendingNotification" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Notification)))) :+: ((C1 ('MetaCons "NotificationSuccess" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Notification)) :+: C1 ('MetaCons "NotificationFailure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NotificationError))) :+: (C1 ('MetaCons "SendingContractState" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ThreadId)) :+: C1 ('MetaCons "Freezing" 'PrefixI 'False) (U1 :: Type -> Type)))))

data UserThreadMsg Source #

Log message produced by the user (main) thread

Instances

Instances details
Eq UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Show UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Generic UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Associated Types

type Rep UserThreadMsg :: Type -> Type Source #

FromJSON UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

parseJSON :: Value -> Parser UserThreadMsg

parseJSONList :: Value -> Parser [UserThreadMsg]

ToJSON UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

toJSON :: UserThreadMsg -> Value

toEncoding :: UserThreadMsg -> Encoding

toJSONList :: [UserThreadMsg] -> Value

toEncodingList :: [UserThreadMsg] -> Encoding

Pretty UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Methods

pretty :: UserThreadMsg -> Doc ann

prettyList :: [UserThreadMsg] -> Doc ann

type Rep UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep UserThreadMsg = D1 ('MetaData "UserThreadMsg" "Plutus.Trace.Emulator.Types" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) (C1 ('MetaCons "UserThreadErr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EmulatorRuntimeError)) :+: C1 ('MetaCons "UserLog" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))