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
|
||||
hr =
|
||||
case ua_net ua of
|
||||
MainNet -> "u"
|
||||
TestNet -> "utest"
|
||||
MainNet -> uniPaymentAddressHrp
|
||||
TestNet -> uniTestPaymentAddressHrp
|
||||
b = f4Jumble $ tReceiver <> sReceiver <> oReceiver <> padding
|
||||
tReceiver =
|
||||
case t_rec ua of
|
||||
|
|
|
@ -77,43 +77,31 @@ getValue c =
|
|||
TestNetCoin -> 1
|
||||
RegTestNetCoin -> 1
|
||||
|
||||
-- | Type for Sapling Human-readable part
|
||||
data SaplingHrp
|
||||
= SapExtSpendingKey
|
||||
| SapExtFullViewingKey
|
||||
| SapPaymentAddress
|
||||
| SapTestExtSpendingKey
|
||||
| SapTestExtFullViewingKey
|
||||
| SapTestPaymentAddress
|
||||
-- | Constants for Sapling Human-readable part
|
||||
sapExtSpendingKeyHrp = "secret-extended-key-main" :: String
|
||||
|
||||
getSaplingHrp :: SaplingHrp -> String
|
||||
getSaplingHrp s =
|
||||
case s of
|
||||
SapExtSpendingKey -> "secret-extended-key-main"
|
||||
SapExtFullViewingKey -> "zxviews"
|
||||
SapPaymentAddress -> "zs"
|
||||
SapTestExtSpendingKey -> "secret-extended-key-test"
|
||||
SapTestExtFullViewingKey -> "zxviewtestsapling"
|
||||
SapTestPaymentAddress -> "ztestsapling"
|
||||
sapExtFullViewingKeyHrp = "zxviews" :: String
|
||||
|
||||
-- | Type for Unified Human-readable part
|
||||
data UnifiedHrp
|
||||
= UniPaymentAddress
|
||||
| UniFullViewingKey
|
||||
| UniIncomingViewingKey
|
||||
| UniTestPaymentAddress
|
||||
| UniTestFullViewingKey
|
||||
| UniTestIncomingViewingKey
|
||||
sapPaymentAddressHrp = "zs" :: String
|
||||
|
||||
getUnifiedHrp :: UnifiedHrp -> String
|
||||
getUnifiedHrp s =
|
||||
case s of
|
||||
UniPaymentAddress -> "u"
|
||||
UniFullViewingKey -> "uview"
|
||||
UniIncomingViewingKey -> "uivk"
|
||||
UniTestPaymentAddress -> "utest"
|
||||
UniTestFullViewingKey -> "uviewtest"
|
||||
UniTestIncomingViewingKey -> "uivktest"
|
||||
sapTestExtSpendingKeyHrp = "secret-extended-key-test" :: String
|
||||
|
||||
sapTestExtFullViewingKeyHrp = "zxviewtestsapling" :: String
|
||||
|
||||
sapTestPaymentAddressHrp = "ztestsapling" :: String
|
||||
|
||||
-- | Constants for Unified Human-readable part
|
||||
uniPaymentAddressHrp = "u" :: T.Text
|
||||
|
||||
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'
|
||||
getTransparentPrefix :: ZcashNet -> TransparentType -> (Word8, Word8)
|
||||
|
|
|
@ -5,7 +5,7 @@ cabal-version: 3.0
|
|||
-- see: https://github.com/sol/hpack
|
||||
|
||||
name: zcash-haskell
|
||||
version: 0.4.3.0
|
||||
version: 0.4.3.1
|
||||
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>
|
||||
category: Blockchain
|
||||
|
|
Loading…
Reference in a new issue