utxorpc-client-0.0.1.0: An SDK for clients of the UTxO RPC specification.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Utxorpc.Client

Description

Create a UTxO RPC client connected to a UTxO RPC service. The UtxorpcClient provides functions for each of the methods in the UTxO RPC specification. Provide a UtxorpcClientLogger to perform automated logging.

Synopsis

Documentation

data UtxorpcInfo m Source #

Configuration info for a UTxO RPC Client. For more fine-grained control, use GrpcClientConfig and UtxorpcClientWith

Constructors

UtxorpcInfo 

Fields

utxorpcClient :: UtxorpcInfo m -> IO (Either ClientError UtxorpcClient) Source #

Connect to a UTxO RPC service from a UtxorpcInfo. Provides more configurability than simpleUtxorpcClient but less than utxorpcClientWith.

simpleUtxorpcClient Source #

Arguments

:: HostName

Host name of the service.

-> PortNumber

Port number of the service.

-> UseTlsOrNot

Whether or not to use TLS.

-> IO (Either ClientError UtxorpcClient) 

Make a connection to a UTxO RPC service with the minimum required information. No compression is used, no headers are added, and no logging is performed. For more configurability, use utxorpcClient or utxorpcClientWith.

utxorpcClientWith :: GrpcClientConfig -> Maybe (UtxorpcClientLogger m) -> IO (Either ClientError UtxorpcClient) Source #

Connect to a UTxO RPC from a GrpcClientConfig. For a simpler interface with less configurability, use utxorpcClient or simpleUtxorpcClient.

data UtxorpcClientLogger m Source #

Logging functions to log requests, replies, server stream messages, and server stream endings. A UUID is generated for each request and passed downstream to the other logging functions.

Constructors

UtxorpcClientLogger 

Fields

type RequestLogger m Source #

Arguments

 = forall i. (Show i, Message i) 
=> ByteString

The RPC path

-> GrpcClient

Included because it contains useful information such as the server address.

-> UUID

Generated for this request, and passed to other logging functions for other RPC events generated by this request. E.g., A unary request and its reply both have the same UUID.

-> i

The request message being sent.

-> m () 

Log outgoing requests of all types (i.e., unary requests and server stream requests).

type ReplyLogger m Source #

Arguments

 = forall o. (Show o, Message o) 
=> ByteString

The RPC path

-> GrpcClient

Included because it contains useful information such as the server address.

-> UUID

Generated for the request that this reply is associated with.

-> Either ClientError (Either TooMuchConcurrency (RawReply o))

Message received from the service (with headers) or an error.

-> m () 

Log unary replies.

type ServerStreamLogger m Source #

Arguments

 = forall o. (Show o, Message o) 
=> ByteString

The RPC path

-> GrpcClient

Included because it contains useful information such as the server address.

-> (UUID, Int)

The UUID was generated for the request that caused this reply, the Int is the index of this message in the stream.

-> o

Message received from the service.

-> m () 

Log server stream messages.

type ServerStreamEndLogger m Source #

Arguments

 = ByteString

The RPC path

-> GrpcClient

Included because it contains useful information such as the server address.

-> (UUID, Int)

The UUID was generated for the request that caused this reply, the Int is the total number of messages received in the stream.

-> (HeaderList, HeaderList)

Headers and Trailers.

-> m ()