From dabd149df2e051b8e5a84bbfdbf1a4a8a8738f58 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Fri, 12 Jan 2024 08:25:23 -0600 Subject: [PATCH] Account for transparent change addresses under UA --- src/Zenith.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Zenith.hs b/src/Zenith.hs index 4ad8bb7..08d184f 100644 --- a/src/Zenith.hs +++ b/src/Zenith.hs @@ -28,10 +28,6 @@ import qualified Data.Text.IO as TIO import qualified Data.Vector as V import Data.Word import GHC.Generics -import ZcashHaskell.Orchard (isValidUnifiedAddress) -import ZcashHaskell.Sapling (isValidShieldedAddress) - -{-import Haskoin.Address.Bech32-} import Network.HTTP.Simple import Network.HTTP.Types import Numeric @@ -43,6 +39,8 @@ import Text.Read (readMaybe) import Text.Regex import Text.Regex.Base import Text.Regex.Posix +import ZcashHaskell.Orchard (isValidUnifiedAddress) +import ZcashHaskell.Sapling (isValidShieldedAddress) -- | A type to model Zcash RPC calls data RpcCall = RpcCall @@ -153,8 +151,8 @@ instance FromJSON AddressGroup where case c of Nothing -> return [] Just x -> do - x' <- x .: "addresses" - return $ map (ZcashAddress s1 [Transparent] Nothing) x' + x' <- x .:? "addresses" + return $ maybe [] (map (ZcashAddress s1 [Transparent] Nothing)) x' processSapling k s2 = case k of Nothing -> return []