From 165977eecf3a914b19c01a83993f7f24a994960d Mon Sep 17 00:00:00 2001 From: "Rene Vergara A." Date: Sun, 29 Sep 2024 20:57:32 -0400 Subject: [PATCH] rvv001 - Saving work in progress.... --- src/Zenith/Utils.hs | 39 ++++++++++++--------------------------- zcash-haskell | 2 +- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/src/Zenith/Utils.hs b/src/Zenith/Utils.hs index e5b54c3..e38beb1 100644 --- a/src/Zenith/Utils.hs +++ b/src/Zenith/Utils.hs @@ -24,7 +24,7 @@ import ZcashHaskell.Types , TransparentAddress(..) , UnifiedAddress(..) , ZcashNet(..) - , ValidAddress(..) + , ValidAddress(..) , ExchangeAddress(..) ) import Zenith.Types @@ -126,7 +126,7 @@ isRecipientValid a = do Nothing -> False) isUnifiedAddressValid :: T.Text -> Bool -isUnifiedAddressValid ua = +isUnifiedAddressValid ua = case isValidUnifiedAddress (E.encodeUtf8 ua) of Just _a1 -> True Nothing -> False @@ -135,41 +135,26 @@ isSaplingAddressValid :: T.Text -> Bool isSaplingAddressValid sa = isValidShieldedAddress (E.encodeUtf8 sa) isTransparentAddressValid :: T.Text -> Bool -isTransparentAddressValid ta = +isTransparentAddressValid ta = case decodeTransparentAddress (E.encodeUtf8 ta) of Just _a3 -> True Nothing -> False isExchangeAddressValid :: T.Text -> Bool -isExchangeAddressValid xa = +isExchangeAddressValid xa = case decodeExchangeAddress (E.encodeUtf8 xa) of Just _a4 -> True - Nothing -> False + Nothing -> False isRecipientValidGUI :: PrivacyPolicy -> T.Text -> Bool isRecipientValidGUI p a = do - let adr = (parseAddress a) - case adr of - Just a -> - case p of - Full -> case a of - Unified ua -> True - Sapling sa -> True - _ -> False - Medium -> case a of - Unified ua -> True - Sapling sa -> True - _ -> False - Low -> case a of - Unified ua -> True - Sapling sa -> True - Transparent ta -> True - Exchange ea -> True - None -> case a of - Transparent ta -> True - Exchange ea -> True - _ -> False - + let adr = parseAddress a + case p of + Full -> True + Medium -> True + Low -> False + None -> False + isZecAddressValid :: T.Text -> Bool isZecAddressValid a = do case isValidUnifiedAddress (E.encodeUtf8 a) of diff --git a/zcash-haskell b/zcash-haskell index 7965dc3..1229602 160000 --- a/zcash-haskell +++ b/zcash-haskell @@ -1 +1 @@ -Subproject commit 7965dc38c48da348f503a52ee10042fffc43f32c +Subproject commit 12296026a0ebb9a5afe0904b251c5d31080eab18