Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.IPC
Description
Node IPC protocols
Synopsis
- connectToLocalNode :: LocalNodeConnectInfo -> LocalNodeClientProtocolsInMode -> IO ()
- connectToLocalNodeWithVersion :: LocalNodeConnectInfo -> (NodeToClientVersion -> LocalNodeClientProtocolsInMode) -> IO ()
- data LocalNodeConnectInfo = LocalNodeConnectInfo {}
- 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 :: forall block. CardanoBlock StandardCrypto ~ block => ConsensusModeParams -> (NodeToClientVersion -> LocalNodeClientProtocolsInMode) -> 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 = 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 :: 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 :: ShelleyBasedEra era -> Tx era -> TxInMode
- TxInByronSpecial :: GenTx ByronBlock -> TxInMode
- data TxValidationErrorInCardanoMode
- data TxValidationError era
- submitTxToNodeLocal :: LocalNodeConnectInfo -> TxInMode -> IO (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 :: QueryInEra era result -> QueryInMode (Either EraMismatch result)
- QueryEraHistory :: QueryInMode EraHistory
- QuerySystemStart :: QueryInMode SystemStart
- QueryChainBlockNo :: QueryInMode (WithOrigin BlockNo)
- QueryChainPoint :: QueryInMode 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 ShelleyEra)
- QueryProtocolParameters :: QueryInShelleyBasedEra era (PParams (ShelleyLedgerEra era))
- 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)
- QueryStakeDelegDeposits :: Set StakeCredential -> QueryInShelleyBasedEra era (Map StakeCredential Lovelace)
- QueryConstitution :: QueryInShelleyBasedEra era (Maybe (Constitution (ShelleyLedgerEra era)))
- QueryGovState :: QueryInShelleyBasedEra era (GovState (ShelleyLedgerEra era))
- QueryDRepState :: Set (Credential DRepRole StandardCrypto) -> QueryInShelleyBasedEra era (Map (Credential DRepRole StandardCrypto) (DRepState StandardCrypto))
- QueryDRepStakeDistr :: Set (DRep StandardCrypto) -> QueryInShelleyBasedEra era (Map (DRep StandardCrypto) Lovelace)
- QueryCommitteeMembersState :: Set (Credential ColdCommitteeRole StandardCrypto) -> Set (Credential HotCommitteeRole StandardCrypto) -> Set MemberStatus -> QueryInShelleyBasedEra era (Maybe (CommitteeMembersState StandardCrypto))
- QueryStakeVoteDelegatees :: Set StakeCredential -> QueryInShelleyBasedEra era (Map StakeCredential (DRep StandardCrypto))
- queryNodeLocalState :: forall result. LocalNodeConnectInfo -> Maybe ChainPoint -> QueryInMode 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
- data LocalTxMonitoringResult
- data MempoolSizeAndCapacity = MempoolSizeAndCapacity {
- capacityInBytes :: !Word32
- sizeInBytes :: !Word32
- numberOfTxs :: !Word32
- queryTxMonitoringLocal :: LocalNodeConnectInfo -> LocalTxMonitoringQuery -> IO LocalTxMonitoringResult
- data EraHistory where
- EraHistory :: CardanoBlock StandardCrypto ~ HardForkBlock xs => Interpreter xs -> EraHistory
- getProgress :: SlotNo -> EraHistory -> Either PastHorizonException (RelativeTime, SlotLength)
- getLocalChainTip :: LocalNodeConnectInfo -> IO ChainTip
- toAcquiringFailure :: AcquireFailure -> AcquiringFailure
- data NodeToClientVersion
- data UnsupportedNtcVersionError = UnsupportedNtcVersionError !MinNodeToClientVersion !NodeToClientVersion
Node interaction
Operations that involve talking to a local Cardano node.
connectToLocalNode :: LocalNodeConnectInfo -> LocalNodeClientProtocolsInMode -> IO () Source #
Establish a connection to a local node and execute the given set of protocol handlers.
connectToLocalNodeWithVersion :: LocalNodeConnectInfo -> (NodeToClientVersion -> LocalNodeClientProtocolsInMode) -> 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 Source #
Constructors
LocalNodeConnectInfo | |
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 :: forall block. CardanoBlock StandardCrypto ~ block => 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 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 = 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.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 where Source #
A Block
in one of the eras.
TODO Rename this to BlockInEra
Constructors
BlockInMode :: CardanoEra era -> Block era -> BlockInMode |
Instances
Show BlockInMode Source # | |
Defined in Cardano.Api.Block |
Local tx submission
newtype LocalTxSubmissionClient tx reject (m :: Type -> Type) a #
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 :: 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
Show TxValidationErrorInCardanoMode Source # | |
Defined in Cardano.Api.InMode | |
ToJSON TxValidationErrorInCardanoMode Source # | |
Defined in Cardano.Api.InMode Methods toJSON :: TxValidationErrorInCardanoMode -> Value # toEncoding :: TxValidationErrorInCardanoMode -> Encoding # toJSONList :: [TxValidationErrorInCardanoMode] -> Value # toEncodingList :: [TxValidationErrorInCardanoMode] -> Encoding # |
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
submitTxToNodeLocal :: LocalNodeConnectInfo -> TxInMode -> IO (SubmitResult TxValidationErrorInCardanoMode) 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
Eq AcquiringFailure Source # | |
Defined in Cardano.Api.IPC Methods (==) :: AcquiringFailure -> AcquiringFailure -> Bool Source # (/=) :: AcquiringFailure -> AcquiringFailure -> Bool Source # | |
Show AcquiringFailure Source # | |
Defined in Cardano.Api.IPC |
data QueryInMode result where Source #
Constructors
QueryCurrentEra :: QueryInMode AnyCardanoEra | |
QueryInEra :: QueryInEra era result -> QueryInMode (Either EraMismatch result) | |
QueryEraHistory :: QueryInMode EraHistory | |
QuerySystemStart :: QueryInMode SystemStart | |
QueryChainBlockNo :: QueryInMode (WithOrigin BlockNo) | |
QueryChainPoint :: QueryInMode ChainPoint |
Instances
Show (QueryInMode result) Source # | |
Defined in Cardano.Api.Query | |
NodeToClientVersionOf (QueryInMode result) Source # | |
Defined in Cardano.Api.Query Methods nodeToClientVersionOf :: QueryInMode 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 # | Mapping for queries in Shelley-based eras returning minimal node-to-client protocol versions. More information about queries versioning can be found: * https://input-output-hk.github.io/ouroboros-network/ouroboros-network/Ouroboros-Network-NodeToClient.html#t:NodeToClientVersion * https://input-output-hk.github.io/ouroboros-consensus/docs/for-developers/QueryVersioning/#implementation |
Defined in Cardano.Api.Query Methods nodeToClientVersionOf :: QueryInShelleyBasedEra era result -> NodeToClientVersion Source # |
queryNodeLocalState :: forall result. LocalNodeConnectInfo -> Maybe ChainPoint -> QueryInMode result -> IO (Either AcquiringFailure result) Source #
Local tx monitoring
newtype LocalTxMonitorClient txid tx slot (m :: Type -> Type) a #
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.IPC Methods toJSON :: LocalTxMonitoringResult -> Value # toEncoding :: LocalTxMonitoringResult -> Encoding # toJSONList :: [LocalTxMonitoringResult] -> Value # toEncodingList :: [LocalTxMonitoringResult] -> Encoding # |
data MempoolSizeAndCapacity #
Constructors
MempoolSizeAndCapacity | |
Fields
|
Instances
queryTxMonitoringLocal :: LocalNodeConnectInfo -> LocalTxMonitoringQuery -> IO LocalTxMonitoringResult Source #
data EraHistory where Source #
Constructors
EraHistory :: CardanoBlock StandardCrypto ~ HardForkBlock xs => Interpreter xs -> EraHistory |
getProgress :: SlotNo -> EraHistory -> Either PastHorizonException (RelativeTime, SlotLength) Source #
Common queries
Helpers
toAcquiringFailure :: AcquireFailure -> AcquiringFailure Source #
data NodeToClientVersion #
Constructors
NodeToClientV_9 | |
NodeToClientV_10 | |
NodeToClientV_11 | |
NodeToClientV_12 | |
NodeToClientV_13 | |
NodeToClientV_14 | |
NodeToClientV_15 | |
NodeToClientV_16 |
Instances
data UnsupportedNtcVersionError Source #
Instances
Eq UnsupportedNtcVersionError Source # | |
Defined in Cardano.Api.IPC.Version Methods (==) :: UnsupportedNtcVersionError -> UnsupportedNtcVersionError -> Bool Source # (/=) :: UnsupportedNtcVersionError -> UnsupportedNtcVersionError -> Bool Source # | |
Show UnsupportedNtcVersionError Source # | |
Defined in Cardano.Api.IPC.Version |