Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Typeclass for blockchain operations
Synopsis
- class Monad m ⇒ MonadBlockchain m where
- sendTx ∷ Tx BabbageEra → m TxId
- utxoByTxIn ∷ Set TxIn → m (UTxO BabbageEra)
- queryProtocolParameters ∷ m (BundledProtocolParameters BabbageEra)
- queryStakePools ∷ m (Set PoolId)
- querySystemStart ∷ m SystemStart
- queryEraHistory ∷ m (EraHistory CardanoMode)
- querySlotNo ∷ m (SlotNo, SlotLength, UTCTime)
- networkId ∷ m NetworkId
- class MonadBlockchain m ⇒ MonadMockchain m where
- modifySlot ∷ (SlotNo → (SlotNo, a)) → m a
- modifyUtxo ∷ (UTxO ERA → (UTxO ERA, a)) → m a
- resolveDatumHash ∷ Hash ScriptData → m (Maybe ScriptData)
- data MonadBlockchainError e
- getSlot ∷ MonadMockchain m ⇒ m SlotNo
- setSlot ∷ MonadMockchain m ⇒ SlotNo → m ()
- setPOSIXTime ∷ (MonadFail m, MonadMockchain m) ⇒ POSIXTime → m ()
- nextSlot ∷ MonadMockchain m ⇒ m ()
- setTimeToValidRange ∷ MonadMockchain m ⇒ (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) → m ()
- getUtxo ∷ MonadMockchain m ⇒ m (UTxO ERA)
- setUtxo ∷ MonadMockchain m ⇒ UTxO ERA → m ()
- newtype MonadBlockchainCardanoNodeT e m a = MonadBlockchainCardanoNodeT {}
- runMonadBlockchainCardanoNodeT ∷ LocalNodeConnectInfo CardanoMode → MonadBlockchainCardanoNodeT e m a → m (Either (MonadBlockchainError e) a)
Documentation
class Monad m ⇒ MonadBlockchain m where Source #
Send transactions and resolve tx inputs.
∷ Tx BabbageEra | |
→ m TxId | Submit a transaction to the network |
∷ Set TxIn | |
→ m (UTxO BabbageEra) | Resolve tx inputs |
queryProtocolParameters Source #
∷ m (BundledProtocolParameters BabbageEra) | Get the protocol parameters |
querySystemStart ∷ m SystemStart Source #
queryEraHistory ∷ m (EraHistory CardanoMode) Source #
∷ m (SlotNo, SlotLength, UTCTime) | returns the current slot number, slot length and begin utc time for slot. Slot 0 is returned when at genesis. |
∷ m NetworkId | Get the network id |
Instances
class MonadBlockchain m ⇒ MonadMockchain m where Source #
Modify the mockchain internals
modifySlot ∷ (SlotNo → (SlotNo, a)) → m a Source #
modifyUtxo ∷ (UTxO ERA → (UTxO ERA, a)) → m a Source #
resolveDatumHash ∷ Hash ScriptData → m (Maybe ScriptData) Source #
Look up the datum of a script hash, taking into account
all datums that were part of transactions submitted with sendTx
.
Instances
data MonadBlockchainError e Source #
Instances
getSlot ∷ MonadMockchain m ⇒ m SlotNo Source #
Get the current slot number
setSlot ∷ MonadMockchain m ⇒ SlotNo → m () Source #
Get the current slot number
setPOSIXTime ∷ (MonadFail m, MonadMockchain m) ⇒ POSIXTime → m () Source #
Set the slot number to the slot that contains the given POSIX time.
nextSlot ∷ MonadMockchain m ⇒ m () Source #
Increase the slot number by 1.
setTimeToValidRange ∷ MonadMockchain m ⇒ (TxValidityLowerBound BabbageEra, TxValidityUpperBound BabbageEra) → m () Source #
Change the clock so that the current slot time is within the given validity range. This MAY move the clock backwards!
Implementation
newtype MonadBlockchainCardanoNodeT e m a Source #
MonadBlockchain
implementation that connects to a cardano node