Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- connectToLocalNode :: MonadIO m => LocalNodeConnectInfo -> LocalNodeClientProtocolsInMode -> m ()
- connectToLocalNodeWithVersion :: MonadIO m => LocalNodeConnectInfo -> (NodeToClientVersion -> LocalNodeClientProtocolsInMode) -> m ()
- data LocalNodeConnectInfo = LocalNodeConnectInfo {}
- data LocalNodeClientParams where
- 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
- data LocalNodeClientProtocols block point tip slot tx txid txerr (query :: Type -> Type) (m :: Type -> Type) = LocalNodeClientProtocols {
- localChainSyncClient :: LocalChainSyncClient block point tip m
- localTxSubmissionClient :: Maybe (LocalTxSubmissionClient tx txerr m ())
- localStateQueryClient :: Maybe (LocalStateQueryClient block point query m ())
- localTxMonitoringClient :: Maybe (LocalTxMonitorClient txid tx slot m ())
- data LocalChainSyncClient block point tip (m :: Type -> Type)
- = NoLocalChainSyncClient
- | LocalChainSyncClientPipelined (ChainSyncClientPipelined block point tip m ())
- | LocalChainSyncClient (ChainSyncClient block point tip m ())
- type LocalNodeClientProtocolsInMode = LocalNodeClientProtocols BlockInMode ChainPoint ChainTip SlotNo TxInMode TxIdInMode TxValidationErrorInCardanoMode QueryInMode IO
- data ConsensusModeParams where
- newtype EpochSlots = EpochSlots {}
- newtype ChainSyncClient header point tip (m :: Type -> Type) a = ChainSyncClient {
- runChainSyncClient :: m (ClientStIdle header point tip m a)
- newtype ChainSyncClientPipelined header point tip (m :: Type -> Type) a = ChainSyncClientPipelined {
- runChainSyncClientPipelined :: m (ClientPipelinedStIdle 'Z header point tip m a)
- data BlockInMode where
- BlockInMode :: forall era. CardanoEra era -> Block era -> BlockInMode
- newtype LocalTxSubmissionClient tx reject (m :: Type -> Type) a = LocalTxSubmissionClient {
- runLocalTxSubmissionClient :: m (LocalTxClientStIdle tx reject m a)
- data TxInMode where
- TxInMode :: forall era. ShelleyBasedEra era -> Tx era -> TxInMode
- TxInByronSpecial :: GenTx ByronBlock -> TxInMode
- data TxValidationErrorInCardanoMode
- data TxValidationError era
- submitTxToNodeLocal :: MonadIO m => LocalNodeConnectInfo -> TxInMode -> m (SubmitResult TxValidationErrorInCardanoMode)
- data SubmitResult reason
- = SubmitSuccess
- | SubmitFail reason
- newtype LocalStateQueryClient block point (query :: Type -> Type) (m :: Type -> Type) a = LocalStateQueryClient {
- runLocalStateQueryClient :: m (ClientStIdle block point query m a)
- data AcquiringFailure
- data QueryInMode result where
- QueryCurrentEra :: QueryInMode AnyCardanoEra
- QueryInEra :: forall era result1. QueryInEra era result1 -> QueryInMode (Either EraMismatch result1)
- QueryEraHistory :: QueryInMode EraHistory
- QuerySystemStart :: QueryInMode SystemStart
- QueryChainBlockNo :: QueryInMode (WithOrigin BlockNo)
- QueryChainPoint :: QueryInMode ChainPoint
- QueryLedgerConfig :: QueryInMode (HardForkLedgerConfig (CardanoEras StandardCrypto))
- data QueryInEra era result where
- QueryByronUpdateState :: QueryInEra ByronEra ByronUpdateState
- QueryInShelleyBasedEra :: forall era result. ShelleyBasedEra era -> QueryInShelleyBasedEra era result -> QueryInEra era result
- data QueryInShelleyBasedEra era result where
- 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
- queryNodeLocalState :: LocalNodeConnectInfo -> Target ChainPoint -> QueryInMode result -> ExceptT AcquiringFailure IO result
- newtype LocalTxMonitorClient txid tx slot (m :: Type -> Type) a = LocalTxMonitorClient {
- runLocalTxMonitorClient :: m (ClientStIdle txid tx slot m a)
- data LocalTxMonitoringQuery
- data LocalTxMonitoringResult
- data MempoolSizeAndCapacity = MempoolSizeAndCapacity {
- capacityInBytes :: !Word32
- sizeInBytes :: !Word32
- numberOfTxs :: !Word32
- queryTxMonitoringLocal :: MonadIO m => LocalNodeConnectInfo -> LocalTxMonitoringQuery -> m LocalTxMonitoringResult
- data EraHistory where
- EraHistory :: forall (xs :: [Type]). CardanoBlock StandardCrypto ~ HardForkBlock xs => Interpreter xs -> EraHistory
- getProgress :: SlotNo -> EraHistory -> Either PastHorizonException (RelativeTime, SlotLength)
- getLocalChainTip :: MonadIO m => LocalNodeConnectInfo -> m ChainTip
- toAcquiringFailure :: AcquireFailure -> AcquiringFailure
- data NodeToClientVersion
- data UnsupportedNtcVersionError = UnsupportedNtcVersionError !NodeToClientVersion ![NodeToClientVersion]
Examples
This section provides two examples:
- Querying the node to obtain basic information
- 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 theshelley-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 theQueryGenesisParameters
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 thenetworkMagic
key in theshelley-genesis.json
file that the node uses to connect to the network. For the preview network, the current identifier is2
. - 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 thedb
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 LocalNodeConnectInfo Source #
Constructors
LocalNodeConnectInfo | |
Instances
Show LocalNodeConnectInfo Source # | |
Defined in Cardano.Api.Internal.IPC |
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
.
Constructors
LocalNodeClientProtocols | |
Fields
|
data LocalChainSyncClient block point tip (m :: Type -> Type) Source #
Constructors
NoLocalChainSyncClient | |
LocalChainSyncClientPipelined (ChainSyncClientPipelined block point tip m ()) | |
LocalChainSyncClient (ChainSyncClient block point tip m ()) |
type LocalNodeClientProtocolsInMode = LocalNodeClientProtocols BlockInMode ChainPoint ChainTip SlotNo TxInMode TxIdInMode TxValidationErrorInCardanoMode QueryInMode IO 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.
Constructors
CardanoModeParams :: EpochSlots -> ConsensusModeParams |
Instances
Show ConsensusModeParams Source # | |
Defined in Cardano.Api.Internal.Modes |
newtype EpochSlots Source #
The number of slots per epoch.
Constructors
EpochSlots | |
Fields |
Instances
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
Show BlockInMode Source # | |
Defined in Cardano.Api.Internal.Block |
Local tx submission
newtype LocalTxSubmissionClient tx reject (m :: Type -> Type) a Source #
Constructors
LocalTxSubmissionClient | |
Fields
|
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. |
data TxValidationErrorInCardanoMode Source #
A TxValidationError
in one of the eras supported by a given protocol
mode.
This is used in the LocalStateQuery protocol.
Instances
ToJSON TxValidationErrorInCardanoMode Source # | |
Defined in Cardano.Api.Internal.InMode Methods toJSON :: TxValidationErrorInCardanoMode -> Value toEncoding :: TxValidationErrorInCardanoMode -> Encoding toJSONList :: [TxValidationErrorInCardanoMode] -> Value toEncodingList :: [TxValidationErrorInCardanoMode] -> Encoding | |
Show TxValidationErrorInCardanoMode Source # | |
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
ToJSON (TxValidationError era) Source # | |||||
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 # | |||||
Defined in Cardano.Api.Internal.InMode Associated Types
Methods from :: TxValidationError era -> Rep (TxValidationError era) x Source # to :: Rep (TxValidationError era) x -> TxValidationError era Source # | |||||
Show (TxValidationError era) Source # | |||||
Defined in Cardano.Api.Internal.InMode | |||||
type Rep (TxValidationError era) Source # | |||||
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)))))) |
submitTxToNodeLocal :: MonadIO m => LocalNodeConnectInfo -> TxInMode -> m (SubmitResult TxValidationErrorInCardanoMode) Source #
data SubmitResult reason Source #
Isomorphic with Maybe but with a name that better describes its purpose and usage.
Constructors
SubmitSuccess | |
SubmitFail reason |
Instances
Functor SubmitResult | |
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) | |
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.
Constructors
AFPointTooOld | |
AFPointNotOnChain |
Instances
Show AcquiringFailure Source # | |
Defined in Cardano.Api.Internal.IPC | |
Eq AcquiringFailure Source # | |
Defined in Cardano.Api.Internal.IPC Methods (==) :: AcquiringFailure -> AcquiringFailure -> Bool Source # (/=) :: AcquiringFailure -> AcquiringFailure -> Bool Source # |
data QueryInMode result where Source #
Constructors
QueryCurrentEra :: QueryInMode AnyCardanoEra | |
QueryInEra :: forall era result1. QueryInEra era result1 -> QueryInMode (Either EraMismatch result1) | |
QueryEraHistory :: QueryInMode EraHistory | |
QuerySystemStart :: QueryInMode SystemStart | |
QueryChainBlockNo :: QueryInMode (WithOrigin BlockNo) | |
QueryChainPoint :: QueryInMode ChainPoint | |
QueryLedgerConfig :: QueryInMode (HardForkLedgerConfig (CardanoEras StandardCrypto)) |
Instances
Show (QueryInMode result) Source # | |
Defined in Cardano.Api.Internal.Query |
data QueryInEra era result where Source #
Constructors
QueryByronUpdateState :: QueryInEra ByronEra ByronUpdateState | |
QueryInShelleyBasedEra :: forall era result. ShelleyBasedEra era -> QueryInShelleyBasedEra era result -> QueryInEra era result |
Instances
Show (QueryInEra era result) Source # | |
Defined in Cardano.Api.Internal.Query |
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
Show (QueryInShelleyBasedEra era result) Source # | |
Defined in Cardano.Api.Internal.Query |
queryNodeLocalState :: LocalNodeConnectInfo -> Target ChainPoint -> QueryInMode result -> ExceptT AcquiringFailure IO result Source #
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. |
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 |
Instances
ToJSON LocalTxMonitoringResult Source # | |
Defined in Cardano.Api.Internal.IPC Methods toJSON :: LocalTxMonitoringResult -> Value toEncoding :: LocalTxMonitoringResult -> Encoding toJSONList :: [LocalTxMonitoringResult] -> Value toEncodingList :: [LocalTxMonitoringResult] -> Encoding |
data MempoolSizeAndCapacity Source #
Describes the MemPool sizes and capacity for a given snapshot.
Constructors
MempoolSizeAndCapacity | |
Fields
|
Instances
Generic MempoolSizeAndCapacity | |||||
Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type Associated Types
Methods from :: MempoolSizeAndCapacity -> Rep MempoolSizeAndCapacity x Source # to :: Rep MempoolSizeAndCapacity x -> MempoolSizeAndCapacity Source # | |||||
Show MempoolSizeAndCapacity | |||||
NFData MempoolSizeAndCapacity | |||||
Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type Methods rnf :: MempoolSizeAndCapacity -> () Source # | |||||
Eq MempoolSizeAndCapacity | |||||
Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type Methods (==) :: MempoolSizeAndCapacity -> MempoolSizeAndCapacity -> Bool Source # (/=) :: MempoolSizeAndCapacity -> MempoolSizeAndCapacity -> Bool Source # | |||||
type Rep MempoolSizeAndCapacity | |||||
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)))) |
queryTxMonitoringLocal :: MonadIO m => LocalNodeConnectInfo -> LocalTxMonitoringQuery -> m LocalTxMonitoringResult Source #
data EraHistory where Source #
Constructors
EraHistory :: forall (xs :: [Type]). CardanoBlock StandardCrypto ~ HardForkBlock xs => Interpreter xs -> EraHistory |
Instances
HasTypeProxy EraHistory Source # | |||||
Defined in Cardano.Api.Internal.Query Associated Types
Methods proxyToAsType :: Proxy EraHistory -> AsType EraHistory Source # | |||||
SerialiseAsCBOR EraHistory Source # | |||||
Defined in Cardano.Api.Internal.Query Methods serialiseToCBOR :: EraHistory -> ByteString Source # deserialiseFromCBOR :: AsType EraHistory -> ByteString -> Either DecoderError EraHistory Source # | |||||
HasTextEnvelope EraHistory Source # | The | ||||
Defined in Cardano.Api.Internal.Query | |||||
data AsType EraHistory Source # | |||||
Defined in Cardano.Api.Internal.Query |
getProgress :: SlotNo -> EraHistory -> Either PastHorizonException (RelativeTime, SlotLength) Source #
Common queries
getLocalChainTip :: MonadIO m => LocalNodeConnectInfo -> m ChainTip Source #
Helpers
data NodeToClientVersion Source #
Enumeration of node to client protocol versions.
Constructors
NodeToClientV_16 | NodeToClientV_10
-- ^ added |
NodeToClientV_17 | added |
NodeToClientV_18 | added |
NodeToClientV_19 | added |
NodeToClientV_20 | added |
Instances
Bounded NodeToClientVersion | |||||
Defined in Ouroboros.Network.NodeToClient.Version | |||||
Enum NodeToClientVersion | |||||
Defined in Ouroboros.Network.NodeToClient.Version Methods succ :: NodeToClientVersion -> NodeToClientVersion Source # pred :: NodeToClientVersion -> NodeToClientVersion Source # toEnum :: Int -> NodeToClientVersion Source # fromEnum :: NodeToClientVersion -> Int Source # enumFrom :: NodeToClientVersion -> [NodeToClientVersion] Source # enumFromThen :: NodeToClientVersion -> NodeToClientVersion -> [NodeToClientVersion] Source # enumFromTo :: NodeToClientVersion -> NodeToClientVersion -> [NodeToClientVersion] Source # enumFromThenTo :: NodeToClientVersion -> NodeToClientVersion -> NodeToClientVersion -> [NodeToClientVersion] Source # | |||||
Generic NodeToClientVersion | |||||
Defined in Ouroboros.Network.NodeToClient.Version Associated Types
Methods from :: NodeToClientVersion -> Rep NodeToClientVersion x Source # to :: Rep NodeToClientVersion x -> NodeToClientVersion Source # | |||||
Show NodeToClientVersion | |||||
Defined in Ouroboros.Network.NodeToClient.Version | |||||
NFData NodeToClientVersion | |||||
Defined in Ouroboros.Network.NodeToClient.Version Methods rnf :: NodeToClientVersion -> () Source # | |||||
Eq NodeToClientVersion | |||||
Defined in Ouroboros.Network.NodeToClient.Version Methods (==) :: NodeToClientVersion -> NodeToClientVersion -> Bool Source # (/=) :: NodeToClientVersion -> NodeToClientVersion -> Bool Source # | |||||
Ord NodeToClientVersion | |||||
Defined in Ouroboros.Network.NodeToClient.Version Methods compare :: NodeToClientVersion -> NodeToClientVersion -> Ordering Source # (<) :: NodeToClientVersion -> NodeToClientVersion -> Bool Source # (<=) :: NodeToClientVersion -> NodeToClientVersion -> Bool Source # (>) :: NodeToClientVersion -> NodeToClientVersion -> Bool Source # (>=) :: NodeToClientVersion -> NodeToClientVersion -> Bool Source # max :: NodeToClientVersion -> NodeToClientVersion -> NodeToClientVersion Source # min :: NodeToClientVersion -> NodeToClientVersion -> NodeToClientVersion Source # | |||||
MonadReader NodeToClientVersion (LocalStateQueryExpr block point query r m) Source # | |||||
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 | |||||
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)))) |
data UnsupportedNtcVersionError Source #
Constructors
UnsupportedNtcVersionError | |
Fields
|
Instances
Show UnsupportedNtcVersionError Source # | |
Defined in Cardano.Api.Internal.IPC.Version | |
Eq UnsupportedNtcVersionError Source # | |
Defined in Cardano.Api.Internal.IPC.Version Methods (==) :: UnsupportedNtcVersionError -> UnsupportedNtcVersionError -> Bool Source # (/=) :: UnsupportedNtcVersionError -> UnsupportedNtcVersionError -> Bool Source # |