Implement full shielded address validation

This commit is contained in:
Rene Vergara 2023-04-18 14:03:29 -05:00
parent 9e1ee2985e
commit c4fc57c0b7
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2
3 changed files with 6 additions and 1 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "haskoin-core"]
path = haskoin-core
url = https://github.com/khazaddum/haskoin-core.git
[submodule "zcash-haskell"]
path = zcash-haskell
url = git@git.vergara.tech:Vergara_Tech/zcash-haskell.git

View file

@ -337,7 +337,7 @@ getAddresses ag = agtransparent ag <> agsapling ag <> agunified ag
validateAddress :: T.Text -> Maybe ZcashPool
validateAddress txt --(tReg || sReg && isJust chk) || (uReg && isJust chk)
| tReg = Just Transparent
| sReg = Just Sapling
| sReg && chkS = Just Sapling
| uReg && chk = Just Orchard
| otherwise = Nothing
where
@ -348,6 +348,7 @@ validateAddress txt --(tReg || sReg && isJust chk) || (uReg && isJust chk)
sReg = T.unpack txt =~ shieldedRegex :: Bool
uReg = T.unpack txt =~ unifiedRegex :: Bool
chk = isValidUnifiedAddress $ E.encodeUtf8 txt
chkS = isValidShieldedAddress $ E.encodeUtf8 txt
-- | RPC methods
-- | List addresses

1
zcash-haskell Submodule

@ -0,0 +1 @@
Subproject commit 1261a585e6f775049e772bccae55233a9fa04b05