11{-# LANGUAGE RankNTypes #-}
22
33{- This is ongoing effort on replacing `cardano-cli` calls with `Cardano.Api` queries, see issues
4- https://github.com/mlabs-haskell/bot-plutus-interface/issues/109
5- https://github.com/mlabs-haskell/bot-plutus-interface/issues/101
6- We decided to provide single replacement for `BotPlutusInterface.CardanoCLI.utxosAt`
7- early on to enable inline Datum support from one side and avoid extending
8- `cardano-cli` output parser from the other side.
9- See https://github.com/mlabs-haskell/bot-plutus-interface/issues/145
4+ https://github.com/mlabs-haskell/bot-plutus-interface/issues/109
5+ https://github.com/mlabs-haskell/bot-plutus-interface/issues/101
6+ We decided to provide single replacement for `BotPlutusInterface.CardanoCLI.utxosAt`
7+ early on to enable inline Datum support from one side and avoid extending
8+ `cardano-cli` output parser from the other side.
9+ See https://github.com/mlabs-haskell/bot-plutus-interface/issues/145
1010-}
1111module BotPlutusInterface.CardanoNode.Effects (
1212 utxosAt ,
@@ -23,7 +23,6 @@ import BotPlutusInterface.CardanoNode.Query (
2323 QueryConstraint ,
2424 connectionInfo ,
2525 queryBabbageEra ,
26- queryInCardanoMode ,
2726 toQueryError ,
2827 )
2928
@@ -44,7 +43,6 @@ import Control.Monad.Freer (Eff, Members, interpret, runM, send, type (~>))
4443import Control.Monad.Freer.Reader (Reader , ask , runReader )
4544import Control.Monad.Trans.Class (lift )
4645import Control.Monad.Trans.Either (firstEitherT , hoistEither , newEitherT , runEitherT )
47- import Control.Monad.Trans.Except (throwE )
4846import Data.Map (Map )
4947import Data.Map qualified as Map
5048import Data.Set qualified as Set
@@ -89,7 +87,7 @@ handleNodeQuery ::
8987handleNodeQuery =
9088 interpret $ \ case
9189 UtxosAt addr -> handleUtxosAt addr
92- PParams -> queryPParams
90+ PParams -> queryBabbageEra CApi. QueryProtocolParameters
9391 MinUtxo txout -> handleMinUtxo txout
9492
9593handleUtxosAt ::
@@ -129,7 +127,7 @@ handleMinUtxo ::
129127handleMinUtxo txout = runEitherT $ do
130128 conn <- lift $ ask @ NodeConn
131129
132- params <- newEitherT queryPParams
130+ params <- newEitherT $ queryBabbageEra CApi. QueryProtocolParameters
133131
134132 let pparamsInEra = CApi. toLedgerPParams CApi. ShelleyBasedEraBabbage params
135133 netId = localNodeNetworkId conn
@@ -157,20 +155,3 @@ runNodeQuery conf effs = do
157155 runM $
158156 runReader conn $
159157 handleNodeQuery effs
160-
161- -- Helpers
162-
163- queryPParams ::
164- forall effs .
165- QueryConstraint effs =>
166- Eff effs (Either NodeQueryError CApi.S. ProtocolParameters )
167- queryPParams = runEitherT $ do
168- let query =
169- CApi. QueryInEra CApi. BabbageEraInCardanoMode $
170- CApi. QueryInShelleyBasedEra CApi. ShelleyBasedEraBabbage CApi. QueryProtocolParameters
171-
172- result <- newEitherT $ queryInCardanoMode query
173-
174- case result of
175- Right params -> return params
176- Left err -> throwE $ toQueryError err
0 commit comments