File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import Data.Kind (Type)
3333import Data.List (uncons , (\\) )
3434import Data.Map (Map )
3535import Data.Map qualified as Map
36- import Data.Maybe (fromJust , fromMaybe , mapMaybe )
36+ import Data.Maybe (fromMaybe , mapMaybe )
3737import Data.Set (Set )
3838import Data.Set qualified as Set
3939import Data.Text (Text )
@@ -144,12 +144,13 @@ balanceTxIO' pabConf ownPkh unbalancedTx balanceTxType =
144144 -- Adds required collaterals in the `Tx`, if the `Tx` is of type `BalanceTxWithScripts`.
145145 -- Also adds signatures for fee calculation
146146 preBalancedTx <-
147- if balanceTxType == BalanceTxWithScripts
148- then
149- hoistEither $
150- addSignatories ownPkh privKeys requiredSigs $
151- addTxCollaterals (fromJust mcollateral) tx
152- else hoistEither $ addSignatories ownPkh privKeys requiredSigs tx
147+ case balanceTxType of
148+ BalanceTxWithScripts ->
149+ maybe
150+ (throwE " Tx uses script but no collateral was provided." )
151+ (hoistEither . addSignatories ownPkh privKeys requiredSigs . flip addTxCollaterals tx)
152+ mcollateral
153+ _ -> hoistEither $ addSignatories ownPkh privKeys requiredSigs tx
153154
154155 -- Balance the tx
155156 (balancedTx, minUtxos) <- balanceTxLoop utxoIndex privKeys [] preBalancedTx
You can’t perform that action at this time.
0 commit comments