@@ -3,7 +3,7 @@ module BotPlutusInterface.ExBudget (
33 estimateBudget ,
44) where
55
6- import BotPlutusInterface.QueryNode (NodeInfo (NodeInfo ), NodeQueryError )
6+ import BotPlutusInterface.QueryNode (NodeInfo (NodeInfo ))
77import BotPlutusInterface.QueryNode qualified as QueryNode
88import BotPlutusInterface.Types (
99 BudgetEstimationError (.. ),
@@ -41,20 +41,17 @@ estimateBudget pabConf txFile = do
4141 Raw rp -> deserialiseRaw rp
4242 Signed sp -> fmap CAPI. getTxBody <$> deserialiseSigned sp
4343
44- pparamsRes <- QueryNode. queryProtocolParams debugNodeInf
45-
4644 budgetRes <-
4745 either
4846 (pure . Left )
49- (getExUnits pparamsRes debugNodeInf)
47+ (getExUnits debugNodeInf)
5048 txBody
5149
5250 return $
5351 do
5452 body <- txBody
5553 budget <- budgetRes
56- pparams <- left toBudgetError pparamsRes
57- maxUnits <- maybeToEither (BudgetEstimationError " Missing max units in parameters" ) $ protocolParamMaxTxExUnits pparams
54+ maxUnits <- maybeToEither (BudgetEstimationError " Missing max units in parameters" ) $ protocolParamMaxTxExUnits pabConf. pcProtocolParams
5855
5956 scaledBudget <- getScaledBudget maxUnits pabConf. pcBudgetMultiplier budget
6057
@@ -122,13 +119,13 @@ type ExUnitsMap =
122119
123120-- | Calculate execution units using `Cardano.Api``
124121getExUnits ::
125- Either NodeQueryError ProtocolParameters ->
126122 NodeInfo ->
127123 CAPI. TxBody CAPI. AlonzoEra ->
128124 IO (Either BudgetEstimationError ExUnitsMap )
129- getExUnits pparams nodeInf txBody = do
125+ getExUnits nodeInf txBody = do
130126 sysStart <- QueryNode. querySystemStart nodeInf
131127 eraHist <- QueryNode. queryEraHistory nodeInf
128+ pparams <- QueryNode. queryProtocolParams nodeInf
132129 utxo <- QueryNode. queryOutsByInputs nodeInf capiIns
133130 return $
134131 flattenEvalResult $
0 commit comments