Implement Unified HRP constants
This commit is contained in:
parent
b568ee5ff4
commit
977f4e791d
3 changed files with 25 additions and 37 deletions
|
@ -77,8 +77,8 @@ encodeUnifiedAddress ua = encodeBech32m (E.encodeUtf8 hr) b
|
||||||
where
|
where
|
||||||
hr =
|
hr =
|
||||||
case ua_net ua of
|
case ua_net ua of
|
||||||
MainNet -> "u"
|
MainNet -> uniPaymentAddressHrp
|
||||||
TestNet -> "utest"
|
TestNet -> uniTestPaymentAddressHrp
|
||||||
b = f4Jumble $ tReceiver <> sReceiver <> oReceiver <> padding
|
b = f4Jumble $ tReceiver <> sReceiver <> oReceiver <> padding
|
||||||
tReceiver =
|
tReceiver =
|
||||||
case t_rec ua of
|
case t_rec ua of
|
||||||
|
|
|
@ -77,43 +77,31 @@ getValue c =
|
||||||
TestNetCoin -> 1
|
TestNetCoin -> 1
|
||||||
RegTestNetCoin -> 1
|
RegTestNetCoin -> 1
|
||||||
|
|
||||||
-- | Type for Sapling Human-readable part
|
-- | Constants for Sapling Human-readable part
|
||||||
data SaplingHrp
|
sapExtSpendingKeyHrp = "secret-extended-key-main" :: String
|
||||||
= SapExtSpendingKey
|
|
||||||
| SapExtFullViewingKey
|
|
||||||
| SapPaymentAddress
|
|
||||||
| SapTestExtSpendingKey
|
|
||||||
| SapTestExtFullViewingKey
|
|
||||||
| SapTestPaymentAddress
|
|
||||||
|
|
||||||
getSaplingHrp :: SaplingHrp -> String
|
sapExtFullViewingKeyHrp = "zxviews" :: String
|
||||||
getSaplingHrp s =
|
|
||||||
case s of
|
|
||||||
SapExtSpendingKey -> "secret-extended-key-main"
|
|
||||||
SapExtFullViewingKey -> "zxviews"
|
|
||||||
SapPaymentAddress -> "zs"
|
|
||||||
SapTestExtSpendingKey -> "secret-extended-key-test"
|
|
||||||
SapTestExtFullViewingKey -> "zxviewtestsapling"
|
|
||||||
SapTestPaymentAddress -> "ztestsapling"
|
|
||||||
|
|
||||||
-- | Type for Unified Human-readable part
|
sapPaymentAddressHrp = "zs" :: String
|
||||||
data UnifiedHrp
|
|
||||||
= UniPaymentAddress
|
|
||||||
| UniFullViewingKey
|
|
||||||
| UniIncomingViewingKey
|
|
||||||
| UniTestPaymentAddress
|
|
||||||
| UniTestFullViewingKey
|
|
||||||
| UniTestIncomingViewingKey
|
|
||||||
|
|
||||||
getUnifiedHrp :: UnifiedHrp -> String
|
sapTestExtSpendingKeyHrp = "secret-extended-key-test" :: String
|
||||||
getUnifiedHrp s =
|
|
||||||
case s of
|
sapTestExtFullViewingKeyHrp = "zxviewtestsapling" :: String
|
||||||
UniPaymentAddress -> "u"
|
|
||||||
UniFullViewingKey -> "uview"
|
sapTestPaymentAddressHrp = "ztestsapling" :: String
|
||||||
UniIncomingViewingKey -> "uivk"
|
|
||||||
UniTestPaymentAddress -> "utest"
|
-- | Constants for Unified Human-readable part
|
||||||
UniTestFullViewingKey -> "uviewtest"
|
uniPaymentAddressHrp = "u" :: T.Text
|
||||||
UniTestIncomingViewingKey -> "uivktest"
|
|
||||||
|
uniFullViewingKeyHrp = "uview" :: T.Text
|
||||||
|
|
||||||
|
uniIncomingViewingKeyHrp = "uivk" :: T.Text
|
||||||
|
|
||||||
|
uniTestPaymentAddressHrp = "utest" :: T.Text
|
||||||
|
|
||||||
|
uniTestFullViewingKeyHrp = "uviewtest" :: T.Text
|
||||||
|
|
||||||
|
uniTestIncomingViewingKeyHrp = "uivktest" :: T.Text
|
||||||
|
|
||||||
-- | Function to get the Base58 prefix for encoding a 'TransparentAddress'
|
-- | Function to get the Base58 prefix for encoding a 'TransparentAddress'
|
||||||
getTransparentPrefix :: ZcashNet -> TransparentType -> (Word8, Word8)
|
getTransparentPrefix :: ZcashNet -> TransparentType -> (Word8, Word8)
|
||||||
|
|
|
@ -5,7 +5,7 @@ cabal-version: 3.0
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
version: 0.4.3.0
|
version: 0.4.3.1
|
||||||
synopsis: Utilities to interact with the Zcash blockchain
|
synopsis: Utilities to interact with the Zcash blockchain
|
||||||
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
||||||
category: Blockchain
|
category: Blockchain
|
||||||
|
|
Loading…
Reference in a new issue