Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data EmulatorTimeEvent e = EmulatorTimeEvent {
- _eteEmulatorTime :: Slot
- _eteEvent :: e
- eteEvent :: forall e e. Lens (EmulatorTimeEvent e) (EmulatorTimeEvent e) e e
- eteEmulatorTime :: forall e. Lens' (EmulatorTimeEvent e) Slot
- emulatorTimeEvent :: Slot -> Prism' (EmulatorTimeEvent e) e
- data EmulatorEvent'
- = ChainEvent ChainEvent
- | ClientEvent Wallet NodeClientEvent
- | WalletEvent Wallet WalletEvent
- | ChainIndexEvent Wallet ChainIndexLog
- | SchedulerEvent SchedulerLog
- | InstanceEvent ContractInstanceLog
- | UserThreadEvent UserThreadMsg
- type EmulatorEvent = EmulatorTimeEvent EmulatorEvent'
- chainEvent :: Prism' EmulatorEvent' ChainEvent
- walletClientEvent :: Wallet -> Prism' EmulatorEvent' NodeClientEvent
- walletEvent :: Wallet -> Prism' EmulatorEvent' WalletEvent
- walletEvent' :: Prism' EmulatorEvent' (Wallet, WalletEvent)
- chainIndexEvent :: Wallet -> Prism' EmulatorEvent' ChainIndexLog
- schedulerEvent :: Prism' EmulatorEvent' SchedulerLog
- instanceEvent :: Prism' EmulatorEvent' ContractInstanceLog
- userThreadEvent :: Prism' EmulatorEvent' UserThreadMsg
- type EmulatedWalletControlEffects = '[NodeClientControlEffect, ChainIndexControlEffect, SigningProcessControlEffect, LogObserve (LogMessage Text), LogMsg Text]
- data MultiAgentEffect r where
- WalletAction :: Wallet -> Eff EmulatedWalletEffects r -> MultiAgentEffect r
- data MultiAgentControlEffect r where
- WalletControlAction :: Wallet -> Eff EmulatedWalletControlEffects r -> MultiAgentControlEffect r
- walletAction :: Member MultiAgentEffect effs => Wallet -> Eff EmulatedWalletEffects r -> Eff effs r
- handleMultiAgentEffects :: forall effs. Member MultiAgentEffect effs => Wallet -> Eff (EmulatedWalletEffects' effs) ~> Eff effs
- raiseWallet :: forall f effs. (Member f EmulatedWalletEffects, Member MultiAgentEffect effs) => Wallet -> f ~> Eff effs
- walletControlAction :: Member MultiAgentControlEffect effs => Wallet -> Eff EmulatedWalletControlEffects r -> Eff effs r
- data EmulatorState = EmulatorState {
- _chainState :: ChainState
- _walletStates :: Map Wallet WalletState
- _emulatorLog :: [LogMessage EmulatorEvent]
- walletStates :: Lens' EmulatorState (Map Wallet WalletState)
- emulatorLog :: Lens' EmulatorState [LogMessage EmulatorEvent]
- chainState :: Lens' EmulatorState ChainState
- walletState :: Wallet -> Lens' EmulatorState WalletState
- chainOldestFirst :: Lens' EmulatorState Blockchain
- chainUtxo :: Getter EmulatorState AddressMap
- fundsDistribution :: EmulatorState -> Map Wallet Value
- emLog :: EmulatorState -> [LogMessage EmulatorEvent]
- emptyEmulatorState :: EmulatorState
- emulatorState :: Blockchain -> EmulatorState
- emulatorStatePool :: TxPool -> EmulatorState
- emulatorStateInitialDist :: Params -> Map PaymentPubKeyHash Value -> Either ToCardanoError EmulatorState
- type MultiAgentEffs = '[State EmulatorState, LogMsg EmulatorEvent', Error WalletAPIError, Error ChainIndexError, ChainEffect, ChainControlEffect]
- handleMultiAgentControl :: forall effs. Members MultiAgentEffs effs => Eff (MultiAgentControlEffect ': effs) ~> Eff effs
- handleMultiAgent :: forall effs. Members MultiAgentEffs effs => Eff (MultiAgentEffect ': effs) ~> Eff effs
Documentation
data EmulatorTimeEvent e Source #
An event with a timestamp measured in emulator time
(currently: Slot
)
Instances
eteEvent :: forall e e. Lens (EmulatorTimeEvent e) (EmulatorTimeEvent e) e e Source #
eteEmulatorTime :: forall e. Lens' (EmulatorTimeEvent e) Slot Source #
emulatorTimeEvent :: Slot -> Prism' (EmulatorTimeEvent e) e Source #
data EmulatorEvent' Source #
Events produced by the blockchain emulator.
Instances
chainEvent :: Prism' EmulatorEvent' ChainEvent Source #
walletClientEvent :: Wallet -> Prism' EmulatorEvent' NodeClientEvent Source #
walletEvent :: Wallet -> Prism' EmulatorEvent' WalletEvent Source #
walletEvent' :: Prism' EmulatorEvent' (Wallet, WalletEvent) Source #
chainIndexEvent :: Wallet -> Prism' EmulatorEvent' ChainIndexLog Source #
schedulerEvent :: Prism' EmulatorEvent' SchedulerLog Source #
instanceEvent :: Prism' EmulatorEvent' ContractInstanceLog Source #
userThreadEvent :: Prism' EmulatorEvent' UserThreadMsg Source #
type EmulatedWalletControlEffects = '[NodeClientControlEffect, ChainIndexControlEffect, SigningProcessControlEffect, LogObserve (LogMessage Text), LogMsg Text] Source #
data MultiAgentEffect r where Source #
The type of actions in the emulator.
WalletAction :: Wallet -> Eff EmulatedWalletEffects r -> MultiAgentEffect r | A direct action performed by a wallet. Usually represents a "user action", as it is triggered externally. |
data MultiAgentControlEffect r where Source #
WalletControlAction :: Wallet -> Eff EmulatedWalletControlEffects r -> MultiAgentControlEffect r | An action affecting the emulated parts of a wallet (only available in emulator - see note [Control effects].) |
walletAction :: Member MultiAgentEffect effs => Wallet -> Eff EmulatedWalletEffects r -> Eff effs r Source #
Run an action in the context of a wallet (ie. agent)
handleMultiAgentEffects :: forall effs. Member MultiAgentEffect effs => Wallet -> Eff (EmulatedWalletEffects' effs) ~> Eff effs Source #
raiseWallet :: forall f effs. (Member f EmulatedWalletEffects, Member MultiAgentEffect effs) => Wallet -> f ~> Eff effs Source #
walletControlAction :: Member MultiAgentControlEffect effs => Wallet -> Eff EmulatedWalletControlEffects r -> Eff effs r Source #
Run a control action in the context of a wallet
data EmulatorState Source #
The state of the emulator itself.
EmulatorState | |
|
Instances
Show EmulatorState Source # | |
Defined in Wallet.Emulator.MultiAgent |
walletStates :: Lens' EmulatorState (Map Wallet WalletState) Source #
emulatorLog :: Lens' EmulatorState [LogMessage EmulatorEvent] Source #
chainState :: Lens' EmulatorState ChainState Source #
walletState :: Wallet -> Lens' EmulatorState WalletState Source #
chainOldestFirst :: Lens' EmulatorState Blockchain Source #
Get the blockchain as a list of blocks, starting with the oldest (genesis) block.
chainUtxo :: Getter EmulatorState AddressMap Source #
fundsDistribution :: EmulatorState -> Map Wallet Value Source #
Get a map with the total value of each wallet's "own funds".
emLog :: EmulatorState -> [LogMessage EmulatorEvent] Source #
Get the emulator log.
emulatorState :: Blockchain -> EmulatorState Source #
Initialise the emulator state with a blockchain.
emulatorStatePool :: TxPool -> EmulatorState Source #
Initialise the emulator state with a pool of pending transactions.
emulatorStateInitialDist :: Params -> Map PaymentPubKeyHash Value -> Either ToCardanoError EmulatorState Source #
Initialise the emulator state with a single pending transaction that creates the initial distribution of funds to public key addresses.
type MultiAgentEffs = '[State EmulatorState, LogMsg EmulatorEvent', Error WalletAPIError, Error ChainIndexError, ChainEffect, ChainControlEffect] Source #
handleMultiAgentControl :: forall effs. Members MultiAgentEffs effs => Eff (MultiAgentControlEffect ': effs) ~> Eff effs Source #
handleMultiAgent :: forall effs. Members MultiAgentEffs effs => Eff (MultiAgentEffect ': effs) ~> Eff effs Source #