#57 - Sapling address in Human Readable format #57

Merged
pitmutt merged 5 commits from rvv040 into dev040 2024-04-10 16:35:40 +00:00
3 changed files with 22 additions and 15 deletions
Showing only changes of commit 30ca143dc9 - Show all commits

View file

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.5.3.1]
### Added
- Functions for Bech32 encoding
- Function to encode a Sapling address
## [0.5.3.0] ## [0.5.3.0]
### Added ### Added

View file

@ -33,7 +33,7 @@ import qualified Data.Text.Encoding as E
import Data.Word import Data.Word
import Foreign.Rust.Marshall.Variable import Foreign.Rust.Marshall.Variable
import ZcashHaskell.Types import ZcashHaskell.Types
import ZcashHaskell.Utils (encodeBech32m, encodeBech32, f4Jumble) import ZcashHaskell.Utils (encodeBech32, encodeBech32m, f4Jumble)
-- | Derives an Orchard spending key for the given seed and account ID -- | Derives an Orchard spending key for the given seed and account ID
genOrchardSpendingKey :: genOrchardSpendingKey ::
@ -154,9 +154,6 @@ decryptOrchardAction key encAction =
withPureBorshVarBuffer $ withPureBorshVarBuffer $
rustWrapperOrchardNoteDecode (o_key key) encAction rustWrapperOrchardNoteDecode (o_key key) encAction
chrToByteString :: [Char] -> C.ByteString
chrToByteString = C.pack
getSaplingFromUA :: BS.ByteString -> Maybe T.Text getSaplingFromUA :: BS.ByteString -> Maybe T.Text
getSaplingFromUA uadd = do getSaplingFromUA uadd = do
let a = isValidUnifiedAddress uadd let a = isValidUnifiedAddress uadd
@ -169,5 +166,8 @@ getSaplingFromUA uadd = do
Just sraw -> do Just sraw -> do
let net = ua_net a let net = ua_net a
case net of case net of
MainNet -> Just $ encodeBech32 (chrToByteString sapPaymentAddressHrp) ( getBytes sraw ) MainNet ->
TestNet -> Just $ encodeBech32 (chrToByteString sapTestPaymentAddressHrp) ( getBytes sraw ) Just $ encodeBech32 (C.pack sapPaymentAddressHrp) (getBytes sraw)
TestNet ->
Just $
encodeBech32 (C.pack sapTestPaymentAddressHrp) (getBytes sraw)

View file

@ -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.5.3.0 version: 0.5.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