Skip to content

Commit 14a6d9d

Browse files
committed
Remove mempool methods from QueryM.Ogmios
1 parent 5c601fe commit 14a6d9d

File tree

11 files changed

+548
-646
lines changed

11 files changed

+548
-646
lines changed

src/Contract/Backend/Ogmios/Mempool.purs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,18 @@ import Ctl.Internal.QueryM.Ogmios
2727
( MempoolSizeAndCapacity
2828
, MempoolSnapshotAcquired
2929
, MempoolTransaction(MempoolTransaction)
30-
, acquireMempoolSnapshotCall
3130
) as Ogmios
3231
import Ctl.Internal.QueryM.OgmiosWebsocket.JsWebSocket (JsWebSocket)
3332
import Ctl.Internal.QueryM.OgmiosWebsocket.Mempool
34-
( mempoolSnapshotHasTxCall
35-
, mempoolSnapshotNextTxCall
36-
, mempoolSnapshotSizeAndCapacityCall
37-
, releaseMempoolCall
38-
)
39-
import Ctl.Internal.QueryM.OgmiosWebsocket.Types
4033
( ListenerSet
4134
, OgmiosListeners
35+
, acquireMempoolSnapshotCall
4236
, listeners
37+
, mempoolSnapshotHasTxCall
38+
, mempoolSnapshotNextTxCall
39+
, mempoolSnapshotSizeAndCapacityCall
4340
, mkRequestAff
41+
, releaseMempoolCall
4442
, underlyingWebSocket
4543
)
4644
import Data.Array as Array
@@ -118,7 +116,7 @@ acquireMempoolSnapshotFetch
118116
:: QueryM Ogmios.MempoolSnapshotAcquired
119117
acquireMempoolSnapshotFetch =
120118
mkOgmiosRequest
121-
Ogmios.acquireMempoolSnapshotCall
119+
acquireMempoolSnapshotCall
122120
_.acquireMempool
123121
unit
124122

src/Internal/Contract/Monad.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ import Ctl.Internal.QueryM.OgmiosHttp
6363
, getSystemStartTime
6464
)
6565
import Ctl.Internal.QueryM.OgmiosWebsocket.JsWebSocket (_wsClose, _wsFinalize)
66-
import Ctl.Internal.QueryM.OgmiosWebsocket.Queries (QueryEnv)
67-
import Ctl.Internal.QueryM.OgmiosWebsocket.Types
66+
import Ctl.Internal.QueryM.OgmiosWebsocket.Mempool
6867
( WebSocket
6968
, mkOgmiosWebSocketAff
7069
, underlyingWebSocket
7170
)
71+
import Ctl.Internal.QueryM.OgmiosWebsocket.Queries (QueryEnv)
7272
import Ctl.Internal.Service.Blockfrost
7373
( BlockfrostServiceM
7474
, runBlockfrostServiceM

src/Internal/Contract/ProviderBackend.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module Ctl.Internal.Contract.ProviderBackend
1515

1616
import Prelude
1717

18-
import Ctl.Internal.QueryM.OgmiosWebsocket.Types (OgmiosWebSocket)
18+
import Ctl.Internal.QueryM.OgmiosWebsocket.Mempool (OgmiosWebSocket)
1919
import Ctl.Internal.ServerConfig (ServerConfig)
2020
import Data.Maybe (Maybe(Just, Nothing))
2121
import Data.Time.Duration (Seconds(Seconds))

src/Internal/QueryM.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ import Ctl.Internal.Helpers (logWithLevel)
3333
import Ctl.Internal.Logging (mkLogger)
3434
import Ctl.Internal.QueryM.Ogmios (AdditionalUtxoSet, OgmiosTxEvaluationR)
3535
import Ctl.Internal.QueryM.Ogmios as Ogmios
36-
import Ctl.Internal.QueryM.OgmiosWebsocket.Queries (QueryEnv)
37-
import Ctl.Internal.QueryM.OgmiosWebsocket.Types
36+
import Ctl.Internal.QueryM.OgmiosWebsocket.Mempool
3837
( listeners
3938
, mkRequestAff
4039
, underlyingWebSocket
4140
)
41+
import Ctl.Internal.QueryM.OgmiosWebsocket.Queries (QueryEnv)
4242
import Data.Bifunctor (lmap)
4343
import Data.Either (Either(Left, Right))
4444
import Data.Maybe (fromMaybe)

src/Internal/QueryM/CurrentEpoch.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Effect.Exception (error)
1616
-- | Get the current Epoch. Details can be found https://ogmios.dev/api/ under
1717
-- | "currentEpoch" query
1818
getCurrentEpoch :: QueryM CurrentEpoch
19-
getCurrentEpoch = do
19+
getCurrentEpoch = do
2020
resp <- OgmiosHttp.currentEpoch
2121
case resp of
2222
Left err -> throwError $ error $ pprintOgmiosDecodeError err

src/Internal/QueryM/Ogmios.purs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,7 @@ module Ctl.Internal.QueryM.Ogmios
2626
, OgmiosTxEvaluationR(OgmiosTxEvaluationR)
2727
, aesonObject
2828
, aesonArray
29-
, acquireMempoolSnapshotCall
3029
, evaluateTxCall
31-
, mempoolSnapshotHasTxCall
32-
, mempoolSnapshotNextTxCall
33-
, mempoolSnapshotSizeAndCapacityCall
34-
, mkOgmiosCallType
35-
, mkOgmiosCallTypeNoArgs
36-
, releaseMempoolCall
3730
, submitSuccessPartialResp
3831
, parseIpv6String
3932
, rationalToSubcoin
@@ -202,48 +195,10 @@ evaluateTxCall = mkOgmiosCallType
202195
}
203196
}
204197

205-
--------------------------------------------------------------------------------
206-
-- Local Tx Monitor Protocol
207-
-- https://ogmios.dev/mini-protocols/local-tx-monitor/
208-
--------------------------------------------------------------------------------
209-
210-
acquireMempoolSnapshotCall :: JsonRpc2Call Unit MempoolSnapshotAcquired
211-
acquireMempoolSnapshotCall =
212-
mkOgmiosCallTypeNoArgs "acquireMempool"
213-
214-
mempoolSnapshotHasTxCall
215-
:: MempoolSnapshotAcquired -> JsonRpc2Call TransactionHash HasTxR
216-
mempoolSnapshotHasTxCall _ = mkOgmiosCallType
217-
{ method: "hasTransaction"
218-
, params: { id: _ }
219-
}
220-
221-
mempoolSnapshotNextTxCall
222-
:: MempoolSnapshotAcquired -> JsonRpc2Call Unit MaybeMempoolTransaction
223-
mempoolSnapshotNextTxCall _ = mkOgmiosCallType
224-
{ method: "nextTransaction"
225-
, params: const { fields: "all" }
226-
}
227-
228-
mempoolSnapshotSizeAndCapacityCall
229-
:: MempoolSnapshotAcquired -> JsonRpc2Call Unit MempoolSizeAndCapacity
230-
mempoolSnapshotSizeAndCapacityCall _ =
231-
mkOgmiosCallTypeNoArgs "sizeOfMempool"
232-
233-
releaseMempoolCall
234-
:: MempoolSnapshotAcquired -> JsonRpc2Call Unit ReleasedMempool
235-
releaseMempoolCall _ =
236-
mkOgmiosCallTypeNoArgs "releaseMempool"
237-
238198
--------------------------------------------------------------------------------
239199
-- Helpers
240200
--------------------------------------------------------------------------------
241201

242-
mkOgmiosCallTypeNoArgs
243-
:: forall (o :: Type). DecodeOgmios o => String -> JsonRpc2Call Unit o
244-
mkOgmiosCallTypeNoArgs method =
245-
mkOgmiosCallType { method, params: const {} }
246-
247202
mkOgmiosCallType
248203
:: forall (a :: Type) (i :: Type) (o :: Type)
249204
. EncodeAeson (JsonRpc2Request a)

src/Internal/QueryM/OgmiosHttp.purs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ import Affjax.ResponseFormat (string) as Affjax.ResponseFormat
3939
import Affjax.StatusCode (StatusCode(StatusCode))
4040
import Affjax.StatusCode as Affjax.StatusCode
4141
import Cardano.AsCbor (encodeCbor)
42-
import Cardano.Provider.Error (ClientError(..), ServiceError(..))
42+
import Cardano.Provider.Error
43+
( ClientError(ClientHttpError, ClientHttpResponseError)
44+
, ServiceError(ServiceOtherError)
45+
)
4346
import Cardano.Provider.TxEvaluation as Provider
4447
import Cardano.Serialization.Lib (fromBytes)
4548
import Cardano.Types
@@ -56,10 +59,10 @@ import Cardano.Types.Chain as Chain
5659
import Cardano.Types.Coin (Coin(Coin))
5760
import Cardano.Types.CostModel (CostModel(CostModel))
5861
import Cardano.Types.EraSummaries
59-
( EraSummaries(..)
60-
, EraSummary(..)
61-
, EraSummaryParameters(..)
62-
, EraSummaryTime(..)
62+
( EraSummaries(EraSummaries)
63+
, EraSummary(EraSummary)
64+
, EraSummaryParameters(EraSummaryParameters)
65+
, EraSummaryTime(EraSummaryTime)
6366
)
6467
import Cardano.Types.ExUnitPrices (ExUnitPrices(ExUnitPrices))
6568
import Cardano.Types.ExUnits (ExUnits(ExUnits))
@@ -93,7 +96,7 @@ import Ctl.Internal.Helpers (encodeMap, showWithParens)
9396
import Ctl.Internal.QueryM (QueryM)
9497
import Ctl.Internal.QueryM.JsonRpc2
9598
( class DecodeOgmios
96-
, OgmiosDecodeError(..)
99+
, OgmiosDecodeError(ClientErrorResponse, ResultDecodingError)
97100
, OgmiosError
98101
, decodeErrorOrResult
99102
, decodeOgmios

0 commit comments

Comments
 (0)