Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Cardano.Api.IPC
Description
Node IPC protocols
Synopsis
- connectToLocalNode ∷ LocalNodeConnectInfo mode → LocalNodeClientProtocolsInMode mode → IO ()
- connectToLocalNodeWithVersion ∷ LocalNodeConnectInfo mode → (NodeToClientVersion → LocalNodeClientProtocolsInMode mode) → IO ()
- data LocalNodeConnectInfo mode = LocalNodeConnectInfo {}
- localConsensusMode ∷ LocalNodeConnectInfo mode → ConsensusMode mode
- data LocalNodeClientParams where
- LocalNodeClientParamsSingleBlock ∷ (ProtocolClient block, LedgerSupportsProtocol (ShelleyBlock (TPraos StandardCrypto) (ShelleyEra StandardCrypto))) ⇒ ProtocolClientInfoArgs block → (NodeToClientVersion → LocalNodeClientProtocolsForBlock block) → LocalNodeClientParams
- LocalNodeClientParamsCardano ∷ (ProtocolClient block, CardanoHardForkConstraints (ConsensusCryptoForBlock block)) ⇒ ProtocolClientInfoArgs block → (NodeToClientVersion → LocalNodeClientProtocolsForBlock block) → LocalNodeClientParams
- mkLocalNodeClientParams ∷ ∀ mode block. ConsensusBlockForMode mode ~ block ⇒ ConsensusModeParams mode → (NodeToClientVersion → LocalNodeClientProtocolsInMode mode) → LocalNodeClientParams
- data LocalNodeClientProtocols block point tip slot tx txid txerr query m = 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
- = NoLocalChainSyncClient
- | LocalChainSyncClientPipelined (ChainSyncClientPipelined block point tip m ())
- | LocalChainSyncClient (ChainSyncClient block point tip m ())
- type LocalNodeClientProtocolsInMode mode = LocalNodeClientProtocols (BlockInMode mode) ChainPoint ChainTip SlotNo (TxInMode mode) (TxIdInMode mode) (TxValidationErrorInMode mode) (QueryInMode mode) IO
- data ByronMode
- data ShelleyMode
- data CardanoMode
- data ConsensusModeParams mode 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 LiftedRep) a = ChainSyncClientPipelined {
- runChainSyncClientPipelined ∷ m (ClientPipelinedStIdle 'Z header point tip m a)
- data BlockInMode mode where
- BlockInMode ∷ IsCardanoEra era ⇒ Block era → EraInMode era mode → BlockInMode mode
- newtype LocalTxSubmissionClient tx reject (m ∷ Type → Type) a = LocalTxSubmissionClient {
- runLocalTxSubmissionClient ∷ m (LocalTxClientStIdle tx reject m a)
- data TxInMode mode where
- data TxValidationErrorInMode mode where
- TxValidationErrorInMode ∷ TxValidationError era → EraInMode era mode → TxValidationErrorInMode mode
- TxValidationEraMismatch ∷ EraMismatch → TxValidationErrorInMode mode
- data TxValidationError era
- submitTxToNodeLocal ∷ ∀ mode. LocalNodeConnectInfo mode → TxInMode mode → IO (SubmitResult (TxValidationErrorInMode mode))
- 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 mode result where
- QueryCurrentEra ∷ ConsensusModeIsMultiEra mode → QueryInMode mode AnyCardanoEra
- QueryInEra ∷ EraInMode era mode → QueryInEra era result → QueryInMode mode (Either EraMismatch result)
- QueryEraHistory ∷ ConsensusModeIsMultiEra mode → QueryInMode mode (EraHistory mode)
- QuerySystemStart ∷ QueryInMode mode SystemStart
- QueryChainBlockNo ∷ QueryInMode mode (WithOrigin BlockNo)
- QueryChainPoint ∷ ConsensusMode mode → QueryInMode mode ChainPoint
- data QueryInEra era result where
- QueryByronUpdateState ∷ QueryInEra ByronEra ByronUpdateState
- QueryInShelleyBasedEra ∷ ShelleyBasedEra era → QueryInShelleyBasedEra era result → QueryInEra era result
- data QueryInShelleyBasedEra era result where
- QueryEpoch ∷ QueryInShelleyBasedEra era EpochNo
- QueryGenesisParameters ∷ QueryInShelleyBasedEra era GenesisParameters
- QueryProtocolParameters ∷ QueryInShelleyBasedEra era ProtocolParameters
- QueryProtocolParametersUpdate ∷ QueryInShelleyBasedEra era (Map (Hash GenesisKey) ProtocolParametersUpdate)
- QueryStakeDistribution ∷ QueryInShelleyBasedEra era (Map (Hash StakePoolKey) Rational)
- QueryUTxO ∷ QueryUTxOFilter → QueryInShelleyBasedEra era (UTxO era)
- QueryStakeAddresses ∷ Set StakeCredential → NetworkId → QueryInShelleyBasedEra era (Map StakeAddress Lovelace, Map StakeAddress PoolId)
- QueryStakePools ∷ QueryInShelleyBasedEra era (Set PoolId)
- QueryStakePoolParameters ∷ Set PoolId → QueryInShelleyBasedEra era (Map PoolId StakePoolParameters)
- QueryDebugLedgerState ∷ QueryInShelleyBasedEra era (SerialisedDebugLedgerState era)
- QueryProtocolState ∷ QueryInShelleyBasedEra era (ProtocolState era)
- QueryCurrentEpochState ∷ QueryInShelleyBasedEra era (SerialisedCurrentEpochState era)
- QueryPoolState ∷ Maybe (Set PoolId) → QueryInShelleyBasedEra era (SerialisedPoolState era)
- QueryPoolDistribution ∷ Maybe (Set PoolId) → QueryInShelleyBasedEra era (SerialisedPoolDistribution era)
- QueryStakeSnapshot ∷ Maybe (Set PoolId) → QueryInShelleyBasedEra era (SerialisedStakeSnapshots era)
- queryNodeLocalState ∷ ∀ mode result. LocalNodeConnectInfo mode → Maybe ChainPoint → QueryInMode mode result → IO (Either AcquiringFailure result)
- newtype LocalTxMonitorClient txid tx slot (m ∷ Type → Type) a = LocalTxMonitorClient {
- runLocalTxMonitorClient ∷ m (ClientStIdle txid tx slot m a)
- data LocalTxMonitoringQuery mode
- data LocalTxMonitoringResult mode
- data MempoolSizeAndCapacity = MempoolSizeAndCapacity {}
- queryTxMonitoringLocal ∷ ∀ mode. LocalNodeConnectInfo mode → LocalTxMonitoringQuery mode → IO (LocalTxMonitoringResult mode)
- data EraHistory mode where
- EraHistory ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → Interpreter xs → EraHistory mode
- getProgress ∷ SlotNo → EraHistory mode → Either PastHorizonException (RelativeTime, SlotLength)
- getLocalChainTip ∷ LocalNodeConnectInfo mode → IO ChainTip
- data ConsensusMode mode where
- consensusModeOnly ∷ ConsensusModeParams mode → ConsensusMode mode
- toAcquiringFailure ∷ AcquireFailure → AcquiringFailure
- data NodeToClientVersion
- data UnsupportedNtcVersionError = UnsupportedNtcVersionError !MinNodeToClientVersion !NodeToClientVersion
Node interaction
Operations that involve talking to a local Cardano node.
connectToLocalNode ∷ LocalNodeConnectInfo mode → LocalNodeClientProtocolsInMode mode → IO () Source #
Establish a connection to a local node and execute the given set of protocol handlers.
connectToLocalNodeWithVersion ∷ LocalNodeConnectInfo mode → (NodeToClientVersion → LocalNodeClientProtocolsInMode mode) → IO () 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 mode Source #
Constructors
LocalNodeConnectInfo | |
localConsensusMode ∷ LocalNodeConnectInfo mode → ConsensusMode mode Source #
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 ∷ (ProtocolClient block, LedgerSupportsProtocol (ShelleyBlock (TPraos StandardCrypto) (ShelleyEra StandardCrypto))) ⇒ ProtocolClientInfoArgs block → (NodeToClientVersion → LocalNodeClientProtocolsForBlock block) → LocalNodeClientParams | |
LocalNodeClientParamsCardano ∷ (ProtocolClient block, CardanoHardForkConstraints (ConsensusCryptoForBlock block)) ⇒ ProtocolClientInfoArgs block → (NodeToClientVersion → LocalNodeClientProtocolsForBlock block) → LocalNodeClientParams |
mkLocalNodeClientParams ∷ ∀ mode block. ConsensusBlockForMode mode ~ block ⇒ ConsensusModeParams mode → (NodeToClientVersion → LocalNodeClientProtocolsInMode mode) → LocalNodeClientParams Source #
Convert from the mode-parametrised style to the block-parametrised style.
data LocalNodeClientProtocols block point tip slot tx txid txerr query m 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 Source #
Constructors
NoLocalChainSyncClient | |
LocalChainSyncClientPipelined (ChainSyncClientPipelined block point tip m ()) | |
LocalChainSyncClient (ChainSyncClient block point tip m ()) |
type LocalNodeClientProtocolsInMode mode = LocalNodeClientProtocols (BlockInMode mode) ChainPoint ChainTip SlotNo (TxInMode mode) (TxIdInMode mode) (TxValidationErrorInMode mode) (QueryInMode mode) IO Source #
Modes
TODO move to Cardano.Api
The Byron-only consensus mode consists of only the Byron era.
This was used on the mainnet before the deployment of the multi-era
CardanoMode
. It is now of little practical use, though it illustrates
how a single-era consensus mode works. It may be sensible to remove this
at some stage.
data ShelleyMode Source #
The Shelley-only consensus mode consists of only the Shelley era.
This was used for the early Shelley testnets prior to the use of the
multi-era CardanoMode
. It is useful for setting up Shelley test networks
(e.g. for benchmarking) without having to go through the complication of the
hard fork from Byron to Shelley eras. It also shows how a single-era
consensus mode works. It may be replaced by other single-era modes in future.
Instances
FromJSON (EraInMode ShelleyEra ShelleyMode) Source # | |
Defined in Cardano.Api.Modes Methods parseJSON ∷ Value → Parser (EraInMode ShelleyEra ShelleyMode) # parseJSONList ∷ Value → Parser [EraInMode ShelleyEra ShelleyMode] # |
data CardanoMode Source #
The Cardano consensus mode consists of all the eras currently in use on
the Cardano mainnet. This is currently: the ByronEra
; ShelleyEra
,
AllegraEra
and MaryEra
, in that order.
This mode will be extended with new eras as the Cardano mainnet develops.
Instances
data ConsensusModeParams mode 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
ByronModeParams ∷ EpochSlots → ConsensusModeParams ByronMode | |
ShelleyModeParams ∷ ConsensusModeParams ShelleyMode | |
CardanoModeParams ∷ EpochSlots → ConsensusModeParams CardanoMode |
Instances
Show (ConsensusModeParams mode) Source # | |
Defined in Cardano.Api.Modes |
newtype EpochSlots #
Constructors
EpochSlots | |
Fields |
Instances
Chain sync protocol
newtype ChainSyncClient header point tip (m ∷ Type → Type) a #
Constructors
ChainSyncClient | |
Fields
|
newtype ChainSyncClientPipelined header point tip (m ∷ Type → TYPE LiftedRep) a #
Constructors
ChainSyncClientPipelined | |
Fields
|
data BlockInMode mode where Source #
A Block
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 block types for all the eras. It is used in the ChainSync protocol.
Constructors
BlockInMode ∷ IsCardanoEra era ⇒ Block era → EraInMode era mode → BlockInMode mode |
Instances
Show (BlockInMode mode) Source # | |
Defined in Cardano.Api.Block |
Local tx submission
newtype LocalTxSubmissionClient tx reject (m ∷ Type → Type) a #
Constructors
LocalTxSubmissionClient | |
Fields
|
data TxInMode mode 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 ∷ Tx era → EraInMode era mode → TxInMode mode | Everything we consider a normal transaction. |
TxInByronSpecial ∷ GenTx ByronBlock → EraInMode ByronEra mode → TxInMode mode | Byron has various things we can post to the chain which are not actually transactions. This covers: update proposals, votes and delegation certs. |
data TxValidationErrorInMode mode where Source #
A TxValidationError
in one of the eras supported by a given protocol
mode.
This is used in the LocalStateQuery protocol.
Constructors
TxValidationErrorInMode ∷ TxValidationError era → EraInMode era mode → TxValidationErrorInMode mode | |
TxValidationEraMismatch ∷ EraMismatch → TxValidationErrorInMode mode |
Instances
Show (TxValidationErrorInMode mode) Source # | |
Defined in Cardano.Api.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
Show (TxValidationError era) Source # | |
Defined in Cardano.Api.InMode |
submitTxToNodeLocal ∷ ∀ mode. LocalNodeConnectInfo mode → TxInMode mode → IO (SubmitResult (TxValidationErrorInMode mode)) Source #
data SubmitResult reason #
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 #
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.IPC | |
Eq AcquiringFailure Source # | |
Defined in Cardano.Api.IPC Methods |
data QueryInMode mode result where Source #
Constructors
QueryCurrentEra ∷ ConsensusModeIsMultiEra mode → QueryInMode mode AnyCardanoEra | |
QueryInEra ∷ EraInMode era mode → QueryInEra era result → QueryInMode mode (Either EraMismatch result) | |
QueryEraHistory ∷ ConsensusModeIsMultiEra mode → QueryInMode mode (EraHistory mode) | |
QuerySystemStart ∷ QueryInMode mode SystemStart | |
QueryChainBlockNo ∷ QueryInMode mode (WithOrigin BlockNo) | |
QueryChainPoint ∷ ConsensusMode mode → QueryInMode mode ChainPoint |
Instances
Show (QueryInMode mode result) Source # | |
Defined in Cardano.Api.Query | |
NodeToClientVersionOf (QueryInMode mode result) Source # | |
Defined in Cardano.Api.Query Methods nodeToClientVersionOf ∷ QueryInMode mode result → NodeToClientVersion Source # |
data QueryInEra era result where Source #
Constructors
QueryByronUpdateState ∷ QueryInEra ByronEra ByronUpdateState | |
QueryInShelleyBasedEra ∷ ShelleyBasedEra era → QueryInShelleyBasedEra era result → QueryInEra era result |
Instances
Show (QueryInEra era result) Source # | |
Defined in Cardano.Api.Query | |
NodeToClientVersionOf (QueryInEra era result) Source # | |
Defined in Cardano.Api.Query Methods nodeToClientVersionOf ∷ QueryInEra era result → NodeToClientVersion Source # |
data QueryInShelleyBasedEra era result where Source #
Constructors
Instances
Show (QueryInShelleyBasedEra era result) Source # | |
Defined in Cardano.Api.Query | |
NodeToClientVersionOf (QueryInShelleyBasedEra era result) Source # | |
Defined in Cardano.Api.Query Methods nodeToClientVersionOf ∷ QueryInShelleyBasedEra era result → NodeToClientVersion Source # |
queryNodeLocalState ∷ ∀ mode result. LocalNodeConnectInfo mode → Maybe ChainPoint → QueryInMode mode result → IO (Either AcquiringFailure result) Source #
Local tx monitoring
newtype LocalTxMonitorClient txid tx slot (m ∷ Type → Type) a #
Constructors
LocalTxMonitorClient | |
Fields
|
data LocalTxMonitoringQuery mode Source #
Constructors
LocalTxMonitoringQueryTx (TxIdInMode mode) | 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 mode 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 mode)) 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 mode) Source # | |
Defined in Cardano.Api.IPC Methods toJSON ∷ LocalTxMonitoringResult mode → Value # toEncoding ∷ LocalTxMonitoringResult mode → Encoding # toJSONList ∷ [LocalTxMonitoringResult mode] → Value # toEncodingList ∷ [LocalTxMonitoringResult mode] → Encoding # |
data MempoolSizeAndCapacity #
Constructors
MempoolSizeAndCapacity | |
Fields
|
Instances
Generic MempoolSizeAndCapacity | |
Defined in Ouroboros.Network.Protocol.LocalTxMonitor.Type Methods from ∷ MempoolSizeAndCapacity → Rep MempoolSizeAndCapacity x Source # to ∷ Rep MempoolSizeAndCapacity x → MempoolSizeAndCapacity Source # | |
Show MempoolSizeAndCapacity | |
Eq MempoolSizeAndCapacity | |
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.3.0.0-a5c03edf74359322ebf0740b15593c6d62479c8337729a353281cef37af6b746" '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 ∷ ∀ mode. LocalNodeConnectInfo mode → LocalTxMonitoringQuery mode → IO (LocalTxMonitoringResult mode) Source #
data EraHistory mode where Source #
Constructors
EraHistory ∷ ConsensusBlockForMode mode ~ HardForkBlock xs ⇒ ConsensusMode mode → Interpreter xs → EraHistory mode |
getProgress ∷ SlotNo → EraHistory mode → Either PastHorizonException (RelativeTime, SlotLength) Source #
Common queries
getLocalChainTip ∷ LocalNodeConnectInfo mode → IO ChainTip Source #
Helpers
data ConsensusMode mode where Source #
This GADT provides a value-level representation of all the consensus modes. This enables pattern matching on the era to allow them to be treated in a non-uniform way.
Constructors
ByronMode ∷ ConsensusMode ByronMode | |
ShelleyMode ∷ ConsensusMode ShelleyMode | |
CardanoMode ∷ ConsensusMode CardanoMode |
Instances
Show (ConsensusMode mode) Source # | |
Defined in Cardano.Api.Modes |
consensusModeOnly ∷ ConsensusModeParams mode → ConsensusMode mode Source #
toAcquiringFailure ∷ AcquireFailure → AcquiringFailure Source #
data NodeToClientVersion #
Constructors
NodeToClientV_9 | |
NodeToClientV_10 | |
NodeToClientV_11 | |
NodeToClientV_12 | |
NodeToClientV_13 | |
NodeToClientV_14 | |
NodeToClientV_15 |
Instances
data UnsupportedNtcVersionError Source #
Instances
Show UnsupportedNtcVersionError Source # | |
Defined in Cardano.Api.IPC.Version | |
Eq UnsupportedNtcVersionError Source # | |
Defined in Cardano.Api.IPC.Version |