diff --git a/src/coin-selection/lib/Convex/CoinSelection.hs b/src/coin-selection/lib/Convex/CoinSelection.hs index c19da818..c070f834 100644 --- a/src/coin-selection/lib/Convex/CoinSelection.hs +++ b/src/coin-selection/lib/Convex/CoinSelection.hs @@ -221,14 +221,15 @@ data BalancingError era = BalancingError Text | -- | A single type of balancing error is treated specially: the type with -- 'C.ScriptExecutionError's. - -- TODO: I would like to retain the actual error structure, but this collides (quite massively) - -- with the required JSON encoding / decoding. - ScriptExecutionErr Text -- [(C.ScriptWitnessIndex, C.ScriptExecutionError)] + ScriptExecutionErr [(C.ScriptWitnessIndex, C.ScriptExecutionError)] | CheckMinUtxoValueError (C.TxOut C.CtxTx era) C.Quantity | BalanceCheckError (BalancingError era) | ComputeBalanceChangeError deriving stock (Show, Generic) - deriving anyclass (ToJSON, FromJSON) + +-- TODO: I would like to retain the actual error structure in ScriptExecutionError, but this collides (quite massively) +-- with the required JSON encoding / decoding. +-- deriving anyclass (ToJSON, FromJSON) makeClassyPrisms ''BalancingError @@ -238,7 +239,7 @@ data constructor. balancingError :: (MonadError (BalancingError era) m) => Either (C.TxBodyErrorAutoBalance era) a -> m a balancingError = \case Right a -> pure a - Left err@(C.TxBodyScriptExecutionError _es) -> throwError $ ScriptExecutionErr (asText err) + Left (C.TxBodyScriptExecutionError es) -> throwError $ ScriptExecutionErr es Left err -> throwError . BalancingError $ asText err where asText = Text.pack . C.docToString . C.prettyError @@ -646,7 +647,8 @@ data BalanceTxError era = ACoinSelectionError CoinSelectionError | ABalancingError (BalancingError era) deriving stock (Show, Generic) - deriving anyclass (ToJSON, FromJSON) + +-- deriving anyclass (ToJSON, FromJSON) makeClassyPrisms ''BalanceTxError