ouroboros-network-0.1.0.1: A networking layer for the Ouroboros blockchain protocol
Safe Haskell None
Language Haskell2010

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.

data LocalTxClientStIdle tx reject m 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 :: 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 :: 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

Execution as a typed protocol

Null local tx submission client

localTxSubmissionClientNull :: 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 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.