Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Cooked.MockChain.MockChainState
Description
This module exposes the internal state in which our direct simulation is run, and functions to update and query it.
Synopsis
- data MockChainState = MockChainState {}
- mcstParamsL :: Lens' MockChainState Params
- mcstLedgerStateL :: Lens' MockChainState EmulatedLedgerState
- mcstOutputsL :: Lens' MockChainState (Map TxOutRef (TxSkelOut, Bool))
- mcstConstitutionL :: Lens' MockChainState (Maybe (Versioned Script))
- mcstToUtxoState :: MockChainState -> UtxoState
- addOutput :: TxOutRef -> TxSkelOut -> MockChainState -> MockChainState
- removeOutput :: TxOutRef -> MockChainState -> MockChainState
- mockChainState0From :: MonadBlockChainBalancing m => InitialDistribution -> m MockChainState
- mockChainState0 :: MonadBlockChainBalancing m => m MockChainState
Documentation
data MockChainState Source #
The state used to run the simulation in Direct
Constructors
MockChainState | |
Fields
|
Instances
Show MockChainState Source # | |
Defined in Cooked.MockChain.MockChainState Methods showsPrec :: Int -> MockChainState -> ShowS # show :: MockChainState -> String # showList :: [MockChainState] -> ShowS # | |
Default MockChainState Source # | |
Defined in Cooked.MockChain.MockChainState Methods def :: MockChainState # | |
Monad m => MonadState MockChainState (MockChainT m) Source # | |
Defined in Cooked.MockChain.Direct Methods get :: MockChainT m MockChainState # put :: MockChainState -> MockChainT m () # state :: (MockChainState -> (a, MockChainState)) -> MockChainT m a # |
mcstParamsL :: Lens' MockChainState Params Source #
A lens to set or get the parameters of the MockChainState
mcstLedgerStateL :: Lens' MockChainState EmulatedLedgerState Source #
A lens to set or get the ledger state of the MockChainState
mcstOutputsL :: Lens' MockChainState (Map TxOutRef (TxSkelOut, Bool)) Source #
A lens to set or get the outputs of the MockChainState
mcstConstitutionL :: Lens' MockChainState (Maybe (Versioned Script)) Source #
A lens to set or get the constitution script of the MockChainState
mcstToUtxoState :: MockChainState -> UtxoState Source #
Builds a UtxoState
from a MockChainState
addOutput :: TxOutRef -> TxSkelOut -> MockChainState -> MockChainState Source #
Stores an output in a MockChainState
removeOutput :: TxOutRef -> MockChainState -> MockChainState Source #
Removes an output from the MockChainState
mockChainState0From :: MonadBlockChainBalancing m => InitialDistribution -> m MockChainState Source #
This creates the initial MockChainState
from an initial distribution by
submitting an initial transaction with the appropriate content. The genesis
key hash has been taken from
https://github.com/input-output-hk/cardano-node/blob/543b267d75d3d448e1940f9ec04b42bd01bbb16b/cardano-api/test/Test/Cardano/Api/Genesis.hs#L60
mockChainState0 :: MonadBlockChainBalancing m => m MockChainState Source #
Same as mockChainState0From
with the default InitialDistribution