Module

Ctl.Internal.QueryM

CTL query layer monad. This module defines an Aff interface for Ogmios Websocket Queries. Since WebSockets do not define a mechanism for linking request/response. Or for verifying that the connection is live, those concerns are addressed here

#ClusterSetup

type ClusterSetup = { keys :: { payment :: PrivatePaymentKey, stake :: Maybe PrivateStakeKey }, kupoConfig :: ServerConfig, ogmiosConfig :: ServerConfig }

Cluster setup contains everything that is needed to run a Contract on a local cluster: paramters to connect to the services and private keys that are pre-funded with Ada on that cluster

#ListenerSet

type ListenerSet (request :: Type) (response :: Type) = { addMessageListener :: ListenerId -> (Either OgmiosDecodeError response -> Effect Unit) -> Effect Unit, addRequest :: ListenerId -> RequestBody /\ request -> Effect Unit, removeMessageListener :: ListenerId -> Effect Unit }

#QueryConfig

type QueryConfig = { customLogger :: Maybe (LogLevel -> Message -> Aff Unit), kupoConfig :: ServerConfig, logLevel :: LogLevel, suppressLogs :: Boolean }

QueryConfig contains a complete specification on how to initialize a QueryM environment. It includes:

  • server parameters for all the services
  • network ID
  • logging level
  • optional custom logger

#QueryM

#ParQueryM

#QueryEnv

type QueryEnv = { config :: QueryConfig, runtime :: QueryRuntime }

QueryEnv contains everything needed for QueryM to run.

Instances

#QueryRuntime

type QueryRuntime = { ogmiosWs :: OgmiosWebSocket }

Reusable part of QueryRuntime that can be shared between many QueryM instances running in parallel.

Includes:

  • WebSocket connections

#WebSocket

data WebSocket listeners

Constructors

#getChainTip

#getLogger

#handleAffjaxResponse

handleAffjaxResponse :: forall (result :: Type). DecodeAeson result => Either Error (Response String) -> Either ClientError result

#listeners

listeners :: forall (listeners :: Type). WebSocket listeners -> listeners

#mkListenerSet

mkListenerSet :: forall (request :: Type) (response :: Type). DecodeOgmios response => Dispatcher -> PendingRequests -> ListenerSet request response

#mkOgmiosRequest

mkOgmiosRequest :: forall (request :: Type) (response :: Type). JsonRpc2Call request response -> (OgmiosListeners -> ListenerSet request response) -> request -> QueryM response

Builds an Ogmios request action using QueryM

#mkOgmiosRequestAff

mkOgmiosRequestAff :: forall (request :: Type) (response :: Type). OgmiosWebSocket -> Logger -> JsonRpc2Call request response -> (OgmiosListeners -> ListenerSet request response) -> request -> Aff response

Builds an Ogmios request action using Aff

#mkRequest

mkRequest :: forall (request :: Type) (response :: Type) (listeners :: Type). listeners -> JsWebSocket -> JsonRpc2Call request response -> (listeners -> ListenerSet request response) -> request -> QueryM response

#mkRequestAff

mkRequestAff :: forall (request :: Type) (response :: Type) (listeners :: Type). listeners -> JsWebSocket -> Logger -> JsonRpc2Call request response -> (listeners -> ListenerSet request response) -> request -> Aff response

#scriptToAeson

#underlyingWebSocket

Re-exports from Ctl.Internal.QueryM.Dispatcher

#RequestBody

#GenericPendingRequests

type GenericPendingRequests (requestData :: Type) = Ref (Map ListenerId requestData)

#Dispatcher

#newPendingRequests

newPendingRequests :: forall (requestData :: Type). Effect (GenericPendingRequests requestData)

#dispatchErrorToError

Re-exports from Ctl.Internal.ServerConfig

#ServerConfig

type ServerConfig = { host :: Host, path :: Maybe String, port :: UInt, secure :: Boolean }

#Host

type Host = String

#mkWsUrl

#mkServerUrl

#mkHttpUrl

#defaultOgmiosWsConfig

Modules