Safe Haskell | None |
---|---|
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
- LocalNodeClientParams ∷ (SerialiseNodeToClientConstraints block, SupportedNetworkProtocolVersion block, ShowProxy block, ShowProxy (ApplyTxErr block), ShowProxy (GenTx block), ShowProxy (Query block), ShowQuery (Query block), ProtocolClient block) ⇒ ProtocolClientInfoArgs block → (NodeToClientVersion → LocalNodeClientProtocolsForBlock block) → LocalNodeClientParams
- mkLocalNodeClientParams ∷ ∀ mode block. ConsensusBlockForMode mode ~ block ⇒ ConsensusModeParams mode → (NodeToClientVersion → LocalNodeClientProtocolsInMode mode) → LocalNodeClientParams
- data LocalNodeClientProtocols block point tip tx txerr query m = LocalNodeClientProtocols {
- localChainSyncClient ∷ LocalChainSyncClient block point tip m
- localTxSubmissionClient ∷ Maybe (LocalTxSubmissionClient tx txerr m ())
- localStateQueryClient ∷ Maybe (LocalStateQueryClient block point query 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 (TxInMode 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) a = ChainSyncClientPipelined {
- runChainSyncClientPipelined ∷ m (ClientPipelinedStIdle 'Z header point tip m a)
- data BlockInMode mode where
- BlockInMode ∷ 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 AcquireFailure
- 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)
- queryNodeLocalState ∷ ∀ mode result. LocalNodeConnectInfo mode → Maybe ChainPoint → QueryInMode mode result → IO (Either AcquireFailure result)
- 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
- data 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
LocalNodeClientParams ∷ (SerialiseNodeToClientConstraints block, SupportedNetworkProtocolVersion block, ShowProxy block, ShowProxy (ApplyTxErr block), ShowProxy (GenTx block), ShowProxy (Query block), ShowQuery (Query block), ProtocolClient 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 tx 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 (TxInMode 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) 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 ∷ 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.TxInMode |
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.TxInMode |
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 AcquireFailure #
Instances
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 |
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 |
data QueryInShelleyBasedEra era result where Source #
Constructors
Instances
Show (QueryInShelleyBasedEra era result) Source # | |
Defined in Cardano.Api.Query |
queryNodeLocalState ∷ ∀ mode result. LocalNodeConnectInfo mode → Maybe ChainPoint → QueryInMode mode result → IO (Either AcquireFailure result) Source #
Establish a connection to a node and execute a single query using the local state query protocol.
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 #
data NodeToClientVersion #
Constructors
NodeToClientV_1 | |
NodeToClientV_2 | |
NodeToClientV_3 | |
NodeToClientV_4 | |
NodeToClientV_5 | |
NodeToClientV_6 | |
NodeToClientV_7 | |
NodeToClientV_8 | |
NodeToClientV_9 | |
NodeToClientV_10 | |
NodeToClientV_11 | |
NodeToClientV_12 |