Compare commits
4 commits
5c4b715a24
...
e25d759b5e
Author | SHA1 | Date | |
---|---|---|---|
e25d759b5e | |||
ff89bbdac6 | |||
d3cf05d00e | |||
9c4e26c9f2 |
4 changed files with 29 additions and 15 deletions
|
@ -23,7 +23,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Update installation to `cabal`
|
- Update installation to `cabal`
|
||||||
- Updated `bech32` Rust crate to 0.11
|
- Updated Rust crates:
|
||||||
|
- `bech32` to 0.11
|
||||||
|
- `orchard` to 0.7.0
|
||||||
|
- `zcash_note_encryption` to 0.4.0
|
||||||
|
- `zcash_primitives` to 0.13.0
|
||||||
|
- `zcash_client_backend` to 0.10.0
|
||||||
|
- `zip32` to 0.1.0
|
||||||
|
- Changed the `UnifiedAddress` to allow for optional shielded receivers
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,12 @@ isValidUnifiedAddress str =
|
||||||
makeUA x =
|
makeUA x =
|
||||||
UnifiedAddress
|
UnifiedAddress
|
||||||
whichNet
|
whichNet
|
||||||
(raw_o x)
|
(if BS.length (raw_o x) == 43
|
||||||
(raw_s x)
|
then Just (raw_o x)
|
||||||
|
else Nothing)
|
||||||
|
(if BS.length (raw_s x) == 43
|
||||||
|
then Just (raw_s x)
|
||||||
|
else Nothing)
|
||||||
(if not (BS.null (raw_t x))
|
(if not (BS.null (raw_t x))
|
||||||
then Just $ TransparentAddress P2PKH whichNet (raw_t x)
|
then Just $ TransparentAddress P2PKH whichNet (raw_t x)
|
||||||
else if not (BS.null (raw_to x))
|
else if not (BS.null (raw_to x))
|
||||||
|
@ -98,18 +102,21 @@ encodeUnifiedAddress ua = encodeBech32m (E.encodeUtf8 hr) b
|
||||||
Nothing -> BS.empty
|
Nothing -> BS.empty
|
||||||
Just t ->
|
Just t ->
|
||||||
case ta_type t of
|
case ta_type t of
|
||||||
P2SH -> packReceiver 0x01 $ ta_bytes t
|
P2SH -> packReceiver 0x01 $ Just $ ta_bytes t
|
||||||
P2PKH -> packReceiver 0x00 $ ta_bytes t
|
P2PKH -> packReceiver 0x00 $ Just $ ta_bytes t
|
||||||
sReceiver = packReceiver 0x02 $ s_rec ua
|
sReceiver = packReceiver 0x02 $ s_rec ua
|
||||||
oReceiver = packReceiver 0x03 $ o_rec ua
|
oReceiver = packReceiver 0x03 $ o_rec ua
|
||||||
padding = E.encodeUtf8 $ T.justifyLeft 16 '\NUL' hr
|
padding = E.encodeUtf8 $ T.justifyLeft 16 '\NUL' hr
|
||||||
packReceiver :: Word8 -> BS.ByteString -> BS.ByteString
|
packReceiver :: Word8 -> Maybe BS.ByteString -> BS.ByteString
|
||||||
packReceiver typeCode receiver =
|
packReceiver typeCode receiver' =
|
||||||
|
case receiver' of
|
||||||
|
Just receiver ->
|
||||||
if BS.length receiver > 1
|
if BS.length receiver > 1
|
||||||
then BS.singleton typeCode `BS.append`
|
then BS.singleton typeCode `BS.append`
|
||||||
(BS.singleton . toEnum . BS.length) receiver `BS.append`
|
(BS.singleton . toEnum . BS.length) receiver `BS.append`
|
||||||
receiver
|
receiver
|
||||||
else BS.empty
|
else BS.empty
|
||||||
|
Nothing -> BS.empty
|
||||||
|
|
||||||
-- | Attempts to decode the given bytestring into a Unified Full Viewing Key
|
-- | Attempts to decode the given bytestring into a Unified Full Viewing Key
|
||||||
decodeUfvk :: BS.ByteString -> Maybe UnifiedFullViewingKey
|
decodeUfvk :: BS.ByteString -> Maybe UnifiedFullViewingKey
|
||||||
|
|
|
@ -280,8 +280,8 @@ instance FromJSON ShieldedOutput where
|
||||||
-- | Type to represent a Unified Address
|
-- | Type to represent a Unified Address
|
||||||
data UnifiedAddress = UnifiedAddress
|
data UnifiedAddress = UnifiedAddress
|
||||||
{ ua_net :: !ZcashNet
|
{ ua_net :: !ZcashNet
|
||||||
, o_rec :: !OrchardReceiver
|
, o_rec :: !(Maybe OrchardReceiver)
|
||||||
, s_rec :: !SaplingReceiver
|
, s_rec :: !(Maybe SaplingReceiver)
|
||||||
, t_rec :: !(Maybe TransparentAddress)
|
, t_rec :: !(Maybe TransparentAddress)
|
||||||
} deriving (Prelude.Show, Eq, Read)
|
} deriving (Prelude.Show, Eq, Read)
|
||||||
|
|
||||||
|
|
|
@ -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.2
|
version: 0.4.4.0
|
||||||
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