Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data EmulatorMessage
- = NewSlot [Block] Slot
- | EndpointCall ThreadId EndpointDescription Value
- | Freeze
- | ContractInstanceStateRequest ThreadId
- | ContractInstanceStateResponse Value
- newtype EmulatorThreads = EmulatorThreads {}
- instanceIdThreads :: Iso' EmulatorThreads (Map ContractInstanceId ThreadId)
- type EmulatorAgentThreadEffs effs = LogMsg ContractInstanceLog ': EmulatedWalletEffects' (Yield (AgentSystemCall EmulatorMessage) (Maybe EmulatorMessage) ': (Reader ThreadId ': effs))
- type EmulatedWalletEffects = EmulatedWalletEffects' '[]
- type EmulatedWalletEffects' effs = WalletEffect ': (Error WalletAPIError ': (NodeClientEffect ': (ChainIndexQueryEffect ': (LogObserve (LogMessage Text) ': (LogMsg RequestHandlerLogMsg ': (LogMsg TxBalanceMsg ': (LogMsg Text ': effs)))))))
- data ContractInstanceTag = ContractInstanceTag {
- unContractInstanceTag :: Text
- shortContractInstanceTag :: Text
- walletInstanceTag :: Wallet -> ContractInstanceTag
- data ContractHandle w s e = ContractHandle {
- chContract :: Contract w s e ()
- chInstanceId :: ContractInstanceId
- chInstanceTag :: ContractInstanceTag
- chNetworkId :: NetworkId
- data 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)
- data ContractInstanceState w (s :: Row *) e a = ContractInstanceState {
- instContractState :: ResumableResult w e PABResp PABReq a
- instEvents :: Seq (Response PABResp)
- instHandlersHistory :: Seq [Request PABReq]
- data ContractInstanceStateInternal w (s :: Row *) e a = ContractInstanceStateInternal {
- cisiSuspState :: SuspendedContract w e PABResp PABReq a
- cisiEvents :: Seq (Response PABResp)
- cisiHandlersHistory :: Seq [Request PABReq]
- emptyInstanceState :: forall w (s :: Row *) e a. Monoid w => Contract w s e a -> ContractInstanceStateInternal w s e a
- addEventInstanceState :: forall w s e a. Monoid w => Response PABResp -> ContractInstanceStateInternal w s e a -> Maybe (ContractInstanceStateInternal w s e a)
- toInstanceState :: ContractInstanceStateInternal w (s :: Row *) e a -> ContractInstanceState w s e a
- data ContractInstanceLog = ContractInstanceLog {}
- cilId :: Lens' ContractInstanceLog ContractInstanceId
- cilMessage :: Lens' ContractInstanceLog ContractInstanceMsg
- cilTag :: Lens' ContractInstanceLog ContractInstanceTag
- data EmulatorRuntimeError
- data ContractInstanceMsg
- = Started
- | StoppedNoError
- | StoppedWithError String
- | ReceiveEndpointCall EndpointDescription Value
- | ReceiveEndpointCallSuccess
- | ReceiveEndpointCallFailure NotificationError
- | NoRequestsHandled
- | HandledRequest (Response Value)
- | CurrentRequests [Request Value]
- | InstErr EmulatorRuntimeError
- | ContractLog Value
- | SendingNotification Notification
- | NotificationSuccess Notification
- | NotificationFailure NotificationError
- | SendingContractState ThreadId
- | Freezing
- _Started :: Prism' ContractInstanceMsg ()
- _StoppedNoError :: Prism' ContractInstanceMsg ()
- _StoppedWithError :: Prism' ContractInstanceMsg String
- _ReceiveEndpointCall :: Prism' ContractInstanceMsg (EndpointDescription, Value)
- _NoRequestsHandled :: Prism' ContractInstanceMsg ()
- _HandledRequest :: Prism' ContractInstanceMsg (Response Value)
- _CurrentRequests :: Prism' ContractInstanceMsg [Request Value]
- _InstErr :: Prism' ContractInstanceMsg EmulatorRuntimeError
- _ContractLog :: Prism' ContractInstanceMsg Value
- data UserThreadMsg
Documentation
data EmulatorMessage Source #
Messages sent to, and received by, threads in the emulator.
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 |
Instances
Eq EmulatorMessage Source # | |
Defined in Plutus.Trace.Emulator.Types (==) :: EmulatorMessage -> EmulatorMessage -> Bool Source # (/=) :: EmulatorMessage -> EmulatorMessage -> Bool Source # | |
Show EmulatorMessage Source # | |
Defined in Plutus.Trace.Emulator.Types |
newtype EmulatorThreads Source #
A map of contract instance ID to thread ID
Instances
Semigroup EmulatorThreads Source # | |
Defined in Plutus.Trace.Emulator.Types (<>) :: EmulatorThreads -> EmulatorThreads -> EmulatorThreads Source # sconcat :: NonEmpty EmulatorThreads -> EmulatorThreads Source # stimes :: Integral b => b -> EmulatorThreads -> EmulatorThreads Source # | |
Monoid EmulatorThreads Source # | |
Defined in Plutus.Trace.Emulator.Types |
instanceIdThreads :: Iso' EmulatorThreads (Map ContractInstanceId ThreadId) Source #
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 = EmulatedWalletEffects' '[] Source #
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.
ContractInstanceTag | |
|
Instances
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.
ContractHandle | |
|
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.
ContractInstanceState | |
|
Instances
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
.
ContractInstanceStateInternal | |
|
emptyInstanceState :: forall w (s :: Row *) e a. Monoid w => Contract w s e a -> ContractInstanceStateInternal w s e a Source #
addEventInstanceState :: forall w s e a. Monoid w => Response PABResp -> ContractInstanceStateInternal w s e a -> Maybe (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
cilId :: Lens' ContractInstanceLog ContractInstanceId Source #
cilTag :: Lens' ContractInstanceLog ContractInstanceTag Source #
data EmulatorRuntimeError Source #
ThreadIdNotFound ContractInstanceId | |
InstanceIdNotFound Wallet | |
EmulatorJSONDecodingError String Value | |
GenericError String | |
EmulatedWalletError WalletAPIError | |
AssertionError String |
Instances
data ContractInstanceMsg Source #
Log messages produced by contract instances
Instances
_Started :: Prism' ContractInstanceMsg () Source #
_StoppedNoError :: Prism' ContractInstanceMsg () Source #
_StoppedWithError :: Prism' ContractInstanceMsg String Source #
_ReceiveEndpointCall :: Prism' ContractInstanceMsg (EndpointDescription, Value) Source #
_NoRequestsHandled :: Prism' ContractInstanceMsg () Source #
_HandledRequest :: Prism' ContractInstanceMsg (Response Value) Source #
_CurrentRequests :: Prism' ContractInstanceMsg [Request Value] Source #
_InstErr :: Prism' ContractInstanceMsg EmulatorRuntimeError Source #
_ContractLog :: Prism' ContractInstanceMsg Value Source #
data UserThreadMsg Source #
Log message produced by the user (main) thread