#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/),
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]
### Added

View file

@ -33,7 +33,7 @@ import qualified Data.Text.Encoding as E
import Data.Word
import Foreign.Rust.Marshall.Variable
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
genOrchardSpendingKey ::
@ -154,20 +154,20 @@ decryptOrchardAction key encAction =
withPureBorshVarBuffer $
rustWrapperOrchardNoteDecode (o_key key) encAction
chrToByteString :: [Char] -> C.ByteString
chrToByteString = C.pack
getSaplingFromUA :: BS.ByteString -> Maybe T.Text
getSaplingFromUA uadd = do
getSaplingFromUA uadd = do
let a = isValidUnifiedAddress uadd
case a of
case a of
Nothing -> Nothing
Just a -> do
let sraw = s_rec a
case sraw of
Nothing -> Nothing
Just sraw -> do
let net = ua_net a
case net of
MainNet -> Just $ encodeBech32 (chrToByteString sapPaymentAddressHrp) ( getBytes sraw )
TestNet -> Just $ encodeBech32 (chrToByteString sapTestPaymentAddressHrp) ( getBytes sraw )
let sraw = s_rec a
case sraw of
Nothing -> Nothing
Just sraw -> do
let net = ua_net a
case net of
MainNet ->
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
name: zcash-haskell
version: 0.5.3.0
version: 0.5.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