From 517b736c9a67a9f54546cce04f589b0fdfa9c8d0 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Wed, 20 Mar 2024 14:16:12 -0500 Subject: [PATCH] Allow for missing `result` in RPC response --- CHANGELOG.md | 1 + src/ZcashHaskell/Types.hs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad3ee7b..fef5e74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Modified the `makeZebraCall` function to handle errors explicitly +- Modified the RPC response to handle missing `result` field ## [0.5.0.1] diff --git a/src/ZcashHaskell/Types.hs b/src/ZcashHaskell/Types.hs index 32f4e57..182ddc1 100644 --- a/src/ZcashHaskell/Types.hs +++ b/src/ZcashHaskell/Types.hs @@ -168,7 +168,7 @@ instance (FromJSON r) => FromJSON (RpcResponse r) where withObject "RpcResponse" $ \obj -> do e <- obj .:? "error" i <- obj .: "id" - r <- obj .: "result" + r <- obj .:? "result" pure $ MakeRpcResponse e i r -- | A type to model the errors from the Zcash RPC