Account for missing block time field
This commit is contained in:
parent
d659368cff
commit
5b6ce3f29b
1 changed files with 4 additions and 3 deletions
|
@ -7,7 +7,7 @@
|
||||||
-- Copyright : 2022-2024 Vergara Technologies
|
-- Copyright : 2022-2024 Vergara Technologies
|
||||||
-- License : MIT
|
-- License : MIT
|
||||||
--
|
--
|
||||||
-- Maintainer : pitmut@vergara.tech
|
-- Maintainer : pitmutt@vergara.tech
|
||||||
-- Stability : experimental
|
-- Stability : experimental
|
||||||
-- Portability : unknown
|
-- Portability : unknown
|
||||||
--
|
--
|
||||||
|
@ -31,6 +31,7 @@ import qualified Data.ByteString as BS
|
||||||
import qualified Data.ByteString.Char8 as C
|
import qualified Data.ByteString.Char8 as C
|
||||||
import Data.HexString
|
import Data.HexString
|
||||||
import Data.Int
|
import Data.Int
|
||||||
|
import Data.Maybe (fromMaybe)
|
||||||
import Data.Structured
|
import Data.Structured
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
|
@ -199,9 +200,9 @@ instance FromJSON BlockResponse where
|
||||||
withObject "BlockResponse" $ \obj -> do
|
withObject "BlockResponse" $ \obj -> do
|
||||||
c <- obj .: "confirmations"
|
c <- obj .: "confirmations"
|
||||||
h <- obj .: "height"
|
h <- obj .: "height"
|
||||||
t <- obj .: "time"
|
t <- obj .:? "time"
|
||||||
txs <- obj .: "tx"
|
txs <- obj .: "tx"
|
||||||
pure $ BlockResponse c h t txs
|
pure $ BlockResponse c h (fromMaybe 0 t) txs
|
||||||
|
|
||||||
-- | Type to represent response from the `zcashd` RPC `getrawtransaction`
|
-- | Type to represent response from the `zcashd` RPC `getrawtransaction`
|
||||||
data RawTxResponse = RawTxResponse
|
data RawTxResponse = RawTxResponse
|
||||||
|
|
Loading…
Reference in a new issue