{-# LANGUAGE PackageImports #-}
{-# LANGUAGE RankNTypes #-}
module Utxorpc.Types
( UtxorpcClient (..),
BuildClient (..),
SubmitClient (..),
SyncClient (..),
WatchClient (..),
ServerStreamCall,
ServerStreamReply,
UnaryReply,
)
where
import Network.GRPC.Client (HeaderList, RawReply)
import Proto.Utxorpc.V1alpha.Build.Build
import Proto.Utxorpc.V1alpha.Submit.Submit
import Proto.Utxorpc.V1alpha.Sync.Sync
import Proto.Utxorpc.V1alpha.Watch.Watch
import "http2-client" Network.HTTP2.Client (ClientError, TooMuchConcurrency)
type ServerStreamCall i o =
forall a.
a ->
i ->
(a -> HeaderList -> o -> IO a) ->
ServerStreamReply a
type UnaryReply o =
IO
(Either ClientError (Either TooMuchConcurrency (RawReply o)))
type ServerStreamReply a =
IO
(Either ClientError (Either TooMuchConcurrency (a, HeaderList, HeaderList)))
data UtxorpcClient = UtxorpcClient
{
UtxorpcClient -> BuildClient
buildClient :: BuildClient,
UtxorpcClient -> SubmitClient
submitClient :: SubmitClient,
UtxorpcClient -> SyncClient
syncClient :: SyncClient,
UtxorpcClient -> WatchClient
watchClient :: WatchClient,
UtxorpcClient -> IO (Either ClientError ())
close :: IO (Either ClientError ())
}
data BuildClient = BuildClient
{ BuildClient -> GetChainTipRequest -> UnaryReply GetChainTipResponse
getChainTip :: GetChainTipRequest -> UnaryReply GetChainTipResponse,
BuildClient
-> GetChainParamRequest -> UnaryReply GetChainParamResponse
getChainParam :: GetChainParamRequest -> UnaryReply GetChainParamResponse,
BuildClient
-> GetUtxoByAddressRequest -> UnaryReply GetUtxoByAddressResponse
getUtxoByAddress :: GetUtxoByAddressRequest -> UnaryReply GetUtxoByAddressResponse,
BuildClient
-> GetUtxoByRefRequest -> UnaryReply GetUtxoByRefResponse
getUtxoByRef :: GetUtxoByRefRequest -> UnaryReply GetUtxoByRefResponse,
BuildClient -> ServerStreamCall HoldUtxoRequest HoldUtxoResponse
holdUtxo :: ServerStreamCall HoldUtxoRequest HoldUtxoResponse
}
data SubmitClient = SubmitClient
{ SubmitClient -> SubmitTxRequest -> UnaryReply SubmitTxResponse
submitTx :: SubmitTxRequest -> UnaryReply SubmitTxResponse,
SubmitClient
-> ReadMempoolRequest -> UnaryReply ReadMempoolResponse
readMempool :: ReadMempoolRequest -> UnaryReply ReadMempoolResponse,
SubmitClient -> ServerStreamCall WaitForTxRequest WaitForTxResponse
waitForTx :: ServerStreamCall WaitForTxRequest WaitForTxResponse,
SubmitClient
-> ServerStreamCall WatchMempoolRequest WatchMempoolResponse
watchMempool :: ServerStreamCall WatchMempoolRequest WatchMempoolResponse
}
data SyncClient = SyncClient
{ SyncClient -> FetchBlockRequest -> UnaryReply FetchBlockResponse
fetchBlock :: FetchBlockRequest -> UnaryReply FetchBlockResponse,
SyncClient -> DumpHistoryRequest -> UnaryReply DumpHistoryResponse
dumpHistory :: DumpHistoryRequest -> UnaryReply DumpHistoryResponse,
SyncClient -> ServerStreamCall FollowTipRequest FollowTipResponse
followTip :: ServerStreamCall FollowTipRequest FollowTipResponse
}
newtype WatchClient = WatchClient
{ WatchClient -> ServerStreamCall WatchTxRequest WatchTxResponse
watchTx :: ServerStreamCall WatchTxRequest WatchTxResponse
}