Make Contract runtime and ConfigParams parametrize-able with a backend. Move every query layer function to a handle (as in handle pattern):
type QueryHandle =
{ getChainTip :: Aff ChainTip
, getDatumByHash :: DatumHash -> Aff Datum
...
}
Particular handle contents are TBD. Please pay close attention to this description: https://github.com/Plutonomicon/cardano-transaction-lib/issues/524 - it should highlight what is required to be in the handle. In particular, note that we use EraSummaries ogmios endpoint in QueryM for time conversions (slotToPosixTime, posixTimeToSlot), so we should expose only these functions in the handle, and not the whole eraSummaries.
QueryM monad should be either removed or used only for Ogmios/ODC/ctl-server backends, and Contract should contain a reference to a handle instead. ConfigParams should be changed: we should include a type BackendSpec { ctlServer :: Maybe _, queryBackend:: QueryBackend } where data QueryBackend = CtlRuntime { ... } | BlockfrostRuntime {..}
We want a function of type QueryBackend -> Aff QueryHandle (attempt to use it with BlockfrostRuntime should throw an error until Blockfrost backend is implemented).
Make
Contract
runtime andConfigParams
parametrize-able with a backend. Move every query layer function to a handle (as in handle pattern):Particular handle contents are TBD. Please pay close attention to this description: https://github.com/Plutonomicon/cardano-transaction-lib/issues/524 - it should highlight what is required to be in the handle. In particular, note that we use
EraSummaries
ogmios endpoint inQueryM
for time conversions (slotToPosixTime
,posixTimeToSlot
), so we should expose only these functions in the handle, and not the wholeeraSummaries
.QueryM
monad should be either removed or used only for Ogmios/ODC/ctl-server backends, and Contract should contain a reference to a handle instead.ConfigParams
should be changed: we should include atype BackendSpec { ctlServer :: Maybe _, queryBackend:: QueryBackend }
wheredata QueryBackend = CtlRuntime { ... } | BlockfrostRuntime {..}
We want a function of type
QueryBackend -> Aff QueryHandle
(attempt to use it withBlockfrostRuntime
should throw an error until Blockfrost backend is implemented).