Skip to content

Commit 6de6e56

Browse files
Merge pull request #107 from mlabs-haskell/chase/trace-logs
Chase/trace logs
2 parents 17072f2 + e3099d8 commit 6de6e56

File tree

8 files changed

+234
-52
lines changed

8 files changed

+234
-52
lines changed

bot-plutus-interface.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ library
124124
, plutus-pab
125125
, plutus-tx
126126
, plutus-tx-plugin
127+
, prettyprinter
127128
, process
128129
, QuickCheck
129130
, row-types
@@ -140,6 +141,7 @@ library
140141
, transformers-except
141142
, unordered-containers
142143
, uuid
144+
, vector
143145
, wai
144146
, warp
145147
, websockets
@@ -193,6 +195,7 @@ test-suite bot-plutus-interface-test
193195
, plutus-pab
194196
, plutus-tx
195197
, plutus-tx-plugin
198+
, prettyprinter
196199
, QuickCheck
197200
, quickcheck-instances
198201
, row-types

flake.lock

Lines changed: 114 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "bot-plutus-interface";
33

44
inputs = {
5-
haskell-nix.url = "github:L-as/haskell.nix";
5+
haskell-nix.url = "github:mlabs-haskell/haskell.nix";
66

77
nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
88

src/BotPlutusInterface/Balance.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module BotPlutusInterface.Balance (
77
) where
88

99
import BotPlutusInterface.CardanoCLI qualified as CardanoCLI
10-
import BotPlutusInterface.Effects (PABEffect, createDirectoryIfMissingCLI, printLog)
10+
import BotPlutusInterface.Effects (PABEffect, createDirectoryIfMissingCLI, printBpiLog)
1111
import BotPlutusInterface.Files (DummyPrivKey, unDummyPrivateKey)
1212
import BotPlutusInterface.Files qualified as Files
1313
import BotPlutusInterface.Types (LogLevel (Debug), PABConfig)
@@ -60,6 +60,7 @@ import Plutus.V1.Ledger.Api (
6060
)
6161

6262
import BotPlutusInterface.BodyBuilder qualified as BodyBuilder
63+
import Prettyprinter (pretty, viaShow, (<+>))
6364
import Prelude
6465

6566
{- | Collect necessary tx inputs and collaterals, add minimum lovelace values and balance non ada
@@ -86,7 +87,7 @@ balanceTxIO pabConf ownPkh unbalancedTx =
8687
(unBalancedTxValidityTimeRange unbalancedTx)
8788
(unBalancedTxTx unbalancedTx)
8889

89-
lift $ printLog @w Debug $ show utxoIndex
90+
lift $ printBpiLog @w Debug $ viaShow utxoIndex
9091

9192
-- We need this folder on the CLI machine, which may not be the local machine
9293
lift $ createDirectoryIfMissingCLI @w False (Text.unpack pabConf.pcTxFileDir)
@@ -130,7 +131,7 @@ balanceTxIO pabConf ownPkh unbalancedTx =
130131

131132
let minUtxos = prevMinUtxos ++ nextMinUtxos
132133

133-
lift $ printLog @w Debug $ "Min utxos: " ++ show minUtxos
134+
lift $ printBpiLog @w Debug $ "Min utxos:" <+> pretty minUtxos
134135

135136
-- Calculate fees by pre-balancing the tx, building it, and running the CLI on result
136137
txWithoutFees <-
@@ -142,7 +143,7 @@ balanceTxIO pabConf ownPkh unbalancedTx =
142143

143144
let fees = nonBudgettedFees + getBudgetPrice (getExecutionUnitPrices pabConf) exBudget
144145

145-
lift $ printLog @w Debug $ "Fees: " ++ show fees
146+
lift $ printBpiLog @w Debug $ "Fees:" <+> pretty fees
146147

147148
-- Rebalance the initial tx with the above fees
148149
balancedTx <- hoistEither $ balanceTxStep minUtxos utxoIndex changeAddr $ tx `withFee` fees

0 commit comments

Comments
 (0)