File tree 1 file changed +6
-2
lines changed
hydra-node/src/Hydra/Ledger
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import Cardano.Ledger.Shelley.UTxO qualified as Ledger
28
28
import Codec.CBOR.Decoding qualified as CBOR
29
29
import Codec.CBOR.Encoding qualified as CBOR
30
30
import Control.Monad (foldM )
31
+ import Data.Aeson qualified as Aeson
31
32
import Data.ByteString qualified as BS
32
33
import Data.Default (def )
33
34
import Data.Map.Strict qualified as Map
@@ -125,10 +126,13 @@ instance FromCBOR Tx where
125
126
(pure . fromLedgerTx)
126
127
127
128
instance ToJSON Tx where
128
- toJSON = toJSON . toLedgerTx
129
+ toJSON tx = Aeson. String $ decodeUtf8 @ Text $ serialiseToCBOR tx
129
130
130
131
instance FromJSON Tx where
131
- parseJSON = fmap fromLedgerTx . parseJSON
132
+ parseJSON v = do
133
+ bytes <- encodeUtf8 @ Text <$> parseJSON v
134
+ let cbor = deserialiseFromCBOR (proxyToAsType @ Tx Proxy ) bytes
135
+ either (fail . show ) pure cbor
132
136
133
137
instance Arbitrary Tx where
134
138
-- TODO: shrinker!
You can’t perform that action at this time.
0 commit comments