Merge pull request 'Update compilation toolchain to custom Cabal' (#64) from rav001 into dev041
Reviewed-on: #64
This commit is contained in:
commit
e9aa73a51f
14 changed files with 242 additions and 328 deletions
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -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
|
||||
|
|
34
Setup.hs
Normal file
34
Setup.hs
Normal file
|
@ -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'
|
|
@ -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
|
||||
|
||||
|
|
15
cabal.project
Normal file
15
cabal.project
Normal file
|
@ -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
|
89
package.yaml
89
package.yaml
|
@ -1,89 +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 <https://git.vergara.tech/Vergara_Tech/zenith#readme>
|
||||
|
||||
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
|
|
@ -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
|
||||
|
@ -12,21 +13,33 @@ 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
|
||||
, focusedFormInputAttr
|
||||
, handleFormEvent
|
||||
, 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
|
||||
|
@ -37,30 +50,43 @@ 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
|
||||
| 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)
|
||||
, _wallets :: !(L.List Name (Entity ZcashWallet))
|
||||
, _addresses :: !(L.List Name String)
|
||||
, _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 +114,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 +163,47 @@ 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 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
|
||||
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
|
||||
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 +216,10 @@ 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)
|
||||
, (focusedFormInputAttr, V.white `on` V.blue)
|
||||
]
|
||||
|
||||
theApp :: M.App State e Name
|
||||
|
@ -141,25 +232,30 @@ 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
|
||||
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
|
||||
(null walList)
|
||||
True
|
||||
(mkWalletForm $ WalletName "Main")
|
||||
(F.focusRing [AList, TList])
|
||||
Nothing -> do
|
||||
print $
|
||||
"No Zebra node available on port " <>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
81
stack.yaml
81
stack.yaml
|
@ -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: 09cee9a064219e4be89413ef86341aa18b62be68
|
||||
- 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
|
|
@ -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: 09cee9a064219e4be89413ef86341aa18b62be68
|
||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||
name: zcash-haskell
|
||||
pantry-tree:
|
||||
sha256: 6bf1902a377bf9399442de6f0b89219479fa908e70706918e81b88caa28dc0f5
|
||||
size: 1367
|
||||
version: 0.4.1
|
||||
original:
|
||||
commit: 09cee9a064219e4be89413ef86341aa18b62be68
|
||||
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
|
|
@ -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 <-
|
||||
|
|
1
zcash-haskell
Submodule
1
zcash-haskell
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 3fa771f9f5b44eb41f9049c3184d94b4ed97b647
|
94
zenith.cabal
94
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 <https://git.vergara.tech/Vergara_Tech/zenith#readme>
|
||||
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,21 +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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
nodeUser = "user"
|
||||
nodePwd = "superSecret"
|
||||
dbName = "zenith.db"
|
||||
zebraHost = "127.0.0.1"
|
||||
zebraPort = 18232
|
||||
|
|
Loading…
Reference in a new issue