Correct JSON parser for raw Tx
This commit is contained in:
parent
d78c269d96
commit
cbbbaa0fd0
1 changed files with 17 additions and 8 deletions
|
@ -48,12 +48,21 @@ 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
|
||||||
pure $
|
Nothing ->
|
||||||
RawTxResponse
|
pure $
|
||||||
i
|
RawTxResponse
|
||||||
(decodeHexText h)
|
i
|
||||||
(getShieldedOutputs (decodeHexText h))
|
(decodeHexText h)
|
||||||
a
|
(getShieldedOutputs (decodeHexText h))
|
||||||
|
[]
|
||||||
|
Just o' -> do
|
||||||
|
a <- o' .: "actions"
|
||||||
|
pure $
|
||||||
|
RawTxResponse
|
||||||
|
i
|
||||||
|
(decodeHexText h)
|
||||||
|
(getShieldedOutputs (decodeHexText h))
|
||||||
|
a
|
||||||
|
|
Loading…
Reference in a new issue