From 4289a9ded67ef2ca432abc412934fb5b8b59a9cf Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Sat, 14 Dec 2024 12:51:06 +0000 Subject: [PATCH] Support for Zebra 2.1.0 (#102) This PR has the changes needed to support the new format of the response of `getblock` released on Zebra 2.1.0. Reviewed-on: https://git.vergara.tech/Vergara_Tech/zcash-haskell/pulls/102 Co-authored-by: Rene Vergara Co-committed-by: Rene Vergara --- CHANGELOG.md | 6 ++++++ src/ZcashHaskell/Types.hs | 4 ++-- zcash-haskell.cabal | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed642a7..973ccec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.6.0] + +### Changed + +- Removed workaround for missing `time` field in Zebra's `getblock` response. + ## [0.7.5.0] ### Added diff --git a/src/ZcashHaskell/Types.hs b/src/ZcashHaskell/Types.hs index 1c55a73..a02ed15 100644 --- a/src/ZcashHaskell/Types.hs +++ b/src/ZcashHaskell/Types.hs @@ -268,10 +268,10 @@ instance FromJSON BlockResponse where withObject "BlockResponse" $ \obj -> do c <- obj .: "confirmations" h <- obj .: "height" - t <- obj .:? "time" + t <- obj .: "time" txs <- obj .: "tx" hash <- obj .: "hash" - pure $ BlockResponse hash c h (fromMaybe 0 t) txs + pure $ BlockResponse hash c h t txs instance ToJSON BlockResponse where toJSON (BlockResponse h c ht t txs) = diff --git a/zcash-haskell.cabal b/zcash-haskell.cabal index c1d1d82..4cddd8a 100644 --- a/zcash-haskell.cabal +++ b/zcash-haskell.cabal @@ -5,7 +5,7 @@ cabal-version: 3.0 -- see: https://github.com/sol/hpack name: zcash-haskell -version: 0.7.5.0 +version: 0.7.6.0 synopsis: Utilities to interact with the Zcash blockchain description: Please see the README on the repo at category: Blockchain