rvv040 - decodeExchangeAddress modified to return an ExcahngeAddress object
This commit is contained in:
parent
1b2c6dce24
commit
ebfac8438f
2 changed files with 6 additions and 6 deletions
|
@ -159,8 +159,8 @@ encodeExchangeAddress net tr = do
|
||||||
Just vhash
|
Just vhash
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
-- | Decode an Exchange Address into a TransparentAddress
|
-- | Decode an Exchange Address into a ExchangeAddress
|
||||||
decodeExchangeAddress:: T.Text-> Maybe TransparentAddress
|
decodeExchangeAddress:: T.Text-> Maybe ExchangeAddress
|
||||||
decodeExchangeAddress ex = do
|
decodeExchangeAddress ex = do
|
||||||
if (T.length ex ) > 1
|
if (T.length ex ) > 1
|
||||||
then do
|
then do
|
||||||
|
@ -174,12 +174,12 @@ decodeExchangeAddress ex = do
|
||||||
let transparentReceiver = bytes rawd
|
let transparentReceiver = bytes rawd
|
||||||
if hr == tMain
|
if hr == tMain
|
||||||
then Just $
|
then Just $
|
||||||
TransparentAddress MainNet $
|
ExchangeAddress MainNet $
|
||||||
TransparentReceiver P2PKH (fromRawBytes transparentReceiver)
|
TransparentReceiver P2PKH (fromRawBytes transparentReceiver)
|
||||||
else do
|
else do
|
||||||
if hr == tTest
|
if hr == tTest
|
||||||
then Just $
|
then Just $
|
||||||
TransparentAddress TestNet $
|
ExchangeAddress TestNet $
|
||||||
TransparentReceiver P2PKH (fromRawBytes transparentReceiver)
|
TransparentReceiver P2PKH (fromRawBytes transparentReceiver)
|
||||||
else Nothing
|
else Nothing
|
||||||
else Nothing
|
else Nothing
|
||||||
|
|
|
@ -1081,8 +1081,8 @@ main = do
|
||||||
case exch of
|
case exch of
|
||||||
Nothing -> assertFailure "Failed to encode Exchange address"
|
Nothing -> assertFailure "Failed to encode Exchange address"
|
||||||
Just addr -> do
|
Just addr -> do
|
||||||
let tadr = decodeExchangeAddress addr
|
let eadr = decodeExchangeAddress addr
|
||||||
tadr `shouldNotBe` Nothing
|
eadr `shouldNotBe` Nothing
|
||||||
|
|
||||||
-- | Properties
|
-- | Properties
|
||||||
prop_PhraseLength :: Property
|
prop_PhraseLength :: Property
|
||||||
|
|
Loading…
Reference in a new issue