Proof-of-concept of brick
TUI
#59
7 changed files with 63 additions and 31 deletions
|
@ -20,8 +20,6 @@ Zenith is a command-line interface for the Zcash Full Node (`zcashd`). It has th
|
|||
- Creating new Unified Addresses.
|
||||
- Sending transactions with shielded memo support.
|
||||
|
||||
Note: Zenith depends on a patched version of the `haskoin-core` Haskell package included in this repo. A pull request to the maintainers of `haskoin-core` has been submitted, if/when it is merged, Zenith will be updated to use the standard package.
|
||||
|
||||
## Installation
|
||||
|
||||
- Install dependencies:
|
||||
|
|
18
app/Main.hs
18
app/Main.hs
|
@ -2,6 +2,7 @@
|
|||
|
||||
module Main where
|
||||
|
||||
import Brick (simpleMain)
|
||||
import Control.Monad (void)
|
||||
import Control.Monad.IO.Class (liftIO)
|
||||
import qualified Data.ByteString as B
|
||||
|
@ -12,9 +13,11 @@ import qualified Data.Text as T
|
|||
import qualified Data.Text.IO as TIO
|
||||
import Data.Time.Clock.POSIX
|
||||
import System.Console.StructuredCLI
|
||||
import System.Environment (getArgs)
|
||||
import System.Exit
|
||||
import System.IO
|
||||
import Text.Read (readMaybe)
|
||||
import Zenith.CLI
|
||||
import Zenith.Types (ZcashAddress(..), ZcashPool(..), ZcashTx(..))
|
||||
import Zenith.Utils
|
||||
import Zenith.Zcashd
|
||||
|
@ -196,8 +199,13 @@ processUri user pwd =
|
|||
main :: IO ()
|
||||
main = do
|
||||
config <- load ["zenith.cfg"]
|
||||
args <- getArgs
|
||||
nodeUser <- require config "nodeUser"
|
||||
nodePwd <- require config "nodePwd"
|
||||
if not (null args)
|
||||
then do
|
||||
case head args of
|
||||
"legacy" -> do
|
||||
checkServer nodeUser nodePwd
|
||||
void $
|
||||
runCLI
|
||||
|
@ -207,3 +215,13 @@ main = do
|
|||
" ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.4.0"
|
||||
}
|
||||
(root nodeUser nodePwd)
|
||||
"cli" -> simpleMain ui
|
||||
_ -> printUsage
|
||||
else printUsage
|
||||
|
||||
printUsage :: IO ()
|
||||
printUsage = do
|
||||
putStrLn "zenith [command] [parameters]\n"
|
||||
putStrLn "Available commands:"
|
||||
putStrLn "legacy\tLegacy CLI for zcashd"
|
||||
putStrLn "cli\tCLI for zebrad"
|
||||
|
|
|
@ -40,10 +40,10 @@ library:
|
|||
- http-types
|
||||
- array
|
||||
- base64-bytestring
|
||||
- hexstring
|
||||
- persistent
|
||||
- persistent-sqlite
|
||||
- persistent-template
|
||||
- brick
|
||||
- zcash-haskell
|
||||
|
||||
executables:
|
||||
|
@ -65,6 +65,7 @@ executables:
|
|||
- text
|
||||
- time
|
||||
- sort
|
||||
- brick
|
||||
|
||||
tests:
|
||||
zenith-test:
|
||||
|
|
13
src/Zenith/CLI.hs
Normal file
13
src/Zenith/CLI.hs
Normal file
|
@ -0,0 +1,13 @@
|
|||
module Zenith.CLI where
|
||||
|
||||
import Brick (Widget, (<+>), joinBorders, simpleMain, str, withBorderStyle)
|
||||
import Brick.Widgets.Border (borderWithLabel, vBorder)
|
||||
import Brick.Widgets.Border.Style (unicode)
|
||||
import Brick.Widgets.Center (center)
|
||||
|
||||
ui :: Widget ()
|
||||
ui =
|
||||
joinBorders $
|
||||
withBorderStyle unicode $
|
||||
borderWithLabel (str "Zenith") $
|
||||
(center (str "Addresses") <+> vBorder <+> center (str "Transactions"))
|
|
@ -44,11 +44,11 @@ packages:
|
|||
# extra-deps: []
|
||||
extra-deps:
|
||||
- git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||
commit: 0858b805d066d0ce91dcc05594d929e63a99484e
|
||||
commit: 6ea8698ccb5e44f9900ba0e61c6ffe6cba900139
|
||||
- git: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git
|
||||
commit: fe2df6f7d63272ac147911c1573550bed1d38a37
|
||||
- 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
|
||||
|
|
|
@ -5,16 +5,27 @@
|
|||
|
||||
packages:
|
||||
- completed:
|
||||
commit: 0858b805d066d0ce91dcc05594d929e63a99484e
|
||||
commit: 6ea8698ccb5e44f9900ba0e61c6ffe6cba900139
|
||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||
name: zcash-haskell
|
||||
pantry-tree:
|
||||
sha256: 1f36dc81c65790bb090acc7b5337a149fe82dfeeea278c89033245cd85c462fc
|
||||
size: 1430
|
||||
sha256: 0506f9f095dbb134a4e7b3ba73a60a21c6298cbea01409871141b31cd0cf9c46
|
||||
size: 1366
|
||||
version: 0.4.1
|
||||
original:
|
||||
commit: 0858b805d066d0ce91dcc05594d929e63a99484e
|
||||
commit: 6ea8698ccb5e44f9900ba0e61c6ffe6cba900139
|
||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||
- completed:
|
||||
commit: fe2df6f7d63272ac147911c1573550bed1d38a37
|
||||
git: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git
|
||||
name: hexstring
|
||||
pantry-tree:
|
||||
sha256: 71f12a60e85f7e1897b07bb2d4c77794faee50df250d68b0c47b3d343dd4625a
|
||||
size: 741
|
||||
version: 0.12.0
|
||||
original:
|
||||
commit: fe2df6f7d63272ac147911c1573550bed1d38a37
|
||||
git: https://git.vergara.tech/Vergara_Tech/haskell-hexstring.git
|
||||
- completed:
|
||||
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
||||
git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git
|
||||
|
@ -26,17 +37,6 @@ packages:
|
|||
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
|
||||
name: hexstring
|
||||
pantry-tree:
|
||||
sha256: 9ecf67856f59dfb382b283eceb42e4fc1865935d1a7e59111556ed381c6a2ffd
|
||||
size: 687
|
||||
version: 0.11.1
|
||||
original:
|
||||
commit: 085c16fb21b9f856a435a3faab980e7e0b319341
|
||||
git: https://github.com/reach-sh/haskell-hexstring.git
|
||||
- completed:
|
||||
commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831
|
||||
git: https://github.com/well-typed/borsh.git
|
||||
|
|
|
@ -25,6 +25,7 @@ source-repository head
|
|||
|
||||
library
|
||||
exposed-modules:
|
||||
Zenith.CLI
|
||||
Zenith.DB
|
||||
Zenith.Types
|
||||
Zenith.Utils
|
||||
|
@ -39,8 +40,8 @@ library
|
|||
, array
|
||||
, base >=4.7 && <5
|
||||
, base64-bytestring
|
||||
, brick
|
||||
, bytestring
|
||||
, hexstring
|
||||
, http-conduit
|
||||
, http-types
|
||||
, persistent
|
||||
|
@ -65,6 +66,7 @@ executable zenith
|
|||
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wunused-imports
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
, brick
|
||||
, bytestring
|
||||
, configurator
|
||||
, data-default
|
||||
|
|
Loading…
Reference in a new issue