plutus-contract-0.1.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 #

NFData ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

ToJSON ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

FromJSON ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceTag Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceTag = D1 ('MetaData "ContractInstanceTag" "Plutus.Trace.Emulator.Types" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" '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.

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 #

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

Defined in Plutus.Trace.Emulator.Types

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

Defined in Plutus.Trace.Emulator.Types

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-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" '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 #

ToJSON ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

FromJSON ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceLog Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceLog = D1 ('MetaData "ContractInstanceLog" "Plutus.Trace.Emulator.Types" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" '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 #

ToJSON EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

FromJSON EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty EmulatorRuntimeError Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

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 #

ToJSON ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

FromJSON ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep ContractInstanceMsg = D1 ('MetaData "ContractInstanceMsg" "Plutus.Trace.Emulator.Types" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" '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 #

ToJSON UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

FromJSON UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

Pretty UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep UserThreadMsg Source # 
Instance details

Defined in Plutus.Trace.Emulator.Types

type Rep UserThreadMsg = D1 ('MetaData "UserThreadMsg" "Plutus.Trace.Emulator.Types" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" '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)))