cardano-rpc
Safe HaskellNone
LanguageHaskell2010

Cardano.Rpc.Server.Internal.UtxoRpc.Type.Block

Description

Conversion of a fetched or streamed chain block to the UTxO RPC AnyChainBlock message.

Synopsis

Documentation

type CardanoBlockComponent = BlockComponent (CardanoBlock StandardCrypto) Source #

Components of a Cardano block that ChainDB reads together, for example the raw bytes and the parsed block.

anyChainBlockRead Source #

Arguments

:: Applicative m 
=> (SlotNo -> m UTCTime)

Convert a slot to its wall-clock timestamp

-> FieldMaskTree AnyChainBlock

Selects the fields to fill

-> CardanoBlockComponent (m AnyChainBlock) 

The block components that the AnyChainBlock fields a mask selects need, and the action that builds the message from them. With no field selected, ChainDB only checks that the block exists.

mkAnyChainBlock Source #

Arguments

:: ByteString

Raw CBOR bytes of the block, exactly as stored on chain

-> BlockInMode

The same block, parsed and placed in its era context

-> UTCTime

Slot wall-clock time; encoded as milliseconds since the Unix epoch

-> Proto AnyChainBlock

Message carrying the native bytes, the parsed cardano block and the timestamp

Assemble the AnyChainBlock proto message: raw CBOR bytes, the cardano header (slot, hash, height - derived from the block itself) and the parsed transactions (all eras), plus the given slot timestamp.