Correct JSON parser for raw Tx

This commit is contained in:
Rene Vergara 2023-09-28 13:56:31 -05:00
parent d78c269d96
commit cbbbaa0fd0
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -48,9 +48,18 @@ instance FromJSON RawTxResponse where
parseJSON = parseJSON =
withObject "RawTxResponse" $ \obj -> do withObject "RawTxResponse" $ \obj -> do
i <- obj .: "txid" i <- obj .: "txid"
o <- obj .: "orchard" o <- obj .:? "orchard"
h <- obj .: "hex" h <- obj .: "hex"
a <- o .: "actions" case o of
Nothing ->
pure $
RawTxResponse
i
(decodeHexText h)
(getShieldedOutputs (decodeHexText h))
[]
Just o' -> do
a <- o' .: "actions"
pure $ pure $
RawTxResponse RawTxResponse
i i