From 5a08c802854eebd1b5b4d8e7e1e2dad574b06100 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Fri, 11 Oct 2024 08:17:02 -0500 Subject: [PATCH] feat: add `toJSON` for `BlockResponse` --- CHANGELOG.md | 21 +++++++++++++++++++++ cabal.project.freeze | 23 ++++++++++++----------- src/ZcashHaskell/Types.hs | 10 ++++++++++ zcash-haskell.cabal | 2 +- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a68512..1feacf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,27 @@ 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.1.1] + +### Added + +- `ToJSON` instance for `BlockResponse` + +### Changed + +- Updated libraries: + - conduit + - data-fix + - happy + - happy-lib + - http-conduit + - iproute + - mono-traversable + - network + - secp256k1-haskell + - strict + - typed-process + ## [0.7.1.0] ### Added diff --git a/cabal.project.freeze b/cabal.project.freeze index b5bd80f..206c446 100644 --- a/cabal.project.freeze +++ b/cabal.project.freeze @@ -54,7 +54,7 @@ constraints: any.Cabal ==3.10.3.0, any.colour ==2.3.6, any.comonad ==5.0.8, comonad +containers +distributive +indexed-traversable, - any.conduit ==1.3.5, + any.conduit ==1.3.6, any.conduit-extra ==1.3.6, any.containers ==0.6.7, any.contravariant ==1.5.5, @@ -74,7 +74,7 @@ constraints: any.Cabal ==3.10.3.0, any.data-default-instances-containers ==0.0.1, any.data-default-instances-dlist ==0.0.1, any.data-default-instances-old-locale ==0.0.1, - any.data-fix ==0.3.3, + any.data-fix ==0.3.4, any.deepseq ==1.4.8.1, any.directory ==1.3.8.4, any.distributive ==0.6.2.1, @@ -93,7 +93,8 @@ constraints: any.Cabal ==3.10.3.0, any.ghc-boot-th ==9.6.5, any.ghc-prim ==0.10.0, any.half ==0.3.1, - any.happy ==1.20.1.1, + any.happy ==2.0.2, + any.happy-lib ==2.0.2, any.hashable ==1.4.7.0, hashable -arch-native +integer-gmp -random-initial-seed, any.haskell-lexer ==1.1.1, @@ -109,7 +110,7 @@ constraints: any.Cabal ==3.10.3.0, any.http-client ==0.7.17, http-client +network-uri, any.http-client-tls ==0.3.6.3, - any.http-conduit ==2.3.8.3, + any.http-conduit ==2.3.9, http-conduit +aeson, any.http-types ==0.12.4, any.indexed-traversable ==0.1.4, @@ -118,16 +119,16 @@ constraints: any.Cabal ==3.10.3.0, any.integer-gmp ==1.1, any.integer-logarithms ==1.0.3.1, integer-logarithms -check-bounds +integer-gmp, - any.iproute ==1.7.12, + any.iproute ==1.7.14, any.language-c ==0.9.3, language-c -allwarnings +iecfpextension +usebytestrings, any.memory ==0.18.0, memory +support_bytestring +support_deepseq, any.mime-types ==0.1.2.0, - any.mono-traversable ==1.0.17.0, + any.mono-traversable ==1.0.20.0, any.mtl ==2.3.1, any.murmur3 ==1.0.5, - any.network ==3.2.1.0, + any.network ==3.2.4.0, network -devel, any.network-uri ==2.6.4.2, any.old-locale ==1.0.0.7, @@ -150,7 +151,7 @@ constraints: any.Cabal ==3.10.3.0, any.safe ==0.3.21, any.scientific ==0.3.8.0, scientific -integer-simple, - any.secp256k1-haskell ==1.2.0, + any.secp256k1-haskell ==1.4.0, any.semialign ==1.3.1, semialign +semigroupoids, any.semigroupoids ==6.0.1, @@ -165,7 +166,7 @@ constraints: any.Cabal ==3.10.3.0, any.stm ==2.5.1.0, any.streaming-commons ==0.2.2.6, streaming-commons -use-bytestring-builder, - any.strict ==0.5, + any.strict ==0.5.1, any.string-conversions ==0.4.0.1, any.tagged ==0.8.8, tagged +deepseq +transformers, @@ -185,7 +186,7 @@ constraints: any.Cabal ==3.10.3.0, any.transformers ==0.6.1.0, any.transformers-compat ==0.7.2, transformers-compat -five +five-three -four +generic-deriving +mtl -three -two, - any.typed-process ==0.2.11.1, + any.typed-process ==0.2.12.0, any.unix ==2.8.4.0, any.unix-time ==0.4.15, any.unliftio-core ==0.2.1.0, @@ -204,4 +205,4 @@ constraints: any.Cabal ==3.10.3.0, any.witherable ==0.5, any.zlib ==0.7.1.0, zlib -bundled-c-zlib +non-blocking-ffi +pkg-config -index-state: hackage.haskell.org 2024-07-01T20:28:56Z +index-state: hackage.haskell.org 2024-10-11T12:55:31Z diff --git a/src/ZcashHaskell/Types.hs b/src/ZcashHaskell/Types.hs index 0fc44c3..ebf3dbf 100644 --- a/src/ZcashHaskell/Types.hs +++ b/src/ZcashHaskell/Types.hs @@ -273,6 +273,16 @@ instance FromJSON BlockResponse where hash <- obj .: "hash" pure $ BlockResponse hash c h (fromMaybe 0 t) txs +instance ToJSON BlockResponse where + toJSON (BlockResponse h c ht t txs) = + object + [ "hash" .= h + , "confirmations" .= c + , "height" .= ht + , "time" .= t + , "tx" .= txs + ] + -- | Type to represent response from the `zcashd` RPC `getrawtransaction` data RawTxResponse = RawTxResponse { rt_id :: !HexString diff --git a/zcash-haskell.cabal b/zcash-haskell.cabal index bcec9de..babe1f3 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.1.0 +version: 0.7.1.1 synopsis: Utilities to interact with the Zcash blockchain description: Please see the README on the repo at category: Blockchain