ouroboros-network-protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.LocalTxSubmission.Client

Description

A view of the transaction submission protocol from the point of view of the client.

This provides a view that uses less complex types and should be easier to use than the underlying typed protocol itself.

For execution, localTxSubmissionClientPeer is provided for conversion into the typed protocol.

Synopsis

Protocol type for the client

The protocol states from the point of view of the client.

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

data LocalTxClientStIdle tx reject (m :: Type -> Type) a where Source #

The client side of the local transaction submission protocol.

The peer in the client role submits transactions to the peer in the server role.

Constructors

SendMsgSubmitTx :: forall tx reject (m :: Type -> Type) a. tx -> (SubmitResult reject -> m (LocalTxClientStIdle tx reject m a)) -> LocalTxClientStIdle tx reject m a

The client submits a single transaction and waits a reply.

The server replies to inform the client that it has either accepted the transaction or rejected it. In the rejection case a reason for the rejection is included.

SendMsgDone :: forall a tx reject (m :: Type -> Type). a -> LocalTxClientStIdle tx reject m a

The client can terminate the protocol.

The result from a transaction submission.

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 Source # 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxSubmission.Type

Methods

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

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

Eq reason => Eq (SubmitResult reason) Source # 
Instance details

Defined in Ouroboros.Network.Protocol.LocalTxSubmission.Type

Methods

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

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

Execution as a typed protocol

localTxSubmissionClientPeer :: forall tx reject (m :: Type -> Type) a. Monad m => LocalTxSubmissionClient tx reject m a -> Client (LocalTxSubmission tx reject) 'NonPipelined ('StIdle :: LocalTxSubmission tx reject) m a Source #

A non-pipelined Peer representing the LocalTxSubmissionClient.

Null local tx submission client

localTxSubmissionClientNull :: forall (m :: Type -> Type) tx reject a. MonadTimer m => LocalTxSubmissionClient tx reject m a Source #

Deprecated: Use Ouroboros.Network.NodeToClient.localTxSubmissionPeerNull

A local tx submission client which never sends any message.

Utilities

mapLocalTxSubmissionClient :: forall tx tx' reject reject' (m :: Type -> Type) a. Functor m => (tx -> tx') -> (reject' -> reject) -> LocalTxSubmissionClient tx reject m a -> LocalTxSubmissionClient tx' reject' m a Source #

Transform a LocalTxSubmissionClient by mapping over the tx and the rejection errors.

Note the direction of the individual mapping functions corresponds to whether the types are used as protocol inputs or outputs.