rvv040 - decodeExchangeAddress modified to return an ExcahngeAddress object

This commit is contained in:
Rene V. Vergara A. 2024-04-18 08:30:14 -04:00
parent 1b2c6dce24
commit ebfac8438f
2 changed files with 6 additions and 6 deletions

View file

@ -159,8 +159,8 @@ encodeExchangeAddress net tr = do
Just vhash
_ -> Nothing
-- | Decode an Exchange Address into a TransparentAddress
decodeExchangeAddress:: T.Text-> Maybe TransparentAddress
-- | Decode an Exchange Address into a ExchangeAddress
decodeExchangeAddress:: T.Text-> Maybe ExchangeAddress
decodeExchangeAddress ex = do
if (T.length ex ) > 1
then do
@ -174,12 +174,12 @@ decodeExchangeAddress ex = do
let transparentReceiver = bytes rawd
if hr == tMain
then Just $
TransparentAddress MainNet $
ExchangeAddress MainNet $
TransparentReceiver P2PKH (fromRawBytes transparentReceiver)
else do
if hr == tTest
then Just $
TransparentAddress TestNet $
ExchangeAddress TestNet $
TransparentReceiver P2PKH (fromRawBytes transparentReceiver)
else Nothing
else Nothing

View file

@ -1081,8 +1081,8 @@ main = do
case exch of
Nothing -> assertFailure "Failed to encode Exchange address"
Just addr -> do
let tadr = decodeExchangeAddress addr
tadr `shouldNotBe` Nothing
let eadr = decodeExchangeAddress addr
eadr `shouldNotBe` Nothing
-- | Properties
prop_PhraseLength :: Property