|
9 | 9 | {-# LANGUAGE MultiWayIf #-}
|
10 | 10 | {-# LANGUAGE NamedFieldPuns #-}
|
11 | 11 | {-# LANGUAGE NumericUnderscores #-}
|
| 12 | +{-# LANGUAGE OverloadedStrings #-} |
12 | 13 | {-# LANGUAGE RankNTypes #-}
|
13 | 14 | {-# LANGUAGE TemplateHaskell #-}
|
14 | 15 | {-# LANGUAGE TupleSections #-}
|
@@ -141,7 +142,8 @@ import Convex.Utxos (
|
141 | 142 | import Convex.Utxos qualified as Utxos
|
142 | 143 | import Convex.Wallet (Wallet)
|
143 | 144 | import Convex.Wallet qualified as Wallet
|
144 |
| -import Data.Aeson (FromJSON (..), ToJSON (..)) |
| 145 | +import Data.Aeson (FromJSON (..), Options (sumEncoding), SumEncoding (..), ToJSON (..), withObject, (.:)) |
| 146 | +import Data.Aeson.TH (defaultOptions, deriveFromJSON) |
145 | 147 | import Data.Bifunctor (Bifunctor (..))
|
146 | 148 | import Data.Default (Default (..))
|
147 | 149 | import Data.Function (on)
|
@@ -222,9 +224,9 @@ bodyError :: C.TxBodyError -> CoinSelectionError
|
222 | 224 | bodyError = BodyError . Text.pack . C.docToString . C.prettyError
|
223 | 225 |
|
224 | 226 | -- Orphan instance, needed to allow full json from here on.
|
| 227 | +-- TODO: Check that automatic generation is compatible with cardano-api encoding. |
225 | 228 |
|
226 |
| -instance FromJSON C.ScriptWitnessIndex where |
227 |
| - parseJSON = undefined |
| 229 | +$(deriveFromJSON defaultOptions{sumEncoding = TaggedObject{tagFieldName = "kind", contentsFieldName = "value"}} ''C.ScriptWitnessIndex) |
228 | 230 |
|
229 | 231 | -- | Balancing errors, including the *special* 'BalancingScriptExecutionErr'.
|
230 | 232 | data BalancingError era
|
|
0 commit comments