plutus-contract-1.2.0.0
Safe HaskellNone
LanguageHaskell2010

Wallet.Emulator.MultiAgent

Synopsis

Documentation

data EmulatorTimeEvent e Source #

An event with a timestamp measured in emulator time (currently: Slot)

Constructors

EmulatorTimeEvent 

Instances

Instances details
Functor EmulatorTimeEvent Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Foldable EmulatorTimeEvent Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

fold :: Monoid m => EmulatorTimeEvent m -> m Source #

foldMap :: Monoid m => (a -> m) -> EmulatorTimeEvent a -> m Source #

foldMap' :: Monoid m => (a -> m) -> EmulatorTimeEvent a -> m Source #

foldr :: (a -> b -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldr' :: (a -> b -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldl :: (b -> a -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldl' :: (b -> a -> b) -> b -> EmulatorTimeEvent a -> b Source #

foldr1 :: (a -> a -> a) -> EmulatorTimeEvent a -> a Source #

foldl1 :: (a -> a -> a) -> EmulatorTimeEvent a -> a Source #

toList :: EmulatorTimeEvent a -> [a] Source #

null :: EmulatorTimeEvent a -> Bool Source #

length :: EmulatorTimeEvent a -> Int Source #

elem :: Eq a => a -> EmulatorTimeEvent a -> Bool Source #

maximum :: Ord a => EmulatorTimeEvent a -> a Source #

minimum :: Ord a => EmulatorTimeEvent a -> a Source #

sum :: Num a => EmulatorTimeEvent a -> a Source #

product :: Num a => EmulatorTimeEvent a -> a Source #

Traversable EmulatorTimeEvent Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Eq e => Eq (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Show e => Show (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Generic (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Associated Types

type Rep (EmulatorTimeEvent e) :: Type -> Type Source #

FromJSON e => FromJSON (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

parseJSON :: Value -> Parser (EmulatorTimeEvent e)

parseJSONList :: Value -> Parser [EmulatorTimeEvent e]

ToJSON e => ToJSON (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

toJSON :: EmulatorTimeEvent e -> Value

toEncoding :: EmulatorTimeEvent e -> Encoding

toJSONList :: [EmulatorTimeEvent e] -> Value

toEncodingList :: [EmulatorTimeEvent e] -> Encoding

Pretty e => Pretty (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

pretty :: EmulatorTimeEvent e -> Doc ann

prettyList :: [EmulatorTimeEvent e] -> Doc ann

type Rep (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep (EmulatorTimeEvent e) = D1 ('MetaData "EmulatorTimeEvent" "Wallet.Emulator.MultiAgent" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) (C1 ('MetaCons "EmulatorTimeEvent" 'PrefixI 'True) (S1 ('MetaSel ('Just "_eteEmulatorTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Slot) :*: S1 ('MetaSel ('Just "_eteEvent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 e)))

eteEvent :: forall e e. Lens (EmulatorTimeEvent e) (EmulatorTimeEvent e) e e Source #

data EmulatorEvent' Source #

Events produced by the blockchain emulator.

Instances

Instances details
Eq EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Show EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Generic EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Associated Types

type Rep EmulatorEvent' :: Type -> Type Source #

FromJSON EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

parseJSON :: Value -> Parser EmulatorEvent'

parseJSONList :: Value -> Parser [EmulatorEvent']

ToJSON EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

toJSON :: EmulatorEvent' -> Value

toEncoding :: EmulatorEvent' -> Encoding

toJSONList :: [EmulatorEvent'] -> Value

toEncodingList :: [EmulatorEvent'] -> Encoding

Pretty EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Methods

pretty :: EmulatorEvent' -> Doc ann

prettyList :: [EmulatorEvent'] -> Doc ann

type Rep EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep EmulatorEvent' = D1 ('MetaData "EmulatorEvent'" "Wallet.Emulator.MultiAgent" "plutus-contract-1.2.0.0-FH8LC9wh7UV4Nmv68NHXrC" 'False) ((C1 ('MetaCons "ChainEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainEvent)) :+: (C1 ('MetaCons "ClientEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Wallet) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NodeClientEvent)) :+: C1 ('MetaCons "WalletEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Wallet) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WalletEvent)))) :+: ((C1 ('MetaCons "ChainIndexEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Wallet) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainIndexLog)) :+: C1 ('MetaCons "SchedulerEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SchedulerLog))) :+: (C1 ('MetaCons "InstanceEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ContractInstanceLog)) :+: C1 ('MetaCons "UserThreadEvent" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UserThreadMsg)))))

chainEvent :: Prism' EmulatorEvent' ChainEvent Source #

chainIndexEvent :: Wallet -> Prism' EmulatorEvent' ChainIndexLog Source #

type EmulatedWalletControlEffects = '[NodeClientControlEffect, ChainIndexControlEffect, SigningProcessControlEffect, LogObserve (LogMessage Text), LogMsg Text] Source #

data MultiAgentEffect r where Source #

The type of actions in the emulator.

Constructors

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 #

Constructors

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.

Constructors

EmulatorState 

Fields

Instances

Instances details
Show EmulatorState Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

chainState :: Lens' EmulatorState ChainState 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 #