From 5fec52bdd076d38751dd8d92ba6e8ef534483f15 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Wed, 14 Feb 2024 12:02:53 -0600 Subject: [PATCH 1/5] Add host parameter for Zebra server --- app/Main.hs | 3 ++- stack.yaml | 2 +- stack.yaml.lock | 8 ++++---- zenith.cfg | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index f64421e..70f07d5 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -203,6 +203,7 @@ main = do nodeUser <- require config "nodeUser" nodePwd <- require config "nodePwd" zebraPort <- require config "zebraPort" + zebraHost <- require config "zebraHost" if not (null args) then do case head args of @@ -216,7 +217,7 @@ main = do " ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.4.0" } (root nodeUser nodePwd) - "cli" -> runZenithCLI zebraPort dbName + "cli" -> runZenithCLI zebraHost zebraPort dbName _ -> printUsage else printUsage diff --git a/stack.yaml b/stack.yaml index 4286f97..94817d2 100644 --- a/stack.yaml +++ b/stack.yaml @@ -44,7 +44,7 @@ packages: # extra-deps: [] extra-deps: - git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git - commit: 09cee9a064219e4be89413ef86341aa18b62be68 + commit: 73d8125b83cda3b69d91770e1617b4a4d6a98c58 - git: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git commit: fd1ddce73c0ad18a2a4509a299c6e93f8c6c383d - git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git diff --git a/stack.yaml.lock b/stack.yaml.lock index fe64ec4..a23fcb3 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -5,15 +5,15 @@ packages: - completed: - commit: 09cee9a064219e4be89413ef86341aa18b62be68 + commit: 73d8125b83cda3b69d91770e1617b4a4d6a98c58 git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git name: zcash-haskell pantry-tree: - sha256: 6bf1902a377bf9399442de6f0b89219479fa908e70706918e81b88caa28dc0f5 + sha256: 0b7870345d7ccc65ff51fbfe7c4e579fd497014ab0e0ee2084ba0ad0f68b8b69 size: 1367 - version: 0.4.1 + version: 0.4.2 original: - commit: 09cee9a064219e4be89413ef86341aa18b62be68 + commit: 73d8125b83cda3b69d91770e1617b4a4d6a98c58 git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git - completed: commit: fd1ddce73c0ad18a2a4509a299c6e93f8c6c383d diff --git a/zenith.cfg b/zenith.cfg index 7a1dc51..3c9bd46 100644 --- a/zenith.cfg +++ b/zenith.cfg @@ -1,4 +1,5 @@ nodeUser = "user" nodePwd = "superSecret" dbName = "zenith.db" +zebraHost = "127.0.0.1" zebraPort = 18232 From e9fd87ef583a98227276e5b3fb93fbdbb3855b1a Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Wed, 14 Feb 2024 12:03:18 -0600 Subject: [PATCH 2/5] Add splash screen to TUI --- src/Zenith/CLI.hs | 118 +++++++++++++++++++++++++++++++++++++-------- src/Zenith/Core.hs | 20 ++++---- 2 files changed, 109 insertions(+), 29 deletions(-) diff --git a/src/Zenith/CLI.hs b/src/Zenith/CLI.hs index e63d581..90a2b6b 100644 --- a/src/Zenith/CLI.hs +++ b/src/Zenith/CLI.hs @@ -12,21 +12,25 @@ import Lens.Micro.Mtl import Lens.Micro.TH import qualified Brick.AttrMap as A +import qualified Brick.Focus as F +import Brick.Forms (Form(..), (@@=), editTextField, newForm, renderForm) import qualified Brick.Main as M import qualified Brick.Types as BT import Brick.Types (Widget) -import Brick.Util (fg, on) +import Brick.Util (fg, on, style) import qualified Brick.Widgets.Border as B -import Brick.Widgets.Border.Style (unicode) +import Brick.Widgets.Border.Style (unicode, unicodeBold) import qualified Brick.Widgets.Center as C import Brick.Widgets.Core ( Padding(..) , (<+>) , (<=>) , emptyWidget + , fill , hLimit , joinBorders , padAll + , padBottom , padRight , str , vBox @@ -46,8 +50,15 @@ data Name | AList | TList | HelpDialog + | WalNameField deriving (Eq, Show, Ord) +data WalletName = WalletName + { _walName :: !T.Text + } deriving (Show) + +makeLenses ''WalletName + data State = State { _network :: !String , _wallets :: !(L.List Name String) @@ -55,12 +66,16 @@ data State = State , _transactions :: !(L.List Name String) , _msg :: !String , _helpBox :: !Bool - } deriving (Show) + , _walletBox :: !Bool + , _splashBox :: !Bool + , _walletForm :: !(Form WalletName () Name) + , _focusRing :: !(F.FocusRing Name) + } makeLenses ''State drawUI :: State -> [Widget Name] -drawUI s = [helpDialog s, ui s] +drawUI s = [splashDialog s, helpDialog s, walletDialog s, ui s] where ui :: State -> Widget Name ui s = @@ -88,13 +103,43 @@ drawUI s = [helpDialog s, ui s] helpDialog s = if s ^. helpBox then D.renderDialog - (D.dialog (Just (str "Commands")) Nothing 50) + (D.dialog (Just (str "Commands")) Nothing 55) (vBox ([C.hCenter $ str "Key", B.hBorder] <> keyList) <+> vBox ([str "Actions", B.hBorder] <> actionList)) else emptyWidget where - keyList = map (C.hCenter . str) ["?", "Esc", "q"] - actionList = map (hLimit 40 . str) ["Open help", "Close dialog", "Quit"] + keyList = map (C.hCenter . str) ["?", "Esc", "c", "q"] + actionList = + map + (hLimit 40 . str) + ["Open help", "Close dialog", "Create Wallet", "Quit"] + walletDialog :: State -> Widget Name + walletDialog s = + if s ^. walletBox + then D.renderDialog + (D.dialog (Just (str "Create Wallet")) Nothing 50) + (renderForm $ s ^. walletForm) + else emptyWidget + splashDialog :: State -> Widget Name + splashDialog s = + if s ^. splashBox + then withBorderStyle unicodeBold $ + D.renderDialog + (D.dialog Nothing Nothing 30) + (withAttr + titleAttr + (str + " _____ _ _ _ \n|__ /___ _ __ (_) |_| |__\n / // _ \\ '_ \\| | __| '_ \\\n / /| __/ | | | | |_| | | |\n/____\\___|_| |_|_|\\__|_| |_|") <=> + C.hCenter (withAttr titleAttr (str "Zcash Wallet v0.4.1")) <=> + C.hCenter (withAttr blinkAttr $ str "Press any key...")) + else emptyWidget + +mkWalletForm :: WalletName -> Form WalletName e Name +mkWalletForm = + newForm [label "Name" @@= editTextField walName WalNameField (Just 1)] + where + label s w = + padBottom (Pad 1) $ vLimit 1 (hLimit 15 $ str s <+> fill ' ') <+> w listDrawElement :: (Show a) => Bool -> a -> Widget Name listDrawElement sel a = @@ -107,15 +152,42 @@ listDrawElement sel a = customAttr :: A.AttrName customAttr = L.listSelectedAttr <> A.attrName "custom" +titleAttr :: A.AttrName +titleAttr = A.attrName "title" + +blinkAttr :: A.AttrName +blinkAttr = A.attrName "blink" + appEvent :: BT.BrickEvent Name e -> BT.EventM Name State () -appEvent (BT.VtyEvent e) = - case e of - V.EvKey V.KEsc [] -> BT.modify $ set helpBox False - V.EvKey (V.KChar 'q') [] -> M.halt - V.EvKey (V.KChar '?') [] -> BT.modify $ set helpBox True - V.EvKey (V.KChar 'c') [] -> printMsg "You pressed C!" - V.EvKey (V.KChar 's') [] -> printMsg "You pressed S!" - ev -> BT.zoom addresses $ L.handleListEvent ev +appEvent (BT.VtyEvent (V.EvKey (V.KChar '\t') [])) = focusRing %= F.focusNext +appEvent (BT.VtyEvent e) = do + r <- F.focusGetCurrent <$> use focusRing + s <- BT.get + if s ^. splashBox + then BT.modify $ set splashBox False + else if s ^. helpBox + then do + case e of + V.EvKey V.KEsc [] -> do + BT.modify $ set helpBox False + ev -> return () + else do + if s ^. walletBox + then do + case e of + V.EvKey V.KEsc [] -> BT.modify $ set walletBox False + ev -> return () + else do + case e of + V.EvKey (V.KChar 'q') [] -> M.halt + V.EvKey (V.KChar '?') [] -> BT.modify $ set helpBox True + V.EvKey (V.KChar 'c') [] -> BT.modify $ set walletBox True + V.EvKey (V.KChar 's') [] -> printMsg "You pressed S!" + ev -> + case r of + Just AList -> BT.zoom addresses $ L.handleListEvent ev + Just TList -> BT.zoom transactions $ L.handleListEvent ev + Nothing -> return () where printMsg :: String -> BT.EventM Name State () printMsg s = BT.modify $ updateMsg s @@ -128,7 +200,9 @@ theMap = V.defAttr [ (L.listAttr, V.white `on` V.blue) , (L.listSelectedAttr, V.blue `on` V.white) - , (customAttr, fg V.cyan) + , (customAttr, fg V.black) + , (titleAttr, V.withStyle (fg V.brightGreen) V.bold) + , (blinkAttr, style V.blink) ] theApp :: M.App State e Name @@ -141,12 +215,12 @@ theApp = , M.appAttrMap = const theMap } -runZenithCLI :: Int -> T.Text -> IO () -runZenithCLI port dbName = do - w <- checkZebra port +runZenithCLI :: T.Text -> Int -> T.Text -> IO () +runZenithCLI host port dbName = do + w <- checkZebra host port case (w :: Maybe ZebraGetInfo) of Just zebra -> do - bc <- checkBlockChain port + bc <- checkBlockChain host port case (bc :: Maybe ZebraGetBlockChainInfo) of Nothing -> print "Unable to determine blockchain status" Just chainInfo -> do @@ -160,6 +234,10 @@ runZenithCLI port dbName = do ("Start up Ok! Connected to Zebra " ++ (T.unpack . zgi_build) zebra ++ " on port " ++ show port ++ ".") False + False + True + (mkWalletForm $ WalletName "Main") + (F.focusRing [AList, TList]) Nothing -> do print $ "No Zebra node available on port " <> diff --git a/src/Zenith/Core.hs b/src/Zenith/Core.hs index 2ba8480..097f645 100644 --- a/src/Zenith/Core.hs +++ b/src/Zenith/Core.hs @@ -25,25 +25,27 @@ checkWallets dbName znet = do -- * Zebra Node interaction -- | Checks the status of the `zebrad` node checkZebra :: - Int -- ^ Port where `zebrad` is available + T.Text -- ^ Host where `zebrad` is available + -> Int -- ^ Port where `zebrad` is available -> IO (Maybe ZebraGetInfo) -checkZebra port = do - res <- makeZebraCall port "getinfo" [] +checkZebra host port = do + res <- makeZebraCall host port "getinfo" [] let body = responseBody (res :: Response (RpcResponse ZebraGetInfo)) return $ result body -- | Checks the status of the Zcash blockchain checkBlockChain :: - Int -- ^ Port where `zebrad` is available + T.Text -- ^ Host where `zebrad` is available + -> Int -- ^ Port where `zebrad` is available -> IO (Maybe ZebraGetBlockChainInfo) -checkBlockChain port = do - let f = makeZebraCall port +checkBlockChain host port = do + let f = makeZebraCall host port result <$> (responseBody <$> f "getblockchaininfo" []) -- | Generic RPC call function connectZebra :: - FromJSON a => Int -> T.Text -> [Data.Aeson.Value] -> IO (Maybe a) -connectZebra port m params = do - res <- makeZebraCall port m params + FromJSON a => T.Text -> Int -> T.Text -> [Data.Aeson.Value] -> IO (Maybe a) +connectZebra host port m params = do + res <- makeZebraCall host port m params let body = responseBody res return $ result body From b8ff1eb5615d23277b7d499c7f5a6fc4d7480a7c Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Mon, 19 Feb 2024 14:05:32 -0600 Subject: [PATCH 3/5] Implement wallet check from DB --- package.yaml | 1 + src/Zenith/CLI.hs | 32 +++++++++++++++++++++++++------- src/Zenith/DB.hs | 7 +++++++ test/Spec.hs | 2 ++ zenith.cabal | 1 + 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/package.yaml b/package.yaml index 91c2bd2..5fcfaeb 100644 --- a/package.yaml +++ b/package.yaml @@ -87,3 +87,4 @@ tests: - persistent - persistent-sqlite - persistent-template + - zcash-haskell diff --git a/src/Zenith/CLI.hs b/src/Zenith/CLI.hs index 90a2b6b..88a2df2 100644 --- a/src/Zenith/CLI.hs +++ b/src/Zenith/CLI.hs @@ -4,6 +4,7 @@ module Zenith.CLI where import Control.Monad (void) +import Control.Monad.IO.Class (liftIO) import Data.Maybe (fromMaybe) import qualified Data.Text as T import qualified Graphics.Vty as V @@ -13,7 +14,15 @@ import Lens.Micro.TH import qualified Brick.AttrMap as A import qualified Brick.Focus as F -import Brick.Forms (Form(..), (@@=), editTextField, newForm, renderForm) +import Brick.Forms + ( Form(..) + , (@@=) + , editTextField + , focusedFormInputAttr + , handleFormEvent + , newForm + , renderForm + ) import qualified Brick.Main as M import qualified Brick.Types as BT import Brick.Types (Widget) @@ -41,9 +50,11 @@ import Brick.Widgets.Core import qualified Brick.Widgets.Dialog as D import qualified Brick.Widgets.List as L import qualified Data.Vector as Vec +import Database.Persist import Network.HTTP.Simple import ZcashHaskell.Types import Zenith.Core +import Zenith.DB data Name = WList @@ -61,7 +72,7 @@ makeLenses ''WalletName data State = State { _network :: !String - , _wallets :: !(L.List Name String) + , _wallets :: !(L.List Name (Entity ZcashWallet)) , _addresses :: !(L.List Name String) , _transactions :: !(L.List Name String) , _msg :: !String @@ -136,7 +147,7 @@ drawUI s = [splashDialog s, helpDialog s, walletDialog s, ui s] mkWalletForm :: WalletName -> Form WalletName e Name mkWalletForm = - newForm [label "Name" @@= editTextField walName WalNameField (Just 1)] + newForm [label "Name: " @@= editTextField walName WalNameField (Just 1)] where label s w = padBottom (Pad 1) $ vLimit 1 (hLimit 15 $ str s <+> fill ' ') <+> w @@ -159,7 +170,6 @@ blinkAttr :: A.AttrName blinkAttr = A.attrName "blink" appEvent :: BT.BrickEvent Name e -> BT.EventM Name State () -appEvent (BT.VtyEvent (V.EvKey (V.KChar '\t') [])) = focusRing %= F.focusNext appEvent (BT.VtyEvent e) = do r <- F.focusGetCurrent <$> use focusRing s <- BT.get @@ -176,9 +186,15 @@ appEvent (BT.VtyEvent e) = do then do case e of V.EvKey V.KEsc [] -> BT.modify $ set walletBox False - ev -> return () + V.EvKey V.KEnter [] -> do + BT.modify $ set walletBox False + fs <- BT.zoom walletForm $ BT.gets formState + printMsg $ + "Creating new wallet " <> (T.unpack $ fs ^. walName) + ev -> BT.zoom walletForm $ handleFormEvent (BT.VtyEvent ev) else do case e of + V.EvKey (V.KChar '\t') [] -> focusRing %= F.focusNext V.EvKey (V.KChar 'q') [] -> M.halt V.EvKey (V.KChar '?') [] -> BT.modify $ set helpBox True V.EvKey (V.KChar 'c') [] -> BT.modify $ set walletBox True @@ -203,6 +219,7 @@ theMap = , (customAttr, fg V.black) , (titleAttr, V.withStyle (fg V.brightGreen) V.bold) , (blinkAttr, style V.blink) + , (focusedFormInputAttr, V.white `on` V.blue) ] theApp :: M.App State e Name @@ -224,17 +241,18 @@ runZenithCLI host port dbName = do case (bc :: Maybe ZebraGetBlockChainInfo) of Nothing -> print "Unable to determine blockchain status" Just chainInfo -> do + walList <- getWallets $ zgb_net chainInfo void $ M.defaultMain theApp $ State ((show . zgb_net) chainInfo) - (L.list WList (Vec.fromList ["wall1"]) 1) + (L.list WList (Vec.fromList walList) 1) (L.list AList (Vec.fromList ["addr1", "addr2"]) 1) (L.list TList (Vec.fromList ["tx1", "tx2", "tx3"]) 1) ("Start up Ok! Connected to Zebra " ++ (T.unpack . zgi_build) zebra ++ " on port " ++ show port ++ ".") False - False + (null walList) True (mkWalletForm $ WalletName "Main") (F.focusRing [AList, TList]) diff --git a/src/Zenith/DB.hs b/src/Zenith/DB.hs index 97bdf55..c1d9310 100644 --- a/src/Zenith/DB.hs +++ b/src/Zenith/DB.hs @@ -16,6 +16,7 @@ module Zenith.DB where +import Control.Monad.IO.Class (liftIO) import qualified Data.ByteString as BS import qualified Data.Text as T import Database.Persist @@ -37,3 +38,9 @@ share network ZcashNet deriving Show |] + +getWallets :: ZcashNet -> IO [Entity ZcashWallet] +getWallets n = + runSqlite "zenith.db" $ do + s <- selectList [ZcashWalletNetwork ==. n] [] + liftIO $ return s diff --git a/test/Spec.hs b/test/Spec.hs index 392e8a4..e3556ce 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -4,6 +4,7 @@ import Control.Monad.IO.Class (liftIO) import Database.Persist import Database.Persist.Sqlite import Test.Hspec +import ZcashHaskell.Types (ZcashNet(..)) import Zenith.DB import Zenith.DB ( EntityField(ZcashWalletId, ZcashWalletName) @@ -27,6 +28,7 @@ main = do "987654321" 2000000 "Main Wallet" + MainNet fromSqlKey s `shouldBe` 1 it "read wallet record" $ do s <- diff --git a/zenith.cabal b/zenith.cabal index 9fb7ca5..69397c7 100644 --- a/zenith.cabal +++ b/zenith.cabal @@ -98,5 +98,6 @@ test-suite zenith-test , persistent , persistent-sqlite , persistent-template + , zcash-haskell , zenith default-language: Haskell2010 From a21a483ded058c552a2425a9192db1aa43b0359e Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Thu, 22 Feb 2024 16:05:08 -0600 Subject: [PATCH 4/5] Add `zcash-haskell` submodule --- .gitmodules | 6 ++---- zcash-haskell | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) create mode 160000 zcash-haskell diff --git a/.gitmodules b/.gitmodules index 1c89539..53b8dda 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,4 @@ -[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 + url = https://git.vergara.tech/Vergara_Tech/zcash-haskell.git + branch = dev040 diff --git a/zcash-haskell b/zcash-haskell new file mode 160000 index 0000000..3fa771f --- /dev/null +++ b/zcash-haskell @@ -0,0 +1 @@ +Subproject commit 3fa771f9f5b44eb41f9049c3184d94b4ed97b647 From 9798f675c04e456320e23242a27a9e3f4f79aac2 Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Thu, 22 Feb 2024 16:06:23 -0600 Subject: [PATCH 5/5] Replace `stack` compilation with custom `cabal` --- Setup.hs | 34 ++++++++++++++++++ cabal.project | 15 ++++++++ package.yaml | 90 ----------------------------------------------- stack.yaml | 81 ------------------------------------------ stack.yaml.lock | 77 ---------------------------------------- zenith.cabal | 93 +++++++++++++++++++++++++------------------------ 6 files changed, 97 insertions(+), 293 deletions(-) create mode 100644 Setup.hs create mode 100644 cabal.project delete mode 100644 package.yaml delete mode 100644 stack.yaml delete mode 100644 stack.yaml.lock diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..4cf4c9c --- /dev/null +++ b/Setup.hs @@ -0,0 +1,34 @@ +import Distribution.PackageDescription +import Distribution.Simple +import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..), localPkgDescr) +import Distribution.Simple.PreProcess +import Distribution.Simple.Setup +import System.Directory (getCurrentDirectory) +import System.FilePath (()) + +main :: IO () +main = defaultMainWithHooks hooks + where + hooks = + simpleUserHooks + {confHook = \a flags -> confHook simpleUserHooks a flags >>= rsAddDirs} + +rsFolder :: FilePath +rsFolder = "zcash-haskell/librustzcash-wrapper" + +rsAddDirs :: LocalBuildInfo -> IO LocalBuildInfo +rsAddDirs lbi' = do + dir <- getCurrentDirectory + let rustIncludeDir = + dir rsFolder "target/x86_64-unknown-linux-gnu/debug" + rustLibDir = dir rsFolder "target/x86_64-unknown-linux-gnu/debug" + updateLbi lbi = lbi {localPkgDescr = updatePkgDescr (localPkgDescr lbi)} + updatePkgDescr pkgDescr = + pkgDescr {library = updateLib <$> library pkgDescr} + updateLib lib = lib {libBuildInfo = updateLibBi (libBuildInfo lib)} + updateLibBi libBuild = + libBuild + { includeDirs = rustIncludeDir : includeDirs libBuild + , extraLibDirs = rustLibDir : extraLibDirs libBuild + } + pure $ updateLbi lbi' diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..cf9dbbc --- /dev/null +++ b/cabal.project @@ -0,0 +1,15 @@ +packages: + ./*.cabal + zcash-haskell/zcash-haskell.cabal + +with-compiler: ghc-9.4.8 + +source-repository-package + type: git + location: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git + tag: fd1ddce73c0ad18a2a4509a299c6e93f8c6c383d + +source-repository-package + type: git + location: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git + tag: 335e804454cd30da2c526457be37e477f71e4665 diff --git a/package.yaml b/package.yaml deleted file mode 100644 index 5fcfaeb..0000000 --- a/package.yaml +++ /dev/null @@ -1,90 +0,0 @@ -name: zenith -version: 0.4.1 -git: "https://git.vergara.tech/Vergara_Tech/zenith" -license: MIT -author: "Rene Vergara" -maintainer: "rene@vergara.network" -copyright: "Copyright (c) 2022 Vergara Technologies LLC" - -extra-source-files: -- README.md -- CHANGELOG.md -- zenith.cfg - -# Metadata used when publishing your package -synopsis: Haskell CLI for Zcash Full Node -# category: Web - -# To avoid duplicated efforts in documentation and dealing with the -# complications of embedding Haddock markup inside cabal files, it is -# common to point users to the README.md file. -description: Please see the README on repo at - -dependencies: -- base >= 4.7 && < 5 - -library: - source-dirs: src - dependencies: - - aeson - - text - - bytestring - - http-conduit - - http-client - - scientific - - vector - - regex-base - - regex-posix - - regex-compat - - Clipboard - - process - - http-types - - array - - base64-bytestring - - persistent - - persistent-sqlite - - persistent-template - - brick - - mtl - - microlens - - microlens-mtl - - microlens-th - - vty - - zcash-haskell - -executables: - zenith: - main: Main.hs - source-dirs: app - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - - -Wall - - -Wunused-imports - dependencies: - - zenith - - configurator - - structured-cli - - data-default - - bytestring - - text - - time - - sort - - brick - -tests: - zenith-test: - main: Spec.hs - source-dirs: test - ghc-options: - - -threaded - - -rtsopts - - -with-rtsopts=-N - dependencies: - - zenith - - hspec - - persistent - - persistent-sqlite - - persistent-template - - zcash-haskell diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index 94817d2..0000000 --- a/stack.yaml +++ /dev/null @@ -1,81 +0,0 @@ -# This file was automatically generated by 'stack init' -# -# Some commonly used options have been documented as comments in this file. -# For advanced use and comprehensive documentation of the format, please see: -# https://docs.haskellstack.org/en/stable/yaml_configuration/ - -# Resolver to choose a 'specific' stackage snapshot or a compiler version. -# A snapshot resolver dictates the compiler version and the set of packages -# to be used for project dependencies. For example: -# -# resolver: lts-3.5 -# resolver: nightly-2015-09-21 -# resolver: ghc-7.10.2 -# -# The location of a snapshot can be provided as a file or url. Stack assumes -# a snapshot provided as a file might change, whereas a url resource does not. -# -# resolver: ./custom-snapshot.yaml -# resolver: https://example.com/snapshots/2018-01-01.yaml -resolver: lts-21.22 - -# User packages to be built. -# Various formats can be used as shown in the example below. -# -# packages: -# - some-directory -# - https://example.com/foo/bar/baz-0.0.2.tar.gz -# subdirs: -# - auto-update -# - wai -packages: -- . -#- 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: -# -# extra-deps: -# - acme-missiles-0.3 -# - git: https://github.com/commercialhaskell/stack.git -# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a -# -# extra-deps: [] -extra-deps: - - git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git - commit: 73d8125b83cda3b69d91770e1617b4a4d6a98c58 - - git: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git - commit: fd1ddce73c0ad18a2a4509a299c6e93f8c6c383d - - git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git - commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05 - - git: https://github.com/well-typed/borsh.git - commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831 - - vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112 - - 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: {} - -# Extra package databases containing global packages -# extra-package-dbs: [] - -# Control whether we use the GHC we find on the path -# system-ghc: true -# -# Require a specific version of stack, using version ranges -# require-stack-version: -any # Default -# require-stack-version: ">=2.7" -# -# Override the architecture used by stack, especially useful on Windows -# arch: i386 -# arch: x86_64 -# -# Extra directories used by stack for building -# extra-include-dirs: [/path/to/dir] -# -# 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 deleted file mode 100644 index a23fcb3..0000000 --- a/stack.yaml.lock +++ /dev/null @@ -1,77 +0,0 @@ -# This file was autogenerated by Stack. -# You should not edit this file by hand. -# For more information, please see the documentation at: -# https://docs.haskellstack.org/en/stable/lock_files - -packages: -- completed: - commit: 73d8125b83cda3b69d91770e1617b4a4d6a98c58 - git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git - name: zcash-haskell - pantry-tree: - sha256: 0b7870345d7ccc65ff51fbfe7c4e579fd497014ab0e0ee2084ba0ad0f68b8b69 - size: 1367 - version: 0.4.2 - original: - commit: 73d8125b83cda3b69d91770e1617b4a4d6a98c58 - git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git -- completed: - commit: fd1ddce73c0ad18a2a4509a299c6e93f8c6c383d - git: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git - name: hexstring - pantry-tree: - sha256: 05af6ec085b0c8ac00e0c3043652095a6a9c9d3bd2112ffdcb4c4e28206e0b1c - size: 741 - version: 0.12.0 - original: - commit: fd1ddce73c0ad18a2a4509a299c6e93f8c6c383d - git: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git -- 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: 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: generically-0.1.1@sha256:378ec049bc2853b8011df116647fbd34bb9f00edce9840e4957f98abc097597c,1169 - pantry-tree: - sha256: 9f30503d1fe709f3849c5dd8b9751697a8db4d66105d7ba9c3b98bf4e36bb232 - size: 233 - original: - hackage: generically-0.1.1 -- completed: - hackage: vector-algorithms-0.9.0.1@sha256:222b01a4c0b9e13d73d04fba7c65930df16d1647acc07d84c47ef0356fa33dba,3880 - pantry-tree: - sha256: f2442ae23235b332dcd8b593bb20bfae02890ec891330c060ac4a410a5f1d64d - size: 1510 - original: - hackage: vector-algorithms-0.9.0.1 -snapshots: -- completed: - sha256: afd5ba64ab602cabc2d3942d3d7e7dd6311bc626dcb415b901eaf576cb62f0ea - size: 640060 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/21/22.yaml - original: lts-21.22 diff --git a/zenith.cabal b/zenith.cabal index 69397c7..148635e 100644 --- a/zenith.cabal +++ b/zenith.cabal @@ -1,40 +1,40 @@ -cabal-version: 1.12 +cabal-version: 3.0 +name: zenith +version: 0.4.2.1 +license: MIT +license-file: LICENSE +author: Rene Vergara +maintainer: pitmut@vergara.tech +copyright: (c) 2022-2024 Vergara Technologies LLC +build-type: Custom +category: Blockchain +extra-doc-files: + README.md + CHANGELOG.md + zenith.cfg --- This file has been generated from package.yaml by hpack version 0.36.0. --- --- see: https://github.com/sol/hpack +common warnings + ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -Wunused-imports -name: zenith -version: 0.4.1 -synopsis: Haskell CLI for Zcash Full Node -description: Please see the README on repo at -author: Rene Vergara -maintainer: rene@vergara.network -copyright: Copyright (c) 2022 Vergara Technologies LLC -license: MIT -license-file: LICENSE -build-type: Simple -extra-source-files: - README.md - CHANGELOG.md - zenith.cfg - -source-repository head - type: git - location: https://git.vergara.tech/Vergara_Tech/zenith +custom-setup + setup-depends: + base >= 4.7 && < 5 + , Cabal >= 3.0.0.0 + , directory >= 1.3.6.0 + , filepath >= 1.3.0.2 library + import: warnings + ghc-options: -Wall -Wunused-imports exposed-modules: - Zenith.CLI - Zenith.Core - Zenith.DB - Zenith.Types - Zenith.Utils - Zenith.Zcashd - other-modules: - Paths_zenith + Zenith.CLI + Zenith.Core + Zenith.DB + Zenith.Types + Zenith.Utils + Zenith.Zcashd hs-source-dirs: - src + src build-depends: Clipboard , aeson @@ -62,15 +62,13 @@ library , vector , vty , zcash-haskell - default-language: Haskell2010 + default-language: GHC2021 executable zenith + import: warnings main-is: Main.hs - other-modules: - Paths_zenith hs-source-dirs: - app - ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wunused-imports + app build-depends: base >=4.7 && <5 , brick @@ -82,22 +80,27 @@ executable zenith , text , time , zenith - default-language: Haskell2010 + extra-libraries: rustzcash_wrapper + default-language: GHC2021 -test-suite zenith-test +test-suite zenith-tests + import: warnings type: exitcode-stdio-1.0 main-is: Spec.hs - other-modules: - Paths_zenith hs-source-dirs: - test - ghc-options: -threaded -rtsopts -with-rtsopts=-N + test build-depends: base >=4.7 && <5 - , hspec + , bytestring + , configurator + , data-default + , sort + , text + , time , persistent , persistent-sqlite - , persistent-template + , hspec , zcash-haskell , zenith - default-language: Haskell2010 + extra-libraries: rustzcash_wrapper + default-language: GHC2021