@@ -35,6 +35,7 @@ import BotPlutusInterface.Types (
3535 CollateralUtxo (CollateralUtxo ),
3636 ContractEnvironment (.. ),
3737 LogLevel (Debug , Notice , Warn ),
38+ LogType (CollateralLog , PABLog ),
3839 Tip (block , slot ),
3940 TxFile (Signed ),
4041 collateralValue ,
@@ -174,7 +175,7 @@ handlePABReq ::
174175 PABReq ->
175176 Eff effs PABResp
176177handlePABReq contractEnv req = do
177- printBpiLog @ w Debug $ pretty req
178+ printBpiLog @ w ( Debug [ PABLog ]) $ pretty req
178179 resp <- case req of
179180 ----------------------
180181 -- Handled requests --
@@ -208,7 +209,7 @@ handlePABReq contractEnv req = do
208209 -- YieldUnbalancedTxReq UnbalancedTx
209210 unsupported -> error (" Unsupported PAB effect: " ++ show unsupported)
210211
211- printBpiLog @ w Debug $ pretty resp
212+ printBpiLog @ w ( Debug [ PABLog ]) $ pretty resp
212213 pure resp
213214
214215{- | Await till transaction status change to something from `Unknown`.
@@ -227,7 +228,7 @@ awaitTxStatusChange ::
227228 Eff effs TxStatus
228229awaitTxStatusChange contractEnv txId = do
229230 checkStartedBlock <- currentBlock contractEnv
230- printBpiLog @ w Debug $ pretty $ " Awaiting status change for " ++ show txId
231+ printBpiLog @ w ( Debug [ PABLog ]) $ pretty $ " Awaiting status change for " ++ show txId
231232
232233 let txStatusPolling = contractEnv. cePABConfig. pcTxStatusPolling
233234 pollInterval = fromIntegral $ txStatusPolling. spInterval
@@ -276,7 +277,7 @@ awaitTxStatusChange contractEnv txId = do
276277 pure . Just $ fromTx blk tx
277278 Nothing -> pure Nothing
278279
279- logDebug = printBpiLog @ w Debug . pretty
280+ logDebug = printBpiLog @ w ( Debug [ PABLog ]) . pretty
280281
281282-- | This will FULLY balance a transaction
282283balanceTx ::
@@ -339,7 +340,7 @@ writeBalancedTx contractEnv (Right tx) = do
339340 if signable
340341 then newEitherT $ CardanoCLI. signTx @ w pabConf tx requiredSigners
341342 else
342- lift . printBpiLog @ w Warn . PP. vsep $
343+ lift . printBpiLog @ w ( Warn [ PABLog ]) . PP. vsep $
343344 [ " Not all required signatures have signing key files. Please sign and submit the tx manually:"
344345 , " Tx file:" <+> pretty (Files. txFilePath pabConf " raw" (Tx. txId tx))
345346 , " Signatories (pkh):" <+> pretty (Text. unwords (map pkhToText requiredSigners))
@@ -477,12 +478,12 @@ handleCollateral cEnv = do
477478 case result of
478479 Right collteralUtxo ->
479480 setInMemCollateral @ w collteralUtxo
480- >> Right <$> printBpiLog @ w Debug " successfully set the collateral utxo in env."
481+ >> Right <$> printBpiLog @ w ( Debug [ CollateralLog ]) " successfully set the collateral utxo in env."
481482 Left err -> pure $ Left $ " Failed to make collateral: " <> err
482483 where
483484 --
484485 helperLog :: PP. Doc () -> ExceptT CollateralUtxo (Eff effs ) ()
485- helperLog msg = newEitherT $ Right <$> printBpiLog @ w Debug msg
486+ helperLog msg = newEitherT $ Right <$> printBpiLog @ w ( Debug [ CollateralLog ]) msg
486487
487488{- | Create collateral UTxO by submitting Tx.
488489 Then try to find created UTxO at own PKH address.
@@ -493,7 +494,7 @@ makeCollateral ::
493494 ContractEnvironment w ->
494495 Eff effs (Either Text CollateralUtxo )
495496makeCollateral cEnv = runEitherT $ do
496- lift $ printBpiLog @ w Notice " Making collateral"
497+ lift $ printBpiLog @ w ( Notice [ CollateralLog ]) " Making collateral"
497498
498499 let pabConf = cEnv. cePABConfig
499500 unbalancedTx <-
@@ -512,7 +513,7 @@ makeCollateral cEnv = runEitherT $ do
512513 WriteBalancedTxFailed e -> throwE . T. pack $ " Failed to create collateral output: " <> show e
513514 WriteBalancedTxSuccess cTx -> do
514515 status <- lift $ awaitTxStatusChange cEnv (getCardanoTxId cTx)
515- lift $ printBpiLog @ w Notice $ " Collateral Tx Status: " <> pretty status
516+ lift $ printBpiLog @ w ( Notice [ CollateralLog ]) $ " Collateral Tx Status: " <> pretty status
516517 newEitherT $ findCollateralAtOwnPKH cEnv
517518
518519-- | Finds a collateral present at user's address
0 commit comments