From 7992e5bfbe4e747d702f5bc6e27d85a7a9041ba4 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Mon, 2 Oct 2023 15:25:44 -0500 Subject: [PATCH] Expand fields of raw Tx parsing --- src/ZcashHaskell/Sapling.hs | 9 +++++++++ src/ZcashHaskell/Types.hs | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/ZcashHaskell/Sapling.hs b/src/ZcashHaskell/Sapling.hs index ac583cd..8207e75 100644 --- a/src/ZcashHaskell/Sapling.hs +++ b/src/ZcashHaskell/Sapling.hs @@ -57,6 +57,9 @@ instance FromJSON RawTxResponse where i <- obj .: "txid" o <- obj .:? "orchard" h <- obj .: "hex" + ht <- obj .: "height" + c <- obj .: "confirmations" + b <- obj .: "blocktime" case o of Nothing -> pure $ @@ -65,6 +68,9 @@ instance FromJSON RawTxResponse where (decodeHexText h) (getShieldedOutputs (decodeHexText h)) [] + ht + c + b Just o' -> do a <- o' .: "actions" pure $ @@ -73,3 +79,6 @@ instance FromJSON RawTxResponse where (decodeHexText h) (getShieldedOutputs (decodeHexText h)) a + ht + c + b diff --git a/src/ZcashHaskell/Types.hs b/src/ZcashHaskell/Types.hs index 51fe2c0..08dec78 100644 --- a/src/ZcashHaskell/Types.hs +++ b/src/ZcashHaskell/Types.hs @@ -105,6 +105,9 @@ data RawTxResponse = RawTxResponse , rt_hex :: BS.ByteString , rt_shieldedOutputs :: [BS.ByteString] , rt_orchardActions :: [OrchardAction] + , rt_blockheight :: Integer + , rt_confirmations :: Integer + , rt_blocktime :: Integer } deriving (Prelude.Show, Eq) -- * Sapling