Skip to content

Commit eda445f

Browse files
Merge branch 'master' into misha/issue-100-time-conversions
2 parents 8454d26 + 6de6e56 commit eda445f

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
@@ -127,6 +127,7 @@ library
127127
, plutus-pab
128128
, plutus-tx
129129
, plutus-tx-plugin
130+
, prettyprinter
130131
, process
131132
, QuickCheck
132133
, row-types
@@ -144,6 +145,7 @@ library
144145
, transformers-except
145146
, unordered-containers
146147
, uuid
148+
, vector
147149
, wai
148150
, warp
149151
, websockets
@@ -197,6 +199,7 @@ test-suite bot-plutus-interface-test
197199
, plutus-pab
198200
, plutus-tx
199201
, plutus-tx-plugin
202+
, prettyprinter
200203
, QuickCheck
201204
, quickcheck-instances
202205
, 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
@@ -11,7 +11,7 @@ import BotPlutusInterface.Effects (
1111
PABEffect,
1212
createDirectoryIfMissingCLI,
1313
posixTimeRangeToContainedSlotRange,
14-
printLog,
14+
printBpiLog,
1515
)
1616
import BotPlutusInterface.Files (DummyPrivKey, unDummyPrivateKey)
1717
import BotPlutusInterface.Files qualified as Files
@@ -65,6 +65,7 @@ import Plutus.V1.Ledger.Api (
6565

6666
import BotPlutusInterface.BodyBuilder qualified as BodyBuilder
6767
import Data.Bifunctor (bimap)
68+
import Prettyprinter (pretty, viaShow, (<+>))
6869
import Prelude
6970

7071
{- | Collect necessary tx inputs and collaterals, add minimum lovelace values and balance non ada
@@ -91,7 +92,7 @@ balanceTxIO pabConf ownPkh unbalancedTx =
9192
(unBalancedTxValidityTimeRange unbalancedTx)
9293
(unBalancedTxTx unbalancedTx)
9394

94-
lift $ printLog @w Debug $ show utxoIndex
95+
lift $ printBpiLog @w Debug $ viaShow utxoIndex
9596

9697
-- We need this folder on the CLI machine, which may not be the local machine
9798
lift $ createDirectoryIfMissingCLI @w False (Text.unpack "pcTxFileDir")
@@ -135,7 +136,7 @@ balanceTxIO pabConf ownPkh unbalancedTx =
135136

136137
let minUtxos = prevMinUtxos ++ nextMinUtxos
137138

138-
lift $ printLog @w Debug $ "Min utxos: " ++ show minUtxos
139+
lift $ printBpiLog @w Debug $ "Min utxos:" <+> pretty minUtxos
139140

140141
-- Calculate fees by pre-balancing the tx, building it, and running the CLI on result
141142
txWithoutFees <-
@@ -147,7 +148,7 @@ balanceTxIO pabConf ownPkh unbalancedTx =
147148

148149
let fees = nonBudgettedFees + getBudgetPrice (getExecutionUnitPrices pabConf) exBudget
149150

150-
lift $ printLog @w Debug $ "Fees: " ++ show fees
151+
lift $ printBpiLog @w Debug $ "Fees:" <+> pretty fees
151152

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

0 commit comments

Comments
 (0)