From 45b7fbcc8015d59c167426a851d935910fd2b17b Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Sat, 15 Apr 2023 19:18:30 -0500 Subject: [PATCH 1/6] Clean up code --- package.yaml | 1 + src/Zenith.hs | 2 ++ stack.yaml | 2 +- stack.yaml.lock | 8 ++++---- zenith.cabal | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package.yaml b/package.yaml index b3434f3..d1d0d2a 100644 --- a/package.yaml +++ b/package.yaml @@ -42,6 +42,7 @@ library: - array - base64-bytestring - hexstring + - blake2 executables: zenith: diff --git a/src/Zenith.hs b/src/Zenith.hs index e207d9d..27b9ddb 100644 --- a/src/Zenith.hs +++ b/src/Zenith.hs @@ -7,9 +7,11 @@ module Zenith where import Control.Concurrent (threadDelay) import Control.Monad +import Crypto.Hash.BLAKE2.BLAKE2b import Data.Aeson import Data.Aeson.Types import qualified Data.Array as A +import Data.Bits import qualified Data.ByteString as B import qualified Data.ByteString.Base64 as B64 import qualified Data.ByteString.Char8 as C diff --git a/stack.yaml b/stack.yaml index ec4be31..d7dd8f5 100644 --- a/stack.yaml +++ b/stack.yaml @@ -17,7 +17,7 @@ # # resolver: ./custom-snapshot.yaml # resolver: https://example.com/snapshots/2018-01-01.yaml -resolver: lts-20.8 +resolver: lts-20.16 # User packages to be built. # Various formats can be used as shown in the example below. diff --git a/stack.yaml.lock b/stack.yaml.lock index 5914216..f33169e 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -17,7 +17,7 @@ packages: git: https://github.com/reach-sh/haskell-hexstring.git snapshots: - completed: - sha256: bfafe5735ccb74527d754b1f9999ded72d7c3a6c3a88529449661431ccfbd6cc - size: 649327 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/8.yaml - original: lts-20.8 + sha256: dad15e2ec0c09280a5c2e07190fb18710fc54472f029f34f861f686540824d81 + size: 649592 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/16.yaml + original: lts-20.16 diff --git a/zenith.cabal b/zenith.cabal index b32eafe..5d8e425 100644 --- a/zenith.cabal +++ b/zenith.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.0. +-- This file has been generated from package.yaml by hpack version 0.35.1. -- -- see: https://github.com/sol/hpack @@ -36,6 +36,7 @@ library , array , base >=4.7 && <5 , base64-bytestring + , blake2 , bytestring , haskoin-core , hexstring From 9e1ee2985e6e52f20e2297e35c23fadd5527a224 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 18 Apr 2023 13:32:37 -0500 Subject: [PATCH 2/6] Update libraries --- CHANGELOG.md | 14 ++++++++++++++ app/Main.hs | 2 +- haskoin-core | 1 - package.yaml | 2 +- src/Zenith.hs | 10 ++++++---- stack.yaml | 18 ++++++++++++++---- stack.yaml.lock | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ zenith.cabal | 2 +- 8 files changed, 87 insertions(+), 12 deletions(-) delete mode 160000 haskoin-core diff --git a/CHANGELOG.md b/CHANGELOG.md index e9835bf..a49c86e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,20 @@ 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). +## [Unreleased] + +### Added + +- `zcash-haskell` library + +### Changed + +- Functions to check if Unified Address is valid. + +### Removed + +- Dependency on patched `haskoin-core` library + ## [0.3.4] ### Added diff --git a/app/Main.hs b/app/Main.hs index 4d1e3ea..0cdaccf 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -202,6 +202,6 @@ main = do "Zenith" def { getBanner = - " ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.3.3" + " ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.3.4" } (root nodeUser nodePwd) diff --git a/haskoin-core b/haskoin-core deleted file mode 160000 index 2313242..0000000 --- a/haskoin-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 23132427a25ebdedbcab4d4a931eaafa13de9011 diff --git a/package.yaml b/package.yaml index d1d0d2a..511a71a 100644 --- a/package.yaml +++ b/package.yaml @@ -31,7 +31,6 @@ library: - bytestring - http-conduit - scientific - - haskoin-core - vector - regex-base - regex-posix @@ -43,6 +42,7 @@ library: - base64-bytestring - hexstring - blake2 + - zcash-haskell executables: zenith: diff --git a/src/Zenith.hs b/src/Zenith.hs index 27b9ddb..e1abd2f 100644 --- a/src/Zenith.hs +++ b/src/Zenith.hs @@ -28,7 +28,9 @@ import qualified Data.Text.IO as TIO import qualified Data.Vector as V import Data.Word import GHC.Generics -import Haskoin.Address.Bech32 +import Zcash + +{-import Haskoin.Address.Bech32-} import Network.HTTP.Simple import Network.HTTP.Types import Numeric @@ -335,8 +337,8 @@ getAddresses ag = agtransparent ag <> agsapling ag <> agunified ag validateAddress :: T.Text -> Maybe ZcashPool validateAddress txt --(tReg || sReg && isJust chk) || (uReg && isJust chk) | tReg = Just Transparent - | sReg && isJust chk = Just Sapling - | uReg && isJust chk = Just Orchard + | sReg = Just Sapling + | uReg && chk = Just Orchard | otherwise = Nothing where transparentRegex = "^t1[a-zA-Z0-9]{33}$" :: String @@ -345,7 +347,7 @@ validateAddress txt --(tReg || sReg && isJust chk) || (uReg && isJust chk) tReg = T.unpack txt =~ transparentRegex :: Bool sReg = T.unpack txt =~ shieldedRegex :: Bool uReg = T.unpack txt =~ unifiedRegex :: Bool - chk = bech32mDecode txt + chk = isValidUnifiedAddress $ E.encodeUtf8 txt -- | RPC methods -- | List addresses diff --git a/stack.yaml b/stack.yaml index d7dd8f5..56d3cd9 100644 --- a/stack.yaml +++ b/stack.yaml @@ -30,7 +30,8 @@ resolver: lts-20.16 # - wai packages: - . -- haskoin-core +#- haskoin-core +- zcash-haskell # Dependency packages to be pulled from upstream that are not in the resolver. # These entries can reference officially published versions as well as # forks / in-progress versions pinned to a git hash. For example: @@ -42,8 +43,18 @@ packages: # # extra-deps: [] extra-deps: - - git: https://github.com/reach-sh/haskell-hexstring.git - commit: 085c16fb21b9f856a435a3faab980e7e0b319341 + - git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git + commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05 + - git: https://github.com/reach-sh/haskell-hexstring.git + commit: 085c16fb21b9f856a435a3faab980e7e0b319341 + - git: https://github.com/well-typed/borsh.git + commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831 + - vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 + - aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 + - generically-0.1.1 + - vector-algorithms-0.9.0.1 + #- vector-0.12.3.1@sha256:abbfe8830e13549596e1295219d340eb01bd00e1c7124d0dd16586911a291c59,8218 +#extra-lib-dirs: [/home/rav/Documents/programs/haskoin] # # Override default flag values for local packages and extra-deps # flags: {} @@ -64,7 +75,6 @@ extra-deps: # # Extra directories used by stack for building # extra-include-dirs: [/path/to/dir] -#extra-lib-dirs: [/home/rav/Documents/programs/haskoin] # # Allow a newer minor version of GHC than the snapshot specifies # compiler-check: newer-minor diff --git a/stack.yaml.lock b/stack.yaml.lock index f33169e..cd0b544 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -4,6 +4,17 @@ # https://docs.haskellstack.org/en/stable/lock_files packages: +- completed: + commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05 + git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git + name: foreign-rust + pantry-tree: + sha256: be2f6fc0fab58a90fec657bdb6bd0ccf0810c7dccfe95c78b85e174fae227e42 + size: 2315 + version: 0.1.0 + original: + commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05 + git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git - completed: commit: 085c16fb21b9f856a435a3faab980e7e0b319341 git: https://github.com/reach-sh/haskell-hexstring.git @@ -15,6 +26,45 @@ packages: original: commit: 085c16fb21b9f856a435a3faab980e7e0b319341 git: https://github.com/reach-sh/haskell-hexstring.git +- completed: + commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831 + git: https://github.com/well-typed/borsh.git + name: borsh + pantry-tree: + sha256: 8335925f495a5a653fcb74b6b8bb18cd0b6b7fe7099a1686108704e6ab82f47b + size: 2268 + version: 0.3.0 + original: + commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831 + git: https://github.com/well-typed/borsh.git +- completed: + hackage: vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 + pantry-tree: + sha256: d2461d28022c8c0a91da08b579b1bff478f617102d2f5ef596cc5b28d14b8b6a + size: 4092 + original: + hackage: vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 +- completed: + hackage: aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 + pantry-tree: + sha256: 8109d6674450841953af7929dbdcf5be9c5c399c3bfa2169b88c3f00c4b429d6 + size: 82465 + original: + hackage: aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 +- completed: + hackage: generically-0.1.1@sha256:aa00d9a77b7fb90c08f935699758ed9de55975021b1e979c6a4a4b5b49a940a9,1133 + pantry-tree: + sha256: ec19e6d2aecfbe7a59e789526b9d7ab5c8ba853f017248d0203ee69a9769adb7 + size: 233 + original: + hackage: generically-0.1.1 +- completed: + hackage: vector-algorithms-0.9.0.1@sha256:f3e5c6695529a94edf762117cafd91c989cb642ad3f8ca4014dbb13c8f6c2a20,3826 + pantry-tree: + sha256: aef389e57ae6020e5da719bee40aaf6cccf1c4d1e7743a85d30c9d8c25d170a0 + size: 1510 + original: + hackage: vector-algorithms-0.9.0.1 snapshots: - completed: sha256: dad15e2ec0c09280a5c2e07190fb18710fc54472f029f34f861f686540824d81 diff --git a/zenith.cabal b/zenith.cabal index 5d8e425..289d093 100644 --- a/zenith.cabal +++ b/zenith.cabal @@ -38,7 +38,6 @@ library , base64-bytestring , blake2 , bytestring - , haskoin-core , hexstring , http-conduit , http-types @@ -49,6 +48,7 @@ library , scientific , text , vector + , zcash-haskell default-language: Haskell2010 executable zenith From c4fc57c0b70e46ec055beba9f64ba51d33abedc6 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 18 Apr 2023 14:03:29 -0500 Subject: [PATCH 3/6] Implement full shielded address validation --- .gitmodules | 3 +++ src/Zenith.hs | 3 ++- zcash-haskell | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) create mode 160000 zcash-haskell diff --git a/.gitmodules b/.gitmodules index 06aa04a..1c89539 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "haskoin-core"] path = haskoin-core url = https://github.com/khazaddum/haskoin-core.git +[submodule "zcash-haskell"] + path = zcash-haskell + url = git@git.vergara.tech:Vergara_Tech/zcash-haskell.git diff --git a/src/Zenith.hs b/src/Zenith.hs index e1abd2f..d4a8cdf 100644 --- a/src/Zenith.hs +++ b/src/Zenith.hs @@ -337,7 +337,7 @@ getAddresses ag = agtransparent ag <> agsapling ag <> agunified ag validateAddress :: T.Text -> Maybe ZcashPool validateAddress txt --(tReg || sReg && isJust chk) || (uReg && isJust chk) | tReg = Just Transparent - | sReg = Just Sapling + | sReg && chkS = Just Sapling | uReg && chk = Just Orchard | otherwise = Nothing where @@ -348,6 +348,7 @@ validateAddress txt --(tReg || sReg && isJust chk) || (uReg && isJust chk) sReg = T.unpack txt =~ shieldedRegex :: Bool uReg = T.unpack txt =~ unifiedRegex :: Bool chk = isValidUnifiedAddress $ E.encodeUtf8 txt + chkS = isValidShieldedAddress $ E.encodeUtf8 txt -- | RPC methods -- | List addresses diff --git a/zcash-haskell b/zcash-haskell new file mode 160000 index 0000000..1261a58 --- /dev/null +++ b/zcash-haskell @@ -0,0 +1 @@ +Subproject commit 1261a585e6f775049e772bccae55233a9fa04b05 From 3e4aaf647c7d792534873f78fe592f3edb9139b2 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Fri, 6 Oct 2023 14:28:07 -0500 Subject: [PATCH 4/6] Use address validation --- src/Zenith.hs | 3 ++- stack.yaml | 24 +++++++++++++----------- stack.yaml.lock | 11 +++++++++++ zcash-haskell | 1 - 4 files changed, 26 insertions(+), 13 deletions(-) delete mode 160000 zcash-haskell diff --git a/src/Zenith.hs b/src/Zenith.hs index d4a8cdf..d597ac2 100644 --- a/src/Zenith.hs +++ b/src/Zenith.hs @@ -28,7 +28,8 @@ import qualified Data.Text.IO as TIO import qualified Data.Vector as V import Data.Word import GHC.Generics -import Zcash +import ZcashHaskell.Orchard (isValidUnifiedAddress) +import ZcashHaskell.Sapling (isValidShieldedAddress) {-import Haskoin.Address.Bech32-} import Network.HTTP.Simple diff --git a/stack.yaml b/stack.yaml index 56d3cd9..545b925 100644 --- a/stack.yaml +++ b/stack.yaml @@ -31,7 +31,7 @@ resolver: lts-20.16 packages: - . #- haskoin-core -- zcash-haskell +#- zcash-haskell # Dependency packages to be pulled from upstream that are not in the resolver. # These entries can reference officially published versions as well as # forks / in-progress versions pinned to a git hash. For example: @@ -43,16 +43,18 @@ packages: # # extra-deps: [] extra-deps: - - git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git - commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05 - - git: https://github.com/reach-sh/haskell-hexstring.git - commit: 085c16fb21b9f856a435a3faab980e7e0b319341 - - git: https://github.com/well-typed/borsh.git - commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831 - - vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 - - aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 - - generically-0.1.1 - - vector-algorithms-0.9.0.1 + - git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git + commit: fef3d3af35a09db718cddb8fc9166b2d2691a744 + - git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git + commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05 + - git: https://github.com/reach-sh/haskell-hexstring.git + commit: 085c16fb21b9f856a435a3faab980e7e0b319341 + - git: https://github.com/well-typed/borsh.git + commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831 + - vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 + - aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 + - generically-0.1.1 + - vector-algorithms-0.9.0.1 #- vector-0.12.3.1@sha256:abbfe8830e13549596e1295219d340eb01bd00e1c7124d0dd16586911a291c59,8218 #extra-lib-dirs: [/home/rav/Documents/programs/haskoin] # diff --git a/stack.yaml.lock b/stack.yaml.lock index cd0b544..e9952c5 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -4,6 +4,17 @@ # https://docs.haskellstack.org/en/stable/lock_files packages: +- completed: + commit: fef3d3af35a09db718cddb8fc9166b2d2691a744 + git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git + name: zcash-haskell + pantry-tree: + sha256: ec7782cf2646da17548d59af0ea98dcbaac1b6c2176258c696a7f508db6dbc21 + size: 1126 + version: 0.1.0 + original: + commit: fef3d3af35a09db718cddb8fc9166b2d2691a744 + git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git - completed: commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05 git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git diff --git a/zcash-haskell b/zcash-haskell deleted file mode 160000 index 1261a58..0000000 --- a/zcash-haskell +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1261a585e6f775049e772bccae55233a9fa04b05 From 9945dfc8c17e708cfdc0b24bd77f6fe432b8517a Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Fri, 6 Oct 2023 14:31:22 -0500 Subject: [PATCH 5/6] Update sending function for ZIP-317 --- src/Zenith.hs | 104 ++++++++++++++++++++++---------------------------- 1 file changed, 45 insertions(+), 59 deletions(-) diff --git a/src/Zenith.hs b/src/Zenith.hs index d597ac2..4ad8bb7 100644 --- a/src/Zenith.hs +++ b/src/Zenith.hs @@ -45,14 +45,12 @@ import Text.Regex.Base import Text.Regex.Posix -- | A type to model Zcash RPC calls -data RpcCall = - RpcCall - { jsonrpc :: T.Text - , id :: T.Text - , method :: T.Text - , params :: [Value] - } - deriving (Show, Generic, ToJSON, FromJSON) +data RpcCall = RpcCall + { jsonrpc :: T.Text + , id :: T.Text + , method :: T.Text + , params :: [Value] + } deriving (Show, Generic, ToJSON, FromJSON) -- | Type for modelling the different address sources for Zcash 5.0.0 data AddressSource @@ -91,14 +89,12 @@ instance FromJSON ZcashPool where "orchard" -> return Orchard _ -> fail "Not a known Zcash pool" -data ZcashAddress = - ZcashAddress - { source :: AddressSource - , pool :: [ZcashPool] - , account :: Maybe Integer - , addy :: T.Text - } - deriving (Eq) +data ZcashAddress = ZcashAddress + { source :: AddressSource + , pool :: [ZcashPool] + , account :: Maybe Integer + , addy :: T.Text + } deriving (Eq) instance Show ZcashAddress where show (ZcashAddress s p i a) = @@ -106,13 +102,11 @@ instance Show ZcashAddress where "..." ++ T.unpack (T.takeEnd 8 a) ++ " Pools: " ++ show p -- | A type to model the response of the Zcash RPC -data RpcResponse r = - RpcResponse - { err :: Maybe T.Text - , respId :: T.Text - , result :: r - } - deriving (Show, Generic, ToJSON) +data RpcResponse r = RpcResponse + { err :: Maybe T.Text + , respId :: T.Text + , result :: r + } deriving (Show, Generic, ToJSON) instance (FromJSON r) => FromJSON (RpcResponse r) where parseJSON (Object obj) = do @@ -136,14 +130,12 @@ instance FromJSON NodeVersion where pure $ NodeVersion v -- | A type to model an address group -data AddressGroup = - AddressGroup - { agsource :: AddressSource - , agtransparent :: [ZcashAddress] - , agsapling :: [ZcashAddress] - , agunified :: [ZcashAddress] - } - deriving (Show, Generic) +data AddressGroup = AddressGroup + { agsource :: AddressSource + , agtransparent :: [ZcashAddress] + , agsapling :: [ZcashAddress] + , agunified :: [ZcashAddress] + } deriving (Show, Generic) instance FromJSON AddressGroup where parseJSON = @@ -195,18 +187,16 @@ displayZec s | otherwise = show (fromIntegral s / 100000000) ++ " ZEC " -- | A type to model a Zcash transaction -data ZcashTx = - ZcashTx - { ztxid :: T.Text - , zamount :: Double - , zamountZat :: Integer - , zblockheight :: Integer - , zblocktime :: Integer - , zchange :: Bool - , zconfirmations :: Integer - , zmemo :: T.Text - } - deriving (Show, Generic) +data ZcashTx = ZcashTx + { ztxid :: T.Text + , zamount :: Double + , zamountZat :: Integer + , zblockheight :: Integer + , zblocktime :: Integer + , zchange :: Bool + , zconfirmations :: Integer + , zmemo :: T.Text + } deriving (Show, Generic) instance FromJSON ZcashTx where parseJSON = @@ -246,13 +236,11 @@ instance ToJSON ZcashTx where ] -- | Type for the UA balance -data UABalance = - UABalance - { uatransparent :: Integer - , uasapling :: Integer - , uaorchard :: Integer - } - deriving (Eq) +data UABalance = UABalance + { uatransparent :: Integer + , uasapling :: Integer + , uaorchard :: Integer + } deriving (Eq) instance Show UABalance where show (UABalance t s o) = @@ -280,13 +268,11 @@ instance FromJSON UABalance where pure $ UABalance vT vS vO -- | Type for Operation Result -data OpResult = - OpResult - { opsuccess :: T.Text - , opmessage :: Maybe T.Text - , optxid :: Maybe T.Text - } - deriving (Show, Eq) +data OpResult = OpResult + { opsuccess :: T.Text + , opmessage :: Maybe T.Text + , optxid :: Maybe T.Text + } deriving (Show, Eq) instance FromJSON OpResult where parseJSON = @@ -439,7 +425,7 @@ sendTx user pwd fromAddy toAddy amount memo = do (V.fromList [object ["address" .= toAddy, "amount" .= amount]]) , Data.Aeson.Number $ Scientific.scientific 1 1 - , Data.Aeson.Number $ Scientific.scientific 1 (-5) + , Data.Aeson.Null , Data.Aeson.String privacyPolicy ] Just memo' -> @@ -453,7 +439,7 @@ sendTx user pwd fromAddy toAddy amount memo = do ] ]) , Data.Aeson.Number $ Scientific.scientific 1 1 - , Data.Aeson.Number $ Scientific.scientific 1 (-5) + , Data.Aeson.Null , Data.Aeson.String privacyPolicy ] response <- makeZcashCall user pwd "z_sendmany" pd From cfb79af1c6e4e3ad2f7540ef91e5366ce8382577 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Mon, 9 Oct 2023 08:21:18 -0500 Subject: [PATCH 6/6] Version bump --- CHANGELOG.md | 3 ++- app/Main.hs | 2 +- package.yaml | 2 +- stack.yaml | 3 +-- stack.yaml.lock | 15 ++++----------- zenith.cabal | 2 +- 6 files changed, 10 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a49c86e..1f8f2f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ 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). -## [Unreleased] +## [0.4.0] ### Added @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Sending of transactions to support ZIP-317. - Functions to check if Unified Address is valid. ### Removed diff --git a/app/Main.hs b/app/Main.hs index 0cdaccf..06a532e 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -202,6 +202,6 @@ main = do "Zenith" def { getBanner = - " ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.3.4" + " ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.4.0" } (root nodeUser nodePwd) diff --git a/package.yaml b/package.yaml index 511a71a..09eaf30 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: zenith -version: 0.3.4 +version: 0.4.0 git: "https://git.vergara.tech/Vergara_Tech/zenith" license: BOSL author: "Rene Vergara" diff --git a/stack.yaml b/stack.yaml index 545b925..e202242 100644 --- a/stack.yaml +++ b/stack.yaml @@ -17,7 +17,7 @@ # # resolver: ./custom-snapshot.yaml # resolver: https://example.com/snapshots/2018-01-01.yaml -resolver: lts-20.16 +resolver: lts-21.6 # User packages to be built. # Various formats can be used as shown in the example below. @@ -52,7 +52,6 @@ extra-deps: - git: https://github.com/well-typed/borsh.git commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831 - vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 - - aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 - generically-0.1.1 - vector-algorithms-0.9.0.1 #- vector-0.12.3.1@sha256:abbfe8830e13549596e1295219d340eb01bd00e1c7124d0dd16586911a291c59,8218 diff --git a/stack.yaml.lock b/stack.yaml.lock index e9952c5..f92b46d 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -55,13 +55,6 @@ packages: size: 4092 original: hackage: vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 -- completed: - hackage: aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 - pantry-tree: - sha256: 8109d6674450841953af7929dbdcf5be9c5c399c3bfa2169b88c3f00c4b429d6 - size: 82465 - original: - hackage: aeson-2.1.2.1@sha256:f10f3c661bd5cf57aee46b94420e47736240b8e209ac15f4bfc1a4e4d55831fa,6344 - completed: hackage: generically-0.1.1@sha256:aa00d9a77b7fb90c08f935699758ed9de55975021b1e979c6a4a4b5b49a940a9,1133 pantry-tree: @@ -78,7 +71,7 @@ packages: hackage: vector-algorithms-0.9.0.1 snapshots: - completed: - sha256: dad15e2ec0c09280a5c2e07190fb18710fc54472f029f34f861f686540824d81 - size: 649592 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/16.yaml - original: lts-20.16 + sha256: 2e7d4a730d8eb5373b2d383fac84efcf7c81e3b7a5fce71b4c2e19a1768f25a6 + size: 640239 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/6.yaml + original: lts-21.6 diff --git a/zenith.cabal b/zenith.cabal index 289d093..a2a59ee 100644 --- a/zenith.cabal +++ b/zenith.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: zenith -version: 0.3.4 +version: 0.4.0 synopsis: Haskell CLI for Zcash Full Node description: Please see the README on repo at author: Rene Vergara