cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.MockChain.Write

Description

This module exposes primitives to update the current state of the blockchain, including by sending transactions for validation.

Synopsis

The MockChainWrite effect

data MockChainWrite :: Effect where Source #

An effect that offers all the primitives that are performing modifications on the blockchain state.

Modifications of the current time

waitNSlots :: Member MockChainWrite effs => Integer -> Sem effs Slot Source #

Waits a certain number of slots and returns the new slot

awaitSlot :: Members '[MockChainRead, MockChainWrite] effs => Slot -> Sem effs Slot Source #

Wait for a certain slot, or throws an error if the slot is already past

awaitEnclosingSlot :: Members '[MockChainRead, MockChainWrite] effs => POSIXTime -> Sem effs Slot Source #

Waits until the current slot becomes greater or equal to the slot containing the given POSIX time. Note that that it might not wait for anything if the current slot is large enough.

waitNMSFromSlotLowerBound :: Members '[MockChainRead, MockChainWrite, Fail] effs => Integer -> Sem effs Slot Source #

Wait a given number of ms from the lower bound of the current slot and returns the current slot after waiting.

waitNMSFromSlotUpperBound :: Members '[MockChainRead, MockChainWrite, Fail] effs => Integer -> Sem effs Slot Source #

Wait a given number of ms from the upper bound of the current slot and returns the current slot after waiting.

Sending TxSkels for validation

validateTxSkel :: Member MockChainWrite effs => TxSkel -> Sem effs (CardanoTx, Utxos) Source #

Generates, balances and validates a transaction from a skeleton, and returns the validated transaction, alongside the created UTxOs.

validateTxSkel' :: Members '[MockChainRead, MockChainWrite] effs => TxSkel -> Sem effs Utxos Source #

Same as validateTxSkel, but only returns the generated UTxOs

validateTxSkel_ :: Member MockChainWrite effs => TxSkel -> Sem effs () Source #

Same as validateTxSkel, but discards the returned transaction

Other operations

setParams :: Member MockChainWrite effs => Params -> Sem effs () Source #

Updates the current parameters

setConstitutionScript :: (Member MockChainWrite effs, ToVScript s) => s -> Sem effs () Source #

Sets the current script to act as the official constitution script

forceOutputs :: Member MockChainWrite effs => [TxSkelOut] -> Sem effs Utxos Source #

Forces the generation of utxos corresponding to certain TxSkelOut. Returns the created UTxOs, which might differ from the original list if some min ADA adjustment occured.

forceOutputs_ :: Member MockChainWrite effs => [TxSkelOut] -> Sem effs () Source #

Same as forceOutputs, but discards the returned outputs