From 9e1ee2985e6e52f20e2297e35c23fadd5527a224 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Tue, 18 Apr 2023 13:32:37 -0500 Subject: [PATCH] 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