Compare commits
2 commits
19ce971b96
...
e82a5e17ae
Author | SHA1 | Date | |
---|---|---|---|
e82a5e17ae | |||
a9a9e824cd |
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.
|
- Creating new Unified Addresses.
|
||||||
- Sending transactions with shielded memo support.
|
- 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
|
## Installation
|
||||||
|
|
||||||
- Install dependencies:
|
- Install dependencies:
|
||||||
|
|
36
app/Main.hs
36
app/Main.hs
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
|
import Brick (simpleMain)
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
import qualified Data.ByteString as B
|
import qualified Data.ByteString as B
|
||||||
|
@ -12,9 +13,11 @@ import qualified Data.Text as T
|
||||||
import qualified Data.Text.IO as TIO
|
import qualified Data.Text.IO as TIO
|
||||||
import Data.Time.Clock.POSIX
|
import Data.Time.Clock.POSIX
|
||||||
import System.Console.StructuredCLI
|
import System.Console.StructuredCLI
|
||||||
|
import System.Environment (getArgs)
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.IO
|
import System.IO
|
||||||
import Text.Read (readMaybe)
|
import Text.Read (readMaybe)
|
||||||
|
import Zenith.CLI
|
||||||
import Zenith.Types (ZcashAddress(..), ZcashPool(..), ZcashTx(..))
|
import Zenith.Types (ZcashAddress(..), ZcashPool(..), ZcashTx(..))
|
||||||
import Zenith.Utils
|
import Zenith.Utils
|
||||||
import Zenith.Zcashd
|
import Zenith.Zcashd
|
||||||
|
@ -196,14 +199,29 @@ processUri user pwd =
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
config <- load ["zenith.cfg"]
|
config <- load ["zenith.cfg"]
|
||||||
|
args <- getArgs
|
||||||
nodeUser <- require config "nodeUser"
|
nodeUser <- require config "nodeUser"
|
||||||
nodePwd <- require config "nodePwd"
|
nodePwd <- require config "nodePwd"
|
||||||
checkServer nodeUser nodePwd
|
if not (null args)
|
||||||
void $
|
then do
|
||||||
runCLI
|
case head args of
|
||||||
"Zenith"
|
"legacy" -> do
|
||||||
def
|
checkServer nodeUser nodePwd
|
||||||
{ getBanner =
|
void $
|
||||||
" ______ _ _ _ \n |___ / (_) | | | \n / / ___ _ __ _| |_| |__ \n / / / _ \\ '_ \\| | __| '_ \\ \n / /_| __/ | | | | |_| | | |\n /_____\\___|_| |_|_|\\__|_| |_|\n Zcash Full Node CLI v0.4.0"
|
runCLI
|
||||||
}
|
"Zenith"
|
||||||
(root nodeUser nodePwd)
|
def
|
||||||
|
{ getBanner =
|
||||||
|
" ______ _ _ _ \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
|
- http-types
|
||||||
- array
|
- array
|
||||||
- base64-bytestring
|
- base64-bytestring
|
||||||
- hexstring
|
|
||||||
- persistent
|
- persistent
|
||||||
- persistent-sqlite
|
- persistent-sqlite
|
||||||
- persistent-template
|
- persistent-template
|
||||||
|
- brick
|
||||||
- zcash-haskell
|
- zcash-haskell
|
||||||
|
|
||||||
executables:
|
executables:
|
||||||
|
@ -65,6 +65,7 @@ executables:
|
||||||
- text
|
- text
|
||||||
- time
|
- time
|
||||||
- sort
|
- sort
|
||||||
|
- brick
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
zenith-test:
|
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: []
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
- 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
|
- git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git
|
||||||
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
||||||
- git: https://github.com/reach-sh/haskell-hexstring.git
|
|
||||||
commit: 085c16fb21b9f856a435a3faab980e7e0b319341
|
|
||||||
- git: https://github.com/well-typed/borsh.git
|
- git: https://github.com/well-typed/borsh.git
|
||||||
commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831
|
commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831
|
||||||
- vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112
|
- vector-0.13.0.0@sha256:fa5cac81a17a5af388716792e8b99c24b3b66770086756d0d8b23f8272a0244c,9112
|
||||||
|
|
|
@ -5,16 +5,27 @@
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
- completed:
|
- completed:
|
||||||
commit: 0858b805d066d0ce91dcc05594d929e63a99484e
|
commit: 6ea8698ccb5e44f9900ba0e61c6ffe6cba900139
|
||||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
pantry-tree:
|
pantry-tree:
|
||||||
sha256: 1f36dc81c65790bb090acc7b5337a149fe82dfeeea278c89033245cd85c462fc
|
sha256: 0506f9f095dbb134a4e7b3ba73a60a21c6298cbea01409871141b31cd0cf9c46
|
||||||
size: 1430
|
size: 1366
|
||||||
version: 0.4.1
|
version: 0.4.1
|
||||||
original:
|
original:
|
||||||
commit: 0858b805d066d0ce91dcc05594d929e63a99484e
|
commit: 6ea8698ccb5e44f9900ba0e61c6ffe6cba900139
|
||||||
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
|
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:
|
- completed:
|
||||||
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
||||||
git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git
|
git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git
|
||||||
|
@ -26,17 +37,6 @@ packages:
|
||||||
original:
|
original:
|
||||||
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05
|
||||||
git: https://git.vergara.tech/Vergara_Tech/haskell-foreign-rust.git
|
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:
|
- completed:
|
||||||
commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831
|
commit: d2fcfa159e0a844b1ec5e8ed3e232d4b380fa831
|
||||||
git: https://github.com/well-typed/borsh.git
|
git: https://github.com/well-typed/borsh.git
|
||||||
|
|
|
@ -25,6 +25,7 @@ source-repository head
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
|
Zenith.CLI
|
||||||
Zenith.DB
|
Zenith.DB
|
||||||
Zenith.Types
|
Zenith.Types
|
||||||
Zenith.Utils
|
Zenith.Utils
|
||||||
|
@ -39,8 +40,8 @@ library
|
||||||
, array
|
, array
|
||||||
, base >=4.7 && <5
|
, base >=4.7 && <5
|
||||||
, base64-bytestring
|
, base64-bytestring
|
||||||
|
, brick
|
||||||
, bytestring
|
, bytestring
|
||||||
, hexstring
|
|
||||||
, http-conduit
|
, http-conduit
|
||||||
, http-types
|
, http-types
|
||||||
, persistent
|
, persistent
|
||||||
|
@ -65,6 +66,7 @@ executable zenith
|
||||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wunused-imports
|
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Wunused-imports
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.7 && <5
|
base >=4.7 && <5
|
||||||
|
, brick
|
||||||
, bytestring
|
, bytestring
|
||||||
, configurator
|
, configurator
|
||||||
, data-default
|
, data-default
|
||||||
|
|
Loading…
Reference in a new issue