plutus-contract-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Wallet.Emulator.MultiAgent

Synopsis

Documentation

data Assertion Source #

Assertions which will be checked during execution of the emulator.

Constructors

IsValidated Tx

Assert that the given transaction is validated.

OwnFundsEqual Wallet Value

Assert that the funds belonging to a wallet's public-key address are equal to a value.

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 #

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

Defined in Wallet.Emulator.MultiAgent

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

Defined in Wallet.Emulator.MultiAgent

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

Defined in Wallet.Emulator.MultiAgent

type Rep (EmulatorTimeEvent e) Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

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

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 #

ToJSON EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

FromJSON EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

Pretty EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep EmulatorEvent' Source # 
Instance details

Defined in Wallet.Emulator.MultiAgent

type Rep EmulatorEvent' = D1 ('MetaData "EmulatorEvent'" "Wallet.Emulator.MultiAgent" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" '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)))))

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].)

Assertion :: Assertion -> MultiAgentControlEffect ()

An assertion in the event stream, which can inspect the current state.

walletAction :: Member MultiAgentEffect effs => Wallet -> Eff EmulatedWalletEffects r -> Eff effs r Source #

Run an action in the context of a wallet (ie. agent)

walletControlAction :: Member MultiAgentControlEffect effs => Wallet -> Eff EmulatedWalletControlEffects r -> Eff effs r Source #

Run a control action in the context of a wallet

assertOwnFundsEq :: Member MultiAgentControlEffect effs => Wallet -> Value -> Eff effs () Source #

Issue an assertion that the funds for a given wallet have the given value.

assertIsValidated :: Member MultiAgentControlEffect effs => Tx -> Eff effs () Source #

Issue an assertion that the given transaction has been validated.

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

chainOldestFirst :: Lens' EmulatorState Blockchain Source #

Get the blockchain as a list of blocks, starting with the oldest (genesis) block.

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 :: Map PaymentPubKeyHash Value -> EmulatorState Source #

Initialise the emulator state with a single pending transaction that creates the initial distribution of funds to public key addresses.

handleMultiAgent :: forall effs. Members MultiAgentEffs effs => Eff (MultiAgentEffect ': effs) ~> Eff effs Source #

assert :: Members MultiAgentEffs effs => Assertion -> Eff effs () Source #

Issue an Assertion.

ownFundsEqual :: Members MultiAgentEffs effs => Wallet -> Value -> Eff effs () Source #

Issue an assertion that the funds for a given wallet have the given value.

isValidated :: Members MultiAgentEffs effs => Tx -> Eff effs () Source #

Issue an assertion that the given transaction has been validated.