plutus-contract-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

Wallet.Emulator.Chain

Synopsis

Documentation

data ChainEvent Source #

Events produced by the blockchain emulator.

Constructors

TxnValidate TxId CardanoTx [ScriptValidationEvent]

A transaction has been validated and added to the blockchain.

TxnValidationFail ValidationPhase TxId CardanoTx ValidationError [ScriptValidationEvent] Value

A transaction failed to validate. The Value indicates the amount of collateral stored in the transaction.

SlotAdd Slot 

Instances

Instances details
Eq ChainEvent Source # 
Instance details

Defined in Wallet.Emulator.Chain

Show ChainEvent Source # 
Instance details

Defined in Wallet.Emulator.Chain

Generic ChainEvent Source # 
Instance details

Defined in Wallet.Emulator.Chain

Associated Types

type Rep ChainEvent :: Type -> Type Source #

ToJSON ChainEvent Source # 
Instance details

Defined in Wallet.Emulator.Chain

FromJSON ChainEvent Source # 
Instance details

Defined in Wallet.Emulator.Chain

Pretty ChainEvent Source # 
Instance details

Defined in Wallet.Emulator.Chain

type Rep ChainEvent Source # 
Instance details

Defined in Wallet.Emulator.Chain

type TxPool = [CardanoTx] Source #

A pool of transactions which have yet to be validated.

data ChainState Source #

Constructors

ChainState 

Fields

Instances

Instances details
Show ChainState Source # 
Instance details

Defined in Wallet.Emulator.Chain

Generic ChainState Source # 
Instance details

Defined in Wallet.Emulator.Chain

Associated Types

type Rep ChainState :: Type -> Type Source #

type Rep ChainState Source # 
Instance details

Defined in Wallet.Emulator.Chain

type Rep ChainState = D1 ('MetaData "ChainState" "Wallet.Emulator.Chain" "plutus-contract-0.1.0.0-2DbvKQdtEvHK4UkDq1ndDW" 'False) (C1 ('MetaCons "ChainState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_chainNewestFirst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Blockchain) :*: S1 ('MetaSel ('Just "_txPool") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TxPool)) :*: (S1 ('MetaSel ('Just "_index") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UtxoIndex) :*: S1 ('MetaSel ('Just "_currentSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Slot))))

processBlock :: Member ChainControlEffect effs => Eff effs Block Source #

Make a new block

modifySlot :: Member ChainControlEffect effs => (Slot -> Slot) -> Eff effs Slot Source #

Adjust the current slot number, returning the new slot.

data ValidatedBlock Source #

The result of validating a block.

Constructors

ValidatedBlock 

Fields

  • vlbValid :: Block

    The transactions that have been validated in this block.

  • vlbEvents :: [ChainEvent]

    Transaction validation events for the transactions in this block.

  • vlbRest :: TxPool

    The transactions that haven't been validated because the current slot is not in their validation interval.

validateBlock :: SlotConfig -> Slot -> UtxoIndex -> TxPool -> ValidatedBlock Source #

Validate a block given the current slot and UTxO index, returning the valid transactions, success/failure events, remaining transactions and the updated UTxO set.

canValidateNow :: Slot -> CardanoTx -> Bool Source #

Check whether the given transaction can be validated in the given slot.

validateEm :: MonadState ValidationCtx m => Slot -> UTxO EmulatorEra -> CardanoTx -> m (Maybe ValidationErrorInPhase, [ScriptValidationEvent]) Source #

Validate a transaction in the current emulator state.

addBlock :: Block -> ChainState -> ChainState Source #

Adds a block to ChainState, without validation.