cardano-api
Safe HaskellNone
LanguageHaskell2010

Cardano.Api.Internal.IPC

Description

Node IPC protocols

This module provides the client side of the node-to-client interprocess communication (IPC) for interacting with a local Cardano node. It supports querying the node for information, submitting transactions, monitoring the local mempool, and retrieving historical chain data using the ChainSync protocol.

Synopsis

Examples

This section provides two examples:

  1. Querying the node to obtain basic information
  2. Submitting a transaction to the node.

For details on how to create a transaction, see the Cardano.Api.Internal.Tx.Body documentation.

The following qualified imports from cardano-api are used in the examples below:

import qualified Cardano.Api as Api
import qualified Cardano.Api.Consensus as Consensus
import qualified Cardano.Api.Network as Network
import qualified Cardano.Api.Shelley as Shelley

The following explicit import from base is also required:

import Control.Monad.Except (runExceptT)

The examples assume the use of the IO monad and unqualified access to the Prelude module.

Constructing connection information

Regardless of whether the goal is to query the node or submit transactions, the first step is to gather the connection information.

The following information is required:

  • The number of slots per epoch. This value depends on the network the node is connected to. It can be obtained by inspecting the epochLength key in the shelley-genesis.json file used by the node. On the preview network, the value is, at the time of writing, 86_400, but it can change. This value and other genesis parameters can also be obtained using the QueryGenesisParameters query.
  • Network identifier. When connecting to a testnet, the network identifier is also required. It can be obtained by looking for the networkId obtained by looking up the networkMagic key in the shelley-genesis.json file that the node uses to connect to the network. For the preview network, the current identifier is 2.
  • Socket path. The path to the node's socket file. It can be set using the --socket-path parameter when starting the node. By default, it is typically located in the db subfolder of the node's working directory.

Then, combine all the required information into a LocalNodeConnectInfo value.

For example, assume the node is connected to the preview network and the socket file is located at /home/user/cardano-node/db/node.socket. The LocalNodeConnectInfo value can then be constructed as follows:

let connectionInfo =
      Api.LocalNodeConnectInfo
         { Api.localConsensusModeParams = Api.CardanoModeParams (Api.EpochSlots 86_400)
         , Api.localNodeNetworkId = Api.Testnet (Api.NetworkMagic 2)
         , Api.localNodeSocketPath = Api.File "/home/user/cardano-node/db/node.socket"
         }

Querying the node for the UTXO set

To obtain the set of unspent transaction outputs (UTXO set) from the network, the current era must first be determined.

Obtaining the current era

Many queries require knowing the current era. This can be hardcoded using one of the ShelleyBasedEra constructors, but it is also possible to retreive it from the node:

eEra <- runExceptT $ Api.queryNodeLocalState connectionInfo Network.VolatileTip Api.QueryCurrentEra

VolatileTip requests information from the most recent block the node is aware of. It is important to note that this information is not guaranteed to remain valid, as it may be rolled back.

Alternatively, ImmutableTip can be used to obtain information from the most recent block considered as final by the consensus algorithm. While this data is stable and will not be rolled back, it is less recent – on mainnet, it is typically about 36 hours behind the current time.

QueryCurrentEra is the constructor of the query that retrieves the node's current era.

The query returns an ExceptT monad, which can be run using the runExceptT function. This yields an eEra value of type Either AcquiringFailure AnyCardanoEra.

Below is an example of how to unwrap this value into a ShelleyBasedEra based era, assuming the node is not running Byron:

Api.AnyShelleyBasedEra sbe :: Api.AnyShelleyBasedEra <- case eEra of
  Right (Api.AnyCardanoEra era) ->
    Api.caseByronOrShelleyBasedEra
      (error "Error, we are in Byron era")
      (return . Api.AnyShelleyBasedEra)
      era
  Left Shelley.AFPointTooOld -> error "Error, point queried in the chain is too old!"
  Left Shelley.AFPointNotOnChain -> error "Error, point queried is not on chain!"

AFPointTooOld and AFPointNotOnChain errors should not occur when querying with either VolatileTip or ImmutableTip.

Obtaining the UTXO set

After determining the current era, the node can be queried for the UTXO set using the QueryUTxO query as follows:

eUtxo <-
  runExceptT $
    Api.queryNodeLocalState
      connectionInfo
      Network.VolatileTip
      (Api.QueryInEra (Api.QueryInShelleyBasedEra sbe (Api.QueryUTxO Api.QueryUTxOWhole)))

This returns, a nested type of Either AcquiringFailure (Either EraMismatch (UTXO era)). You can unwrap it as follows:

utxo <- case eUtxo of
  Right (Right (Api.UTxO utxo)) -> do
    return utxo
  Right (Left (Consensus.EraMismatch{Consensus.ledgerEraName, Consensus.otherEraName})) ->
    error
      ( "Error, we assumed era was "
          ++ show otherEraName
          ++ " but it was "
          ++ show ledgerEraName
      )
  Left Shelley.AFPointTooOld -> error "Error, point queried in the chain is too old!"
  Left Shelley.AFPointNotOnChain -> error "Error, point queried is not on chain!"

Alternatively, to avoid nested result types, you can use convenience functions and types from Cardano.Api.Internal.Convenience.Query. It is also posible to combine several queries into a single connection by using the monadic interface that can be found in the Cardano.Api.Internal.IPC.Monad documentation.

The obtained utxo variable is a standard Map of type Map TxIn (TxOut CtxUTxO era).

Submitting a transaction

Assume there is a signed transaction in the latest era that you would like to submit to the node. Assume it is stored in the variable signedTx of type Tx era.

For details on how to create such a transaction, see the Cardano.Api.Internal.Tx.Body documentation.

To submit the transaction to the node, use the submitTxToNodeLocal function as follows:

result <- Api.submitTxToNodeLocal connectionInfo (Api.TxInMode sbe signedTx)

The result is a SubmitResult value, which can be inspected as follows:

case result of
  Api.SubmitSuccess -> putStrLn "Transaction submitted successfully!"
  Api.SubmitFail reason -> error $ "Error submitting transaction: " ++ show reason

If the command succeeds, the transaction gets into the node's mempool, ready to be included in a block.

Node interaction

Operations that involve talking to a local Cardano node.

connectToLocalNode :: MonadIO m => LocalNodeConnectInfo -> LocalNodeClientProtocolsInMode -> m () Source #

Establish a connection to a local node and execute the given set of protocol handlers.

connectToLocalNodeWithVersion :: MonadIO m => LocalNodeConnectInfo -> (NodeToClientVersion -> LocalNodeClientProtocolsInMode) -> m () Source #

Establish a connection to a local node and execute the given set of protocol handlers parameterized on the negotiated node-to-client protocol version.

data LocalNodeClientParams where Source #

This type defines the boundary between the mode-parametrised style used in this API and the block-parametrised style used by the underlying network and consensus libraries.

This interface itself is in the block-parametrised style, with the block type itself being an hidden/existential type.

It bundles together all the necessary class instances, the consensus protocol client identifier, and the set of client side mini-protocol handlers for the node-to-client protocol.

Constructors

LocalNodeClientParamsSingleBlock :: forall block. (ProtocolClient block, LedgerSupportsProtocol (ShelleyBlock (TPraos StandardCrypto) ShelleyEra)) => ProtocolClientInfoArgs block -> (NodeToClientVersion -> LocalNodeClientProtocolsForBlock block) -> LocalNodeClientParams 
LocalNodeClientParamsCardano :: forall block. (ProtocolClient block, CardanoHardForkConstraints (ConsensusCryptoForBlock block)) => ProtocolClientInfoArgs block -> (NodeToClientVersion -> LocalNodeClientProtocolsForBlock block) -> LocalNodeClientParams 

mkLocalNodeClientParams :: ConsensusModeParams -> (NodeToClientVersion -> LocalNodeClientProtocolsInMode) -> LocalNodeClientParams Source #

Convert from the mode-parametrised style to the block-parametrised style.

data LocalNodeClientProtocols block point tip slot tx txid txerr (query :: Type -> Type) (m :: Type -> Type) Source #

The protocols we can use with a local node. Use in conjunction with connectToLocalNode.

These protocols use the types from the rest of this API. The conversion to/from the types used by the underlying wire formats is handled by connectToLocalNode.

data LocalChainSyncClient block point tip (m :: Type -> Type) Source #

Modes

TODO move to Cardano.Api

data ConsensusModeParams where Source #

The consensus-mode-specific parameters needed to connect to a local node that is using each consensus mode.

It is in fact only the Byron era that requires extra parameters, but this is of course inherited by the CardanoMode that uses the Byron era. The reason this parameter is needed stems from unfortunate design decisions from the legacy Byron era. The slots per epoch are needed to be able to decode epoch boundary blocks from the Byron era.

It is possible in future that we may be able to eliminate this parameter by discovering it from the node during the initial handshake.

newtype EpochSlots Source #

The number of slots per epoch.

Constructors

EpochSlots 

Fields

Instances

Instances details
Data EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EpochSlots -> c EpochSlots Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EpochSlots Source #

toConstr :: EpochSlots -> Constr Source #

dataTypeOf :: EpochSlots -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EpochSlots) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EpochSlots) Source #

gmapT :: (forall b. Data b => b -> b) -> EpochSlots -> EpochSlots Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EpochSlots -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EpochSlots -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> EpochSlots -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> EpochSlots -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> EpochSlots -> m EpochSlots Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EpochSlots -> m EpochSlots Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EpochSlots -> m EpochSlots Source #

Generic EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Associated Types

type Rep EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

type Rep EpochSlots = D1 ('MetaData "EpochSlots" "Cardano.Chain.Slotting.EpochSlots" "cardano-ledger-byron-1.1.0.0-7fb551a04b7ebd202180a636c363fd4c69d431c37908920ba820fedd2c0d0ade" 'True) (C1 ('MetaCons "EpochSlots" 'PrefixI 'True) (S1 ('MetaSel ('Just "unEpochSlots") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))
Read EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Show EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

FromCBOR EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

ToCBOR EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

DecCBOR EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

EncCBOR EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Buildable EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

build :: EpochSlots -> Builder

Eq EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Ord EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

NoThunks EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

Methods

noThunks :: Context -> EpochSlots -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> EpochSlots -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy EpochSlots -> String #

type Rep EpochSlots 
Instance details

Defined in Cardano.Chain.Slotting.EpochSlots

type Rep EpochSlots = D1 ('MetaData "EpochSlots" "Cardano.Chain.Slotting.EpochSlots" "cardano-ledger-byron-1.1.0.0-7fb551a04b7ebd202180a636c363fd4c69d431c37908920ba820fedd2c0d0ade" 'True) (C1 ('MetaCons "EpochSlots" 'PrefixI 'True) (S1 ('MetaSel ('Just "unEpochSlots") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

Chain sync protocol

newtype ChainSyncClient header point tip (m :: Type -> Type) a Source #

A chain sync protocol client, on top of some effect m. The first choice of request is within that m.

Constructors

ChainSyncClient 

Fields

newtype ChainSyncClientPipelined header point tip (m :: Type -> Type) a Source #

Pipelined chain sync client. It can only pipeline MsgRequestNext messages, while the MsgFindIntersect are non pipelined. This has a penalty cost of an RTT, but they are sent relatively seldom and their response might impact how many messages one would like to pipeline. It also simplifies the receiver callback.

Constructors

ChainSyncClientPipelined 

Fields

data BlockInMode where Source #

A Block in one of the eras. TODO Rename this to BlockInEra

Constructors

BlockInMode :: forall era. CardanoEra era -> Block era -> BlockInMode 

Instances

Instances details
Show BlockInMode Source # 
Instance details

Defined in Cardano.Api.Internal.Block

Local tx submission

newtype LocalTxSubmissionClient tx reject (m :: Type -> Type) a Source #

data TxInMode where Source #

A Tx in one of the eras supported by a given protocol mode.

For multi-era modes such as the CardanoMode this type is a sum of the different transaction types for all the eras. It is used in the LocalTxSubmission protocol.

Constructors

TxInMode :: forall era. ShelleyBasedEra era -> Tx era -> TxInMode

Shelley based transactions.

TxInByronSpecial :: GenTx ByronBlock -> TxInMode

Legacy Byron transactions and things we can post to the chain which are not actually transactions. This covers: update proposals, votes and delegation certs.

Instances

Instances details
Show TxInMode Source # 
Instance details

Defined in Cardano.Api.Internal.InMode

data TxValidationError era Source #

The transaction validations errors that can occur from trying to submit a transaction to a local node. The errors are specific to an era.

Instances

Instances details
ToJSON (TxValidationError era) Source # 
Instance details

Defined in Cardano.Api.Internal.InMode

Methods

toJSON :: TxValidationError era -> Value

toEncoding :: TxValidationError era -> Encoding

toJSONList :: [TxValidationError era] -> Value

toEncodingList :: [TxValidationError era] -> Encoding

omitField :: TxValidationError era -> Bool

Generic (TxValidationError era) Source # 
Instance details

Defined in Cardano.Api.Internal.InMode

Associated Types

type Rep (TxValidationError era) 
Instance details

Defined in Cardano.Api.Internal.InMode

type Rep (TxValidationError era) = D1 ('MetaData "TxValidationError" "Cardano.Api.Internal.InMode" "cardano-api-10.15.0.0-inplace" 'False) (C1 ('MetaCons "ByronTxValidationError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ApplyTxErr ByronBlock))) :+: C1 ('MetaCons "ShelleyTxValidationError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ShelleyBasedEra era)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ApplyTxErr (ShelleyBlock (ConsensusProtocol era) (ShelleyLedgerEra era))))))
Show (TxValidationError era) Source # 
Instance details

Defined in Cardano.Api.Internal.InMode

type Rep (TxValidationError era) Source # 
Instance details

Defined in Cardano.Api.Internal.InMode

type Rep (TxValidationError era) = D1 ('MetaData "TxValidationError" "Cardano.Api.Internal.InMode" "cardano-api-10.15.0.0-inplace" 'False) (C1 ('MetaCons "ByronTxValidationError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ApplyTxErr ByronBlock))) :+: C1 ('MetaCons "ShelleyTxValidationError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ShelleyBasedEra era)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ApplyTxErr (ShelleyBlock (ConsensusProtocol era) (ShelleyLedgerEra era))))))

data SubmitResult reason Source #

Isomorphic with Maybe but with a name that better describes its purpose and usage.

Constructors

SubmitSuccess 
SubmitFail reason 

Instances

Instances details
Functor SubmitResult 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxSubmission.Type

Methods

fmap :: (a -> b) -> SubmitResult a -> SubmitResult b Source #

(<$) :: a -> SubmitResult b -> SubmitResult a Source #

Eq reason => Eq (SubmitResult reason) 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxSubmission.Type

Methods

(==) :: SubmitResult reason -> SubmitResult reason -> Bool Source #

(/=) :: SubmitResult reason -> SubmitResult reason -> Bool Source #

Local state query

newtype LocalStateQueryClient block point (query :: Type -> Type) (m :: Type -> Type) a Source #

Constructors

LocalStateQueryClient 

Fields

data AcquiringFailure Source #

Establish a connection to a node and execute a single query using the local state query protocol.

data QueryInEra era result where Source #

Constructors

QueryByronUpdateState :: QueryInEra ByronEra ByronUpdateState 
QueryInShelleyBasedEra :: forall era result. ShelleyBasedEra era -> QueryInShelleyBasedEra era result -> QueryInEra era result 

Instances

Instances details
Show (QueryInEra era result) Source # 
Instance details

Defined in Cardano.Api.Internal.Query

Methods

showsPrec :: Int -> QueryInEra era result -> ShowS Source #

show :: QueryInEra era result -> String Source #

showList :: [QueryInEra era result] -> ShowS Source #

data QueryInShelleyBasedEra era result where Source #

Constructors

QueryEpoch :: forall era. QueryInShelleyBasedEra era EpochNo 
QueryGenesisParameters :: forall era. QueryInShelleyBasedEra era (GenesisParameters ShelleyEra) 
QueryProtocolParameters :: forall era. QueryInShelleyBasedEra era (PParams (ShelleyLedgerEra era)) 
QueryStakeDistribution :: forall era. QueryInShelleyBasedEra era (Map (Hash StakePoolKey) Rational) 
QueryUTxO :: forall era. QueryUTxOFilter -> QueryInShelleyBasedEra era (UTxO era) 
QueryStakeAddresses :: forall era. Set StakeCredential -> NetworkId -> QueryInShelleyBasedEra era (Map StakeAddress Coin, Map StakeAddress PoolId) 
QueryStakePools :: forall era. QueryInShelleyBasedEra era (Set PoolId) 
QueryStakePoolParameters :: forall era. Set PoolId -> QueryInShelleyBasedEra era (Map PoolId StakePoolParameters) 
QueryDebugLedgerState :: forall era. QueryInShelleyBasedEra era (SerialisedDebugLedgerState era) 
QueryProtocolState :: forall era. QueryInShelleyBasedEra era (ProtocolState era) 
QueryCurrentEpochState :: forall era. QueryInShelleyBasedEra era (SerialisedCurrentEpochState era) 
QueryPoolState :: forall era. Maybe (Set PoolId) -> QueryInShelleyBasedEra era (SerialisedPoolState era) 
QueryPoolDistribution :: forall era. Maybe (Set PoolId) -> QueryInShelleyBasedEra era (SerialisedPoolDistribution era) 
QueryStakeSnapshot :: forall era. Maybe (Set PoolId) -> QueryInShelleyBasedEra era (SerialisedStakeSnapshots era) 
QueryStakeDelegDeposits :: forall era. Set StakeCredential -> QueryInShelleyBasedEra era (Map StakeCredential Coin) 
QueryAccountState :: forall era. QueryInShelleyBasedEra era AccountState 
QueryConstitution :: forall era. QueryInShelleyBasedEra era (Constitution (ShelleyLedgerEra era)) 
QueryGovState :: forall era. QueryInShelleyBasedEra era (GovState (ShelleyLedgerEra era)) 
QueryRatifyState :: forall era. QueryInShelleyBasedEra era (RatifyState (ShelleyLedgerEra era)) 
QueryFuturePParams :: forall era. QueryInShelleyBasedEra era (Maybe (PParams (ShelleyLedgerEra era))) 
QueryDRepState :: forall era. Set (Credential 'DRepRole) -> QueryInShelleyBasedEra era (Map (Credential 'DRepRole) DRepState) 
QueryDRepStakeDistr :: forall era. Set DRep -> QueryInShelleyBasedEra era (Map DRep Coin) 
QuerySPOStakeDistr :: forall era. Set (KeyHash 'StakePool) -> QueryInShelleyBasedEra era (Map (KeyHash 'StakePool) Coin) 
QueryCommitteeMembersState :: forall era. Set (Credential 'ColdCommitteeRole) -> Set (Credential 'HotCommitteeRole) -> Set MemberStatus -> QueryInShelleyBasedEra era CommitteeMembersState 
QueryStakeVoteDelegatees :: forall era. Set StakeCredential -> QueryInShelleyBasedEra era (Map StakeCredential DRep) 
QueryProposals :: forall era. Set GovActionId -> QueryInShelleyBasedEra era (Seq (GovActionState (ShelleyLedgerEra era))) 
QueryLedgerPeerSnapshot :: forall era. QueryInShelleyBasedEra era (Serialised LedgerPeerSnapshot) 
QueryStakePoolDefaultVote :: forall era. KeyHash 'StakePool -> QueryInShelleyBasedEra era DefaultVote 

Instances

Instances details
Show (QueryInShelleyBasedEra era result) Source # 
Instance details

Defined in Cardano.Api.Internal.Query

Local tx monitoring

newtype LocalTxMonitorClient txid tx slot (m :: Type -> Type) a Source #

A tx monitor client, on top of some effect m.

Constructors

LocalTxMonitorClient 

Fields

data LocalTxMonitoringQuery Source #

Constructors

LocalTxMonitoringQueryTx TxIdInMode

Query if a particular tx exists in the mempool. Note that, the absence of a transaction does not imply anything about how the transaction was processed: it may have been dropped, or inserted in a block.

LocalTxMonitoringSendNextTx

The mempool is modeled as an ordered list of transactions and thus, can be traversed linearly. LocalTxMonitoringSendNextTx requests the next transaction from the current list. This must be a transaction that was not previously sent to the client for this particular snapshot.

LocalTxMonitoringMempoolInformation

Ask the server about the current mempool's capacity and sizes. This is fixed in a given snapshot.

data LocalTxMonitoringResult Source #

Constructors

LocalTxMonitoringTxExists TxId SlotNo

Slot number at which the mempool snapshot was taken

LocalTxMonitoringTxDoesNotExist TxId SlotNo

Slot number at which the mempool snapshot was taken

LocalTxMonitoringNextTx (Maybe TxInMode) SlotNo

Slot number at which the mempool snapshot was taken

LocalTxMonitoringMempoolSizeAndCapacity MempoolSizeAndCapacity SlotNo

Slot number at which the mempool snapshot was taken

data MempoolSizeAndCapacity Source #

Describes the MemPool sizes and capacity for a given snapshot.

Constructors

MempoolSizeAndCapacity 

Fields

  • capacityInBytes :: !Word32

    The maximum capacity of the mempool. Note that this may dynamically change when the ledger state is updated.

  • sizeInBytes :: !Word32

    The summed byte size of all the transactions in the mempool.

  • numberOfTxs :: !Word32

    The number of transactions in the mempool

Instances

Instances details
Generic MempoolSizeAndCapacity 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type

Associated Types

type Rep MempoolSizeAndCapacity 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type

type Rep MempoolSizeAndCapacity = D1 ('MetaData "MempoolSizeAndCapacity" "Ouroboros.Network.Protocol.LocalTxMonitor.Type" "ouroboros-network-protocols-0.14.0.0-6da35fbc0b561ecbae05b98d95c7533cc16547611a057c0d8f3f9c6a8290c3ee" 'False) (C1 ('MetaCons "MempoolSizeAndCapacity" 'PrefixI 'True) (S1 ('MetaSel ('Just "capacityInBytes") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "sizeInBytes") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word32) :*: S1 ('MetaSel ('Just "numberOfTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word32))))
Show MempoolSizeAndCapacity 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type

NFData MempoolSizeAndCapacity 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type

Eq MempoolSizeAndCapacity 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type

type Rep MempoolSizeAndCapacity 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type

type Rep MempoolSizeAndCapacity = D1 ('MetaData "MempoolSizeAndCapacity" "Ouroboros.Network.Protocol.LocalTxMonitor.Type" "ouroboros-network-protocols-0.14.0.0-6da35fbc0b561ecbae05b98d95c7533cc16547611a057c0d8f3f9c6a8290c3ee" 'False) (C1 ('MetaCons "MempoolSizeAndCapacity" 'PrefixI 'True) (S1 ('MetaSel ('Just "capacityInBytes") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word32) :*: (S1 ('MetaSel ('Just "sizeInBytes") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word32) :*: S1 ('MetaSel ('Just "numberOfTxs") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word32))))

data EraHistory where Source #

Constructors

EraHistory :: forall (xs :: [Type]). CardanoBlock StandardCrypto ~ HardForkBlock xs => Interpreter xs -> EraHistory 

Instances

Instances details
HasTypeProxy EraHistory Source # 
Instance details

Defined in Cardano.Api.Internal.Query

Associated Types

data AsType EraHistory 
Instance details

Defined in Cardano.Api.Internal.Query

SerialiseAsCBOR EraHistory Source # 
Instance details

Defined in Cardano.Api.Internal.Query

HasTextEnvelope EraHistory Source #

The HasTextEnvelope instance for EraHistory is required by the transaction calculate-plutus-script-cost command in cartdano-cli and it can be obtained through the query era-history@ command.

Instance details

Defined in Cardano.Api.Internal.Query

data AsType EraHistory Source # 
Instance details

Defined in Cardano.Api.Internal.Query

Common queries

Helpers

data NodeToClientVersion Source #

Enumeration of node to client protocol versions.

Constructors

NodeToClientV_16

NodeToClientV_10 -- ^ added GetChainBlockNo and GetChainPoint queries | NodeToClientV_11 -- ^ added GetRewardInfoPools Block query | NodeToClientV_12 -- ^ added LocalTxMonitor mini-protocol | NodeToClientV_13 -- ^ enabled CardanoNodeToClientVersion9, i.e., Babbage | NodeToClientV_14 -- ^ added GetPoolDistr, GetPoolState, GetSnapshots | NodeToClientV_15 -- ^ added query to NodeToClientVersionData

NodeToClientV_17

added GetProposals and GetRatifyState queries

NodeToClientV_18

added GetFuturePParams query

NodeToClientV_19

added GetLedgerPeerSnapshot

NodeToClientV_20

added QueryStakePoolDefaultVote, added MsgGetMeasures / MsgReplyGetMeasures to LocalTxMonitor

Instances

Instances details
Bounded NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

Enum NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

Generic NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

Associated Types

type Rep NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

type Rep NodeToClientVersion = D1 ('MetaData "NodeToClientVersion" "Ouroboros.Network.NodeToClient.Version" "ouroboros-network-api-0.13.0.0-8280e54c003c7ca0e1e162886b133a2c335a080e3ea7bd5274be948b7ae79602" 'False) ((C1 ('MetaCons "NodeToClientV_16" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToClientV_17" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NodeToClientV_18" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NodeToClientV_19" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToClientV_20" 'PrefixI 'False) (U1 :: Type -> Type))))
Show NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

NFData NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

Eq NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

Ord NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

MonadReader NodeToClientVersion (LocalStateQueryExpr block point query r m) Source # 
Instance details

Defined in Cardano.Api.Internal.IPC.Monad

Methods

ask :: LocalStateQueryExpr block point query r m NodeToClientVersion Source #

local :: (NodeToClientVersion -> NodeToClientVersion) -> LocalStateQueryExpr block point query r m a -> LocalStateQueryExpr block point query r m a Source #

reader :: (NodeToClientVersion -> a) -> LocalStateQueryExpr block point query r m a Source #

type Rep NodeToClientVersion 
Instance details

Defined in Ouroboros.Network.NodeToClient.Version

type Rep NodeToClientVersion = D1 ('MetaData "NodeToClientVersion" "Ouroboros.Network.NodeToClient.Version" "ouroboros-network-api-0.13.0.0-8280e54c003c7ca0e1e162886b133a2c335a080e3ea7bd5274be948b7ae79602" 'False) ((C1 ('MetaCons "NodeToClientV_16" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToClientV_17" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "NodeToClientV_18" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "NodeToClientV_19" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NodeToClientV_20" 'PrefixI 'False) (U1 :: Type -> Type))))